Giter VIP home page Giter VIP logo

samsungappspatcher's Introduction

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)

samsungappspatcher's People

Contributors

adil192 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

samsungappspatcher's Issues

No patch for Galaxy Watch Active plugin

Hello,

In the prebuild patched APK files i see the Plugin APK files for all sorts of devices, but not for the Galaxy Watch Active. Is there a specific reason for this? If not, can somebody please build it for me, since i get a java error?

Samsung S21 Ultra Galaxy Watch Plugin Crash

Hello, yesterday I loaded the latest versions. Shealth works great. As soon as I want to pair my S21 Ultra with the Galaxy Watch (watchplugin.2.2.05.22042841N.apk), I get the message that the "Galaxy Watch Plugin" app has hung and the connection isn't working.

Galaxy Watch (OG) (SM-R800) Plugin is unable to setup/connect Galaxy Watch!

Describe the bug
Galaxy Watch (OG) Plugin is unable to setup/connect Galaxy Watch. I just installed 3 core apps and Galaxy Watch and Buds2 plugins. SHealth, Wearable and Buds2 works just fine. I even did a software update with Buds2. And my guess Acessory Service works too since I am able to connect to my Buds2. Now when I try to setup/connect (you need to reset your watch to be able to connect a new/formatted phone so that's why the setup needed) it stucks in this screen and watch displays "Check your phone to complete setup." message in my local language. (It doesn't freeze. Last bubble fades in and out in a loop.)
Screenshot_20220911-115158_Galaxy Watch PlugIn

Smartphone

  • Device: Samsung Galaxy A50 (SM-A505F)
  • OS: Android 12 / OneUI 4.1
  • Accessory: Galaxy Watch (OG) (SM-R800)

What (versions of) modded apps have you installed?

  • shealth 6.22.1.053
  • wearable 2.2.50.22072061
  • accessoryservice 3.1.96.30607
  • watchplugin 2.2.05.22042841N
  • buds2plugin.4.1.22051251

Unmodded apps

  • I'm not trying to mix modded and unmodded apps
  • Have you tried running wearable-wipe.sh?

Logs (if possible)
Output of adb logcat -b crash when crash/error/bug occurs:
https://pastebin.com/nCn6WNsZ (I couldn't paste the logs because of the character limit. (65536))

Apktool build error

Describe the bug
After running ./wearable-patcher.sh shealth

Apktool build error

~/SamsungAppsPatcher/decompiled $ apktool b shealth/ --output out.apk
I: Using Apktool 2.6.1
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether resources has changed...
I: Building resources...
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/data/data/com.termux/files/usr/tmp/brut_util_Jar_22721310018420179231920746392872093442.tmp, p, --forced-package-id, 127, --min-sdk-version, 26, --target-sdk-version, 31, --version-code, 6222007, --version-name, 6.22.2.007, --no-version-vectors, -F, /data/data/com.termux/files/usr/tmp/APKTOOL427404339190470838.tmp, -e, /data/data/com.termux/files/usr/tmp/APKTOOL17802574958280800067.tmp, -0, arsc, -I, /data/data/com.termux/files/home/.local/share/apktool/framework/1.apk, -S, /data/data/com.termux/files/home/SamsungAppsPatcher/decompiled/shealth/res, -M, /data/data/com.termux/files/home/SamsungAppsPatcher/decompiled/shealth/AndroidManifest.xml]

apktool --version: 2.6.1

patching shealth with shealth_custom_cert.patch

I know you're officially stopped developing for this, but if you would be so kind to help me out here
It looks like I'm running into this issue

patching shealth with shealth_custom_cert.patch
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- smali_classes9/com/samsung/android/app/shealth/util/SignatureChecker.smali
|+++ smali_classes9/com/samsung/android/app/shealth/util/SignatureChecker.smali

If you could guide me on how to bypass or fix this I would appreciate it. I'm still kind of learning how your script works, I'm not that knowledgeable

Thanks

Shealth crash w/logs

Hello,

Sorry to bother you, would it be too much bother if you can check out these logs of shealth crashing
Latest one in your download page
Version 6.22.1.053
I used the -b crash flag in logcat, let me know if you need me to capture all logs

Log: Shealth https://pastebin.com/YuqRFwVC

Can't pair my smartwatches (Fold4,Watch3,GearS2)

Hi, I can't get it working with the patched apks. I can't connect my two smart watches (Watch3 and the Gear S2) with it. When I try to connect to my Fold4 (rooted), both watch plugins have force closed and won't connect. I hope I can get help for my problem here.

Galaxy 4 watch setup issue

Hi, when pairing gavaxy 4 watch, everything goes fine until the app goes to configure the watch. then another dialog to pick a device to pair appears, ruining the setup.

My Galaxy Watch OG is disconnected most of the time!

Describe the bug
My Galaxy Watch OG is disconnected most of the time. Sometimes it's Bluetooth connected, plugin disconnected (shows disconnected on the Watch too). Sometimes it's fully disconnected and can't connect back even only with Bluetooth.

Smartphone (please complete the following information)

  • Device: Samsung Galaxy A50 (SM-A505F)
  • OS: Android 12 / OneUI 4.1

What (versions of) modded apps have you installed?

  • shealth 6.22.1.053
  • wearable 2.2.50.22072061
  • accessoryservice 3.1.96.30607
  • watchplugin 2.2.05.22081141N (Self-patched)

Unmodded apps

  • I'm not trying to mix modded and unmodded apps
  • Have you tried running wearable-wipe.sh? (not specifically for this but while installing)

Logs (if possible)
Output of adb logcat -b crash when crash/error/bug occurs:

Collapsible
I will provide this when I can re-do the bug.

Galaxy Watch3 plugin + connection is working โœ“

In your website you asked us to test if the Galaxy Watch3 plugin is working or not. I can confirm that it's working with version 2.2.09.22042841N.apk on my Galaxy S9 with an android 12 custom ROM. If anyone has problems make sure to also install the patched accessory service apk, along with the patched wearable app ofc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.