yashsingh1/xdaforums huggingface dataset:
[AT&T Samsung Galaxy S 4 Android Development] Nottach:
Framework installation using ApkTool

In order to use Apk_Manager on System APKs you will first need to install the System Frameworks to your ApkTool.

Assuming you have downloaded both zips from the first post unzip the tools folder to a location of your choosing.

Next, extract the frameworks zip to your newly created Apk_Manager folder and place them in the 'other' folder so they are in scope of apktool.jar, also in the 'other' folder.

Now, with no files selected in the 'other' folder, Shift+RightClick an empty area of the folder and choose "Open command window here".

Do:

apktool if framework-res.apk

&&

apktool if twframework-res.apk

The frameworks should be installed as 1.apk and 2.apk respectively. Confirm by navigating to C:/Users/<YOU>/apktool/framework.

Example output:

You should see 1.apk and 2.apk, they will be a different file size of the res APK, this is because they only contain info pertaining to APKs that may utilize their resources.

Now you have your frameworks installed correctly and can continue using Apk-Manager to Mod your other, deodexed, APKs, such as SystemUI.apk.

I hope this will be helpful to some, if there are any additional steps I can add to make it clearer please let me know.
[AT&T Samsung Galaxy S 4 Android Development] Nottach:
Modding using Apk Manager

Apk-Manager examples coming soon...
[AT&T Samsung Galaxy S 4 Android Development] Nottach:
Reading source using Dex2Jar

Dex2Jar is a useful tool for generating Java source from APK/JAR dex files.

In order to use Dex2Jar first open your APK/JAR with WinRar or similar and extract the dex file to the Dex2Jar root directory.

Next drag-n-drop the dex file onto dex2jar.bat. This will create a jar archive in the same directory.

Next drag-n-drop that newly created jar onto jd-gui.exe.

This will open a tree view of the Java source.

Note that it is not always possible for Dex2Jar to reconstruct the source code and some classes may have errors.

Also, structure of the source may be in somewhat ByteCode format, still having gotos and labels...

For more information on Dalvik opcodes see here.

Another tool useful in reconstructing Java code is Virtuous Ten Studio.
[AT&T Samsung Galaxy S 4 Android Development] Nottach:
Did you know?

A few additional places to look at are...
[AT&T Samsung Galaxy S 4 Android Development] captawsm:
That tip about enabling Find My Mobile is quite nice. After changing that, the option does show up in Settings -> More Tab -> Security; however it doesn't appear to work correctly. :( The phone never shows up as registered on my Samsung Account. I even tried creating a new Samsung account to test with and by enabling remote control when over wifi and cell data.
[AT&T Samsung Galaxy S 4 Android Development] Nottach:
Hmm, just checked it out and it seems they haven't added the S4 to the list of devices? Maybe in the future they will. :rolleyes:
[AT&T Samsung Galaxy S 4 Android Development] captawsm:
I saw that the S III shows up in the list of devices on the Samsung Dive website. I still have my "stock" rooted S III so I might check to see if this trick works on there and if it will register on the site. I can post results if anyone is interested which may let us know if we just need to wait till the S4 shows up on the site.

Edit: if anyone wanted to know: Tried on a stock rooted AT&T S3 w/ 4.1.1 and ran into same issue - I can enable remote controls but device never registers on the samsungdive.com website so maybe there is something more to getting Find My Phone working that just editing features.xml

If someone else tries this, I'd be interested in hearing if you run into the same problem.
[AT&T Samsung Galaxy S 4 Android Development] madquack:
I do a lot of decompiling/recompiling and minor smali/xml edits, I just want your general opinion here.. Do you or have you ever used Chainfires Fast AAPT?

http://xdaforums.com/showthread.php?t=1907281
[AT&T Samsung Galaxy S 4 Android Development] Nottach:
So I'm trying to disable the Media Volume Alert by modifying android\media\AudioManager of framework.jar, as shown below, and I'm unable to get the device to fully boot after replacing the original file. It just hangs on the AT&T logo. I can get ADB so I can replace the original and then it boots.

Does my mod look like it should break it? All I did was change the level at which the dialog appears to 16 (0x10) instead of 10 (0xa). I would think that would be OK. I don't get any error recompiling either. I've tried wiping dalvik-cache between replacements, no luck. I've also tried returning false at the beginning of the 'isEarProtectLimitOn' method, no luck. I'm stuck, any ideas?

line 483

# direct methods
.method static constructor <clinit>()V
.registers 1

.prologue
.line 60
const-string v0, "AudioManager"

sput-object v0, Landroid/media/AudioManager;->TAG:Ljava/lang/String;

.line 269
const/16 v0, 0xd

new-array v0, v0, [I

fill-array-data v0, :array_16

sput-object v0, Landroid/media/AudioManager;->DEFAULT_STREAM_VOLUME:[I

.line 2971
const/16 v0, 0x10

sput v0, Landroid/media/AudioManager;->EAR_PROTECT_LIMIT_INDEX_DISABLE:I

.line 2972
[COLOR="Red"]-- const/16 v0, 0xa[/COLOR]
[COLOR="Green"]++ const/16 v0, 0x11[/COLOR]

sput v0, Landroid/media/AudioManager;->EAR_PROTECT_LIMIT_INDEX_NORMAL:I

EDIT: This is the correct edit to disable the Loud Volume Notification. I guess my tools were out of date. After updating baksmali it worked.

Basically instead of at level 10 it triggers only at the max volume, which I think is triggered someplace else. I'll keep looking for the root.

EDIT2: In addition to the above edit the 'EAR_PROTECT_DEFAULT_INDEX' needs to be changed so it doesn't trigger at Max Volume.

Same file, line 109:

.field public static final EAR_PROTECT_DEFAULT_INDEX:I = [COLOR="Red"]0x11[/COLOR]

No moar Loudness warnings!!
[AT&T Samsung Galaxy S 4 Android Development] CPA Poke:
Thanks for this!

This was my first time editing SQL db's, so I didn't want to do anything I wasn't sure about. After making the APN's editable, the APN protocol is still grayed out. Is there a way to change the default value of the APN protocol itself (specifically to "iPv4/iPv6") within the database?
[AT&T Samsung Galaxy S 4 Android Development] howtomen:
Hey man i see ur postinf mods. I removed the ongoing wifi on s3 and same exact method works on s4 but needs to be using a deodex system which i will push this weekend however i can get u a guide if u wanna try?

sgh-i747(d2att)(sgs3) on latest cm10.1 or ultimatum
[AT&T Samsung Galaxy S 4 Android Development] Nottach:
You mean the WiFi Connected notification?

I found this method. Is yours different?

Mine seems to work well but I'm curious as to what you found too.
[AT&T Samsung Galaxy S 4 Android Development] howtomen:
in the s3 we used this method which still works and only requires the secsettings http://xdaforums.com/showpost.php?p=29047026&postcount=1
[AT&T Samsung Galaxy S 4 Android Development] Nottach:
I see, I think my method never calls the NotificationManager because it returns doNotShowNotification while yours still creates the notification but never calls show() on it. which may lead to memory leaks. I think mines cleaner?
[AT&T Samsung Galaxy S 4 Android Development] howtomen:
i see makes good sense thanks for the work :D
[AT&T Samsung Galaxy S 4 Android Development] Nottach:
[MENTION=3471910]howtomen[/MENTION] You have experience making all apps multi-window? I was abe to get the all to show in the drawer but their indexes are messed up and the wrong app gets added when dragging.

I think I have to fix or create the adapter?
[AT&T Samsung Galaxy S 4 Android Development] jcase:
Why not linking directly to the tools? dex2jar and smali are udpated often, and the current APKTool fails to properly decode some resources in stock firmware of this device.
[AT&T Samsung Galaxy S 4 Android Development] geoldr:
Very excited to see this happen. Really miss this from my hacked S3.
[AT&T Samsung Galaxy S 4 Android Development] akira02rex:
That download speed from devhost is PAINFUL! I'm working on porting over cm10.1's MMS.apk for our device once this is finished. I may try to find a you better mirror man lol.
[AT&T Samsung Galaxy S 4 Android Development] Nottach:
On the S3, was there an issue where the app you drag isn't the app that gets placed in the bar? And the only way to solve it was clearing the bars data? I've got all the apps working but this issue remains and I think I read it was this way on other devices too.

Added a mirror, hopefully it's faster.
[AT&T Samsung Galaxy S 4 Android Development] Thermalwolf:
Will pushing these files set my system status to modified? I have been able to maintain my device as official while still keeping root but I feel like pushing over a deodexed system will permanently set me to modified even if I reupdate my su binaries.

Actually urgent!!!

mcRegistry and pak were not copied following your instructions, is this correct or do I need to cp those paths as well? curious before I completely reboot as I would reallllllly love to not softbrick and have to go back to stock from scratch :P (Though I will if that's the case, fully aware of these dangers and the consequences that can arise)

Update: Nvm I pushed those as well and rebooted fine. Work flawlessly still, great job and can now verify we are one step closer :)
[AT&T Samsung Galaxy S 4 Android Development] romracer:
Mine still says official after removing odex files, replacing APKs, modifying them, etc. I think the custom firmware check must be looking for Superuser.apk (amongst other things). There's nothing inherently different between SuperSU and it, yet using SuperSU removes the custom notice too.

The mcRegistery and pak files are not modified during the deodex'ing. You don't need to delete them, so you don't need to reupload them (but you can if you want I guess).
[AT&T Samsung Galaxy S 4 Android Development] romracer:
While I can't comment on direct linking, I used the current apktool (1.5.2) just fine. No issues decoding resources. There's some issues putting it back together again with aapt, but that's a Samsung problem, not an apktool (or Google technically since aapt is part of the SDK).
[AT&T Samsung Galaxy S 4 Android Development] jcase:
Apktool certainly has some decoding issues, it doesnt fail but on some of the system apps it improperly decodes manifests and layouts. Either you didnt decode all of them, or wasnt noticing the malformes output.

This only affects some of the apks, and is due to an encoding error.

Edit because people like to debate without completely investigating:

Retina:app jcase$ apktool d BluetoothTest.apk

I: Baksmaling...

I: Loading resource table...

Exception in thread "main" java.lang.NullPointerException

at brut.androlib.res.decoder.ARSCDecoder.addMissingResSpecs(ARSCDecoder.java:326)

at brut.androlib.res.decoder.ARSCDecoder.readType(ARSCDecoder.java:138)

at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:110)

at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:83)

at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:49)

at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:491)

at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:74)

at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:66)

at brut.androlib.Androlib.getResTable(Androlib.java:50)

at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:189)

at brut.androlib.ApkDecoder.decode(ApkDecoder.java:114)

at brut.apktool.Main.cmdDecode(Main.java:146)

at brut.apktool.Main.main(Main.java:77)

Retina:app jcase$ apktool

Apktool v1.5.2 - a tool for reengineering Android apk files
[AT&T Samsung Galaxy S 4 Android Development] rsbuffalo:
Thank you Nottach!

Download "Entire Deodexed System With Listed Mods" to PC (ran MD5 checker) then unzipped and changed directory from "S4 Deodexed" to "Deodexed", then deleted the two folders in the "apps" unzipped folder (mcRegistry and pak) on PC. Then I made a new zip called "Deodexed.zip" with the Entire Deodexed System + the simple mods and copied zip file to internal sdcard root directory. Used ES File Explorer to unzip re-zipped file at internal sdcard root directory. Ran the commands posted for adb. Did a of couple of complete re-boots and deleted zip+folders. Everything works perfect!
[AT&T Samsung Galaxy S 4 Android Development] Thermalwolf:
Interesting, does this mean his deodexed framework and apps is possibly flawed?
[AT&T Samsung Galaxy S 4 Android Development] Nottach:
It's based off romracer's deodexing, could be issues but I haven't ran into any yet..
[AT&T Samsung Galaxy S 4 Android Development] jcase:
I didn't use his tools, thats fresh apktool, I was just suggesting he link to github/googlecode sources of the tools he includes. That was bug fixes can be gotten a bit easier.
[AT&T Samsung Galaxy S 4 Android Development] CPA Poke:
For anyone who deodexed their system and wants the lightly-themed swipe bar and quick settings icons from this thread (http://xdaforums.com/showthread.php?p=41051344), I brought in the pngs to the deodexed SystemUI apk (d/l link below) and it's working fine for me - I just couldn't get the apk to recompile with the circle battery mod, which I was really hoping to have. Anyone who has an idea of how to make it work, I'd love the input.

http://www.mediafire.com/?ou4dri633m3wrg5
[AT&T Samsung Galaxy S 4 Android Development] romracer:
I stand corrected then. I only suggested I didn't have any problems.

Since apktool is not used in the deodex'ing process, this shouldn't affect my deodex.
[AT&T Samsung Galaxy S 4 Android Development] Thermalwolf:
Yea I didn't really think it would but it certainly raised an eyebrow, your deodex runs smoothly on my end so I wasn't too worried :p
[AT&T Samsung Galaxy S 4 Android Development] tokoam:
when running the ADB Commands listed

adb shell

su

mount -o rw,remount /system

stop

cp sdcard/Deodexed/app/* system/app/

cp sdcard/Deodexed/framework/* system/framework/

rm system/app/*.odex

rm system/framework/*.odex

rm data/dalvik-cache/*

reboot

after i get to the stop command the phone turns black "screen turns off" and i cannot continue .. i have to turn the phone off then back on but this still dosnt fix my problem after retrying it still gets stuck at stop right after mount -o rw,remount /system am i doing something wrong ?
[AT&T Samsung Galaxy S 4 Android Development] Nottach:
stop is supposed to black screen, it "stops" the framework.

continue with the commands

i've got an easy update coming soon if you want to wait.
[AT&T Samsung Galaxy S 4 Android Development] tokoam:
Right but after doing the command after stop it says the dir can not be found. Ill wait for your update I guess
[AT&T Samsung Galaxy S 4 Android Development] Nottach:
Just posted an updated deodexed system installer that doesn't require entering ADB commands.

You must be updated to the new OTA, AMDL, and rooted to use the installer.
[AT&T Samsung Galaxy S 4 Android Development] Scott:
Nottach, how did you de-odex SecEmail_j.apk?
[AT&T Samsung Galaxy S 4 Android Development] Nottach:
It took a few tries. That one gave me a lil trouble. I used dsikitchen and universal deodexer.
[AT&T Samsung Galaxy S 4 Android Development] romracer:
See my reply in the other thread. API level 16.
[AT&T Samsung Galaxy S 4 Android Development] howtomen:
never really messed with multiwindow since ive never used it in my roms but i think u might need to create... idk about fix.. ive never really looked at it
[AT&T Samsung Galaxy S 4 Android Development] Nottach:
After reading some of the Note2 threads I think that's what they had to put up with also. Seems the best solution so far is to apply the MOD, then clear the data for FlashBarService so all apps are put into the multi-widow bar, then remove the apps not wanted in the bar. Seems kinda hacky so I'm not going to worry about it for now, I don't feel like trying to inject an adapter in smali. Maybe I'll come back to it later.
[AT&T Samsung Galaxy S 4 Android Development] Nottach:
Satisfactory linkages? :confused:
[AT&T Samsung Galaxy S 4 Android Development] jcase:
Satisfaction wasn't required by me, was just a question. I actually use Jeb (http://www.android-decompiler.com/) and hopper (http://hopperapp.com/) for my needs, unless i need to reassemble then I use smali
[AT&T Samsung Galaxy S 4 Android Development] Nottach:
You bought Jeb? I read about it a while ago and thought it couldn't do anything that the free tools can't do with a little extra work. $1000 seems steep unless you're re-releasing those reversed-compiled apps with your own admob/IAP implementation.

NTM: It's almost cheating when the tool does that much of the work.
[AT&T Samsung Galaxy S 4 Android Development] Scott:
No kidding? Ok thanks man. I will give it another go.
[AT&T Samsung Galaxy S 4 Android Development] Scott:
Its Jcase man... He prolly wrote it :good:

Guy knows everything there is to know about security.
[AT&T Samsung Galaxy S 4 Android Development] Scott:
If you update your mod pack you can include my init.d port from smokin1337 here: [MOD][5/10/13] Add init.d support to your ROOTED S4
[AT&T Samsung Galaxy S 4 Android Development] eyi:
Thanks for the Pseudo-ROM and the debloater!
[AT&T Samsung Galaxy S 4 Android Development] Thermalwolf:
Works amazing! Keep it up!
[AT&T Samsung Galaxy S 4 Android Development] jcase:
Actually I'm auditing software for security vulnerabilities and malware analysis on a professional level. I depend on a reliable output to put food on my table. So the price was acceptable after demoing the product (first few beta demos were quite rough and put me off of it, but it greatly improved after a couple weeks and is now a stellar product).

Jeb provides no means of reassembly, and would not really be that helpful to those injecting their own code for admob/IAP to apps. Admob is a one line change to hijack anyhow. These people use smali.

Jeb's decompilation is much more accurate that dex2jar/jd-gui. JD-gui and JAD just fail far to often, or put out undogly (new word?!) incorrect output. The interactivity is pretty nice, but as you said doable for free (Androguard/sublime combo). It's assembly output is on par with smali, but I do prefer Jeb's layout. Going to have to say best feature is Nico (the author), guy is a beast at fixing bugs (and I produce quite a few edge case bugs, many who prevent Jeb/Jad/Dex2jar/smali/jd-gui/apktool from working).

Not quite sure what is cheating about it, it doesn't automatically reverse apps for you or anything, it is just a different decompiler/disassembler. Still takes skill and time. Thats kinda like saying it is cheating to use decent shoes in a race.
[AT&T Samsung Galaxy S 4 Android Development] jcase:
Lol no https://twitter.com/NicolasFalliere wrote it
[AT&T Samsung Galaxy S 4 Android Development] latinohot:
HI, I've successfully flashed the rom, but now I'd like to know how to run the debloater,

can anyone please help me, thank-you

Update, stupid me had not realized i had the android sdk moved from C to D

All is well now
[AT&T Samsung Galaxy S 4 Android Development] Dean1650:
Nothing like going into a "black hole" and hoping you come out the other side intact. I can't say thanks enough for this. Already modding thanks to your good work. Awsome, awsome. Send me a donate link.

sent from my SGH-i317
[AT&T Samsung Galaxy S 4 Android Development] Scott:
Power menu is up for this mod pack if you like...

[MOD][5/11/13] - Extended Reboot Menu - De-Odex - MDL

I'm going to work on MultiWindow Mod tonight if no one gets to it before then. I successfully ported on about 10 different Note II bases but those were all 4.1.1 and 4.1.2 never a 4.2.2... Cross your fingers!
[AT&T Samsung Galaxy S 4 Android Development] Scott:
Oh and I also did a launcher if you want to include that as an optional install... I love touchwiz but hate the stock grids. So wasteful on a 1080P screen!

MOD][5/10/13] Touch Wiz Launcher 5x5 Home and 5x6 App
[AT&T Samsung Galaxy S 4 Android Development] sulpher:
Love this package, thx for all the work guys!

Have one request if anyone is willing/able to do it... Is it easy to remove the texts from the call log? Last thing thats really annoying me...
[AT&T Samsung Galaxy S 4 Android Development] jeboo:
I took a quick look, it looks like my approach from the S2 will still work:

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

There are 4 sql inserts now. I just tested and it's working.
[AT&T Samsung Galaxy S 4 Android Development] sulpher:
Well, i decompiled and made the edits... but then ran into the problem i always do, it wont recompile for me. Just end up with a bunch of exceptions. I'm too clueless on how to fix to get any further...

edit- heres the whole thing if anyone wants to recompile :p

https://www.dropbox.com/s/qkl412t8qyl5id7/SecMms.rar
[AT&T Samsung Galaxy S 4 Android Development] Nottach:
There is a 'View by' option in the call log that will filter out messages, select 'All calls' instead of 'All logs'.
[AT&T Samsung Galaxy S 4 Android Development] jthrasher47:
Won't work for me says "failed because it's a read only file system" yes I'm rooted I just don't get it. I had it working yesterday then had to Odin back then take the ota again now it won't work. .
[AT&T Samsung Galaxy S 4 Android Development] Nottach:
Did you allow ADB connection from your computer?
[AT&T Samsung Galaxy S 4 Android Development] jthrasher47:
Thanks for quick reply and yes sir
[AT&T Samsung Galaxy S 4 Android Development] jeboo:
You prob need the updated appt and apktool.jar. If you find the MultiAPK tool here on XDA, I believe they have them.

---------- Post added at 02:50 PM ---------- Previous post was at 02:49 PM ----------

You may need to do:

mount -o remount,rw /system

chmod 777 /system/app

Adjust the path if you're messing with framework.
[AT&T Samsung Galaxy S 4 Android Development] jthrasher47:
i will try and get back with you guys here in a few

edit- still nothing so im going to try to odin back again take the update then try again...
[AT&T Samsung Galaxy S 4 Android Development] jthrasher47:
finally got it idk what the problem was but i odined to stock, factory reset, updated then it worked
[AT&T Samsung Galaxy S 4 Android Development] sulpher:
Ya but unfortunately you have to do it every time you come back to logs. :(
[AT&T Samsung Galaxy S 4 Android Development] Nottach:
Mine defaults to 'All calls', no text messages shown. Your's defaults to 'All logs'?
[AT&T Samsung Galaxy S 4 Android Development] sulpher:
Yup. Just closing it and opening again and its back to all logs each time.

Edit: okay played with it some more, if you use the back key to get out of logs it reverts to all logs, but if you use the home button it remains where you set it... Thx samsung...
[AT&T Samsung Galaxy S 4 Android Development] Dean1650:
After I installed everthing to my S4, I pulled the frameworks and sysui. I use VTS and made a lot of mods to sysui. I got it to compile error free, but the only way it would run without fc is to keep existing signature. Ive used the test keys from VTS on 4.1.2 with no problem. Havent spent a lot of time fully understanding signatures. I didnt try not signing (system apk), probably should have. Can I use the signature in the apk (permission). I dont distribute my work.

sent from my SGH-i317
[AT&T Samsung Galaxy S 4 Android Development] Scott:
Simplified:

If its a system level APK and you are NOT editing the permissions / manifest then you would reuse the permissions and meta-inf from original APK.

If its a system APK and you need to edit manifest then you have two options...

1. Resign the entire ROM with the same test keys(wasteful)

2. Make Jcases angry with you by disable signature check in services.jar.

Neither are secure but they are the only methods if you ARE changing anything in manifest. AFAIK anyways.

If your not changing permissions / manifest then reuse original manifest and meta-inf.
[AT&T Samsung Galaxy S 4 Android Development] Dean1650:
Simplified is good. Answers all but one question. Is it important to ask the original signer to use their work. I may someday post a mod or 2.

sent from my SGH-i317