Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.
/ SamsungAppsPatcher Public archive

[Unmaintained] Samsung Apps Patcher for Samsung phones with custom ROMs

Notifications You must be signed in to change notification settings

adil192/SamsungAppsPatcher

Repository files navigation

Samsung Apps Patcher for Samsung phones with custom ROMs

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.

Important notice

As I've moved on from having a Samsung phone and Samsung accessories, I will no longer be maintaining this project.

March 2023 update

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








Download pre-patched apps

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.

App support

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.

Core

  1. accessoryservice.apk | Samsung Accessory Service
  2. shealth.apk | Samsung Health
  3. wearable.apk | Galaxy Wearable

Watch plugins

  1. watchplugin.apk | Galaxy Watch Plugin
  2. watch3plugin.apk | Galaxy Watch3 Plugin
  3. watch4plugin.apk | Galaxy Watch4 Plugin
  4. activeplugin.apk | Watch Active Plugin
  5. active2plugin.apk | Watch Active2 Plugin
  6. gearfit2plugin.apk | Gear Fit2 Plugin
  7. gearsportplugin.apk | Gear S Plugin
  8. 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).

Other plugins

  1. budsplugin.apk | Galaxy Buds Manager
  2. budsproplugin.apk | Galaxy Buds Pro Manager
  3. buds2plugin.apk | Galaxy Buds2 Manager
  4. budsplusplugin.apk | Galaxy Buds+ Manager
  5. budsliveplugin.apk | Galaxy Buds Live Manager
  6. Other plugins: These will most likely work without any customised patches needed. Just run the apk through ./wearable-patcher.sh.

How to use the scripts

  1. Make sure your system satisfies the requirements (below) first.
  2. 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.
  3. Open a terminal in the SamsungAppsPatcher folder. Run ./wearable-patcher.sh to automatically patch all the apps from the SamsungAppsPatcher/originals folder.
    • Sidenote: you can also patch a specific app like this: ./wearable-patcher.sh shealth.
  4. 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).

Requirements

  1. 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.

  2. 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.

  3. Install the latest version of platform-tools.

    1. 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"
    2. 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"
    3. Run the command source ~/.bashrc to update your path in your current terminal.

  4. Clone/Download this repo somewhere.

    git clone "https://github.com/adil192/SamsungAppsPatcher"

Generating a certificate (not necessary)

  1. If you're not using Android Studio, follow this to generate a keystore. Otherwise do the following...

  2. Open Android Studio and select Build > Generate Signed Bundle / APK... from the toolbar (you may need to create an empty project first).

  3. Select APK/whatever, then choose to Create new for the key store.

    1. Choose a key store path for your new keystore. I'll be storing it as SamsungAppsPatcher/keystore.jks.
    2. 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.
    3. Fill in the rest of the form and click OK.
  4. 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
    
  5. Get the hex for your certificate: Open a terminal in the SamsungAppsPatcher folder and enter keytool -alias key0 -exportcert -keystore keystore.jks -storepass password1 | xxd -p, replacing password1 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 +.

    image

How to patch a new watch plugin

  1. 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).

  2. 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/

  3. 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"
  1. 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 file smali_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 for Landroid/content/pm/Signature to find potentially relevant areas of code.
308202ef308201d7a003020102020414698683300d06092a864886f70d01010b05003028312630240603550403131d53616d73756e6750617463682050617463684365727469666963617465301e170d3231303830323139303032345a170d3436303732373139303032345a3028312630240603550403131d53616d73756e675061746368205061746368436572746966696361746530820122300d06092a864886f70d01010105000382010f003082010a0282010100e7305c88fe815cad51ee59c6d424833dcef3ebcca98a64d43f5e7fce0225dc7131625fb0d07858b64c7a8da6a7c38a6361f3d8a8ef057e2d533c2e35132c5ca1452ef0b3e7b987ff34afc483626f1a8c89f76be9fd4e85c676040906b8601c3bdf01e373c156fbeb94159b0e7cc66c68d6a1900811f0d8d80328bb5807876d7d5f0f9768c0f98e66ebab0aa0f8966f11092d35130f375c06f7ca0d1d5abc2ed4c9eea664349f06e80ed09e4ac214bb61f085848b1733846b1eb771f1b41163e0babc4510392cb15f4f454a4b91bf1a07267e34d7daaa9da811d4c082fccd4ddc028cda3733a85991f7c9c218b14d03cedaa73599a8d8d033a4bfab44dc377cef0203010001a321301f301d0603551d0e0416041439f1b24007584379561b2d19af849f71da60d2dc300d06092a864886f70d01010b050003820101008315f6c17aa4eb4620da01163133265d1b4e8cf0788acaa19cb54c7f8e0fcd683e4aa9da7132db2804fa9feef2d0809a258058aaf75386c53577a12fa9656a6d5a6812aace735196452e51c6a4cdc4a83b5227361e7b1710f1023235206637371974cb95d009777559d05c8af510f80d4d527904039810fd8f887e3a39039bfe62f97d63d9f20df09c2df8d2b2a6e18d4790d38edb61d0685f534333189d938e36c07d6cfe5c67e2df92dabd5c33e57a40885ac8f79ba93223d4917f850b5bdf4cc79a6a73dcca34982efe71a25b5ae12c7dc142b6c62d637b8b061155eb40381be335a7bc159443993ca73fd80e79a4177fc62455fedef6e4c6e405a7f5fb61
  1. When you're done, convert the changes you made to a .patch file.
git add *
git commit -m "custom cert"
git format-patch -1
  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 the patches folder.
mv 0001-custom-cert.patch ../../patches/active2plugin-custom-cert.patch
cd ../../  # move back to the PatchedApps folder
  1. 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
  1. 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)