yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] tetsuo55:
I was wondering, will this zipaligning use the intelligent zipping as described in this thread?

http://xdaforums.com/showthread.php?t=2358261

Compression Levels: #
Script always uses 10 passes for compression which #
guarantees maximum compression and does not impact #
decompression time. Script CL differ in fast bytes. #
CL(1) <=> 4 fb CL(4) <=> 32 fb #
CL(2) <=> 8 fb CL(5) <=> 64 fb #
CL(3) <=> 16 fb CL(6) <=> 128 fb #
You can also enter custom fast bytes number to be used #
for compression by entering fb[3-258] instead CL. #
Examples: -afb3 -dfb69 -lfb132 -rfb258 #
#
APK Recompression (-r option): #
As of v1.25 script uses Smart Recompressing i.e. it #
will leave files uncompressed in GOptimized apk that #
were uncompressed in original apk which is the best way #
for recompressing. #
-R+ Script will use Smart Recompression plus it will #
never compress file formats from below list even if #
they were compressed in original apk. #
-R- Script will disable Smart Recompress and store #
file formats uncompressed only if they are on below #
list. #
Following Android Asset Packaging Tool rules following #
list of file formats: #
"jpg jpeg jpe jfif png gif wav mp2 mp3 ogg aac mpg #
mpeg mid midi smf jet rtttl imy xmf mp4 m4a m4v 3gp #
3gp 3gpp 3g2 3gpp2 amr awb wma wmv zip lzma xz 7z lua #
pxp resS gltxt geo apf zi_" #
should never be compressed as they are already #
compressed formats or don't compress well. #
Most developers use this file formats for databases and #
compressing them would result with application errors. #
[Android Software/Hacking General [Developers Only]] Surge1223:
Honesty, no idea. Lol anyways you'll be able to build later today yourself (sleep time for me) but I was able to make it into an ndk project that compiles and works, but I don't remember/know if it's dynamically linked in in output because because of the crazyness I had to implement in the Android.mk, force static executable is hit or miss for me but I'm sure it's trivial and temporary.

We'll have to see if any of you get the same when you compile it with ndk. Ii start the push to git and then my pc froze and died so we'll find out later today I guess lol

Edit: dont worry about the dynamic linker being wrong it that pic, that was a derp on my part that i fixed later
[Android Software/Hacking General [Developers Only]] osm0sis:
Awesome! I'm itching to try it! I tried using ndk-build with the Android.mk files for the various required libraries and that did okay with zopfli and zlib but it got pretty ugly around libandroidfw, so I'm especially looking forward to seeing how you handled stuff like that. :)
[Android Software/Hacking General [Developers Only]] Surge1223:
Its up and I cloned my own repo and tested and it built fine statically. I vaguely remember pseudo hacking my NDK/build dirs make files to always produce static executables, so that remains to be seen if it will build statically or not for others lol

Also I sort of cheated, I added zopfli and zlib to built their static libs dynamically with zipalign but as for the other dependencies

LOCAL_LDFLAGS += $(LOCAL_PATH)/libandroidfw.a \
$(LOCAL_PATH)/libandroidfw.a \
$(LOCAL_PATH)/libutils.a \
$(LOCAL_PATH)/libcutils.a \
$(LOCAL_PATH)/liblog.a \
$(LOCAL_PATH)/libm.a \
$(LOCAL_PATH)/zlib-lib/libz.a \
$(LOCAL_PATH)/zopfli-lib/libzopfli.a

these two:

$(LOCAL_PATH)/zlib-lib/libz.a \
$(LOCAL_PATH)/zopfli-lib/libzopfli.a

should be created in the root of the zipalign nkd dir after it finishes building them, i figured id start with dynamically have zopfli and zlib being built in, and slowly remove the the static libs i included in the project root dir as i go. Also, liblog was giving me grief about a symbol, and even though i recompiled it with the flags it needed to produce the symbol, it didnt so i just added a stub for now.

#ifndef _SET_ABORT_MESSAGE_H
#define _SET_ABORT_MESSAGE_H
static const char *msg = "Im just as useless as official log messages";
__BEGIN_DECLS
void android_set_abort_message(const char* msg) { printf(" %s \n ", msg); }
__END_DECLS
#endif // _SET_ABORT_MESSAGE_H
[Android Software/Hacking General [Developers Only]] osm0sis:
Haha, a lot of my hackery has come from me trying to get things to cross-compile properly with the standalone NDK toolchains in Cygwin. ;)

Hmm yeah, no luck with just adding NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk APPLICATION_BUILD_SCRIPT=./Application.mk or replacing . with $(pwd), same issues. Guess I'll fire up the Ubuntu VM instead.
[Android Software/Hacking General [Developers Only]] Surge1223:
Hmm, not sure if its a cygwin path issue or what...odd

...Wait Application.mk has only 9 lines it cant error on 13...ahhh i see whats happening

LOL

ok so we have

TOP_LEVEL := jni

jni/include/*

jni/libs/*

jni/Application.mk

jni/Android.mk

jni/zipalign

we have an Application.mk and Android.mk in jni/zipalign and in jni so im guessing its reading the Application.mk a directory further down than it should..

lol the rabbit hole of windows PATHS
[Android Software/Hacking General [Developers Only]] bjcrj:
Thanks for putting these together and sharing them osmosis! Nice clean and simple. Great work!
[Android Software/Hacking General [Developers Only]] AutomaticFailure27:
[MENTION=4544860]osm0sis[/MENTION] With the vm tweaks you are working on, it reminded me of the EVO 4G days when I used to run V6 Supercharger from zepplinrox. That thread is still booming ever since 2011.
[Android Software/Hacking General [Developers Only]] osm0sis:
Yeah we're just trying to do some basic stuff with the vm that's available through the sysfs, not replace a more comprehensive solution like Supercharger.
[Android Software/Hacking General [Developers Only]] qu4nd:
Hi,

I'm having trouble to get correct screenshots from TWRP 2.5.0.0 with your adb tool on Galaxy Nexus (Maguro).

They look like this
[Android Software/Hacking General [Developers Only]] Midomad:
[MENTION=4544860]osm0sis[/MENTION]

I have a question : What do you prefer Row or Deadline with last tunables?and now that franco added you're tweaks in 382 update init.d scripts still needed?

Envoyé depuis mon Galaxy Nexus avec Tapatalk
[Android Software/Hacking General [Developers Only]] The Gingerbread Man:
Last I read he was using ROW and most of the tweaks are included in the new Franco build, how ever you will want to use 950iosettings or use set on boot option for deadline tunables as Franco has his as default for now. To remind you what those values are 250,2500,1,1,8
[Android Software/Hacking General [Developers Only]] osm0sis:
The color thing could just mean that for some reason TWRP is using a different pixel format than CWM, but the 4 quadrants of pics thing is definitely odd. Especially since someone tested and told me that it worked on TWRP before.

I retested this the other night on my latest CWM build and it's still working fine here. It outputs 4 separate full-size pictures from the screen framebuffer generally..

Anyway, I'll get TWRP 2.5.0.0 and try it on my device to see if I can reproduce your issue. Stay tuned. :good:
[Android Software/Hacking General [Developers Only]] Empty Hand:
With the new Franco GNex nightly, I know the io script can be used to set the deadline values. Is the vm script still needed to test those settings, or are those now part of the kernel? Thank you!
[Android Software/Hacking General [Developers Only]] osm0sis:
Yeah I wouldn't even use the io script for deadline on f.K. Now that Francisco has added the ability to set io scheduler tunables on boot to f.Ku, it'd kinda be overkill to use the whole script. ;) I think that's what The Gingerbread Man was implying above as well with his suggestion.

The vm and lmk sections are currently in the testing phase, so are not added. Only our finalized stuff makes it into official nightlies (at Francisco's discretion of course). TCP CAA is the only thing in there that might not ever get added even though we've chosen it as the best from our testing, since Francisco doesn't want to make it westwood instead of the Linux default cubic for whatever reasons.

r382 is pretty sweet though, he took all the latest osmod files I sent him for reference and directly added them. Proud moment. :D

All we're missing is deadline hardcoded and pkgnex's bfq quick-tune to optimize it further for flash media and we're at milestone.
[Android Software/Hacking General [Developers Only]] osm0sis:
Turns out I was right, and even more, pixel format will fix both of those issues. :)

I guess TWRP (now?) uses rgb565le where CWM uses bgr0. Trying to work out if there's a way I can get the recovery brand from the commandline so the script can automatically decide which format to use. :cowboy:

Edit: TWRP doesn't appear to put anything on the device to identify it by.. /cache/recovery/.version is only the actual number, /data/media/0/TWRP/ doesn't have anything in it unless you have backups, and uname -a doesn't give the brand either. CWM on the other hand has the recovery brand in the file /data/media/clockworkmod/.recovery_version in the latest versions, but I'd like to be able to support older CWM versions too.. So unless there's some other hidden random file/folder/command they both use that I don't know about I might just have to make it convert with both pixel formats and you can just look at the ones for your recovery brand.

Edit 2: Nailed it. ;)

http://xdaforums.com/showthread.php?p=42719303#post42719303
[Android Software/Hacking General [Developers Only]] The Gingerbread Man:
Osmosis you should try your screen colours with the r g b gammas set to 0, it gives the white a slightly more natural look and not slightly blue in some bright light situations.

Edit

Also iv noticed since trying to set these via init.d I haven't been able to see the particular time when the script gets loaded, I had my colours set via init.d with different values some time ago and it was clearly visible the white level changed at Google boot screen, its not so obvious now if its even happening there. Have you managed to time it perfectly at the switch from Google screen to nexus boot animation? I'm certain permissions are correct for the script and folder
[Android Software/Hacking General [Developers Only]] osm0sis:
For my panel, zeroing the gammas makes things a bit too yellow. Things aren't slightly blue with mine, they're quite natural with -4 0 5. :)

If you need to use the sleep command then you don't see the color change any more, since it's the multipliers that are responsible for that. My new screen gets a washed out, dusky look if the multipliers are set before the boot animation, so the sleep just pushes it ahead to avoid the issue.

If the sleep is still commented out on yours then it might just be whatever's happening before during boot (other scripts?) is taking long enough that it's during the boot animation for you anyway.
[Android Software/Hacking General [Developers Only]] The Gingerbread Man:
I have no sleep in the the script, and the 900colours is the only script I got in my init.d at this time, here's a link http://db.tt/Bi5nZvPm to the file. I wasn't complaining I just found it odd I couldn't see the moment it changed like I could before. My screen looks great though with these colours I'm really pleased! :)
[Android Software/Hacking General [Developers Only]] osm0sis:
Yeah, didn't think you were complaining. Just one of those "every screen is slightly different" type things, I think! :)

Only thing I can think of is that maybe some of the stuff I added to fkbootscript.sh in the latest version pushes it ahead by the 2 second gap. Hopefully not though, since that would mean people with panels like my old one would be getting the duskiness without the sleep since it needs to be before the boot animation on those ones (not after like on my new one).
[Android Software/Hacking General [Developers Only]] The Gingerbread Man:
So just to be clear your saying right now at present the colours are getting set before the boot animations start? Hence why I can't see the change during the boot process?
[Android Software/Hacking General [Developers Only]] osm0sis:
Should be technically during the boot animation with the 2 second delay, but it pushes the multiplier only just far enough that it's during the beginning fade-in, so not really perceptible.

Edit: Just updated the lmk whitelist launcher list, adding LMT, Action Launcher Pro, and TSF Shell (thanks boype/Fancy Kernel). Updated in 975experimental as well. :)
[Android Software/Hacking General [Developers Only]] qu4nd:
Since i didn't find any solution yet I'm just wondering of you were able to find out what's going on?

Regards

Daniel
[Android Software/Hacking General [Developers Only]] osm0sis:
Already worked it out and told you the solution back here: http://xdaforums.com/showpost.php?p=42586883&postcount=49 ;)

I haven't figured out a fancy way to determine whether I'm running TWRP or CWM yet, and I want to play with that a bit more when I've got some free time this weekend before I upload a new version to support both pixel formats.

For now to work around it, open adb-screenshot.bat and change the -pix_fmt argument on the ffmpeg commandline from bgr0 to rgb565le, as I suggested. It will work. :good: :)
[Android Software/Hacking General [Developers Only]] qu4nd:
Thank you so much! I must have been too tired to follow you lately ^^

Anyway, it works with your suggestion!
[Android Software/Hacking General [Developers Only]] osm0sis:
I asked the great [MENTION=4666971]Phil3759[/MENTION] (PhilZ) if he had any ideas and he suggested a rather clever way by just checking the contents of the /sbin/recovery binary itself with a cat | grep. Working on it now. :D
[Android Software/Hacking General [Developers Only]] osm0sis:
Haha yeah that was definitely confusing me as to the execution point. I just tried again in the jni directory as you suggested and it did work this time with your commandline additions, but I had to copy the zlib/*.h files from zlib/src/ since the symlinks broke in ndk-build despite being run from Cygwin. I attempted it after remaking the symlinks in Cygwin as well and it still didn't like it haha.

Edit

: Ends up not being static though! :p

$ ndk-depends arm-linux-androideabi obj/local/armeabi/zipalign
0x00000001 (NEEDED) Shared library: [libstdc++.so]
0x00000001 (NEEDED) Shared library: [libm.so]
0x00000001 (NEEDED) Shared library: [libc.so]
0x00000001 (NEEDED) Shared library: [libdl.so]

Edit 2

: Adding LOCAL_LDFLAGS += -static gets it working (I actually replaced your LOCAL_CFLAGS += -fPIC line with it). Executes on ye olde Galaxy Nexus as well! :D

Edit 3

: Damn, --help worked but still "Illegal instruction" when I try to actually zipalign an APK.. :(

[MENTION=4939386]Surge1223[/MENTION], must be something in one of your precompiled libs?
[Android Software/Hacking General [Developers Only]] Surge1223:
whats the command you used exactly? Also can you send me a binary thats was made for the GN? I want to look at some elf flags.

btw you can do some nifty things with patchelf..very handy
[Android Software/Hacking General [Developers Only]] osm0sis:
Any command other than --help fails with "Illegal instruction" on the GN.

zipalign -c 4 <apk>

zipalign -p 4 <inapk> <outapk>

etc.

Similar to your test build, it appears to work perfectly on my N5 and N7. :confused:

Here's the unstripped binary for you to check out. Hopefully there's something to be done to make it build universal like static binaries usually are. :fingers-crossed: :)

Edit: [MENTION=4939386]Surge1223[/MENTION], adding -v to -c gets us a little more output.

root@tuna:/data/local/tmp # ./zipalign -c -v 4 base.apk
Verifying alignment of base.apk (4)...
Illegal instruction

strace: http://pastebin.com/s5Fq8DDV

[ Attachment removed ]
[Android Software/Hacking General [Developers Only]] osm0sis:
[MENTION=4939386]Surge1223[/MENTION] I've managed to get everything to compile on my own from scratch except libandroidfw, what's the secret there?
[Android Software/Hacking General [Developers Only]] Surge1223:
Off the top of my head, it would require parts of bionic libc, frameworks native, cutiils, and some kernel headers (prob ok to get from bionic tho). I think I might have the deps list laying around..ill get back to ya
[Android Software/Hacking General [Developers Only]] osm0sis:
That'd be great. For some reason it goes off the rails with

[armeabi] Compile++ thumb: androidfw <= AssetManager.cpp
In file included from ./AssetManager.cpp:29:0:
./../include/androidfw/ResourceTypes.h:1138:27: error: 'ACONFIGURATION_SCREENROUND_ANY' was not declared in this scope
SCREENROUND_ANY = ACONFIGURATION_SCREENROUND_ANY,
^
./../include/androidfw/ResourceTypes.h:1139:26: error: 'ACONFIGURATION_SCREENROUND_NO' was not declared in this scope
SCREENROUND_NO = ACONFIGURATION_SCREENROUND_NO,
^
./../include/androidfw/ResourceTypes.h:1140:27: error: 'ACONFIGURATION_SCREENROUND_YES' was not declared in this scope
SCREENROUND_YES = ACONFIGURATION_SCREENROUND_YES,
^
./../include/androidfw/ResourceTypes.h:1181:31: error: 'ACONFIGURATION_SCREEN_ROUND' was not declared in this scope
CONFIG_SCREEN_ROUND = ACONFIGURATION_SCREEN_ROUND,
^
/cygdrive/g/android/android-ndk-r10e/build/core/build-binary.mk:466: recipe for target 'obj/local/armeabi/objs/androidfw/AssetManager.o' failed
make: *** [obj/local/armeabi/objs/androidfw/AssetManager.o] Error 1

which all appears to be in there just the same as other similar stuff that does work. And I even went so far as to see what happens if I chop that out, and anything corresponding in ResourceTypes.cpp, and it makes it a bit further, then fails with something else funky later, so I must be missing something.
[Android Software/Hacking General [Developers Only]] osm0sis:
Nevermind! https://github.com/osm0sis/zipalign ;)

Works on all my devices now. I also noticed a few of my static ARM binary collection weren't stripped yet, so I did that and now they're a bit smaller for /system partition use:

https://s.basketbuild.com/devs/osm0sis/binaries

Edit: [MENTION=5514152]Paget96[/MENTION], you might want the new zipalign with -p for Marshmallow support in your app? :)
[Android Software/Hacking General [Developers Only]] Surge1223:
Nice, looks like you cleaned up and added better methods for handling dependencies than the mess I had lol.

Lol I intentionally don't strip mine, for two reasons, one so if someone is curious how I built it then the symbols are still present and they can see what source files I used, two I sometimes forget how I managed to get something to build statically so I have to utilize this too. Also if I have to debug, comes in handy. I do tend to statically link everything by default just a habit from the past I guess.

What's next for you?
[Android Software/Hacking General [Developers Only]] osm0sis:
Haha now I can get back to testing gappsintegrator on Marshmallow using the new static zipalign to repackage the APK libs correctly. ;) :highfive:
[Android Software/Hacking General [Developers Only]] osm0sis:
gappsintegrator: v5 - fix lib removal, add exclusions to Marshmallow main method, misc. fixes/improvements:

https://github.com/osm0sis/gappsintegrator/commit/1f7f82bc7631fc3986c3fa9ef5848e7ddc67ab55

Updated in the OP as well. :D

Complete proper APK internal lib support for Marshmallow is tested and working using my new zipalign binary! I worked around pretty much the same SystemUI FC permissions issues we were seeing with the Lollipop-style external lib fallback method by excluding integration of both Google TTS and Google Keyboard (which is interesting because Keyboard doesn't trigger the issue with the fallback method in my testing, only Google TTS does). I also improved cleanup to finally remove those extra numbered inactive /data/app package directories that can occur as a side-effect of the integration procedure's packages.xml changes. All in all it's feeling pretty stable/complete for Lollipop and Marshmallow now! :cowboy:

This took a fair amount of my time off this week, so if you like the progress I'm making on this project, or enjoy anything else I've done on xda, please do hit the donate link from my profile. Thanks for your support!
[Android Software/Hacking General [Developers Only]] Sik-1:
Is it possible to ask for a repackaged init.d scripts from pkgnex plz Os
[Android Software/Hacking General [Developers Only]] osm0sis:
The Lollipop (and above) updated [MENTION=4793042]pkgnex[/MENTION] versions are linked in the OPs, you just need to place them in /system/etc/init.d, or more modernly, /system/su.d or /su/su.d depending on your setup, and set them executable. :good:

I don't plan to update the old ones because they're basically up there for posterity as the Jelly Bean/KitKat version.
[Android Software/Hacking General [Developers Only]] Sik-1:
Copy, will do
[Android Software/Hacking General [Developers Only]] domicq:
where I have to paste your new zipalign binary? Or it's not necessary?

EDIT: in /su/xbin?

EDIT2: I have in system partition about 1GB free space and in log is every app with star, so any is integrated. I tried it twice and with same result.

Gesendet von meinem Nexus 5X mit Tapatalk
[Android Software/Hacking General [Developers Only]] osm0sis:
If you're using systemless su (pointless when your plan is to modify system ;)), then yes, otherwise /system/xbin; you need zip and zipalign.

Sounds like the free space calculation isn't working on your setup. ROM? Busybox?
[Android Software/Hacking General [Developers Only]] domicq:
I'm using yours busybox version. And stock 6.0.1.

Gesendet von meinem Nexus 5X mit Tapatalk
[Android Software/Hacking General [Developers Only]] osm0sis:
From a command prompt, run:

df /system; df -Pm /system 2>/dev/null | tail -n 1 | awk '{ print $4 }' | cut -d. -f1;

And post the output please. :)

My N5 shows:

u0_a95@hammerhead:/ $ df /system; df -Pm /system 2>/dev/nu>
Filesystem Size Used Free Blksize
/system 1009.3M 980.8M 28.5M 4096
28

Similar on my other devices. :good:
[Android Software/Hacking General [Developers Only]] domicq:
tem; df -Pm /system 2>/dev/null | tail -n 1 | awk '{ print $4 }' | cut -d. -f1; <

Filesystem Size Used Free Blksize

/system 2.9G 1.8G 1.1G 4096

1

u0_a140@bullhead:/ $

Gesendet von meinem Nexus 5X mit Tapatalk
[Android Software/Hacking General [Developers Only]] osm0sis:
Haha damnit, the system df isn't accepting the -m to display in megabytes, so it truncated 1.1GB to 1 and the calculation thinks that's free megabytes. :p
[Android Software/Hacking General [Developers Only]] domicq:
? ahaha, Now I understand

Gesendet von meinem Nexus 5X mit Tapatalk
[Android Software/Hacking General [Developers Only]] osm0sis:
Yeah, I'll see if I can make it smarter by parsing that it's in GB, so multiply by 1024 or something. That way we don't have to force busybox applet over system, which I've avoided having to do so far. :):good:

Edit: [MENTION=5040989]domicq[/MENTION], change the first line of freespace() from:

free=$(df -Pm /system 2>/dev/null | tail -n 1 | awk '{ print $4 }' | cut -d. -f1);

to:

free=$(df -Pm /system 2>/dev/null | tail -n 1 | awk '{ print $4 }');
case $free in *K) free=0;; *M) free=`echo $free | cut -d. -f1`;; *G) free=$((`echo $free | cut -d. -f1` * 1024));; esac;

I'll reupload and force push v5.0 again in a bit with that fix. :cowboy:
[Android Software/Hacking General [Developers Only]] domicq:
Now it works! Thanks man :)

[MENTION=4544860]osm0sis[/MENTION]

On every start-up it's going to optimize all apps, that was integrated. It's possible to get around this?

Gesendet von meinem Nexus 5X mit Tapatalk
[Android Software/Hacking General [Developers Only]] osm0sis:
It needs to optimize the apps to recognize the new system versions. It'll stop after several reboots once it's done integrating.
[Android Software/Hacking General [Developers Only]] domicq:
[MENTION=4544860]osm0sis[/MENTION]

ah, again systemUI FC, here is log :crying:

it did integrating few days ago and now it integrated now updated apps. sadly with fc