[MOD][ATT][4.4] Remove unsafe volume warning - Moto X Themes and Apps

I did this for myself, and thought I would share. I got tired of the "Raise volume above safe level?" warning, and I removed it. I like to learn, so rather than use the existing xposed framework mod, I built a flashable zip to make the change via framework-res.apk.
WARNING: I AM NOT RESPONSIBLE IF YOU MESS UP YOUR PHONE
Prerequisite:
ATT Moto X running stock official 4.4 kitkat (140.44.5)
TWRP or CWM (safestrap for those who don't have an unlocked bootloader, thanks Hashcode)
backup all of your data in case something goes horribly wrong
Instructions:
using your choice of file manager, backup /system/framework/framework-res.apk
Download or copy flashable zip (below) to sdcard
Reboot to [safestrap] TWRP recovery
flash zip file
Below are the 'broad strokes' of how I did this in linux: (Each of these steps below require various skills, and my intent is not to do too much 'hand holding.')
DUMP AND DECOMPILE framework-res.apk
make sure java 7 is installed
download/extract apktool_2.0.0b7.jar (thanks brut.all)
move /system/framework/framework-res.apk to apktool directory
install framework: java -jar apktool_2.0.0b7.jar if framework-res.apk
dump framework-res.apk: java -jar apktool_2.0.0b7.jar d framework-res.apk
--
CHANGE SETTING IN TWO FILES:
edit this file: framework-res/res/values/bools.xml
search for the line with this info: config_safe_media_volume_enabled
change the value to: false
repeat with framework-res/res/values-mcc310/bools.xml
--
DELETE DIRECTORY STRUCTURE (not sure why framework wouldn't compile with this, but it is unused on AT&T phones)
delete this directory: framework-res/values-mcc310-1
--
RECOMPILE AND COPY EXISTING SIGNATURE:
recompile: java -jar apktool_2.0.0b7.jar b framework-res -o framework-res-new.apk
move META-INF structure from inside the original framework-res.apk to the new framework-res-new.apk (I used 7z)
--
ZIPALIGN NEW FILE:
zipalign -f -v 4 framework-res-new.apk framework-res.apk
--
CREATE FLASHABLE ZIP WITH NEW framework-res.apk
you can use mine as a template and just replace my framework-res.apk under /system/framework
TWRP/CWM flashable zip: http://www.androidfilehost.com/?fid=23252070760973197
(Replaces /system/framework/framework-res.apk with my modified version.)

Trying this now on my Rogers ATT KK based Moto X. Ill update soon.

Updated script brakes at device check.
Sent from my XT1058 using XDA Premium 4 mobile app

slimdizzy said:
Updated script brakes at device check.
Sent from my XT1058 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Do you mean the updater-script in the flashable zip? If so, you can modify those checks for your phone if you can see the error. I used twrp->advanced->copy logs to /sdcard to see the error messages.

Ctrl-Freak said:
Do you mean the updater-script in the flashable zip? If so, you can modify those checks for your phone if you can see the error. I used twrp->advanced->copy logs to /sdcard to see the error messages.
Click to expand...
Click to collapse
Will do. Ill post shortly.
Update:
Installing '/sdcard/motox-att-140.44.5-framework-res-1.zip'...
Checking for MD5 file...
I:Cannot find file /sdcard/motox-att-140.44.5-framework-res-1.zip.md5
Skipping MD5 check: no MD5 file found.
I:Zip does not contain SELinux file_contexts file in its root.
script aborted: This package is for "ghost" devices; this is a "xt1060".
This package is for "ghost" devices; this is a "xt1060".
E:Error executing updater binary in zip '/sdcard/motox-att-140.44.5-framework-res-1.zip'
My build.prop shows 1058 for the record.

slimdizzy said:
Will do. Ill post shortly.
Update:
Installing '/sdcard/motox-att-140.44.5-framework-res-1.zip'...
Checking for MD5 file...
I:Cannot find file /sdcard/motox-att-140.44.5-framework-res-1.zip.md5
Skipping MD5 check: no MD5 file found.
I:Zip does not contain SELinux file_contexts file in its root.
script aborted: This package is for "ghost" devices; this is a "xt1060".
This package is for "ghost" devices; this is a "xt1060".
E:Error executing updater binary in zip '/sdcard/motox-att-140.44.5-framework-res-1.zip'
My build.prop shows 1058 for the record.
Click to expand...
Click to collapse
Did you build this from your Rogers framework? (If not, keep in mind my framework-res if from an AT&T phone. I have no idea if there are any differences.)
To continue, you can edit the updater-script and make the change from "ghost to "xt1060".

I have a rogers phone but ATT firmware. This is just what happens when I flash your zip. Your updated script asks for a 1058, which is my model but breaks and says my device is a 1060. That is nowhere in my prop. This should flash no problem and it doesn't. I even tried to manually overwrite using root explorer and my phone wouldn't boot after. I replaced original file and all is well.
Sent from my XT1058 using XDA Premium 4 mobile app

Thanks, this worked like a charm for my Moto G.
I used Advanced ApkTool v2.0.0 to decompile 'framework-res.apk',
I used Notepad++ to set all 'config_safe_media_volume_enabled' entries to false,
After the recompilation, I extracted the content of the original 'framework-res.apk' with 7-zip, and just replaced 'resources.arsc' with the modified one. (can be found in the '\build\apk' directory)
Recompressed again with 7-zip (compression level: store) and used adb to replace the file:
adb push framework-res.apk /sdcard/Download/framework-res.apk
adb shell
Code:
su
mount -o remount,rw -t ext4 /dev/block/platform/msm_sdcc.1/by-name/system /system
mv /system/framework/framework-res.apk /system/framework/framework-res.apk.bak
cat /sdcard/Download/framework-res.apk > /system/framework/framework-res.apk
chmod 644 /system/framework/framework-res.apk
sync
reboot

Related

How do I make my own update.zip from my Nexus S ROM?

How do I make a update.zip on my phone from my whole system folder?
I want to start making cyanogenmod ROMs
Can I edit their update.zip's ? Or do I have to resign them? I used to make odin roms...
1) Create an empty folder (eg. C:\workdir)
2) Create C:\workdir\system\app folder
-- load all your apks in here
3) Create C:\workdir\system\lib folder
-- if the apk needs libraries referenced
4) Create C:\workdir\META-INF\com\google\android folder
5) Create the update-script script and put that in the \com\google\android folder ^
Code:
show_progress 0.1 0
copy_dir PACKAGE:system SYSTEM:
show_progress 0.1 10
oneblanklinethatdoesn'tparseinthiscodeblock...
Put the extra white line at the bottom of the update-script.
6) Compress the contents of C:\workdir folder to a zip
7) Sign the workdir.zip file
Code:
java -jar signapk.jar certificate.pem key.pk8 myupdate.zip update.zip
If you don't know howto sign your zip file: http://www.londatiga.net/it/how-to-sign-apk-zip-files/
Now you have a workdir.zip file (rename it to update.zip if you want). You can flash this through CWM, it will replace the contents of your workdir/system/app with the files in /system/app.
Greetz
Dude i get update failed to flashh....i think its becuz of the script and put the white line staff...........im trying to install more than one app ...any help on the script for more than one app

[GUIDE] Deodexing APKs Manually and with xUltimate

Manually Deodexing (Windows/Linux/OSX)
Let's start first with deodexing manually in order to learn about how the whole process works. Deodexing manually can be very useful if you only want to deodex a couple apks, or if some apks are giving tools such as xUltimate trouble. So here's what you'll need:
Basic knowledge of odex vs. deodex... READ THIS
Smali/baksmali installed correctly (if you are on Linux/OSX you can get the wrapper script as well, otherwise just use the .jars)
Java JRE installed correctly
The apks you want to deodex
ALL of the files in /system/framework from your ROM
This is also an excellent read for understanding the process of deodexing an apk
The first thing we want to do is find the bootclasspath for the ROM you are using. You will have to get the file /init.rc from your phone in some way; if you prefer using root explorer then use root explorer to copy it to your sd card, I prefer using adb. Once you have init.rc on your computer, open it up in a text editor. Search for the line that begins with "export BOOTCLASSPATH" and copy the rest of the line. It should look like this:
Code:
/system/framework/core.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/framework-ext.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar:/system/framework/filterfw.jar:/system/framework/com.motorola.android.frameworks.jar:/system/framework/com.motorola.android.widget.jar:/system/framework/com.motorola.frameworks.core.addon.jar:/system/framework/kafdex.jar:/system/framework/com.motorola.orange.simauth.jar
The bootclasspath is simply a list of dependencies that the system apps need to run - i.e. jars/apks that contain code that the system apps use. It is necessary to have the correct bootclasspath when deodexing.
Now that we have the bootclasspath we can start to set up for the actual deodexing. All the files listed in the bootclasspath are found in /system/framework, so grab all the jars/apks in /system/framework from your ROM (adb pull them or take them from the flashable zip if available) and put them in a folder named "framework" somewhere that you can remember, such as your desktop or at the root of your hard drive (i.e. C:\framework). We will use the bootclasspath to find all the files in this folder that are needed to deodex the apps properly.
Now we have to modify the bootclasspath in order to get the baksmali command to work correctly. The current bootclasspath that we have is saying that all the frameworks are in the /system/framework folder of your computer, but most of you have the frameworks somewhere like C:\framework or /home/me/framework. So open your text editor again and paste the current bootclasspath. Hopefully your editor will have a find/replace function; if so, just keep replacing all instances of "/system/framework" with the path to your frameworks. For example, this is what it would look like if your frameworks are in C:\framework:
Code:
C:\framework\core.jar:C:\framework\core-junit.jar:C:\framework\bouncycastle.jar:C:\framework\ext.jar:C:\framework\framework.jar:C:\framework\framework-ext.jar:C:\framework\android.policy.jar:C:\framework\services.jar:C:\framework\apache-xml.jar:C:\framework\filterfw.jar:C:\framework\com.motorola.android.frameworks.jar:C:\framework\com.motorola.android.widget.jar:C:\framework\com.motorola.frameworks.core.addon.jar:C:\framework\kafdex.jar:C:\framework\com.motorola.orange.simauth.jar
Finally we are ready to actually deodex the apks. Place the apks and odex's (odexes?) you want to deodex anywhere... your desktop, a folder somewhere, the root of your hard drive... it does not matter. Place the smali/baksmali .jar's in the same directory as the apps you wish to deodex. Open up a command prompt/terminal/etc and "cd" to the directory that the .apk's are in. For example if they are in C:\apps_to_deodex then I would type
Code:
cd C:\apps_to_deodex
The process for deodexing is a little dance like this:
Use baksmali to decompile the .odex file to smali
Use smali to compile the .smali files to a .dex
Use an archive manager (ex. 7zip) to put the newly created .dex file into the original .apk
Delete the old .odex file and all the decompiled smali.
So, let's begin.
BAKSMALI
Since baksmali/smali are .jar's, we will be using java to execute them. The syntax for the baksmali command is something like this:
Code:
java -jar baksmali.jar -a [COLOR="Red"]api_level[/COLOR] -c [COLOR="red"]bootclasspath[/COLOR] -x [COLOR="red"]file.odex[/COLOR]
The -a argument is not necessary with ICS. If you are on GB then you must use "-a 10" in order for it to deodex properly.
The bootclasspath is the bootclasspath that we determined earlier
The file.odex is, of course, the name of the odex file you want to decompile.
So let's say I want to decompile abc.odex, which was built for ICS. The command would be:
Code:
java -jar baksmali.jar -c C:\framework\core.jar:C:\framework\core-junit.jar:C:\framework\bouncycastle.jar:C:\framework\ext.jar:C:\framework\framework.jar:C:\framework\framework-ext.jar:C:\framework\android.policy.jar:C:\framework\services.jar:C:\framework\apache-xml.jar:C:\framework\filterfw.jar:C:\framework\com.motorola.android.frameworks.jar:C:\framework\com.motorola.android.widget.jar:C:\framework\com.motorola.frameworks.core.addon.jar:C:\framework\kafdex.jar:C:\framework\com.motorola.orange.simauth.jar -x abc.odex
This command creates a directory called "out" containing the decompiled odex file.
SMALI
Now that we have "baksmalid" the odex file, we now need to "smali" it to turn the .smali code into the .dex format. The syntax for this command is something like this:
Code:
java -jar smali.jar out -o classes.dex
We are calling the newly generated file "classes.dex" because that is the file that Android looks for in deodexed apks.
When the command completes you will have a file called "classes.dex" sitting in the directory holding all the deodexed apps.
ARCHIVE MANAGER
Hopefully by now you understand the difference between an odexed app and a deodexed app...
Odexed -> abc.apk AND abc.odex
Deodexed -> abc.apk ONLY which contains classes.dex
So, since we have the classes.dex, all we have to do is drag-n-drop it into the respective.apk using an archive manager such as 7zip (Windows). The result is an .apk which contains all the files necessary for it to install and run... it is deodexed.
CLEANUP
If you are going to repeat the process multiple times you will begin to get confused with filenames and everything. Since you now have a fully funtional abc.apk, you can delete:
-The abc.odex file as it is no longe necessary
-The "out" folder created in step 1
-The classes.dex because it is already copied into abc.apk
TROUBLESHOOTING
Sometimes, no matter what you try, you just can not get an app to deodex because it just isn't finding the right dependencies to load. If you come across some troublesome apps, you can use the "-I" argument when baksmaling to force it to decompile:
Code:
java -jar baksmali.jar -a [COLOR="Red"]api_level[/COLOR] -c [COLOR="red"]bootclasspath[/COLOR] -x -I [COLOR="red"]file.odex[/COLOR]
A warning... if you use the -I option on an app that is normally able to deodex fine, you will most likely get force closes and other random errors. Only use -I as a last resort.
For some reason our BOOTCLASSPATH on the ICS leak seems to list some files that don't exist in /system/framework. This means that when you try to baksmali you will get an error about not being able to load class files. If you get this error, look for the .jar that it references, and delete it from the BOOTCLASSPATH and try again. In the end it should look something like this in Windows:
Code:
C:\path_to_frameworks\core.jar:C:\path_to_frameworks\core-junit.jar:C:\path_to_frameworks\bouncycastle.jar:C:\path_to_frameworks\ext.jar:C:\path_to_frameworks\framework.jar:C:\path_to_frameworks\framework-ext.jar:C:\path_to_frameworks\android.policy.jar:C:\path_to_frameworks\services.jar:C:\path_to_frameworks\apache-xml.jar:C:\path_to_frameworks\filterfw.jar:C:\path_to_frameworks\com.motorola.android.frameworks.jar:C:\path_to_frameworks\com.motorola.android.widget.jar:C:\path_to_frameworks\com.motorola.frameworks.core.addon.jar
Thanks alteredlikeness for the tip!
Deodexing Automatically with xUltimate (Windows)
Coming soon...
Hope this helps clear up some questions that you've had... enjoy!
Nice work!
Mods, stickify please?
Sent from my SAMSUNG-SGH-I747 using xda premium
Grrreat! Thank you for putting this together! I swear I dreamed about this last nite...
But, a note on bootclasspath: For ICS, I have run into problems using it directly from the init.rc - we don't physically have all of those jar files in our framework. So, I removed a couple and have not ran into problems since. Here's what I got:
Code:
/system/framework/core.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/framework-ext.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar:/system/framework/filterfw.jar:/system/framework/com.motorola.android.frameworks.jar:/system/framework/com.motorola.android.widget.jar:/system/framework/com.motorola.frameworks.core.addon.jar
Edit: edited.
alteredlikeness said:
Grrreat! Thank you for putting this together! I swear I dreamed about this last nite...
But, a note on bootclasspath: For ICS, I have run into problems using it directly from the init.rc - we don't physically have all of those jar files in our framework. So, I removed a couple and have not ran into problems since. Here's what I got:
Code:
/system/framework/core.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/framework-ext.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar:/system/framework/filterfw.jar:/system/framework/com.motorola.android.frameworks.jar:/system/framework/com.motorola.android.widget.jar:/system/framework/com.motorola.frameworks.core.addon.jar
Click to expand...
Click to collapse
Thanks! I haven't manually done anything in ICS so I forgot about that... modified OP
hello i got classes.dex and put it in Bluetooth.apk , i put it on system/app and removed old apk, .odex files but after reboot i can't find bluetooth.odex in system/app , and not working what i changed in apk...
Error when attempting first deodex
I get this error not matter how I do the command in CMD.
Error occured while loading boot class path files. Aborting.
org.jf.dexlib.Util.ExceptionWithContext: Cannot locate boot class path file C
at org.jf.dexlib.Code.Analysis.ClassPath.loadBootClassPath(ClassPath.java:218)
at org.jf.dexlib.Code.Analysis.ClassPath.initClassPath(ClassPath.java:146)
at org.jf.dexlib.Code.Analysis.ClassPath.InitializeClassPath(ClassPath.java:131)
at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:101)
at org.jf.baksmali.main.main(main.java:308)
I am a noob when it comes to this stuff...do you have any insight on this? Thanks.
jcvermillion
HTC Droid Incredible 4G LTE
Rooted
Unlocked Bootloader
Ready to Deodex the old fashion way.
First: I got this error:
Error occured while loading boot class path files. Aborting.
org.jf.dexlib.Util.ExceptionWithContext: Cannot locate boot class path file C
at org.jf.dexlib.Code.Analysis.ClassPath.loadBootClassPath(ClassPath.java:218)
at org.jf.dexlib.Code.Analysis.ClassPath.initClassPath(ClassPath.java:146)
at org.jf.dexlib.Code.Analysis.ClassPath.InitializeClassPath(ClassPath.java:131)
at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:101)
at org.jf.baksmali.main.main(main.java:308)
Click to expand...
Click to collapse
after writing this
Code:
java -jar baksmali-1.4.2.jar -a 10 -c \framework\core.jar:\framework\bouncycastle.jar:\framework\ext.jar:\framework\framework.jar:\framework\android.policy.jar:\framework\services.jar:\framework\core-junit.jar -x framework.odex
(I am using mac os x)
Second: what should I use to put classes.dex files inside .jar files??
I have the same error and where i must put your solution
"java -jar baksmali-1.4.2.jar -a 10 -c \framework\core.jar:\framework\bouncycastle.jar:\framework\ext.jar:\framework\framework.jar:\framework\android.policy.jar:\framework\services.jar:\framework\core-junit.jar -x framework.odex"
Where i must put this?
Thanks.
Edit: i used this topic to deodex my pre-rooted ROM: http://forum.xda-developers.com/showthread.php?t=2374008
Help-Me Memo.odex Samsung GT-S5360B
Help-me
C:\framework>java -jar baksmali.jar -a 10 -c c:\framework\core.jar:c:\framework\
bouncycastle.jar:c:\framework\ext.jar:c:\framework\framework.jar:c:\framework\an
droid.policy.jar:c:\framework\services.jar:c:\framework\core-junit.jar -x Memo.o
dex
Error occured while loading boot class path files. Aborting.
org.jf.dexlib.Util.ExceptionWithContext: Cannot locate boot class path file c
at org.jf.dexlib.Code.Analysis.ClassPath.loadBootClassPath(ClassPath.jav
a:237)
at org.jf.dexlib.Code.Analysis.ClassPath.initClassPath(ClassPath.java:14
5)
at org.jf.dexlib.Code.Analysis.ClassPath.InitializeClassPath(ClassPath.j
ava:131)
at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:111)
at org.jf.baksmali.main.main(main.java:293)
anexo: Memo.apk, Memo.odex, init.rc, BOOTCLASSPATH.txt
Anyone got solution for these 'cannot find boot class path in C' error ?
EDIT:FOUND IT!!!
Just copy all framework files in C:/framework and instead of -c use -d
and command should look like
Code:
java -jar baksmali.jar -a [COLOR="Red"]##(api lvl)[/COLOR] -d C:/framework/ -x [COLOR="red"][.odex file][/COLOR]
No need to type the whole bootclasspath he just needs the path to framework folder
Hope it helps
I am trying to deodex telephony-common.jar and telephony-common.odex
I tried first
Code:
java -jar baksmali.jar -x telephony-common.odex
and got
Code:
Error occured while loading boot class path files. Aborting.
org.jf.dexlib.Code.Analysis.ClassPath$ClassNotFoundException: Could not find superclass Landroid/app/Service;
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.loadSuperclass(ClassPath.java:784)
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.<init>(ClassPath.java:668)
at org.jf.dexlib.Code.Analysis.ClassPath.loadClassDef(ClassPath.java:280)
at org.jf.dexlib.Code.Analysis.ClassPath.initClassPath(ClassPath.java:163)
at org.jf.dexlib.Code.Analysis.ClassPath.InitializeClassPathFromOdex(ClassPath.java:110)
at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:98)
at org.jf.baksmali.main.main(main.java:278)
Error while loading class Landroid/accessibilityservice/AccessibilityService; from file ./framework.zip
Error while loading ClassPath class Landroid/accessibilityservice/AccessibilityService;
then
Code:
java -jar baksmali.jar -c "/home/matthew/temp/X9006&X9076ColorOS_V1.2.7i_full/system/framework"/core.jar:"/home/matthew/temp/X9006&X9076ColorOS_V1.2.7i_full/system/framework"/core-junit.jar:"/home/matthew/temp/X9006&X9076ColorOS_V1.2.7i_full/system/framework"/bouncycastle.jar:"/home/matthew/temp/X9006&X9076ColorOS_V1.2.7i_full/system/framework"/ext.jar:"/home/matthew/temp/X9006&X9076ColorOS_V1.2.7i_full/system/framework"/framework.jar:"/home/matthew/temp/X9006&X9076ColorOS_V1.2.7i_full/system/framework"/framework-ext.jar:"/home/matthew/temp/X9006&X9076ColorOS_V1.2.7i_full/system/framework"/android.policy.jar:"/home/matthew/temp/X9006&X9076ColorOS_V1.2.7i_full/system/framework"/services.jar:"/home/matthew/temp/X9006&X9076ColorOS_V1.2.7i_full/system/framework"/apache-xml.jar:"/home/matthew/temp/X9006&X9076ColorOS_V1.2.7i_full/system/framework"/filterfw.jar:"/home/matthew/temp/X9006&X9076ColorOS_V1.2.7i_full/system/framework"/com.motorola.android.frameworks.jar:"/home/matthew/temp/X9006&X9076ColorOS_V1.2.7i_full/system/framework"/com.motorola.android.widget.jar:"/home/matthew/temp/X9006&X9076ColorOS_V1.2.7i_full/system/framework"/com.motorola.frameworks.core.addon.jar:"/home/matthew/temp/X9006&X9076ColorOS_V1.2.7i_full/system/framework"/kafdex.jar:"/home/matthew/temp/X9006&X9076ColorOS_V1.2.7i_full/system/framework"/com.motorola.orange.simauth.jar -x telephony-common.odex
and got
Code:
Error occured while loading boot class path files. Aborting.
org.jf.dexlib.Util.ExceptionWithContext: Cannot locate boot class path file /home/matthew/temp/X9006&X9076ColorOS_V1.2.7i_full/system/framework/core.jar
at org.jf.dexlib.Code.Analysis.ClassPath.loadBootClassPath(ClassPath.java:237)
at org.jf.dexlib.Code.Analysis.ClassPath.initClassPath(ClassPath.java:145)
at org.jf.dexlib.Code.Analysis.ClassPath.InitializeClassPath(ClassPath.java:131)
at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:105)
at org.jf.baksmali.main.main(main.java:278)

[TOOL/GUIDE]1by1_ReOdexer - Make a new ODEX file

WHAT IS THIS, AND WHAT IS IT FOR?
This is a guide for creating a new odex file from a deodexed file, one at a time – manually, or with the tool provided. There are tools/methods for doing the entire system at once, but I have not had any luck with those. Plus, typically, one does not need the entire system re-odexed. This is more for those who want to personally mod their stock odexed systems, or create an odexed ROM maybe.
For starters, you can get away with modding a lot on an odexed system, without needing to deodex. You really only need to deodex in order to edit the smali files within the classes.dex (which is required to achieve the cooler mods). See cogeary’s great guide for deodexing tips.
-------------------------
SCRIPT METHOD (using the 1by1_ReOdexer):
I made this script to speed up the process a little bit (thanks! to jimbridgman and cogeary for their input).
NOTE: This could hurt your phone if you don't place your original files (the ones that are currently running on your odexed system) in the 'orig-odexed' folder…
Requirements:
Windows OS (for now – Linux coming soon)
odexed system
root
busybox installed
DOWNLOAD the 1by1_ReOdexer_v2.0.zip for Windows
Unzip it on your desktop or other convenient place (with no spaces in the file path), and read the README.txt.
NOTES
-It will show a few failed processes right when the script starts - it's just trying to clean stuff that isn't there..
-This will not push the new modded files to your phone - but, the re-odex process needs to take place in the /system, so this script does a quick switcheroo by pushing the deodexed file to your running odexed system, then replaces the originals (that's why you must place copies of the odexed ones from your system to the 'orig-odexed' folder - I plan on automating that too eventually) - that's also why you may need to reboot afterwards to straighten things out
-It still needs A LOT of work... but it does the job
MAJOR NOTE: The script is currently set up based on Motorola’s ICS bootclasspath.
To change the file name/path and/or the bootclasspath, right-click on the .bat file and open with a text editor (preferably something like Notepad++) and edit accordingly. The bootclasspath was taken from /init.rc.
-------------
MANUAL METHOD:
I will use the services.jar in this example. Just change the file name and path to existing .odex accordingly for other files. (thanks! to jhotmann for helping me to nail down this method)
Requirements:
odexed system
root
adb
busybox installed
dexopt-wrapper
Put this dexopt-wrapper file in /system/bin with 775 permissions:
X X X
X....X
X....X
Put the deodexed services.jar (or other jar/apk file you want to make a new odex of) on the root your /sdcard (on some phones that means internal storage).
Make sure USB Debugging is enabled.
Put your USB connection to MTP or PTP mode.
The bootclasspath is located in the /init.rc file at the root of your phone. Just make sure that all jars listed in init.rc are actually in your /system/framework folder and only include those in your bootclasspath in the command below. The one from Moto A2/Razr/other ICS is used below (minus the extra jar paths). To replace it with that of a different device, change the word bootclasspath with yours, using the path style as shown in the example below: dexopt-wrapper services.jar new.odex bootclasspath...
Connect with adb (do a adb devices check to make sure you're all good).
To create the new odex, enter the following one line at a time:
Code:
adb shell
su
cd /sdcard/
dexopt-wrapper services.jar new.odex /system/framework/core.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/framework-ext.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar:/system/framework/filterfw.jar:/system/framework/com.motorola.android.frameworks.jar:/system/framework/com.motorola.android.widget.jar:/system/framework/com.motorola.frameworks.core.addon.jar
To copy the signature from the existing odex (change path to /system/app/.. if necessary):
Code:
busybox dd if=/system/framework/services.odex of=new.odex bs=1 count=20 skip=52 seek=52 conv=notrunc
Done! Rename new.odex (created on your /sdcard) to services.odex since that is your new signed odex file... and move to your phone using the method of your choice.
---------------------
CHANGE LOG:
Code:
11/7/12 (v2.0)
-more automated
-changed the location where the new odex is made
-thanks to [URL="http://forums.acsyndicate.net/showthread.php?113-Re-Odexing-script&p=1369&viewfull=1#post1369"]tanimn[/URL] for the hint
-thanks to [URL="http://forum.xda-developers.com/showthread.php?t=1879128"]alkhafaf[/URL] for his bat files that I got ideas from (his script didn't work for me)
8/25/12 (v1.0)
-initial release
Thanks to the following for testing!:
-A2Trip (formerly DX2Trip) on the A2 ICS
-RETIEF on the RAZR Maxx ICS
-iwabashu on the RAZR ICS
(I tested it on GB - but I am not high-fiving myself :D)
-----------------
Some vague notes on what to do next:
Depending on what you are after by re-odexing, there are different routes. For example, if you only edited or copied smali files, then you only need the new.odex file. Meaning that all of the smali code was inside of that classes.dex of the deodexed file on your sdcard, and you just made that into a new odex file (and copied the signatures from the existing .odex in /system).
If you have a deodexed apk with more edits than just smali (you could really just copy those edits over to your existing odexed apk with 7-zip or similar), but – if you want to, you will need to remove the classes.dex from the deodexed apk, and make sure that the signatures (/META-INF folder) and AndroidManifest.xml are the same as your existing apk (check, and or copy with 7-zip or similar).
.
.
.
Good job on this!
Mods, am I crazy or are we in need of a separate "stickied" section here"?
Please stickify...
An Edit: I'm glad were seeing so many great guides here in this forum, before long, we'll have a directory that other forums will envy -if not already.
Sent from my SAMSUNG-SGH-I747 using xda premium
Updated the tool (not the guide).. eh, it's still a work-in-progress but gets the job done

[Q] Volume Rocker Wake: Bootlooping after editing android.policy.odex

Hello All,
I was trying to get the option of waking the phone using volume keys. I am on ICS (Asia Retail) on my MB865. Editing the Keylayout files did not work. It had worked for me before, but now they did not probably since my phone is locked by a password lock screen due to corporate policies. I tried to decompile android.policy.odex and change isWakeKeyWhenKeyguardShowing. But after I compiled it back and put the changed odex back to system/framwork. But strangely I got a boot loop. I tried a battery pull and also cleared cache and Dalvik cache. But could not get it to boot. Finally I had to restore /system from a backup.
I have detailed my steps below. Can anyone please point out what I am doing wrong here.
1. Get /system/framwork out and put it in a folder
2. Download smali-1.4.2 and baksmali-1.4.2 utilities.
3. I extracted android.policy.odex by java -jar baksmali.jar -d framework -x android.policy.odex
4. I changed the file KeyguardViewMediator.smali (removed lines for 0x18 and 0x19 under the switch case of the method isWakeKeyWhenKeyguardShowing(IZ)Z
5. Packed the odex file back by java -jar smali.jar -o android.policy.odex out
where "out" is the previously extracted folder
Then I replaced the android.policy.odex back to /system/framework
Please help! My power key is already showing some signs that it does not want to stay with me any more.
Thanks,
Sayantan
Re: Solved - Volume Rocker wake via android.policy.jar
Okay! I have been a total noob. I did not read enough about odexing and deodexing.. should have read more before I posted. Here's what I did (in short), thanks to Jordan Hotmann from http://www.jordanhotmann.com/2011/08/how-to-change-default-orientation-of.html
For detailed explanations, please visit the above website.
1. Downloaded smali and baksmali tools
2. Downloaded and installed dexopt-wrapper (just Google)
3. Extracted /system/framwork
4. Extracted android.policy.odex (used api level 15)
5. Modified the required files - KeyguardViewMediator.smali (removed lines for 0x18 and 0x19 under the switch case of the method isWakeKeyWhenKeyguardShowing(IZ)Z
6. Repacked the folder to classes.dex
7. Integrated classes.dex into android.policy and pushed the latter to /sdcard/
8. Created new odex file from android.policy.jar (dexopt-wrapper android.policy.jar new.odex BOOTCLASSPATH)
Got the BOOTCLASSPATH from init.rc which I pulled from the phone root directory
9. Copied the "signature" from the original .odex file to the newly created one (busybox dd if=/system/framework/android.policy.odex of=new.odex bs=1 count=20 skip=52 seek=52 conv=notrunc)
10. Replaced android.policy.odex
cd /system/framework/
busybox cp /sdcard/new.odex android.policy.odex
busybox chmod 644 android.policy.odex
(I already had my keylayout file modded. So not sure if they are actually required after the above mod)
Please take a nandroid backup before attempting this. I am not responsible for any damage being done to your phone as a result of this!
Thanks again to XDA forums and Devs here and Jordan Hotmann (from the link above)
Can't say about ICS but in JB we use the lab menu *#*#6686#*#* to have the functionality of the volume key waking the phone.
Right. I used the same when I was on the JB leak. It doesn't work on ICS. However, last time I was on ICS, changing the key layout files sufficed with the lock screen set to none. This time my phone has to have a password lock screen due to corporate policy and editing android.policy.jar seems to be the only way.
Regards,
Sayantan
Sent from my MB865 using xda app-developers app
Ok, in that case I learned something new to use in ICS as per your tutorial below :good:
Hi guys.
I stumbled upon this thread while researching info for modding framework-res.apk and android.policy.jar. I'm trying to make some changes to the power menu.
I'm pretty much a noob and so far I managed to get framework-res.apk to compile and install successfully, but android.policy.odex is giving me nightmares My rom is odexed, and no matter what I do I always end up stuck at boot.
So I tried to just baksmali and smali it again with no changes whatsoever, then dexopt-wrap from the phone exactly like the guide SMONDAL84 linked says, dd the old signature into the new odex file and finally move it to /system/framework.
Even that isn't working, so I wonder what am I doing wrong?

Make your own updater-script!

To create updater-script or to edit updater-script you need Notepad++ (don’t use notepad). Download it from Here and install in your pc
updater-script is located in Meta-inf/com/google/android/updater-script
To create your own updater-script
Open notepad++ and from file menu select new and create the commands and create your own updater-script with this tutorial
After typing the commands save it as all types(*.*) and name it as updater-script and click save and put it in folder Meta-inf/com/google/android/updater-script
In this tutorial i will explain you all commands used in updater-script so that you can edit or create updater-script
ui_print – This command prints the prints the word inside the quotations
Example – ui_print(“xolo – next level”); prints xolo next level in your cwm recovery
mount – This command mounts the partition, if you want to add files to system partition you have to mount system partition, data for data partition
To mount system - mount(“ext4″, “EMMC”, “/dev/block/mmcblk0p5″, “/system”);
Here mmcblk0p5 is the name of system partition for mtk 6589 chipsets (this name varies from device to device)
To mount data - mount(“ext4″, “EMMC”, “/dev/block/mmcblk0p7″, “/data”); (partition name varies from device to device)
format - This command formats the partition specified
It is highly recommended to include this command to format system and data if you are making updater-script for ROM
To Format system - format(“ext4″, “EMMC”, “/dev/block/mmcblk0p5″, “0″);(partition name varies from device to device)
To Format data - format(“ext4″, “EMMC”, “/dev/block/mmcblk0p7″, “0″);(partition name varies from device to device)
package_extract_dir(” “, “/”) – This command extracts all the files from the folder mentioned inside first quotation to the partition or directory inside second quotation
For system - package_extract_dir(“system”, “/system”);
(this copies all files from system folder in zip to system partition in phone)
For data - package_extract_dir(“data”, “/data”);
package_extract_file(” “,”/”) - This command extract the single file inside between first quotation from zip to the partition or directory inside second quotation
symlink – This command creates links to its executable files
Here is an example
for super su binaries - symlink(“/system/xbin/su”, “/system/bin/su”);
set_perm_recursive - This command sets permission for folders
here android uses unix permission system
in unix
4 – read
2 – write
1 – execute
so
rwx is 4+2+1 = 7
rw is 4+2 = 6
rx is 4+1 = 5
Example - set_perm_recursive(0, 0, 0755, 0644, “/system”);
In this 0 is a user id for owner that refers to root. It means that permission owner for system folder. and 0 is root user means it unrestricted access to system. it is given in order to run programs to run properly
second 0 also refers to root. but here it refers to group id 0
we are only seeing about folders because “set_perm_recursive” is a command that sets permission to folders
next 0755 it means rwxr-xr-x permission has been given to system folder and rw-r-r is set for all folders inside system folder
set_perm – This command sets permission for a specific file
Example - set_perm(1000, 1000, 0640, “/system/etc/bluetooth/auto_pairing.conf”);
here the 1000 refers to user id system and 0640 is rw-r—–
and this command sets the permission rw-r—– for the file auto_pairing.conf
unmount – This command unmounts the partition
Example - unmount(“/system”); – unmounts system
General rule in updater-script – all commands should end with semi colon ; otherwise it will show error and if cwm or twrp shows status 7 error the error is in updater-script:laugh:
try fixing it by going through this thread
Use zipme app from Playstore to Make .Zip Flashable Files....
----------Signature---------
Need Some Cool Guides Visit Hmpshah Guides
Zeuscluts said:
Use zipme app from Playstore to Make .Zip Flashable Files....
----------Signature---------
Need Some Cool Guides Visit Hmpshah Guides
Click to expand...
Click to collapse
i use kitchen always
anyways thanks for the info :good:
and do you know any app to decompile in phone like apk multitool in pc?
Renaming is the Option
pradeepxtremehacker said:
i use kitchen always
anyways thanks for the info :good:
and do you know any app to decompile in phone like apk multitool in pc?
Click to expand...
Click to collapse
Bro its not possible,
but if you rename the .apk to .zip
you can decompile it,
but you need a PC to recompile.
Eg
sms.apk to sms.zip
then just Unzip sms.zip
you can get the Details.
Zeuscluts said:
Bro its not possible,
but if you rename the .apk to .zip
you can decompile it,
but you need a PC to recompile.
Eg
sms.apk to sms.zip
then just Unzip sms.zip
you can get the Details.
Click to expand...
Click to collapse
bro i think you are saying like extract
in fact we no need even to rename to extract we can directly extract with es file explorer from .apk but when we extract the xml will not be editable it will show like boxes
i am asking like a app like apk multi tool
No not Possible in Mobile.
Yet
Hope anyone Make this Possible In Future.
:Fingercrossed:
Let's Hope for the Better. ..
----------Signature---------
Need Some Cool Guides Visit Hmpshah Guides
OK thanks
Sent from my GT-I9070 using xda app-developers app
I have a question, i and my friend both port the rom for HTC One International to HTC One J (the japan variant of HTC One) and we edit the updater-script the same way but then my friend's rom can be flashed without any error and my, it's stuck at format step, the log file say:
Code:
format() expects 4 args, got 5
format() expects 4 args, got 5
here is the command line that was corrupted:
HTML:
format("ext4", "EMMC", "/dev/block/mmcblk0p38", "0", "/system")
my friend use the same and he has no error @@
Can you tell me why i can't make the rom to be able to flashed
Very helpful... Thanks.
KuroKeita said:
I have a question, i and my friend both port the rom for HTC One International to HTC One J (the japan variant of HTC One) and we edit the updater-script the same way but then my friend's rom can be flashed without any error and my, it's stuck at format step, the log file say:
Code:
format() expects 4 args, got 5
format() expects 4 args, got 5
here is the command line that was corrupted:
HTML:
format("ext4", "EMMC", "/dev/block/mmcblk0p38", "0", "/system")
my friend use the same and he has no error @@
Can you tell me why i can't make the rom to be able to flashed
Click to expand...
Click to collapse
The format command depends on the update-binary you are using. If you use the one your friend is using it will probably work with the existing command. If you would like to keep using your existing update-binary, change the above line to
Code:
format("ext4", "EMMC", "/dev/block/mmcblk0p38");
SuperR. said:
The format command depends on the update-binary you are using. If you use the one your friend is using it will probably work with the existing command. If you would like to keep using your existing update-binary, change the above line to
Code:
format("ext4", "EMMC", "/dev/block/mmcblk0p38");
Click to expand...
Click to collapse
Yeah, i changed to that and the rom was flashed properly, thanks guys
Sent from my HTC J One using Tapatalk
Zeuscluts said:
No not Possible in Mobile.
Yet
Hope anyone Make this Possible In Future.
:Fingercrossed:
Let's Hope for the Better. ..
----------Signature---------
Need Some Cool Guides Visit Hmpshah Guides
Click to expand...
Click to collapse
Yes I think so. Even Stericson's NinjaMorph can't do it.
Hello. I am making a flashable zip that flashes a modified build.prop. i dont know much about how to do it. the screenshot attached below, shows the code i already have. All i want is an updater script that will delete the build.prop and replace it with the modified one.
[HELP] generic updater script
I do have a "strange" question: is possible to update (overwrite) just specific files/dir ?
This could allow to make "generic" roms for a whole class of devices (for example all MT65xx).
Thanks in advice for any suggestion you can provide.
How to delete files in order to replace them with new ones? You didn't specify any commands for that one.
Sent from my Nokia_XL
I need help porting a ROM that always gives me status 7 and error setting permissions.
I think it is having problems identifying my device and I might've erased the get_prop commands.
Any help?
thank you
Hey. was wondering if you had any idea what im doind wrong by this log:
AROMA INSTALLER version 2.70B6
(c) 2013 by amarullz xda-developers
ROM Name : Project Unity
ROM Version : Google Apps
ROM Author : LiquidSmokeX64
Device : Any Device
Start at : Sat Aug 9 19:34:06 2014
Installing Google Core Apps
Mounting system...
Copying files...
Extract: /system/app/GoogleContactsSyncAdapter.apk
Extract: /system/etc/permissions/com.google.android.ble.xml
Extract: /system/etc/permissions/com.google.android.camera2.xml
Extract: /system/etc/permissions/com.google.android.maps.xml
Extract: /system/etc/permissions/com.google.android.media.effects.xml
Extract: /system/etc/permissions/com.google.widevine.software.drm.xml
Extract: /system/etc/permissions/features.xml
Extract: /system/etc/preferred-apps/google.xml
Extract: /system/framework/com.google.android.ble.jar
Extract: /system/framework/com.google.android.camera2.jar
Extract: /system/framework/com.google.android.maps.jar
Extract: /system/framework/com.google.android.media.effects.jar
Extract: /system/framework/com.google.widevine.software.drm.jar
Extract: /system/lib/libAppDataSearch.so
Extract: /system/lib/libconscrypt_gmscore_jni.so
Extract: /system/lib/libgames_rtmp_jni.so
Extract: /system/lib/libgcastv2_base.so
Extract: /system/lib/libgcastv2_support.so
Extract: /system/lib/libgmscore.so
Extract: /system/lib/libgoogle_hotword_jni.so
Extract: /system/lib/libgoogle_recognizer_jni_l.so
Extract: /system/lib/libjgcastservice.so
Fixing Permissions...
Installing Google Chrome
package_extract_file: can't open /system/app/Chrome.apk for write: Read-only file system
package_extract_file: can't open /system/lib/libchrome.1985.128.so for write: Read-only file system
Installing Cloud Print
package_extract_file: can't open /system/app/CloudPrint.apk for write: Read-only file system
Installing Google Play Music
package_extract_file: can't open /system/app/Music2.apk for write: Read-only file system
Installing Gmail
package_extract_file: can't open /system/app/Gmail.apk for write: Read-only file system
Installing YouTube
package_extract_file: can't open /system/app/YouTube.apk for write: Read-only file system
package_extract_file: can't open /system/lib/libm2ts_player.so for write: Read-only file system
Fixing permissions again...
Finished
script result was [@Finished]
Installer Sucessfull (Status 0)
End at : Sat Aug 9 19:34:06 2014
Problems with script
Greetings, I am new to the forum and have a question, I use a program to change my boot image, this generates me an update.zip and works perfect, but using as a basis the same script and copy any file to the same path, the script does nothing at all.
this is the script that changes the boot image
ui_print("Flashing logo...");
show_progress(0.200000, 0);
package_extract_file("logo.bin", "/dev/logo");
ui_print("Patched!");
ui_print("");
ui_print("Now you can reboot your phone");
Click to expand...
Click to collapse
and this is my script
ui_print("Flashing logo...");
show_progress(0.200000, 0);
package_extract_file("test.txt", "/dev/test.txt");
ui_print("Patched!");
ui_print("");
ui_print("Now you can reboot your phone");
Click to expand...
Click to collapse
i don't see what the problem is, any ideas?
Gorgonitte said:
Greetings, I am new to the forum and have a question, I use a program to change my boot image, this generates me an update.zip and works perfect, but using as a basis the same script and copy any file to the same path, the script does nothing at all.
this is the script that changes the boot image
and this is my script
i don't see what the problem is, any ideas?
Click to expand...
Click to collapse
if understood correctly, your script should extract to /tmp/scriptname.sh or /temp/scriptname.sh
after which your updater script in you meta-inf/com/google/android directory of your update.zip
need to include instruction to set permission and execute the script that actually performs the function.
m

Categories

Resources