yashsingh1/xdaforums huggingface dataset:
[Miscellaneous Android Development] alecthenice:
Hahaha you think im not kicking myself for doing everything the hard way? The moverios dont have a hardware button combination to boot recovery which is why I have been working off of .img backups. This is why it hadnt been a primary concern on this hardware. Twrps main utility here is flashing on the moverios not boot loop rescue. On my other nexus devices someone else already had it figured out for me (enemy of education) so thats my android profile for you. Dont pitty me so far, i dont normally come across a device as uneaque as the moverio bt300s
[Miscellaneous Android Development] DoR3M3:
Why are you bringing up moverio bt300s? Why are you talking about Smart Glasses?
[Miscellaneous Android Development] Balrog86:
I missed the NanoDroid patcher part, sorry. I followed your guide and pasted the deodexed services.vdex into services.jar and moved this one to the input folder as framework.jar. After this I did manual patching as I used to do on android 7. vdexExtractor does not create any smali files.
[Miscellaneous Android Development] alecthenice:
This is the device i rooted and am trying to bring micro g to. It is an android 5.1 x86 tablet that you see through google glass thanks for that .log I will let you know if that helps me if I chose to use the version of twrp I have.
[Miscellaneous Android Development] ale5000:
Now it find the correct smali file to patch but it still not working.

This is a bit more complicated, unfortunately currently I don't have time for this but I will look at it in the future.

It work fine for me.

Have you placed

build.prop

and

framework.jar

in the input folder?

Have you downloaded the latest version of Tingle?
[Miscellaneous Android Development] ale5000:
Tingle currently patch only the file /system/framework/framework.jar

To revert simply push back the original framework.jar using adb or fastboot (I never used it but probably work), you don't need anything complicate but flash the system.img to recover would probably work.
[Miscellaneous Android Development] DoR3M3:
I'm not sure others are seeing the differences between Tingle and NanoDroid-patcher, but I'd really like to know the Pros/Cons between the two, and I'd recommend placing some information here on the OP as well as Github, so people can better understand, why to use Tingle over Nanodroid, if there is really an reason, or it's just apples and oranges, just take your pick.

But if people don't know why to choose Tingle over Nanodroid or vice versa, then how can we make an educated guess? :eek:

There is brief information saying what it does on the OP and Github, but still not enough information, and also the reasons as to why someone needs to patch the framework.jar vs the services.jar that Nanodroid does?

Thanks
[Miscellaneous Android Development] StardustDroid:
Hi,

what to do with Lineage OS 16.0 alpha (Android 9) ?

Seems not working. Any workaround ?
[Miscellaneous Android Development] guillermohs9:
Hi! I'm trying to apply Tingle to a Samsung GT3 10.1 that is correctly recognised through ADB on Linux, but getting this error... Any ideas?

ERROR INFO
==========
Type: <class 'subprocess.CalledProcessError'>
Cmd: ['/usr/bin/unzip', '-oq', '-d', 'framework/', 'framework.jar', '*.dex']
Return code: 11
Output: caution: filename not matched: *.dex

ERROR CODE: 87
[Miscellaneous Android Development] AnonVendetta:
[MENTION=5627087]ale5000[/MENTION]: Can you help me with something? It's in regards to MicroG not being recognized as a location provider. I use Tingle to patch my deodexed framework.jar, with GmsCore, GSF, and Play Store installed to /system/priv-app....MicroG fully works, but but location provider box is unchecked. I can use XposedGmsCoreUnifiedNlp to make this box as checked, but I want to pass SafetyNet.

I did some homework and determined that I can maybe get this box checked without Xposed, by modding framework-res.apk. But I have no experience with APKTool to decompile/recompile APKs, the few times I have tried there was either no apk outputted, or a file was outputted but ROM wouldnt boot.

There are 2 files in res folder that need to be patched, arrays.xml and bools.xml.

In arrays.xml I made this change:

<string-array name="config_locationProviderPackageNames">

<item>com.google.android.gms</item>

<item>com.android.location.fused</item>

<item>org.microg.nlp</item>

The org.microg.nlp line was the only one missing, so I pasted it in with Notepad++ and saved.

Then, for bools.xml I changed the values you mentioned in this thread from false to true.

My current issue is that I cant get APKTool to compile or output anything. I have also tried with Tickle My Android, it failed to compile too.

I have also tried the UnifiedNlp patch at:

https://xdaforums.com/android/software-hacking/unifiednlp-gapps-patch-t3567887

It produced an APK but the ROM wont boot, it just hangs @ boot logo.

Some info:

Device: Galaxy Note 4

ROM: Stock 6.0.1 Marshmallow, official, personally deodexed by me, rooted with Magisk. All works.

I have tried custom AOSP/LOS ROMs but they are too buggy, normally I prefer these over stock, but stock is much more stable for this device. ROM is heavily debloated, with all Google components thoroughly removed, except Google Package Installer, Android System Webview, and Play Store (would rather ditch the store too, but I have dozens of paid apps which cant pass license check witout it).

Can you please patch my APK with the changes mentioned? Or maybe you can post instructions? I'm attching some files you might need to decompile/recompile successfully.
[Miscellaneous Android Development] ale5000:
You ROM is probably odexed, could you please extract framework.jar (it is a zip file) and check the content?
[Miscellaneous Android Development] raptorddd:
[MENTION=5627087]ale5000[/MENTION] are going to support pie.? it bootloops.

i want to use wakeblock (not sure the name) app module but when it starts to patch i get error.

now i have used this on the past with no errors but this time i used your setialpha nano patcher for signature spoofing. and it seems that it is the reason it gives error.
[Miscellaneous Android Development] ale5000:
Hi,

looking at the issues on GitHub it looks like smali/baksmali doesn't properly support Pie yet.

It think this is most likely the issue.
[Miscellaneous Android Development] 4nndee:
Hello guys, I have a small issue here and I hope you can help me. I use the latest Tingle from git on a Lineage 16.0 for SM-A310F (latest ROM by danwood76). I run the patcher in recovery mode and it looks like everything is fine.

python3 main.py
MENU

1 - Patch file from a device (adb)
2 - Patch file from the input folder

> 1

*** OS: Linux 5.1.16-200.fc29.x86_64 (linux)
*** Python: 3.7.3 (64 bit)
*** Mode: 1
*** Working dir: /tmp/Tingle-35gpn_6m
*** Selected device: 52031a27ea05c305
*** Automounting /system...
*** Pulling framework from device...
*** Device SDK: 28
*** Decompressing framework...
DEBUG: Decompressing framework.jar
*** Disassembling classes...
DEBUG: Disassembling framework/classes.dex
*** Patching...
*** Detected: Android 9.x (or LOS 16)
*** Patching succeeded.
*** Reassembling classes...
DEBUG: Assembling out/classes.dex
*** Recompressing framework...
DEBUG: Compressing framework.jar
*** Copying the patched file to the output folder...
*** Rooting adbd...
DEBUG: adbd is already running as root
*** Unlocked ADB: True
*** Remounting /system...
DEBUG: remount succeeded
*** Pushing changes to the device...
DEBUG: [ 0%] /system/framework/framework.jar
...
[100%] /system/framework/framework.jar
framework.jar: 1 file pushed. 20.8 MB/s (7957316 bytes in 0.366s)
*** All done! :)

Your original file is present at /home/.../ale5000-git-tingle-a7fad15/output/0d28183125f8abe42c3dedf697bef557c65f701b2e7b6581cd5e1207/framework.jar.backup

If your device bootloop, please run this command on the pc when the connected device is inside recovery:
adb push "/home/.../ale5000-git-tingle-a7fad15/output/0d28183125f8abe42c3dedf697bef557c65f701b2e7b6581cd5e1207/framework.jar.backup" /system/framework/framework.jar

The issue is, that signature spoofing is not enabled for a reason. Any suggestions on how to solve this would be very appreciated :)
[Miscellaneous Android Development] raptorddd:
i usually patch it manually but pie dont work. oreo does work ok. when pie is patched my phone bootloops.

you can try to nanodroid patcher. i can patch using nanodroid but cant use wakeblock module as it needs to modify the same file.

https://xdaforums.com/apps/magisk/module-nanomod-5-0-20170405-microg-t3584928
[Miscellaneous Android Development] levone1:
[MENTION=5627087]ale5000[/MENTION] (or anyone) - any way to patch framework files without adb?I am hoping to just copy framework folder to computer and patch and then copy back to device. I thought I had done it before with smali patcher module, but maybe remembering wrong - I can't get it to work now without "no adb" error... Tingle, Haystack, Needle also all say connecting to adb is a requirement, in the docs.

Thanks
[Miscellaneous Android Development] ale5000:
Just choose the option 2 (Patch file from the input folder) inside Tingle after you have placed the files in the input folder and at the end the patched file will be in the output folder.

To all: I didn't have time to continue development but it isn't dead, I will continue it before or later.

Currently I'm working on "microG unofficial installer".
[Miscellaneous Android Development] AnonVendetta:
Does your patcher work on Android 11/12? If not, do you know of anything that does?
[Miscellaneous Android Development] ale5000:
I haven't tried but the major problem is another, it doesn't work with odexed ROMs and I need to do big changes that require a lot of time.

As alternative there are NanoDroid Patcher and Haystack by Lanchon, but I don't know what is the current compatibility.
[Miscellaneous Android Development] kaszebci:
It's not that hard to do manually. What confuses me is - all other tools mod `services.jar`, while Tingle mods `framework.jar`.

Here is the old Samsung N910F, stock image, Android 6:

```

# Download 2 jars and 2 scripts from the baksmali project

# Get latest version, not the one from Github releases. Then:

ln -s baksmali-2.5.2.jar baksmali.jar

ln -s smali-2.5.2.jar smali.jar

# Prepare to DeODEX'ing

mkdir orig mod

adb pull /system/framework orig/framework

# DeODEX framework.jar

./baksmali -JXmx512m deodex -c boot.oat -d orig/framework/arm -o framework-new orig/framework/arm/boot.oat/system/framework/framework.jar

./smali -JXmx512m a framework-new -o classes.dex

# We've recompiled classes file, now add it to the jar

cp orig/framework/framework.jar mod/framework.jar

zip -j mod/framework.jar classes*.dex

# Push somewhere where user can write (ADB cannot push directly on production builds)

adb push mod/framework.jar /sdcard/TWRP/framework.jar

# Shell can do whatever it wants, as long as we're rooted

adb shell

su

mount -o rw,remount /system

# Replace the actual file - "danger zone"

mv /system/framework/framework.jar /system/framework/framework.jar.orig

mv /sdcard/TWRP/framework.jar /system/framework/framework.jar

chmod 0644 /system/framework/framework.jar

chown root:root /system/framework/framework.jar

# done, now verify

ls -l /system/framework/framework.jar

```

EDIT: Hm, modified framework installed, but microG says it still cannot spoof..
[Miscellaneous Android Development] ale5000:
It isn't so simple, even if you deodex framework.jar the system will still use the odexed one unless you remove it.

And it is possible that you will break other apps (that are odexed using the original framework).

It is possible to patch framework.jar or services.jar.

Probably services.jar is simpler but Tingle patch framework.jar since it is a fork of Needle and it always patched framework.jar from the start.

Changing it to patch services.jar isn't so simple; it require time and testing.
[Miscellaneous Android Development] kaszebci:
That explains why spoofing didn't worked after patching. Thanks for clarifying.

So I understand you mean `services.jar` is easier because of separate `*.odex` or `*.vdex` file, rather that the `*.oak` which combines a lot of stuff.

Well, there are already tools able to patch `services.jar`, so maybe it would make sense to keep "uniqueness" of Tingle in that area.

The `services.jar` patches do not seem to work on my Samsung (tried NanoDroid-patcher and Haystack), this is why I started looking at Tingle in the first place.
[Miscellaneous Android Development] Gaberiel Logan:
Hi again

This is the tingle related error
[Miscellaneous Android Development] exitee:
cant patch lineageos android 13. always error. something missing in fstab. what fstab? from pc or phone? must adb shell in archlinux also root?
[Miscellaneous Android Development] ale5000:
I haven't update Tingle from a lot of time; I will fix the major problems in 2/3 days.

Root is only needed in the phone; root access of the pc is NOT needed.
[Miscellaneous Android Development] ale5000:
Sorry for you but do not worry, the time isn't wasted since it is likely there will be a lot of people with a similar problem, now fixed.

The framework.jar (actually a zip file) contains one or more dex files.

There can be a maximum of 65536 methods in a single dex file and if the file is already at the limit then add the patching code fails; so I have added a workaround to move some methods in another dex file (when there is more than one dex) so that the patch can be applied successfully.
[Miscellaneous Android Development] AnonVendetta:
[MENTION=5627087]ale5000[/MENTION]: Thanks for the explanation, if your solution will help others then great. My ex-friend is too lazy and technically inept, so I doubt he'll figure out how to apply the patch on his own.

I have 2 requests, if you can look into them:

1. Both your patch and the Needle patch seem to be incompatible with odexed framework.jar files. Would it be possible to first deodex and zipalign the jar, apply the patch, then optionally reodex and zipalign the jar (if this last step is desired by the user), then push the file back to the device, all within the script? I'm guessing it is more complex than this, especially on Lollipop/Marshmallow/Nougat, but it's just a thought. A lot of OEM ROMs can't use either patch without deodexing, and this is an issue. I'm also aware that the device may not boot as a result of this.

2. Would it be possible to apply the patch to a user-supplied jar, placed in a location such as where the script is being run from, or another specified location, without needing to use ADB to pull/push files? And then, maybe place the unmodified jar into a flashable zip so that it can be flashed if the device fails to boot. You can also place the modified jar into a flashable zip so that it can be installed via recovery. This would make it much easier to apply the patch. I understand that the ADB method would be better for devices that don't have custom recoveries. I had issues using ADB in Windows with one of my devices (Galaxy Tab 7.0), it couldn't be seen, and i know your script (and Needle) use ADB, I had to boot into my installed Fedora Linux distro to apply the patch. Many others also have issues with ADB in Windows, mainly due to drivers, whereas Linux mostly has Android drivers integrated. You could also maybe add commands to clear cache/dalvik cache and then auto-reboot the device.
[Miscellaneous Android Development] ChristianTC:
It works well, it has been properly patched, thanks teacher :good:
[Miscellaneous Android Development] AnonVendetta:
Continued from my last post:

Also, consider creating an add-on survival script, to be placed in /system/addon.d, so that the patch can be automatically reapplied after ROM updates. You could also maybe create a folder (called 'tingle' or 'ale5000' or whatever) in the root of the system partition, containing all the necessary tools to apply the patch. But this would probably only work on devices that have a custom recovery. Is this even feasible?
[Miscellaneous Android Development] ale5000:
[MENTION=7441667]AnonVendetta[/MENTION]

1a) The problem with odexed files that need to be deodexed is known, in these cases the framework.jar is almost empty and the file are elsewhere; I will do something in the future but it is a lot complicated (currently I already detect it and display a proper message instead of just show an unknown error).

1b) About reodex well I don't know if it is even possible, I will look at it in the future but this is at the last place in my ToDO list.

1c) About zipalign, it is already planned and it is easy (this should be only the latest step since every operation will disalign the zip).

2a) About patching the file in a specific folder, it can already do this (try the latest version with option 2).

2b) About the flashable zip creation, currently it cannot do it. It is planned but it isn't a priority.

2c) About cleaning cache/dalvik cache and reboot, already planned but low priority.

3) About the add-on survival script, well feasible but risky. It will require a lot of time for patching, after every upgrade it will probably make the phone unresponsive or slow while patching and if it fail it will make the phone unbootable. This is planned but I should add a whole lot of integrity checks and other things to prevent the problem.

Currently the patch can be applied from the pc to the phone connected (the phone can be both inside Android and inside ClockworkMod recovery, adb work well inside this recovery; about other recoveries I don't know).

You need to mount the /system partion from CWM options before running the script (I will automate it in the future).

I also plan to make the script usable from inside Android without a pc.

PS: Can you please help me in one thing?

I'm currently only under Windows, can you please tell me the commands to install adb and zipalign under Linux without install all the Android SDK and the build tools that aren't needed.

I mean the command like "apt-get install packagename".

PS2: In the case you have an Odexed ROM with the framework.jar not empty please tell me.
[Miscellaneous Android Development] ale5000:
Big progress:

I have been able to decompress and disassemble a framework.jar inside a Galaxy Ace (with QPython/QPython3 for Android).

It is a bit slow but it works.
[Miscellaneous Android Development] sonickles9:
I know that under debian wheezy(or squeeze), both old versions

you can install android-tools-adb with apt-get.

If you are on ubuntu there should be the same android-tools-adb, if not (or if youre on a more recent version of debian) you can try downloading the package on the website and installing it thru dpkg.

the command for installing woth dpkg is

"dpkg -i (filename.deb)"

Enviado do meu GT-I9505
[Miscellaneous Android Development] ale5000:
[MENTION=6018519]sonickles9[/MENTION]: Thanks for the help but it isn't on my pc.

I have setup Travis CI to test my code under linux and it can only use the package name of apt-get withouth sudo.

I have tried android-tools-adb but it didn't work, but it may be a bug on their end.
[Miscellaneous Android Development] Shadow53:
Most Linux distributions have a package called "android-tools" that provides both adb and fastboot, though apparently Debian is weird and splits everything out into its own package... TravisCI looks to use Ubuntu as a Linux base, so you should look at this page for instructions on how to set it up (if you haven't already): https://docs.travis-ci.com/user/installing-dependencies/

The package names you'll want are... android-tools-adb (for adb), android-tools-adbd (for the adb daemon), and zipalign.

Hope this helps!
[Miscellaneous Android Development] ale5000:
@ Shadow53: Thanks, I will look at them soon; I don't have time currently.
[Miscellaneous Android Development] ale5000:
Now it can also be executed from inside Android.

You need QPython/QPython3 (QPython3 is preferred), busybox (it doesn't need to be installed, just present), zip

Run it, select mode 3 also if it isn't present in the list, wait until the end.

At the end you will found the patched file in the output folder.
[Miscellaneous Android Development] sonickles9:
That's nice :)

Enviado de meu GT-I9505 usando Tapatalk
[Miscellaneous Android Development] _Kosmas_:
Hi,

tried with CM14, OnePlus Two (arm64 device). I got this error:

.qpy/projects3/tingle-master/main.py" && exit <

MENU

1 - Patch file from a device (adb)

2 - Patch file from the input folder

> 3

*** OS: Linux 3.10.84-perf+ (linux-android)

*** Mode: 3

*** Working dir: /storage/emulated/0/com.hipipal.qpyplus/cache/Tingle-xvx42r

*** Decompressing framework...

DEBUG: Decompressing framework.jar

*** Disassembling classes...

DEBUG: Disassembling framework/classes.dex

*** Patching...

*** Patching succeeded.

*** Reassembling classes...

DEBUG: Assembling out/classes.dex

UNEXPECTED TOP-LEVEL ERROR:

java.lang.UnsatisfiedLinkError: Library javacrypto not found; tried [./libjavacrypto.so, /data/user/0/org.qpython.qpy3/files/lib/libjavacrypto.so, /data/user/0/org.qpython.qpy3/files/libjavacrypto.so, /data/user/0/org.qpython.qpy3/lib/libjavacrypto.so]

at java.lang.Runtime.loadLibrary0(Runtime.java:1001)

at java.lang.System.loadLibrary(System.java:1530)

at com.android.org.conscrypt.NativeCryptoJni.init(NativeCryptoJni.java:25)

at com.android.org.conscrypt.NativeCrypto.<clinit>(NativeCrypto.java:54)

at com.android.org.conscrypt.NativeCrypto.EVP_get_digestbyname(Native Method)

at com.android.org.conscrypt.OpenSSLMessageDigestJDK$SHA1.<clinit>(OpenSSLMessageDigestJDK.java:166)

at java.lang.Class.newInstance(Native Method)

at java.security.Provider$Service.newInstance(Provider.java:1264)

at sun.security.jca.GetInstance.getInstance(GetInstance.java:236)

at sun.security.jca.GetInstance.getInstance(GetInstance.java:164)

at java.security.Security.getImpl(Security.java:587)

at java.security.MessageDigest.getInstance(MessageDigest.java:186)

at org.jf.dexlib2.writer.DexWriter.updateSignature(DexWriter.java:271)

at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:261)

at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:230)

at org.jf.smali.main.run(main.java:176)

at org.jf.smali.main.main(main.java:265)

Return code: 3

ERROR CODE: 83

83|oneplus2:/ $

Btw thank you for this script :good:
[Miscellaneous Android Development] ale5000:
[MENTION=6061988]_Kosmas_[/MENTION]: Do you have a phone with CM14 without a 64-bit CPU to test?

It is just to know if this problem is specific to 64-bit.

Also please tell me if /system/lib64/libjavacrypto.so and /system/lib/libjavacrypto.so exist.
[Miscellaneous Android Development] _Kosmas_:
Will try with my Moto G 2014 ;)!

Both files exist.
[Miscellaneous Android Development] ale5000:
[MENTION=6061988]_Kosmas_[/MENTION]

I think it is a bug in QPython but I have inserted a workaround.

Please try if it is working.
[Miscellaneous Android Development] _Kosmas_:
It is an other error with your workaround.

/data/user/0/org.qpython.qpy3/files/bin/qpython-android5.sh "/storage/emulated/0/org.qpython.qpy/projects3/Tingle/main.py" && exit

.qpy/projects3/Tingle/main.py" && exit <

MENU

1 - Patch file from a device (adb)

2 - Patch file from the input folder

> 2

*** OS: Linux 3.10.84-perf+ (linux-android)

*** Mode: 2

*** Working dir: /storage/emulated/0/com.hipipal.qpyplus/cache/Tingle-nldqyd

*** Decompressing framework...

DEBUG: Decompressing framework.jar

*** Disassembling classes...

DEBUG: Disassembling framework/classes.dex

*** Patching...

*** Patching succeeded.

*** Reassembling classes...

DEBUG: Assembling out/classes.dex

*** Recompressing framework...

DEBUG: Compressing framework.jar

zip error: Nothing to do! (framework.jar)

Return code: 12

ERROR CODE: 88

88|oneplus2:/ $
[Miscellaneous Android Development] ale5000:
[MENTION=6061988]_Kosmas_[/MENTION]: Probably the parameters that I use for zip aren't supported by the one installed on your phone.

Can you please run zip -h on the phone and paste the output here so I can see what is the problem?