This is a guide to patch galaxy wearable apps to work on a modified samsung phone. This was originally taken from an xda post by dansimko but I wanted to make it a little easier to follow. I've since scripted the process, kept the patches up to date, and added new patches. The scripts are written for linux in bash, so if you're using something else, you could try the old (manual) guide at https://gist.github.com/adil192/ab95808fb66b6cde3d63ded6c19b0f1d.
As I've moved on from having a Samsung phone and Samsung accessories, I will no longer be maintaining this project. |
---|
There's a new project that could supercede this one: https://github.com/BlackMesa123/KnoxPatch. I haven't tried it myself of course but it's worth checking out
You can find the pre-patched apks at the project website: https://adil.hanney.org/SamsungAppsPatcher/.
The platform-tools zip are in the MEGA drive, if you need them to patch your own apps: https://mega.nz/folder/sUFj2C5b#M4zEP-c9ylY-ENxPw7qCUQ.
These are the apps that probably work (please check the project website for compatibility ratings) along with a link to apkmirror where you can download an unpatched apk. Please note that I cannot test the majority of the plugins because I don't have the devices myself, and no longer use my Galaxy Watch regularly.
- accessoryservice.apk | Samsung Accessory Service
- shealth.apk | Samsung Health
- wearable.apk | Galaxy Wearable
- watchplugin.apk | Galaxy Watch Plugin
- watch3plugin.apk | Galaxy Watch3 Plugin
- watch4plugin.apk | Galaxy Watch4 Plugin
- activeplugin.apk | Watch Active Plugin
- active2plugin.apk | Watch Active2 Plugin
- gearfit2plugin.apk | Gear Fit2 Plugin
- gearsportplugin.apk | Gear S Plugin
- Other watches: Watch plugins that integrate with Samsung Health verify their certificate so they won't work without a specific custom certificate patch (there's a section below on how to patch it yourself).
- budsplugin.apk | Galaxy Buds Manager
- budsproplugin.apk | Galaxy Buds Pro Manager
- buds2plugin.apk | Galaxy Buds2 Manager
- budsplusplugin.apk | Galaxy Buds+ Manager
- budsliveplugin.apk | Galaxy Buds Live Manager
- Other plugins: These will most likely work without any customised patches needed. Just run the apk through
./wearable-patcher.sh
.
- Make sure your system satisfies the requirements (below) first.
- Download the unpatched apks of the three core apps and any plugins you need. You can find the links in the App support section. Save these into the
SamsungAppsPatcher/originals
folder. Feel free to delete the dummy apks first as they're just there to make sure you name your downloaded apks correctly. - Open a terminal in the
SamsungAppsPatcher
folder. Run./wearable-patcher.sh
to automatically patch all the apps from theSamsungAppsPatcher/originals
folder.- Sidenote: you can also patch a specific app like this:
./wearable-patcher.sh shealth
.
- Sidenote: you can also patch a specific app like this:
- Install the patched apks! You can do this with the
./wearable-installer.sh
script to batch install them, or just install them regularly. However, you will need to uninstall the old apps (signed by Samsung) before you can use the modded apps with a custom signature:./wearable-wipe.sh
(not necessary if you've already got the modded apps installed).
-
Install apktool. You can find the official instructions here. If you're on Pop OS like me, the apktool you install through apt is out of date (you'll want at least 2.6.0) so make sure to follow those instructions.
-
If you don't want to use my keystore, install Android Studio. You could also generate a keystore without Android Studio and I've linked a guide for that later. I recommend that you use the provided keystore so you can update between your patched apps and mine without losing data.
-
Install the latest version of platform-tools.
-
You can install platform-tools and build-tools through Android Studio. For me they are located at
~/Android/Sdk/platform-tools/
and~/Android/Sdk/build-tools/31.0.0/
respectively. You should add these to your PATH, e.g. add the following to your~/.bashrc
...# add android platform-tools and build-tools to path export PATH="~/Android/Sdk/platform-tools/:$PATH" export PATH="~/Android/Sdk/build-tools/31.0.0/:$PATH"
-
If that doesn't work out for you, I have zipped up a combined platform-tools and build-tools folder in the MEGA drive. This is not updated regularly so I heavily recommend the above method. Extract this to a folder like
~/platform-tools
and add it to path, e.g. add the following to your~/.bashrc
...# add android platform tools to path export PATH="~/platform-tools:$PATH"
-
Run the command
source ~/.bashrc
to update your path in your current terminal.
-
-
Clone/Download this repo somewhere.
git clone "https://github.com/adil192/SamsungAppsPatcher"
-
If you're not using Android Studio, follow this to generate a keystore. Otherwise do the following...
-
Open Android Studio and select
Build
>Generate Signed Bundle / APK...
from the toolbar (you may need to create an empty project first). -
Select APK/whatever, then choose to
Create new
for the key store.- Choose a key store path for your new keystore. I'll be storing it as
SamsungAppsPatcher/keystore.jks
. - Choose a password for the keystore (e.g.
password1
), and a password for the key (e.g.password2
). These passwords can be the same if you want. - Fill in the rest of the form and click OK.
- Choose a key store path for your new keystore. I'll be storing it as
-
Create a password file: create a file at
SamsungAppsPatcher/ks-pass.txt
and on the first line, enter your keystore password, and on the second line, enter your key password.password1 password2
-
Get the hex for your certificate: Open a terminal in the
SamsungAppsPatcher
folder and enterkeytool -alias key0 -exportcert -keystore keystore.jks -storepass password1 | xxd -p
, replacingpassword1
with yours. Now remove the spaces/linebreaks from the output of this command, and keep it on hand. You'll need to open each patch file, and where the existing signature is added, replace it with yours. Make sure you only replace the signature on lines beginning with a+
.
-
Download the apk of the app you want to patch into the
originals
folder (rename it to something simple like active2plugin.apk to make things easier). -
Run the wearable-patcher.sh script with the apk you downloaded earlier, but with the
--no-patch
flag:./wearable-patcher.sh active2plugin.apk --no-patch
. You should now have the decompiled app in the decompiled folder. Move the terminal to this folder: e.g.cd decompiled/active2plugin/
-
Make a local git repo. This will make it easy to generate a patch file later.
git init
git add *
git commit -m "Initial commit"
- Open the app folder in something like Atom or Sublime Text:
atom .
. You can look at other patches in the patches folder; for example, the watchplugin (original Galaxy Watch) needed to patch the filesmali_classes2/com/samsung/accessory/goproviders/shealthproviders/util/Signaturechecker.smali
. Essentially you just want to add the signature of the provided keystore (below) to the valid list of signatures. You might want to start with searching the decompiled app forLandroid/content/pm/Signature
to find potentially relevant areas of code.
308202ef308201d7a003020102020414698683300d06092a864886f70d01010b05003028312630240603550403131d53616d73756e6750617463682050617463684365727469666963617465301e170d3231303830323139303032345a170d3436303732373139303032345a3028312630240603550403131d53616d73756e675061746368205061746368436572746966696361746530820122300d06092a864886f70d01010105000382010f003082010a0282010100e7305c88fe815cad51ee59c6d424833dcef3ebcca98a64d43f5e7fce0225dc7131625fb0d07858b64c7a8da6a7c38a6361f3d8a8ef057e2d533c2e35132c5ca1452ef0b3e7b987ff34afc483626f1a8c89f76be9fd4e85c676040906b8601c3bdf01e373c156fbeb94159b0e7cc66c68d6a1900811f0d8d80328bb5807876d7d5f0f9768c0f98e66ebab0aa0f8966f11092d35130f375c06f7ca0d1d5abc2ed4c9eea664349f06e80ed09e4ac214bb61f085848b1733846b1eb771f1b41163e0babc4510392cb15f4f454a4b91bf1a07267e34d7daaa9da811d4c082fccd4ddc028cda3733a85991f7c9c218b14d03cedaa73599a8d8d033a4bfab44dc377cef0203010001a321301f301d0603551d0e0416041439f1b24007584379561b2d19af849f71da60d2dc300d06092a864886f70d01010b050003820101008315f6c17aa4eb4620da01163133265d1b4e8cf0788acaa19cb54c7f8e0fcd683e4aa9da7132db2804fa9feef2d0809a258058aaf75386c53577a12fa9656a6d5a6812aace735196452e51c6a4cdc4a83b5227361e7b1710f1023235206637371974cb95d009777559d05c8af510f80d4d527904039810fd8f887e3a39039bfe62f97d63d9f20df09c2df8d2b2a6e18d4790d38edb61d0685f534333189d938e36c07d6cfe5c67e2df92dabd5c33e57a40885ac8f79ba93223d4917f850b5bdf4cc79a6a73dcca34982efe71a25b5ae12c7dc142b6c62d637b8b061155eb40381be335a7bc159443993ca73fd80e79a4177fc62455fedef6e4c6e405a7f5fb61
- When you're done, convert the changes you made to a .patch file.
git add *
git commit -m "custom cert"
git format-patch -1
- You'll then get a patch file named like
0001-custom-cert.patch
. Rename this so that it begins with the apk name: e.g.active2plugin-custom-cert.patch
, and move it to thepatches
folder.
mv 0001-custom-cert.patch ../../patches/active2plugin-custom-cert.patch
cd ../../ # move back to the PatchedApps folder
- Re-run the wearable-patcher.sh script, without the --no-patch flag. Then you can install the patched app from the patched folder.
./wearable-patcher.sh active2plugin.apk
- If your patch works, feel free to contribute to the project. Go to the issues tab and make a new issue with your .patch file attached. (or do a pull request)