yashsingh1/xdaforums huggingface dataset:
[Miscellaneous Android Development] _Kosmas_:
Sure ;)

oneplus2:/ $ su

oneplus2:/ # zip -h

Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.

Zip 3.0 (July 5th 2008). Usage:

zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]

The default action is to add or replace zipfile entries from list, which

can include the special name - to compress standard input.

If zipfile and list are omitted, zip compresses stdin to stdout.

-f freshen: only changed files -u update: only changed or new files

-d delete entries in zipfile -m move into zipfile (delete OS files)

-r recurse into directories -j junk (don't record) directory names

-0 store only -l convert LF to CR LF (-ll CR LF to LF)

-1 compress faster -9 compress better

-q quiet operation -v verbose operation/print version info

-c add one-line comments -z add zipfile comment

-@ read names from stdin -o make zipfile as old as latest entry

-x exclude the following names -i include only the following names

-F fix zipfile (-FF try harder) -D do not add directory entries

-A adjust self-extracting exe -J junk zipfile prefix (unzipsfx)

-T test zipfile integrity -X eXclude eXtra file attributes

-y store symbolic links as the link instead of the referenced file

-e encrypt -n don't compress these suffixes
[Miscellaneous Android Development] ale5000:
[MENTION=6061988]_Kosmas_[/MENTION]: The parameters was correct but they were behaving differently on Android, now I have changed them and everything should work correctly.

Please report if the latest version on GitHub works correctly.
[Miscellaneous Android Development] _Kosmas_:
Yeaaah, that's it :good: :good: !!! Thank you, signature spoofing on CM14 without Xposed - great job :D !!

You need about half an hour and 30% battery usage (depending to your phone) but it's working.
[Miscellaneous Android Development] ale5000:
The first step was to make it working on low end phones, then I can add some optimizations.

It won't change significatively but it can be a little faster I think.

Now it should work with just 64MB heap for the disassembling phase but need about 166MB heap in the reassembling phase.

I need some help to do some things in Python for those that know:

- Force RAM defragmentation

- Force CPU at full speed without standby for all the duration of the script (the display can be turned off)
[Miscellaneous Android Development] Shadow53:
I'm not sure how much this will help, but for the second point I know there are ways of using root access to change the CPU governor (because Tasker can do it). If you were to:

- Read and save the current CPU governor

- Change the governor to "performance", which I believe ramps the CPUs up to max until you change it to something else

- Perform the necessary CPU intensive operations

- Revert back to the original CPU governor when done

... That should give you the effect you are looking for, I would think. You should be able to research how to do that or if it really is possible.

As for the first point, I'm not sure what you mean by RAM defragging. I tried searching the term because I hadn't heard of it, and all that came up were file defragging and releasing used memory (i.e. killing background processes). If that's what you mean... Good luck? You'd have to know which processes are safe to kill. Normal Linux tends to run non system processes with a UID of 1000 or more, but I'm not sure if that translates to Android too. There might be a similar way of detecting user programs that can be stopped, but you'd also have to deal with the "Unfortunately, XXXXXXX has stopped working" messages if you force them to quit.

An alternative thought is to have the Android method work as a flashable zip. That way no user processes are running and the system can focus on doing the one operation. Plus you can have the add-on.d script to persist through ROM upgrades. What may help is looking into the Termux python package and copying some or all of it into the Tingle tree for use in the flashable script.

(Termux is a FOSS terminal emulator for Android that provides ARM implementations of some common Linux packages, including a few shells, got, and python. Not sure about running java executables though)
[Miscellaneous Android Development] ale5000:
[MENTION=7126506]Shadow53[/MENTION]

I didn't mean to change CPU governor but just prevent standby/battery optimizations (except display) with Python code (I think there is something).

About RAM I need to collapse all used space in RAM at the start (avoiding empty space between various parts of used RAM) so I can have a big empty block of contiguous memory.
[Miscellaneous Android Development] Shadow53:
My bad for misunderstanding. If you're requiring QPython to run the python script, you might be able to ask the user to disable battery optimizations manually and wait for them to press enter before continuing, but IMO the whole idea of a user running a Python script in an app to do something like this sounds hacky and should be a temporary solution at best. Perhaps we (though idk how much I could help) should work on writing a method of doing this purely in Android Java, then perhaps it could be adopted under the microG umbrella, published on F-Droid, or, even better, included into the microG GMS app itself.

Honestly, even though I misunderstood your last post, I think the bit I said on making a flashable zip is still valid too. There's no Doze in a recovery, and a lack of other apps in the background helps with having available memory (I'm curious though, why do you need to have a contiguous block? From what I've read it won't help r/w speeds compared to having a fragmented object or file in memory).

Those are just some of my thoughts. I don't develop for Android though so take it with a grain of salt.
[Miscellaneous Android Development] ale5000:
[MENTION=7126506]Shadow53[/MENTION]

1) Disable battery optimizations manually is annoying, the whole idea of a script is to automatize things.

It is possible to create an apk that include Python for Android and the script itself inside (but I haven't tried it and it is low priority).

My script possibly works also inside recovery but this add additional complications (and it is low priority currently).

2) Defragmenting RAM wasn't for the script itself but I use smali/basmali that are in Java and they use a lot of RAM.

If I have understood correctly Java need contiguous memory for heap.
[Miscellaneous Android Development] Nubiko:
Did deodexed framework.jar patched, the signature is not lost.

Phone Xiaomi Redmi Note 3 Pro (arm 64) firmware ResurrectionRemix-M-v5.7.4
[Miscellaneous Android Development] ale5000:
[MENTION=5880220]Nubiko[/MENTION]: The file seems to be already patched.

Can you check if the file on the phone has the same hash as the one you have posted?

(always keep a backup of the original unpatched file).
[Miscellaneous Android Development] Nubiko:
Several times I changed the file, the result of one, signature verification on the spot.
[Miscellaneous Android Development] ale5000:
[MENTION=5880220]Nubiko[/MENTION]: I'm not sure because my ROM is deodexed but probably you have to deodex the entire ROM before patching, not just framework.jar.
[Miscellaneous Android Development] Nubiko:
In rom, only the framework folder odex (partially), I did deodex the whole framework folder didn't help.
[Miscellaneous Android Development] ale5000:
[MENTION=5880220]Nubiko[/MENTION]: I'm not sure but from the info found over the internet all contents of "framework", "app" and "priv-app" in the system partition should be deodexed.

PS: Always keep a backup so you can restore files in the worst case.
[Miscellaneous Android Development] Nubiko:
Some Odex files in the framework folder, everything else deodex

Can advise how to make a full deodex ROM? In Google not found how to do with Android 6
[Miscellaneous Android Development] ale5000:
[MENTION=5880220]Nubiko[/MENTION]

I have found this: http://xdaforums.com/android/general/guide-deodex-marshmallow-6-0-completely-t3403544

PS: What version of microG are you using? The latest release is old, try the latest preview.
[Miscellaneous Android Development] ale5000:
I have added support for CyanogenMod 7 and 9 (Untested).
[Miscellaneous Android Development] ale5000:
[MENTION=5880220]Nubiko[/MENTION]: This seems simpler.
[Miscellaneous Android Development] Nubiko:
Thank you. I will try.
[Miscellaneous Android Development] Nubiko:
Did deodex all firmware, did not help! Still no 1st and 3rd jackdaws. The species is not destiny. Will have to wait for the unofficial RR, it patch working.
[Miscellaneous Android Development] ale5000:
There must be something that we miss, have you try to clean the dalvik cache?
[Miscellaneous Android Development] Nubiko:
And wipe did not help.
[Miscellaneous Android Development] ale5000:
[MENTION=5880220]Nubiko[/MENTION]: There was another user with a similar problem and it was caused from Xposed.

The solution was uninstalling Xposed (it may also be needed to uninstall magisk before uninstall Xposed), then deodexing the system and patching it before re-installing.

This is just in case you have Xposed installed.
[Miscellaneous Android Development] Nubiko:
Xposed is not installed.
[Miscellaneous Android Development] xDark_:
I feel like I'm missing something really obvious and that this is a stupid question but...

Trying to install this on my OP3 running Sultan's modded CM13. I used phh's SuperUser instead of Chainfire's for use with Magisk but SafetyNet gets tripped anyways so :/. Anyways, I've enabled su access for apps and ADB in phh's app and I can adb/adb shell su into my device and gain root access.

But when using Tingle's python script from your GitHub it installs but gives me an Error 80, saying it can't access root and tells me to enable root access via dev options - but I can't, the option is grayed out.

Any ideas to use this with phh's?
[Miscellaneous Android Development] ale5000:
[MENTION=5383271]xDark_[/MENTION]: What it say if you execute "adb root" from command prompt?
[Miscellaneous Android Development] _Kosmas_:
[MENTION=5627087]ale5000[/MENTION] your last update works fine :good:

Thank you !!
[Miscellaneous Android Development] ale5000:
[MENTION=5383271]xDark_[/MENTION]: Please try the latest version and post the entire log.

[MENTION=6061988]_Kosmas_[/MENTION]: Thanks.
[Miscellaneous Android Development] xDark_:
Nothing happens. It just loops back to the main screen. But when trying to adb root after adb shell, it gives me an "adb not found".

unupdated:

updated:
[Miscellaneous Android Development] ale5000:
[MENTION=5383271]xDark_[/MENTION]

I'm not sure there is a real solution but there is a workaround:

1) Inside the phone to remount /system as read-write run terminal ed execute:

su
mount -o remount,rw /system
exit

2) Execute the latest version of Tingle (I have updated it now).

3) Then to remount back as read-only run terminal again ed execute:

su
mount -o remount,ro /system
exit
[Miscellaneous Android Development] xDark_:
booted into TWRP, went to mount > checked "system" , then went to advanced > terminal.

typed in "su" and it just gives me an "sh: su not found". So I just typed in the mount code which booted me back to "~ # " and then I typed exit and it spat out "child process exited."

then when running Tingle, this is what appears:
[Miscellaneous Android Development] ale5000:
[MENTION=5383271]xDark_[/MENTION]:

I mean the terminal inside Android (not in the recovery).

But it also looks like it is Magisk that is messing the process, try to:

- Fully uninstall Magisk and reboot

- Make sure you have root

- Repeat the previous procedure and reboot

- Verify if it is successful and then reinstall Magisk
[Miscellaneous Android Development] xDark_:
Nope. Argh, this is such a headache, all cuz Sultan won't put the damn signature faking in his ROM x.x

uninstalled Magisk via Magisk Uninstaller and uninstalled phh's app. Then I flashed SuperSU 2.7.6, and I typed in "su" in adb. I granted root access to adb (because my first try had adb's root access denied) and I ran the script, and it spits out the error I had a few posts up (returned non-zero exit status 1).
[Miscellaneous Android Development] ale5000:
[MENTION=5383271]xDark_[/MENTION]: Have you tried to run Tingle while the phone is in the recovery (/system must be mounted before running Tingle)?
[Miscellaneous Android Development] xDark_:
I can't, adb doesn't detect it while it's in recovery.
[Miscellaneous Android Development] ale5000:
[MENTION=5383271]xDark_[/MENTION]:

You can skip adb.

- On the phone install regular SuperSU (it works better for replacing files)

- On the pc patch the framework.jar file with mode 2

- On the pc copy the patched framework.jar file from the output folder of Tingle to the microSD

- On the phone with a file manager with root support copy the file from the microSD to /system/framework/framework.jar (this will work better if rooted with SuperSU that fix selinux limitations)

- Adjust the permissions and owner of /system/framework/framework.jar if needed

- Restart the phone
[Miscellaneous Android Development] xDark_:
This is what happens when I try running mode 2
[Miscellaneous Android Development] Shadow53:
Mode 2 requires that you pull the framework.jar file from your phone and place it into the input folder that it mentions in the error message. Did you do that?

The instructions you were given assume some technical knowledge, as well as a microSD card that you can use to copy the framework.jar file to the computer and back to the phone, and a root-enabled file explorer that can copy the file in the first place.
[Miscellaneous Android Development] ale5000:
[MENTION=5383271]xDark_[/MENTION]: Since you have already executed Tingle with mode 1 previously you should have a file named framework.jar.backup in the output folder, just copy it to the input folder and rename to framework.jar; then the mode mode 2 should work.
[Miscellaneous Android Development] xDark_:
Thank you! I got it working now, sorry being such a pain in the ass.

For future reference, here's how I did it:

copy and pasted the framework.jar.backup from the output folder to the input folder and renamed to remove the .backup

started the script and hit mode 2

it finished, I copy and pasted the framework.jar from the output folder into my phone

opened up Amaze, granted it root perms, copied the framework.jar

copied it, navigated to /system/framework/ and pasted the framework.jar I transferred

asked if i wanted to overwrite the framework.jar from 2009, clicked yes

rebooted

Now Signal doesn't nag me about not having Google Play Services!

Again, thanks a lot for having so much patience with me! :victory:
[Miscellaneous Android Development] ale5000:
[MENTION=5383271]xDark_[/MENTION]: Do not worry, good that you have been able to get it working :)

In the future I will try again to fix the problem to simplify it but currently the su executable doesn't behave as expected.
[Miscellaneous Android Development] ale5000:
[MENTION=5880220]Nubiko[/MENTION]: Your problem is strange and there isn't any hint.

Maybe it is possible that something installed on your phone is causing problems.

Samsung for example have Knox that possibly interfere with the process.
[Miscellaneous Android Development] Nubiko:
I don't know what the problem is, if the firmware is deodex, then the patch is no problem. But if the firmware is odex partial (part of the files in the framework folder), then after deodex framework, the problem occurs. Tried xposed, 1 and 3 jackdaws appeared, but not a market.

Phone Xiaomi Redmi Note 3 Pro (snapdragon 2\16)
[Miscellaneous Android Development] pupsidze:
Hi [MENTION=5627087]ale5000[/MENTION],

I am also having troubles patching framework.jar on Honor 8 phone (Android 6.0.1 with EMUI). I have patched framework.jar manually with your tool, copied the file back with all the original permissions, rebooted...and nothing happened, I still have a signature spoofing check box empty in MicroG.

Any idea how to fix it?
[Miscellaneous Android Development] ale5000:
[MENTION=5880220]Nubiko[/MENTION], [MENTION=7474499]pupsidze[/MENTION]

After successfully patching, run the patch again; the second time it should say that the file is already patched.

After that remove all parts of microG that doesn't detect signature spoofing, restart the phone, reinstall them, restart the phone.
[Miscellaneous Android Development] pupsidze:
[MENTION=5627087]ale5000[/MENTION] thanks, tried it but no luck. Is there anything else I could try?
[Miscellaneous Android Development] ale5000:
[MENTION=7474499]pupsidze[/MENTION]: Try to restart in the recovery and use the option "Wipe Dalvik Cache", after restart the phone will recreate the Dalvik Cache and if there was a part of the Dalvik Cache that wasn't updated then the problem should be fixed.
[Miscellaneous Android Development] pupsidze:
[MENTION=5627087]ale5000[/MENTION] yeah, did it a couple of times - still no luck :(
[Miscellaneous Android Development] ale5000:
[MENTION=5880220]Nubiko[/MENTION], [MENTION=7474499]pupsidze[/MENTION]

Please report if the above solution is working.
[Miscellaneous Android Development] pupsidze:
[MENTION=5627087]ale5000[/MENTION] Hi, unfortunately I do not have Spoof Package signature in App Permissions, maybe because I am on the stock ROM, so I am unable to enable both items.
[Miscellaneous Android Development] Nubiko:
Can only check on the weekends.
[Miscellaneous Android Development] ale5000:
[MENTION=5880220]Nubiko[/MENTION], [MENTION=7474499]pupsidze[/MENTION]

If it still doesn't work please post a logcat when you have time, maybe there are some hints there.
[Miscellaneous Android Development] pupsidze:
Sure, here is my logcat, hope it will shed some light - https://www.dropbox.com/s/8tfp91a2tyjm6pd/honor8_2.txt?dl=0
[Miscellaneous Android Development] ale5000:
[MENTION=7474499]pupsidze[/MENTION]

To understand the problem I need a logcat while you install and run microG (withOUT Xposed and/or Magisk, they must be completely uninstalled).

In this debugging phase I need a clean system, once we have fixed the problem then everything can be installed.
[Miscellaneous Android Development] pupsidze:
Oki-doki, sir, not a problem!

Here is what I did. Reinstalled my ROM, removed Google Services, rebooted, launched logcat, installed MicroG components, Launched MicroG, Enabled Checkin, went to Self-check menu, logcat stopped.

Logcat -> https://www.dropbox.com/s/gbo3d75pfdduhxf/honor8_4.txt?dl=0
[Miscellaneous Android Development] pupsidze:
[MENTION=5627087]ale5000[/MENTION] Thanks a lot for your time, the issue has been resolved! It turned out that I had some ODEX files, which I did not remove. After the removal everything worked like a charm.
[Miscellaneous Android Development] ale5000:
[MENTION=7474499]pupsidze[/MENTION]: Thanks for your time too, now we know that a possible cause of problems are the odex files left on the phone.

Good that you have fixed the problem :)
[Miscellaneous Android Development] Gillivray:
Thanks for the Tingle Patcher, work great!
[Miscellaneous Android Development] SenK9:
Does anybody have issue with UnifiedNLP checkbox in MicroG not being ticked after using Tingle? It works fine with Xposed fake signature, but with Tingle it's the only checkbox that doesn't become ticked.
[Miscellaneous Android Development] Gillivray:
I haven't issue, UnifiedNLP checkbox is ticked by my Xperia Ray (CM14.1 LegaxyXperia)

I do not why :confused:, sorry :(
[Miscellaneous Android Development] ale5000:
In some cases UnifiedNLP need to be in /system/priv-app/ for it to be registered in the system.

It is possible that Xposed fake signature do more than just spoof signature (but I don't know).
[Miscellaneous Android Development] AnonVendetta:
Patching works fine on a Galaxy Note 10.1 tablet running CM14.1. System was already deodexed. I tried running the patch on-device (with framework.jar in input folder) via QPython3, but it ran for over 25 minutes and didn't finish. On PC it took only a few minutes. I assume this is due to high resource usage.

MicroG works fine, it is installed to /system/priv-app, along with MicroG Google Services Framework. Play Store and other Google apps seem to be working too.
[Miscellaneous Android Development] ale5000:
[MENTION=7441667]AnonVendetta[/MENTION]: On a phone it can take from 30 minutes to 3 hours (it is just an estimation and varies from device to device).

Note: If you install microG as system app you have to also manually install the libraries otherwise many applications will crash; in case you don't know how to do it I suggest to try microG unofficial installer.
[Miscellaneous Android Development] AnonVendetta:
[MENTION=5627087]ale5000[/MENTION]: I think you're right about the time estimate. It just goes to show that the average computer is still far more powerful than Android mobiles.

I already know how to properly install the libraries into system. I just copy over the app's folder from /data/app to priv-app, which brings the libs with it. Then I copy the libs to /system/lib and /system/lib64 (the latter is optional unless you have a ARM64 device). Then again to /system/vendor/lib and /system/vendor/lib64. Then I chmod the directories to 755 and files to 644, with root set as both the user and group for all. Last, I uninstall the user app copies and reboot. This ensures that MicroG finds its' libs no matter where it looks. I do believe this is the correct process for properly installing MicroG as a system app. Converting to system app with something like Titanium Backup is incorrect for Lollipop+, since libs aren't copied, and /system/app and /system/priv-app on 5.0+ has a different folder/file structure than KitKat and below. See for yourself. I have had no issues using this method. I choose priv-app over app folder because some APKs/apps need higher system privileges.

I've been trying to deodex my MM LG stock ROM for quite awhile now, but it never boots afterwards. I've mostly just tried manual deodexers, and SuperR's Kitchen. If I could get that to work then I could use Tingle instead of FakeGapps. This is why I won't be upgrading my LG v10 to Nougat immediately, until Xposed is ready.
[Miscellaneous Android Development] ale5000:
[MENTION=7441667]AnonVendetta[/MENTION]: Using /system/vendor/lib do work (and I use it for old Android) but on Android 5+ I think it is safer to use /system/priv-app/GmsCore/lib/arm/ and /system/priv-app/GmsCore/lib/arm64/ so they don't get mixed with system libraries and when the app is updated it also pick the updated libs

I will also create a tool for deodexing in the future but it is a thing that need a lot of time and a lot of testing so it won't be soon.
[Miscellaneous Android Development] AnonVendetta:
[MENTION=5627087]ale5000[/MENTION]: I just choose to put multiple copies of the libs in all folders I listed, I doubt that MicroG libs are updated often, even with new releases. The libs are also within the app folder as well.

I forgot to mention that when copying the app folder from /data/app to priv-app, I delete the folder that has the odex. The app isn't truly odexed so this file isn't needed. And Android will keep optimizing on boot if you leave it. I also rename to something relevant, although I don't think the actual name makes a difference, since any name you give it still won't change the package name that Android sees.

Any deodex tool you create probably won't work on my LG stock ROM, I think I have a special case. I think the boot.oat and boot.art files in /system/framework being deleted are what causes my bootloops, but the issue is that deodexing deletes these files. An experienced dev created a deodex ROM for an older MM firmware, but I can't run it because LG has anti-rollback restrictions that prevent downgrading, which means you're stuck with the latest version or higher if you install firmware updates. In his ROM these 2 files are present, it does boot for others, I'm trying to get him to disclose how he did it, but no answers so far. I guess he's really busy.