[MOD][SOURCE] Disable lockscreen vibration on any ROM - Android Software/Hacking General [Developers Only]

Here is another solution to disable the lockscreen vibration. Root is needed.
Be careful, you are responsible for everything you do, not me.
Please don't ask, i won't do anything like a graphical interface or else to enable/disable.
This thread was the inspiration: http://forum.xda-developers.com/showthread.php?t=1605363
I dont yet know how to compile the source from this thread, so i searched for another way, baksmalimanager is the solution.
It decompiles and recompiles .jar files and their contents.
Download baksmalimanager
Take the framework.jar from /system/framework/ on the device and place it into the baksmalimanager directory on the pc.
Be sure to remain a backup of this file if something doesn't work.
Then run "baksmali Manager.bat" press 4 to select the framework.jar file and then 1 to decompile it.
Open this directory path inside your baksmalimanager directory framework\com\android\internal\widget\multiwaveview.
Open MultiWaveView.smali in a text editor, search for "setVibrateEnabled" until you find following line, remove it completely:
Code:
invoke-virtual {p0, v11}, Lcom/android/internal/widget/multiwaveview/MultiWaveView;->setVibrateEnabled(Z)V
Save the file. Run "baksmali Manager.bat" again if you closed it. Press 4, select the framework.jar and then press 2 to recompile.
Then open the framework.jar with 7-Zip or something else like that and replace the classes.odex file with the one from the baksmalimanager directory. Think of the backup before you do it.
Then replace the framework.jar in your devices /system/framework/ directory with the modded framework.jar.
Reboot and vibration is gone.
If something doesn't work like expected. Replace with the original framework.jar again.

works great on CM9 ROM latest nightly build for SGS2,,,,,now i can remove the vibra,,,,,thx a lot mate,,,
just suggestion, it's better to include adb.exe and all related files because without it,your program cannot work,,,
And you're now +1 in your thx meter,,,,

A couple of Qs before I replace my old framework.jar:
1.What if I just put '#' before the line I'm supposed delete? Seeing as # is usually a comment and does not affect the code, isn't it the same if I comment it or delete it? I did delete it, i'm just asking out of curiosity...
2.As much as I can understand, you don't need ADB for this, right? The program decompiles the .jar file without it with no problems, at least for me...
You got your thanks
EDIT: Works like a charm on my HTC Desire (SpazeDog's ICS ROM). Finally, the dreaded vibrations have stopped!
Though the answers to the upper questions would be appreciated...

thank you for this, works great on Galaxy Ace with CM9

Thanks Heaps badcrow! Works perfectly on Galaxy S2, CM9.0.0.
1. Tested commenting out the line (with #) and it works perfectly.
2. Doesn't need ADB coz it's working on the file on your PC, not on your phone, just hit any key when baksmali tells you.
Still have vibrate elsewhere, just not on lockscreen. Also, the file I replaced in framework.jar was classes.dex (not .odex).

siganid said:
1. Tested commenting out the line (with #) and it works perfectly.
Click to expand...
Click to collapse
Thanks for confirming, I thought that might happen, but I just didn't want to destroy my phone
siganid said:
2. Doesn't need ADB coz it's working on the file on your PC, not on your phone, just hit any key when baksmali tells you.
Click to expand...
Click to collapse
I really don't want to say this, but; I told you so
As for the other vibrations, see other settings ot other baksmali files and mess with them

on AOSP JellyBean 4.1.1, I had to edit GlowPadView.smali to remove the vibration.
"framework\com\android\internal\widget\multiwaveview"
form this:
Code:
invoke-virtual {p0, v6}, Lcom/android/internal/widget/multiwaveview/GlowPadView;->setVibrateEnabled(Z)V
to this:
Code:
[B]#[/B]invoke-virtual {p0, v6}, Lcom/android/internal/widget/multiwaveview/GlowPadView;->setVibrateEnabled(Z)V
this has worked for me.

im very confused bro...
"replace the classes.odex file with the one from the baksmalimanager directory."
in baksmalimanager directory not file the classes.odex,,,

You 'baksmali' the jar file (de-compile), make the edits you need and 'smali' (compile). Once you do that, you should have a classes.dex (not .odex, but .dex !!) file.
Then just take 7Zip (or winrar, or whatever else can open .jar files) and replace the original classes.dex with the one you 'smali'd'

badcrow said:
Take the framework.jar from /system/framework/ on the device and place it into the baksmalimanager directory on the pc.
Be sure to remain a backup of this file if something doesn't work.
Then run "baksmali Manager.bat" press 4 to select the framework.jar file and then 1 to decompile it.
Open this directory path inside your baksmalimanager directory framework\com\android\internal\widget\multiwaveview.
Open MultiWaveView.smali in a text editor, search for "setVibrateEnabled" until you find following line, remove it completely:
Code:
invoke-virtual {p0, v11}, Lcom/android/internal/widget/multiwaveview/MultiWaveView;->setVibrateEnabled(Z)V
Save the file. Run "baksmali Manager.bat" again if you closed it. Press 4, select the framework.jar and then press 2 to recompile.
Then open the framework.jar with 7-Zip or something else like that and replace the classes.odex file with the one from the baksmalimanager directory. Think of the backup before you do it.
Then replace the framework.jar in your devices /system/framework/ directory with the modded framework.jar.
Reboot and vibration is gone.
If something doesn't work like expected. Replace with the original framework.jar again.
Click to expand...
Click to collapse
Hmmm. Doesn't seem to work for me Maybe I did something wrong. I had to deviate from these steps a little for my phone. Maybe I screwed it up.
I have a deodexed stock rom for Droid 4 running ICS 4.0.4. I actually found this file and line of code in the framework-ext.jar file instead of framework.jar. And, for some reason, baksmali manager wouldn't find the file when I typed 4, unless I renamed the file to framework.jar. Once I did, it found it and decompiled it fine. I changed the code and recompiled, and copied the classes.odex file into the framework.jar file. Then I renamed it BACK to framework-ext.jar. But when I put it back in the system/framework directory, the phone got stuck at the Droid Eye screen on bootup. It just continuously showed it. I had to used adb to push the old file back in place.
Can you just not do it this way? Any ideas? Thanks

How come Baksmali didn't recognize a .jar file? It does, with every version of the name 'framework' I've tried...
BTW, was there even an .dex file inside the .jar file? (de-odexed, kinda sounds like there aren't any more .dex files... just a thought, tho, since I have no idea what that actually means...)
Did you delete the old version of the framework-ext.jar? Or at least rename it (I keep a renamed original copy of the file right there in /system/framework, just in case)?

someone755 said:
How come Baksmali didn't recognize a .jar file? It does, with every version of the name 'framework' I've tried...
BTW, was there even an .dex file inside the .jar file? (de-odexed, kinda sounds like there aren't any more .dex files... just a thought, tho, since I have no idea what that actually means...)
Did you delete the old version of the framework-ext.jar? Or at least rename it (I keep a renamed original copy of the file right there in /system/framework, just in case)?
Click to expand...
Click to collapse
I'm not sure why it didn't recognize the framework-ext.jar file. Was hoping you could tell me Well anyway, it looks like my rename method should work, because all that Baksmali does is extract the file. So, if I gotta rename framework-ext.jar to framework.jar to do the work, and then change it back, it shouldn't matter. And yes the .dex file was in there (and lol nice xP )
I figured out what I did wrong. I replaced the .dex file with 7Zip incorrectly. I couldn't figure out how to place the new .dex file into the .jar file, so I tried clicking "Copy" and changed the destination directory to C:\...\framework-ext.jar. What that did was erase the .jar file, and replaced it with a renamed version of the .dex file. Whoops, haha I later figured out that you can just drag and drop.
Ok, so my phone boots now....Buuuuuuut....the vibration is still there???? The lockscreen still vibrates. Although, the vibration doesn't seem as intense as before. But, it's still there, even if I disable "Vibrate on Touch" in the sound menu.
I checked to make sure that I didn't accidentally put the original framework-ext.jar file into /system/framework/, but I confirmed that I put the modified file in there with the line of code removed, so I'm not crazy Maybe this method just doesn't work completely on my ROM, but I like that the vibration is at least less intense. Thanks so much for the help!

Request for option on CM website
Hi gyus,
thaks for the explanations.
I don't really like to change the code so I requested the option to able or disable vibrations on lock screen on the CM website.
Maybe if we're enough to say it's a good idea, they'll actually program it
Here is the post (as I'm a new member I can't post outside links, repalce underscores by dots)
forum_cyanogenmod_com/topic/59819-request-lock-screen-vibration-option/
If you didn't subscribe, I suggest you do it because there is many many good stuff there too
Bijnok

Thanks!! ...works great on my SGSII..
Sent from my AOKP'd T989

reapsor said:
on AOSP JellyBean 4.1.1, I had to edit GlowPadView.smali to remove the vibration.
"framework\com\android\internal\widget\multiwaveview"
form this:
Code:
invoke-virtual {p0, v6}, Lcom/android/internal/widget/multiwaveview/GlowPadView;->setVibrateEnabled(Z)V
to this:
Code:
[B]#[/B]invoke-virtual {p0, v6}, Lcom/android/internal/widget/multiwaveview/GlowPadView;->setVibrateEnabled(Z)V
this has worked for me.
Click to expand...
Click to collapse
Recently installed CM9 from modpank and encountered this problem, but your version, help me! Thank you!

Just an update on this, if you want this to work on the ICs and JB lockscreen you also need to repeat the process for GlowPadView.smali as well.

4.2.1
Does anyone know how to get it to work on 4.2.1? I tried it 3 different times with no luck.

thats what you get with a new firmware
Ask on the ROM thread, maybe? If there's enough interest, maybe the DEVs will include a setting in the next version...

there‘s no MultiWaveView.smali after decompiling of moto fire xt

What about some info about your ROM...?
Wouldn't that be nice?

Related

Anyone managed to change style.xml and recompile/add resources.arsc

Tried everything I can find and no luck with this with Sony framwork-res.apk doing my head in, My new resources.arsc is alwyas about 200kb smaller aswell after recompiling, furthest ive got is bootanimation then restart lol. Anyone had any luck with it? All i need to change is 1 bloody line in style.xml to change bottom popup menu to black, driving me mad lol
go3asy said:
Tried everything I can find and no luck with this with Sony framwork-res.apk doing my head in, My new resources.arsc is alwyas about 200kb smaller aswell after recompiling, furthest ive got is bootanimation then restart lol. Anyone had any luck with it? All i need to change is 1 bloody line in style.xml to change bottom popup menu to black, driving me mad lol
Click to expand...
Click to collapse
Have you followed this guide to the letter?
I changed the progressbar_horizontal.xml in my framework using this guide and it worked!
yeah , changed that worked fine but the style.xml file isnt viewable unless you decompile the apk then when you recompile the folder value with style.xml is compiled into the above file resources.arsc and not had any luck with it at all lol
Try asking Mr.Rusch or Calum?
Sent from my X10a using XDA App
go3asy said:
yeah , changed that worked fine but the style.xml file isnt viewable unless you decompile the apk then when you recompile the folder value with style.xml is compiled into the above file resources.arsc and not had any luck with it at all lol
Click to expand...
Click to collapse
Hmm style.xml is not viewable but also not any other .xml is viewable or readable if you do not decompile.
So I return to My_Immortal's initial question. Have you followed calum's guide about decomipling/recompiling the resources to the letter? What about the part where you take the .asrc file from the unsigned.apk and you chose to add it to the copmressed .zip file (which is the original signed apk that you have renamed). Have you done that exactly as you should?
_calum_ said:
This will create a new framework-res.apk in a subfolder out.
IMPORTANT: Do not push this apk to your phone unless you want to reflash
Extract the xml files and images from the newly generated apk (you can use the original images, but the xml files must be the newly compiled ones from the new apk). Add these files to the original framework-res.apk that you want to push to your phone (see the previous post).
Extract the resources.arsc from the root of the apk
Rename the original framework-res.apk from your theme to framework-res.zip
Right-click the extracted resources.arsc and choose the 7zip menu item ‘Add to archive’
In the dialog that appears set the achive field at the top to the framework-res.zip from step 7. And set the archive format to zip. Now set the Compression level to store and click OK(if you do not do this your phone will not boot). The settings are in the attached screenshot.
Rename framework-res.zip to framework-res.apk and double check that the compressed size or resources.arsc is the same as the original size (see screenshot)
Done. Push the new framework to your phone.
Click to expand...
Click to collapse
Its tge re compiling tgatsvthe problem aleays get sources not founf error in apktool. Read that it might be im not using fresh framework files tgat havent already been fiddlef eith but dont have any originnalsat the moment they all gave battery mod
Sent from my X10i using XDA App

[SOLVED] Looking for help to remove clock from status bar.

Was searching the forums looking for a way to remove the clock from my status bar and have come to the conclusion it may be a little over my head at this point. Can make me a flashable zip to remove the clock? Or maybe some step by step instructions on how I would accomplish this? Thanks in advance.
Update 3/26---------------------------------------------------------------------------
JKILO is working on a flashable .zip for MikShift, so until then here's how you do it manually....
Instructions for removing status bar clock on an odex rom:
Props to JKILO and riggsandroid for helping a total noob and doing most of the work. Also thanks to Steelh for showing us the lines to replace. His method for deodex roms is here. If I forgot to add anyone that helped out, let me know. I always throw props where its deserved.
You are modding at your own risk. Nobody who helped bring this to you is responsible for bricked phones or temper-tantrums.
Requirements:
-Rooted Evo Shift
-Odex Rom
-Windows (I used Windows 7. If you are using another os, I'm sure you can figure it out. If not, ask)
-sdk properly set up
-smali\baksmali
-dexopt-wrapper
-knowledge of the above things (at least have the ability to google for info)
-a nandroid backup of your phone (for obvious reasons)
-patience
-/system mounted as r/w (I did this in terminal emulator from my phone: type:
"su" then hit enter. type: "mount -o rw,remount -t ext3 /dev/block/mmcblk0p26 /system" then hit enter)
First thing you need to do is pull services.jar from /system/framework;
-"adb pull /system/framework/services.jar"
Next you need to open up services.jar with 7zip or winrar or something similar
Pull classes.dex out into a working folder with smali\baksmali
(I just did everything in my platform-tools folder in sdk so I didnt have to switch back and forth. You can do it however you want.)
Open command prompt as administrator
Cd to your work folder
Type this line:
java -jar baksmali.jar classes.dex
This will will create a folder named out in your work folder
Navigate to \com\android\server\status and look for StatusBarPolicy.smali
Open StatusBarPolicy.smali with Notepad or something similar
Search for:
.line 593
invoke-direct {p0}, Lcom/android/server/status/StatusBarPolicy;->updateClock()V
Add the following line two spaces under that to look like this:
invoke-virtual {p2, v3, v6}, Lcom/android/server/status/StatusBarService;->setinvisibilty(Landroid/os/IBinder;Z)V
It should look like this now:
.line 593
invoke-direct {p0}, Lcom/android/server/status/StatusBarPolicy;->updateClock()V
invoke-virtual {p2, v3, v6}, Lcom/android/server/status/StatusBarService;->setinvisibilty(Landroid/os/IBinder;Z)V
Now click file then save as. Be sure to change the file type or youll save it as a text file that is useless to you.
Now head back to your command prompt.
still being cd'd to your work folder, type this:
java -jar smali.jar out
This will create a new .dex file named out.dex. Rename it to classes.dex and replace the classes.dex from services.jar with the new one you just made.
Now place the modified services.jar and dexopt-wrapper on your sdcard and plug your phone into your computer. (charge only)
Back to command prompt in your platform-tools directory
Type these commands in the order they appear, hitting enter after each one:
-adb shell
-cd /system/bin
-busybox cp /sdcard/dexopt-wrapper /system/bin
-busybox chmod 755 dexopt-wrapper
-cd /sdcard
-dexopt-wrapper services.jar new.odex /system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/com.htc.framework.jar:/system/framework/com.htc.android.pimlib.jar:/system/framework/com.htc.android.easopen.jar:/system/framework/com.scalado.util.ScaladoUtil.jar:/system/framework/com.orange.authentication.simcard.jar
- busybox dd if=/system/framework/services.odex of=new.odex bs=1 count=20 skip=52 seek=52 conv=notrunc
-cd /system/framework
-busybox cp /sdcard/new.odex services.odex
-busybox chmod 644 services.odex
-sync
-reboot
Your phone will reboot and, viola! NO Clock!!!!
bobtsunam said:
Was searching the forums looking for a way to remove the clock from my status bar and have come to the conclusion it may be a little over my head at this point. Can make me a flashable zip to remove the clock? Or maybe some step by step instructions on how I would accomplish this? Thanks in advance.
<Blaze One>
Click to expand...
Click to collapse
on page 2 of this forum.
http://forum.xda-developers.com/showthread.php?t=966190
riggsandroid said:
on page 2 of this forum.
http://forum.xda-developers.com/showthread.php?t=966190
Click to expand...
Click to collapse
Saw that one but I havent done anything to that extent before. Was really hoping someone had a zip out there I could flash. Oh well. Maybe in the future. Until then ill try my hand at compiling....
<Blaze One>
bobtsunam said:
Saw that one but I havent done anything to that extent before. Was really hoping someone had a zip out there I could flash. Oh well. Maybe in the future. Until then ill try my hand at compiling....
<Blaze One>
Click to expand...
Click to collapse
what rom are you on?
riggsandroid said:
what rom are you on?
Click to expand...
Click to collapse
Currently on infinite's 2.0.
<Blaze One>
So I'm still trying to figure this out. From what I read I need to edit system/framework/services/classes? How would I go about editing this?
<Blaze One>
bobtsunam said:
So I'm still trying to figure this out. From what I read I need to edit system/framework/services/classes? How would I go about editing this?
<Blaze One>
Click to expand...
Click to collapse
Download apktool - http://code.google.com/p/android-apktool/
Follow instructions to setup your machine (installing framework, etc)
Decompile the services.jar in the /system/framework folder
Edit the lines indicated in teh smali files and recompile.
Push updated services.jar to your phone, reboot (takes a while, has to rebuild dalvik cache) and you should be good to go.
Thanks. I'll attempt this when I get home. If/when I get this completed, is it possible to make a general .zip file for others to flash if they are interested in doing the same thing? I've seen the question posed on many forums but haven't found a file that can be flashed. Would be nice to have something everyone can benefit from...
Edit: I'm guessing its gonna be Rom specific?
bobtsunam said:
Thanks. I'll attempt this when I get home. If/when I get this completed, is it possible to make a general .zip file for others to flash if they are interested in doing the same thing? I've seen the question posed on many forums but haven't found a file that can be flashed. Would be nice to have something everyone can benefit from...
Edit: I'm guessing its gonna be Rom specific?
Click to expand...
Click to collapse
Definitely rom specific. Unique for themes as well, I believe.
Sent from my MikShift.
smoothtaste said:
Definitely rom specific. Unique for themes as well, I believe.
Sent from my MikShift.
Click to expand...
Click to collapse
Figured as much. Hopefully I will be able to pull this off. I have not done any programming related stuff on Android yet. Most I've done is change an icon or two but that was pretty simple using ninjamorph. I literally know nothing about the file structure or coding. Might he time to start learning java at least if I'm gonna get into modding to this extent. We shall see how all this goes later tonight.
<Blaze One>
I have been trying to rebuild services.jar after editing StatusBarPolicy.smali and for some reason it doesn't work. I get something to this extent:
Exception in thread "main" java.lang.NullPointerException
(and then a bunch of other lines...)
Any idea what's goin on?
By the way, I'm replacing this:
.line 593
invoke-direct {p0}, Lcom/android/server/status/StatusBarPolicy;->updateClock()V
With this:
.line 593
invoke-direct {p0}, Lcom/android/server/status/StatusBarPolicy;->updateClock()V
invoke-virtual {p2, v3, v6}, Lcom/android/server/status/StatusBarService;->setIconVisibility(Landroid/os/IBinder;Z)V
Does this look right?
Thanks for any help...
Ok....I noob'd it. When a saved the changes to the StatusBarPolicy file I saved it as a text file somehow. Was able to build services.jar and push it back but the changes didn't take or something. Clock is still there. Am I editing the right line with right changes?
bobtsunam said:
Ok....I noob'd it. When a saved the changes to the StatusBarPolicy file I saved it as a text file somehow. Was able to build services.jar and push it back but the changes didn't take or something. Clock is still there. Am I editing the right line with right changes?
Click to expand...
Click to collapse
Just want to make sure - you restarted? It will take a little while because it has to rebuild the Dalvik Cache cause you modified the .jar file.
Yeah I actually mounted /system from recovery and pushed back in from there. I even tried it a second time, formatting dalvik cache. Do I need to restart an additional time?
<Blaze One>
bobtsunam said:
Yeah I actually mounted /system from recovery and pushed back in from there. I even tried it a second time, formatting dalvik cache. Do I need to restart an additional time?
<Blaze One>
Click to expand...
Click to collapse
No that should work the way you're doing it. Not sure...
riggsandroid said:
No that should work the way you're doing it. Not sure...
Click to expand...
Click to collapse
Just remembered something I saw as services.jar was rebuilding. Right before it finished it said sources not found. Don't know if this gives a clue. Also I'm running dreads blue honeycomb theme. Would that have something to do with it?
<Blaze One>
Figured I would post the steps I took in case I'm messing it up somehow. I'm using Windows 7.
First thing I did was adb pull services.jar from /system/framework using: adb pull /system/framework/services.jar
Moved services.jar to a folder I created on the root of my c: drive called test.
Opened cmd as an administrator.
Decoded services.jar using : apktool d services.jar which created services.jar.out in my test folder.
Navigated to StatusBarPolicy.smali @ c:\test\services.jar.out\smali\com\Android\server\status
Edited the lines as stated previously.
Opened cmd back up and rebuilt with: apktool b -f -d services.jar.out which put the new services.jar in a new folder called build located in services.jar.out
Noticed at this point that the meta file wasn't in services.jar so I copied from the original to the new.
Then pushed back to phone while in recovery using: adb push services.jar /system/framework and booted.
See anything I'm doing wrong?
<Blaze One>
You don't need apktool to do that. Use smali.jar and baksmali.jar to decompile and recompile.
http://code.google.com/p/smali/
Download the two jar files under featured downloads. For ease of typing, rename them baksmali.jar and smali.jar, respectively, and put them in c:\. Open as archive with 7zip to pull the classes.dex file out. Move classes.dex to c:\. Open admin cmd prompt and type:
java -jar -Xmx512M baksmali.jar c:\classes.dex
This will dump classes.dex into a folder c:\out. Make your smali edit then to recompile the dex file type:
java -jar -Xmx512M smali.jar c:\out
This will produce c:\out.dex. Move the file to your Desktop, rename it classes.dex and put it back in your services.jar. Push the file in recovery, no need to clear dalvik cache and it should work. If it's still not working, link me your original services.jar and I'll try to get it working for you.
EDIT: btw, kudos to you for taking the initiative to learn this. I have much respect for that.
EDIT 2: Are you on 2.0 odexed or deodexed?
Sent from my PG06100 using Tapatalk
tambourineman86 said:
You don't need apktool to do that. Use smali.jar and baksmali.jar to decompile and recompile.
http://code.google.com/p/smali/
Download the two jar files under featured downloads. For ease of typing, rename them baksmali.jar and smali.jar, respectively, and put them in c:\. Open as archive with 7zip to pull the classes.dex file out. Move classes.dex to c:\. Open admin cmd prompt and type:
java -jar -Xmx512M baksmali.jar c:\classes.dex
This will dump classes.dex into a folder c:\out. Make your smali edit then to recompile the dex file type:
java -jar -Xmx512M smali.jar c:\out
This will produce c:\out.dex. Move the file to your Desktop, rename it classes.dex and put it back in your services.jar. Push the file in recovery, no need to clear dalvik cache and it should work. If it's still not working, link me your original services.jar and I'll try to get it working for you.
EDIT: btw, kudos to you for taking the initiative to learn this. I have much respect for that.
EDIT 2: Are you on 2.0 odexed or deodexed?
Sent from my PG06100 using Tapatalk
Click to expand...
Click to collapse
Its mikshift lol we've been tryin to figure it out together..so odexed
Sent from my PG06100 using XDA App
You know apktool uses small baksmali right?
i find it easier to use the same program for stuff - its nice that apktool does both .jar and .apk files.
tambourineman86 said:
You don't need apktool to do that. Use smali.jar and baksmali.jar to decompile and recompile.
http://code.google.com/p/smali/
Download the two jar files under featured downloads. For ease of typing, rename them baksmali.jar and smali.jar, respectively, and put them in c:\. Open as archive with 7zip to pull the classes.dex file out. Move classes.dex to c:\. Open admin cmd prompt and type:
java -jar -Xmx512M baksmali.jar c:\classes.dex
This will dump classes.dex into a folder c:\out. Make your smali edit then to recompile the dex file type:
java -jar -Xmx512M smali.jar c:\out
This will produce c:\out.dex. Move the file to your Desktop, rename it classes.dex and put it back in your services.jar. Push the file in recovery, no need to clear dalvik cache and it should work. If it's still not working, link me your original services.jar and I'll try to get it working for you.
EDIT: btw, kudos to you for taking the initiative to learn this. I have much respect for that.
EDIT 2: Are you on 2.0 odexed or deodexed?
Sent from my PG06100 using Tapatalk
Click to expand...
Click to collapse
Sent from my PG06100 using XDA App

[Q] How to edit .xml files within and .apk

Im not trying to re-engineer an app, but I simply want to check out an apk to look at the placement of a certain line of code. When i open up the files within the apk though, i get a bunch of nonsense. How do I edit the files within the apk...i know theres a way, or else we wouldnt have custom roms.
Apktool (or some wrapper like Apk Manager). It's quite outdated, so you won't be able to decode some newer apks though.
Brut.all said:
Apktool (or some wrapper like Apk Manager). It's quite outdated, so you won't be able to decode some newer apks though.
Click to expand...
Click to collapse
gahh, i was hoping there would be an easier way than that xP...I experimented with apktool, but it wasnt recognizing the .apk i was typing in...i just suck with command prompt stuff
....thanks anyway though
schwartzman93 said:
gahh, i was hoping there would be an easier way than that xP...I experimented with apktool, but it wasnt recognizing the .apk i was typing in...i just suck with command prompt stuff
Click to expand...
Click to collapse
Brut.all also mentioned APK Manager in his post which is a script wrapper for his apktool that automates much of the process. It's available at the link I gave for both Windows and Linux. All you should need to do is run the script, place your apk in the appropriate folder created by the script, have the script decompile your apk, then you can find the decoded xml file(s) of interest.
thanks guys
i was having a bit of trouble with apk mananger, i couldnt get it to do anything with this one app, i would tell it an action and it just closed the script
EDIT: I figured it out
Hi guys, i'm using APK Manager and i was able to change the xml without having any trouble by decompressing the apk. I'm wondering what i need to do in order to resign the APK. I have already tried to compress the apk and then sign it, but streight away after I installed the apk i got in boot looping.
The file i'm talking about is the framework-res.apk
Any suggestion?
Thanks in advance.
Edit/
Solved.
Basically i was trying to sign framework-res.apk, instead i have found the solution in this forum that actually worked fine for me:
Code:
1. Place your original "framework-res.apk" into "\place-apk-here-for-modding\" folder
2. Run "script.bat"
3. Set Project (22) and choose the "framework-res.apk" (1)
4. Decompile (9)
5. Place or overwrite new Xmls and PNGs in "\projects\framework-res.apk\res\drawable or drawable-hdpi"
5. Recompile (11)
6. Answer "Yes" when it asks wheter it is system file
7. Answer "Yes" when it asks "would you like to copy over any additional files...?"
8. Script is paused => (don't press a key)
9. Go to the "keep" folder (it's in the same folder than "script.bat")
10. In this "Keep" Folder,
- delete "resources.arsc" file
- delete originals "stat_sys_battery.xml" and "stat_sys_battery_charge.xml" from the "keep\res\drawable" folder
- delete all originals PNGs that were meant to be edited
11. Go back to "script.bat" and press a key to let him finish the job
12. Your new "framework-res.apk" has been created in the "\place-apk-here-for-modding\" folder. It's called "unsignedframework-res.apk".. but he's not working yet.
13. Unzip all the content of the "unsignedframework-res.apk". You should have 5 objects (3 folders, 2 files).
14. Zip these files with Winrar/Winzip (whatever) but you must choose "No compression" method to zip it.
15. Rename this zip into "framework-res.apk".
15. Put it into an update.zip and it should be OK to flash trough the recovery mode.
Thanks anyway!

[Q] Modifying .odex file

Is it possible to modify code in a system .odex file without de-odexing?
Here is what I've been trying, without success (Windows computer, Samsung Epic 4G Touch phone, stock ROM with 2.3.6):
On my computer, using Android Commander, I pull a .odex from /system/app to my computer. There is a corresponding .apk, but I leave that alone. I also pull the entire /system/framework folder.
On my computer, from the location containing the framework folder and the .odex file, I run "java -jar baksmali.jar --api-level 10 -d framework -x <FILE_NAME>.odex". This creates an "out" folder, with the com/android/<FILE_NAME> folder structure and the code.
I modify the code (.smali files).
I rename the original .odex file and run "java -jar smali.jar --api-level 10 out/ -o <FILE_NAME>.odex". This creates a new .odex file that, as far as I can tell, should have the updated code in it.
Using Android Commander, I push the new .odex to /system/app on my phone, change the permissions to 644, and reboot the phone.​
The changes aren't having an effect. In fact, the status bar is completely gone (the example I'm working on is a mod to the status bar in SystemUI.odex).
Any idea what I'm doing wrong?
So I'm getting the feeling that it's not possible to edit odexed apks. Is there anyway to de-odex just a single apk rather than the whole rom?
Brent212 said:
So I'm getting the feeling that it's not possible to edit odexed apks. Is there anyway to de-odex just a single apk rather than the whole rom?
Click to expand...
Click to collapse
http://forum.xda-developers.com/showthread.php?t=1208320
Basically, no odex can be edited and put back that easy. Wrapping and Signing ODEX style is required.
Awesome! That thread's perfect. I'm hoping I can deodex, mod the code, create a classes.dex file and put it in with the .apk, zipalign it, and just replace the existing .apk and .odex with the new .apk.
That thread (http://forum.xda-developers.com/showthread.php?t=1208320) had the answers I was looking for.
The trick was to either rename the new .odex to classes.dex and put it into the .apk, and zipalign the .apk (although I have a feeling that wasn't actually necessary), or to copy the signature from the old .odex file to the new one.
Brent212 said:
That thread (http://forum.xda-developers.com/showthread.php?t=1208320) had the answers I was looking for.
The trick was to either rename the new .odex to classes.dex and put it into the .apk, and zipalign the .apk (although I have a feeling that wasn't actually necessary), or to copy the signature from the old .odex file to the new one.
Click to expand...
Click to collapse
Odex is not dex. And vice versa. Remember that. When compiling, the result is always dex. To have odex, you need to wrap it with dexopt-wrapper within your phone.
sent from my white ray using XDA App

How to re-odex?

Normally to decompile my dex files I use smali and baksmali, how can I re-odex them?
Id like to get my service.jar re-odexed so I can try and push it to my phone via a zip update.
Sent from my MB865 using xda premium
[mini HOW-TO] Re-Odex (or create a new .odex file)
Fall of Enosis said:
Normally to decompile my dex files I use smali and baksmali, how can I re-odex them?
Id like to get my service.jar re-odexed so I can try and push it to my phone via a zip update.
Sent from my MB865 using xda premium
Click to expand...
Click to collapse
It all needs to be done on your phone, live.. with adb.
Here's how I accomplished it - I will use the services.jar in this example. Just change the file name and path to existing .odex accordingly for other files (not sure if all steps are required exactly, but it has worked for me multiple times with different jars and SysUI apk):
Requirements:
Odexed system
adb
dexopt-wrapper
Put this dexopt-wrapper file (unzip first) in /system/bin with 775 permissions:
X X X
X....X
X....X
Probably a good idea to reboot after pushing that file, if you use root explorer (like I did).
Put the deodexed services.jar (or other jar/apk file you want to make an new odex of) on your sd card.
Go to /system folder (with root explorer or equal) and mount it R/W (not sure if this is necessary - but won't hurt)
Put your USB connection to "Charge only" mode.
Go here (big props and credit to jhotmann for this) and follow steps 8-12 (I've recreated the steps with the A2's bootclasspath below).
The bootclass path is located in the /init.rc file at the root of your phone.
Connect with adb (do a adb devices check to make sure you're all good).
To create the new odex:
Code:
adb shell
su
cd /sdcard/
dexopt-wrapper services.jar new.odex /system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar:/system/framework/com.motorola.android.frameworks.jar:/system/framework/com.motorola.android.widget.jar
I know it's a long entry for those who don't work with command lines often (like me), but double check your entry before hitting enter.
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...
You can then get that on your odexed system by your choice of method (adb push, update.zip, root explorer push, etc.. - note: please know what you are doing before trying to push files with root explorer! - you cannot simply copy and paste!)
Or, if you want to deodex it right away again for some odd reason like I did (personal issues )... Take the services.jar and the new services.odex from your sdcard and put them on your computer - and open the services.jar with 7-zip (maybe winzip) and delete the classes.dex file from the 7-zip window. Now you have a fresh new set of .jar/.odex files ready for deodexing (I did this all with the SystemUI.apk last night, that's why I elaborated and re-typed this whole thing today..).
Frigging brilliant man.
Much appreciated. I'm super sick and my USB cable is at work.
Once i get it back on Wednesday, I'll work all this out. If I could thank you twice I would.
Thanks man!
Sent from my MB865 using xda premium
Fall of Enosis said:
Frigging brilliant man.
Much appreciated. I'm super sick and my USB cable is at work.
Once i get it back on Wednesday, I'll work all this out. If I could thank you twice I would.
Thanks man!
Sent from my MB865 using xda premium
Click to expand...
Click to collapse
Not a prob.
And, I updated the dexopt-wrapper link so it's easier to download - just unzip it first..
Good luck on your quest.. let me know if you catch any snags along the way - and i'll try and help you out.
Sent from my mind using XDA
Ok sooo, I think we (or most likely me) are confused on what I wanted to do. I don't want to make a NEW odex file. I need to recombine my modded classes.dex BACK with the service.jar.
Since I needed to modify some script in the services.jar I had to de-odex it so I had a classes.dex file to use baksmali with so I could modify it. Once I modded it I used smali to create the NEW MODDED classes.dex. And now I need to re-odex(bad terminology?) them to re-combine the services.jar with the classes.dex so the modded services.jar could be used on a odexed ROM.
I'm working on a de-odexed version also, but I'd like to be able to offer both
Fall of Enosis said:
Ok sooo, I think we (or most likely me) are confused on what I wanted to do. I don't want to make a NEW odex file. I need to recombine my modded classes.dex BACK with the service.jar.
Since I needed to modify some script in the services.jar I had to de-odex it so I had a classes.dex file to use baksmali with so I could modify it. Once I modded it I used smali to create the NEW MODDED classes.dex. And now I need to re-odex(bad terminology?) them to re-combine the services.jar with the classes.dex so the modded services.jar could be used on a odexed ROM.
I'm working on a de-odexed version also, but I'd like to be able to offer both
Click to expand...
Click to collapse
So, you have a deodexed services.jar (with an unedited classes.dex inside)? And, you also have an edited classes.dex (the new modded one). Just drag and drop the new modded classes.dex into the services.jar file with 7-zip to overwrite the old one.
Then I would check out the mods on a deodexed system, and provided they work, then go through the re-odexing process (separating that classes.dex from the apk and creating a new odex file) as described above to get it working on odexed systems.
Hope that helps.. Good luck!
Yes sir, you are correct. That was the first thing I tried to do was just drag and drop the modded classes.dex with 7zip, save it, however when i tried to flash the "modded" ROM it can't install the system folder because (according to Jim), when I modded copied the new classes.dex, I changed the size, and so the signature needed to be changed as well. They mismatched.
Fall of Enosis said:
Yes sir, you are correct. That was the first thing I tried to do was just drag and drop the modded classes.dex with 7zip, save it, however when i tried to flash the "modded" ROM it can't install the system folder because (according to Jim), when I modded copied the new classes.dex, I changed the size, and so the signature needed to be changed as well. They mismatched.
Click to expand...
Click to collapse
Not sure about the details of that.. I know the signatures can be tricky, but I've modded a few apks/jars similarly with no problems... when you say "can't install.." is that it wouldn't flash in recovery, or you bootlooped?
Just wouldn't flash at all.
And thanks for all your help man.
Sent from my MB865 using xda premium
I've updated the 2nd post with more detail on creating a new odex file...
Not to be a "rooster" (replace with your word of choice) or anything, but maybe this info has a place somewhere besides the general threads..?:angel: (and what is up with these new Smilies and posting reply layout?) - it just seems so hard to come by good literature on this process (which, I suppose, is a process so rarely needed though...)
So I need to perform the processes above while running in an odexed environment correct? Does this process change the deodexed APK we are running the script on to an odexed one as well as create a new .odex file for that APK? I am just confused about what the result is after running the script. For my situation I want to take 2 deodexed files (systemui and sec settings.apk) and odex them. Then push them into an odexed rom. Once I run the script above what am I left with?
Didact74 said:
So I need to perform the processes above while running in an odexed environment correct?
YES.
Does this process change the deodexed APK we are running the script on to an odexed one as well as create a new .odex file for that APK?
(Yes, it will create a new odex file that you will need to rename, but..)NO. You will need to take the classes.dex out of the deodexed apk/jar - use something like 7-zip. Unless you only edited smali, then you really only need the new odex file.
I am just confused about what the result is after running the script. For my situation I want to take 2 deodexed files (systemui and sec settings.apk) and odex them. Then push them into an odexed rom. Once I run the script above what am I left with?
Click to expand...
Click to collapse
I broke up your quote with my best answers...
As for what your're left with is a new.odex file, properly signed, if all goes well. You are going to need to do it for each of your deodexed files.
Rename them, remove the classes.dex from the deodexed files you used, and get them on your phone however you choose (I prefer zip packages and a restore.zip in case something goes wrong).
Also note that the bootclass path is different from GB to ICS.. and among different devices of course. Check init.rc file if need be. I posted the one to use for A2 ICS (think it may be the same for razr too) here: http://forum.xda-developers.com/showthread.php?t=1753659
I can't garuntee you won't have problems, but good luck... if you do you could try the dexopt-wrapper from here: http://forum.xda-developers.com/showthread.php?t=1645950 - just unzip it first obviously (but I think it's the exact same file though..)
Btw, it's all done with adb, one line at a time.. not really a script, but thank you for the idea - maybe a batch file?
Sent from my phone's mind
Great, thank you for the detailed response. Last question.
What if I have the original SystenUI.odex and SecSettings.odex files that used to be attributed to them before i deodexed them? Can I simply reuse those without having to run through the adb process?
Thanks,
Didact74 said:
Great, thank you for the detailed response. Last question.
What if I have the original SystenUI.odex and SecSettings.odex files that used to be attributed to them before i deodexed them? Can I simply reuse those without having to run through the adb process?
Thanks,
Click to expand...
Click to collapse
But, you deodexed them to edit the smali files in the classes.dex right? So, no, you will need to use the new odex files that are created from the modded deodexed files you used..
If you never edited any of the smali files, then you didn't need to deodex in the first place... you only need to deodex in order to mod the smali files - everything else in the apk can be modded as is on odexed systems.
Sent from my phone's mind
Thank you very much. Can you repost the wrapper file? Its not downloading correctly.
Didact74 said:
Thank you very much. Can you repost the wrapper file? Its not downloading correctly.
Click to expand...
Click to collapse
Updated the link in Post #2 with a zip file - you need to unzip it first then move it.
Thank you.
So I am getting an error trying to re-odex. See the attached image of the error.
Weird thing is that even though I get an error it still creates the new.odex file. I triedto go through the entire process even though I was getting errors and it just got stuck on the boot screen and never loaded. Anything in my error attached raise any flags?
Thanks,
Didact74 said:
Thank you.
So I am getting an error trying to re-odex. See the attached image of the error.
Weird thing is that even though I get an error it still creates the new.odex file. I triedto go through the entire process even though I was getting errors and it just got stuck on the boot screen and never loaded. Anything in my error attached raise any flags?
Thanks,
Click to expand...
Click to collapse
Hmmm... First thing I can think of is: are all of those framework files in the bootclass path that you used actually in your /framework folder? With our A2, in ICS there are a few extra .jar files listed that were not actually on our phone, so I had to remove those from the path...
I will try to make a new odex myself and make sure that's not a standard error message... @Fall of Enosis, you recall what it spits out?
EDIT: Shoot - forgot I'm deodexed right now... will attempt later or hear back from Fall by then..
alteredlikeness said:
Hmmm... First thing I can think of is: are all of those framework files in the bootclass path that you used actually in your /framework folder? With our A2, in ICS there are a few extra .jar files listed that were not actually on our phone, so I had to remove those from the path...
I will try to make a new odex myself and make sure that's not a standard error message... @Fall of Enosis, you recall what it spits out?
EDIT: Shoot - forgot I'm deodexed right now... will attempt later or hear back from Fall by then..
Click to expand...
Click to collapse
Yes, all .jar files listed in my bootclass were located in the framework directory.
Nevermind...my mistake. I had an issue with my files not being deodexed correctly from the start. I went back and deodexed, made the edits to res and smali then odexed using the method above again and all went well!
Thanks!

Categories

Resources