I realise that this subject already has multiple threads, but many of them do not include proper instructions, and are therefore hard to understand for users who are not familiar with Smali and other more complicated Android terminology.
This guide will help you to restore functionality similar to the Galaxy S4 and earlier models, by changing the new Recent Apps softkey back to menu, and restoring the long-press of the home button to the recent apps switcher. Unlike most other modifications that achieve this, the home button long press retains it's haptic feedback.
Before beginning, you need the following:
- Rooted Galaxy S5. Should work on all variants but I have personally tested on the G900I and G900F
- PC with Windows (Can obviously be done on Linux or OSX, but for this tutorial I will be using Windows)
- ADB Drivers for Samsung (HERE)
- Deodexed rom. I don't think this will work with an Odexed rom, as you won't be able to mod android.policy.jar
- ES File explorer, ADB or any file manager capable of editing files in root.
- ADB (Go HERE)
- JDK (Go HERE)
- Smali & Backsmali (Will be covered further down, Download from HERE)
- WinRar, 7zip or other program capable of unzipping JAR files
You do not need Xposed framework for this to work, making it compatible with Android 5+
I have tested this as working on the following devices & Android versions:
G900I: Android 5.0 (TW), Android 4.4.2 (TW)
G900F: Android 4.4.2 (TW)
Right, lets get started.
First, the easy part. For the ease of this guide I'll be using ES File Explorer to make changes, but if you are comfortable with ADB push/pull you can use that, or any other root file explorer.
Connect your phone to your computer, making sure USB debugging is enabled (Settings > Developer Options > USB Debugging)
Run ADB with your device connected (Navigate to the directory it's installed in in a command prompt window). If you don't have it, download this and install it.
Now, issue the following commands:
adb shell After a second you should see [email protected]:/ $
Now, type su and hit enter. You will likely have to grant superuser access on your device.
Now you can issue mount -o remount,rw /system to allow us to save the modifications we make back to the system partition.
Hit Control-C on the command prompt window to exit ADB, but leave the window open and the device connected.
Back on the phone, open ES File Explorer. If you haven't already you will need to go to Tools and enable 'Root Explorer' and grant superuser access.
Now, navigate to the root directory by tapping the directory you are in to bring up the history window, then tapping '/ Device'. Then go to system/usr/keylayout
Edit the file 'Generic.kl' by tapping it, opening as text (Use ES Note Editor), tapping the three dots in the top right and selecting 'Edit'
Scroll just past halfway to find the following section, And edit the line in red to MENU (It should originally be APP_SWITCH)
Code:
key 224 BRIGHTNESS_DOWN
key 225 BRIGHTNESS_UP
key 226 HEADSETHOOK
# samsung
key 252 USER
# samsung
[COLOR="Red"]key 254 MENU[/COLOR]
key 256 BUTTON_1
key 257 BUTTON_2
key 258 BUTTON_3
key 259 BUTTON_4
Save the file and repeat the above steps to edit the file 'gpio-keys.kl' changing the same thing at the bottom of the file (Changing APP_SWITCH to MENU).
Now for the more difficult part. Back on your PC, in the command prompt window type adb pull /system/framework/android.policy.jar you should now have a file called 'android.policy.jar' in your ADB directory. Copy it to a new folder somewhere on your computer.
In the folder with android.policy.jar, place smali-X.X.X.jar and baksmali-X.X.X.jar. Links to these files are at the top of the post.
Now, using WinRar or similar, extract the file 'classes.dex' from android.policy.jar and place it in the same folder as the jar itself.
Shift-rightclick in the folder holding smali, baksmali and classes.dex and select 'Open command window here'. This should open a new CMD window, in it type java -jar baksmali-2.0.5.jar -o out classes.dex (If you have a different version of baksmali, change the command accordingly)
You should now have a new folder called out. Navigate to \out\com\android\internal\policy\impl and then edit the file 'PhoneWindowManager.smali' with your favourite text editor. I recommend Notepad++ but you could get away with Notepad.
Now, there are a few different things that might need to be changed here. Online I have found many recommendations that say to change a line with if-ne v2, v5, :cond_6 however this did not work for me. If the first option does not work, try the second.
First, search for a section that looks like this:
Code:
iget v2, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mLongPressOnHomeBehavior:I
if-eqz v2, :cond_0
iput-boolean v5, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHomeConsumed:Z
const/4 v2, 0x0
invoke-virtual {p0, v2, v4, v4}, Lcom/android/internal/policy/impl/PhoneWindowManager;->performHapticFeedbackLw(Landroid/view/WindowManagerPolicy$WindowState;IZ)Z
iget v2, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mLongPressOnHomeBehavior:I
[COLOR="red"]if-ne v2, v5, :cond_6[/COLOR]
invoke-direct {p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->toggleRecentApps()V
and remove the line that is highlighted in red. If you don't have this line, don't worry, neither did I. Instead, look for this:
Code:
iput-boolean v2, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHomeConsumed:Z
const/4 v0, 0x0
invoke-virtual {p0, v0, v1, v1}, Lcom/android/internal/policy/impl/PhoneWindowManager;->performHapticFeedbackLw(Landroid/view/WindowManagerPolicy$WindowState;IZ)Z
iget v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mLongPressOnHomeBehavior:I
[COLOR="red"]if-ne v0, v2, :cond_1d[/COLOR]
invoke-direct {p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->toggleRecentApps()V
goto :goto_a
And remove the red line. For me, it was on line #2547.
If you do not have either of these lines, PM me or reply with your PhoneWindowManager.smali along with what rom, version and variant of the S5 you have and I'll try to locate the correct line for you, then add it to the OP.
Now you need to recompile it and load it back on to your phone. To do this, save the PhoneWindowManager.smali if you haven't already. Now back out of the folders you are in until you are in the folder with out, Baksmali, smali, etc in it.
Rename the file 'classes.dex' to 'classes.dex.bak', this way we can restore from a backup if anything goes wrong.
Now open a command window again (Either use the one you had from before or open a new one with Shift-rightclick > Open new command window) and type java -jar smali-2.0.5.jar out -o classes.dex (If you have a different version of smali, change the command accordingly)
This should create a new classes.dex file, you can now open the android.policy.jar with WinRar again, and replace the classes.dex inside with the one that you just recompiled. Copy this android.policy.jar file back on to your phone, placing it on the root of the SD card like you would any other file. It is possible to use ADB push, however I had issues with it.
Back on the phone in ES File Explorer, go to your SD card where you just pasted the android.policy.jar and copy it. Then go to /system/framework and remove the existing android.policy.jar before pasting the new one.
Done! Reboot into recovery, wipe cache, boot your phone. It WILL take some time to boot back up, possibly upwards of 10-15min, and will say 'Android is upgrading' upon first boot. Don't take the battery out or force reboot the phone unless you are sure it's not working.
If anyone has any issues, let me know in a reply and I'll try to help. Likewise, if your phone no longer boots or you want to restore it to how it was before, I'll create an undo tutorial if required.
If I've missed anything or made some obvious typos, correct me
Credits:
In no way did I come up with all this without help, I spent a fair bit of time looking around to find all this information. If anyone thinks I've ripped off their work here, tell me and I'll give due credit.
I use Xposed addition to do that, but thank you
The point is that xposed doesn't work on stock Samsung lollipop devices yet.
Sent from my SM-G900F using XDA Free mobile app
Yeah, it works for Lollipop Touchwiz roms, and although it's not a big deal I found that the Xposed module did not have haptic feedback for opening the recents menu.
kaise123 said:
I realise that this subject already has multiple threads, but many of them do not include proper instructions, and are therefore hard to understand for users who are not familiar with Smali and other more complicated Android terminology.
This guide will help you to restore functionality similar to the Galaxy S4 and earlier models, by changing the new Recent Apps softkey back to menu, and restoring the long-press of the home button to the recent apps switcher. Unlike most other modifications that achieve this, the home button long press retains it's haptic feedback.
Before beginning, you need the following:
- Rooted Galaxy S5. Should work on all variants but I have personally tested on the G900I and G900F
- PC with Windows (Can obviously be done on Linux or OSX, but for this tutorial I will be using Windows)
- ADB Drivers for Samsung (HERE)
- Deodexed rom. I don't think this will work with an Odexed rom, as you won't be able to mod android.policy.jar
- ES File explorer, ADB or any file manager capable of editing files in root.
- ADB (Go HERE)
- JDK (Go HERE)
- Smali & Backsmali (Will be covered further down, Download from HERE)
- WinRar, 7zip or other program capable of unzipping JAR files
You do not need Xposed framework for this to work, making it compatible with Android 5+
I have tested this as working on the following devices & Android versions:
G900I: Android 5.0 (TW), Android 4.4.2 (TW)
G900F: Android 4.4.2 (TW)
Right, lets get started.
First, the easy part. For the ease of this guide I'll be using ES File Explorer to make changes, but if you are comfortable with ADB push/pull you can use that, or any other root file explorer.
Connect your phone to your computer, making sure USB debugging is enabled (Settings > Developer Options > USB Debugging)
Run ADB with your device connected (Navigate to the directory it's installed in in a command prompt window). If you don't have it, download this and install it.
Now, issue the following commands:
adb shell After a second you should see [email protected]:/ $
Now, type su and hit enter. You will likely have to grant superuser access on your device.
Now you can issue mount -o remount,rw /system to allow us to save the modifications we make back to the system partition.
Hit Control-C on the command prompt window to exit ADB, but leave the window open and the device connected.
Back on the phone, open ES File Explorer. If you haven't already you will need to go to Tools and enable 'Root Explorer' and grant superuser access.
Now, navigate to the root directory by tapping the directory you are in to bring up the history window, then tapping '/ Device'. Then go to system/usr/keylayout
Edit the file 'Generic.kl' by tapping it, opening as text (Use ES Note Editor), tapping the three dots in the top right and selecting 'Edit'
Scroll just past halfway to find the following section, And edit the line in red to MENU (It should originally be APP_SWITCH)
Code:
key 224 BRIGHTNESS_DOWN
key 225 BRIGHTNESS_UP
key 226 HEADSETHOOK
# samsung
key 252 USER
# samsung
[COLOR="Red"]key 254 MENU[/COLOR]
key 256 BUTTON_1
key 257 BUTTON_2
key 258 BUTTON_3
key 259 BUTTON_4
Save the file and repeat the above steps to edit the file 'gpio-keys.kl' changing the same thing at the bottom of the file (Changing APP_SWITCH to MENU).
Now for the more difficult part. Back on your PC, in the command prompt window type adb pull /system/framework/android.policy.jar you should now have a file called 'android.policy.jar' in your ADB directory. Copy it to a new folder somewhere on your computer.
In the folder with android.policy.jar, place smali-X.X.X.jar and baksmali-X.X.X.jar. Links to these files are at the top of the post.
Now, using WinRar or similar, extract the file 'classes.dex' from android.policy.jar and place it in the same folder as the jar itself.
Shift-rightclick in the folder holding smali, baksmali and classes.dex and select 'Open command window here'. This should open a new CMD window, in it type java -jar baksmali-2.0.5.jar -o out classes.dex (If you have a different version of baksmali, change the command accordingly)
You should now have a new folder called out. Navigate to \out\com\android\internal\policy\impl and then edit the file 'PhoneWindowManager.smali' with your favourite text editor. I recommend Notepad++ but you could get away with Notepad.
Now, there are a few different things that might need to be changed here. Online I have found many recommendations that say to change a line with if-ne v2, v5, :cond_6 however this did not work for me. If the first option does not work, try the second.
First, search for a section that looks like this:
Code:
iget v2, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mLongPressOnHomeBehavior:I
if-eqz v2, :cond_0
iput-boolean v5, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHomeConsumed:Z
const/4 v2, 0x0
invoke-virtual {p0, v2, v4, v4}, Lcom/android/internal/policy/impl/PhoneWindowManager;->performHapticFeedbackLw(Landroid/view/WindowManagerPolicy$WindowState;IZ)Z
iget v2, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mLongPressOnHomeBehavior:I
[COLOR="red"]if-ne v2, v5, :cond_6[/COLOR]
invoke-direct {p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->toggleRecentApps()V
and remove the line that is highlighted in red. If you don't have this line, don't worry, neither did I. Instead, look for this:
Code:
iput-boolean v2, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHomeConsumed:Z
const/4 v0, 0x0
invoke-virtual {p0, v0, v1, v1}, Lcom/android/internal/policy/impl/PhoneWindowManager;->performHapticFeedbackLw(Landroid/view/WindowManagerPolicy$WindowState;IZ)Z
iget v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mLongPressOnHomeBehavior:I
[COLOR="red"]if-ne v0, v2, :cond_1d[/COLOR]
invoke-direct {p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->toggleRecentApps()V
goto :goto_a
And remove the red line. For me, it was on line #2547.
If you do not have either of these lines, PM me or reply with your PhoneWindowManager.smali along with what rom, version and variant of the S5 you have and I'll try to locate the correct line for you, then add it to the OP.
Now you need to recompile it and load it back on to your phone. To do this, save the PhoneWindowManager.smali if you haven't already. Now back out of the folders you are in until you are in the folder with out, Baksmali, smali, etc in it.
Rename the file 'classes.dex' to 'classes.dex.bak', this way we can restore from a backup if anything goes wrong.
Now open a command window again (Either use the one you had from before or open a new one with Shift-rightclick > Open new command window) and type java -jar smali-2.0.5.jar out -o classes.dex (If you have a different version of smali, change the command accordingly)
This should create a new classes.dex file, you can now open the android.policy.jar with WinRar again, and replace the classes.dex inside with the one that you just recompiled. Copy this android.policy.jar file back on to your phone, placing it on the root of the SD card like you would any other file. It is possible to use ADB push, however I had issues with it.
Back on the phone in ES File Explorer, go to your SD card where you just pasted the android.policy.jar and copy it. Then go to /system/framework and remove the existing android.policy.jar before pasting the new one.
Done! Reboot into recovery, wipe cache, boot your phone. It WILL take some time to boot back up, possibly upwards of 10-15min, and will say 'Android is upgrading' upon first boot. Don't take the battery out or force reboot the phone unless you are sure it's not working.
If anyone has any issues, let me know in a reply and I'll try to help. Likewise, if your phone no longer boots or you want to restore it to how it was before, I'll create an undo tutorial if required.
If I've missed anything or made some obvious typos, correct me
Credits:
In no way did I come up with all this without help, I spent a fair bit of time looking around to find all this information. If anyone thinks I've ripped off their work here, tell me and I'll give due credit.
Click to expand...
Click to collapse
How do I remap longpress menu or double tap menu button to lock screen, long press back key to kill foreground app and double tap back key switch previous app??
slimshouki said:
How do I remap longpress menu or double tap menu button to lock screen, long press back key to kill foreground app and double tap back key switch previous app??
Click to expand...
Click to collapse
I am out and about at the moment so I can't sit down and look at the files in detail, however I'm not sure how to remap long-press actions off the top of my head. I can think of a couple of workarounds though.
For the long press/double tap menu button to lock screen, this can be achieved via an app. Apps that have device administrator access are able to perform actions like locking the screen, so anything that runs in the background and has an action for long pressing menu can be set as the default action, and therefore lock the screen. The easiest way I can think of doing this is to install the app Greenify (https://play.google.com/store/apps/details?id=com.oasisfeng.greenify&hl=en) and then hold your menu button down. It should ask if you want to complete the action with Greenify (Hibernate + Lock screen), and that will lock your screen if set as default.
For killing an app with a long press of the home button, I don't believe there is a default way of assigning this to a button via any of the built in files, either. You would need to find an app or mod which enables it. You can install this (http://www.mediafire.com/download/p8rtci9bttn14s7/Hold_Back_To_Kill_v1.0.apk) and give it a shot (You'll need Unknown sources enabled and a rooted device). It should do what you're looking for.
As for double tapping the back button to switch to your last app, I'm out of ideas. Maybe someone else around the forums can help here.
As far as I'm aware, the keymapping files can only customise buttons to do things that the keys on the phone are already capable of, so switching the menu to recents is possible, and so is moving recents to long press of home, but adding things beyond this (Like killing apps, etc) is only possible with additional software that is beyond my ability to code.
Good luck, and if you find any other solution to this please let me know and I'll add it to the OP incase anyone else wants to know how to do it.
I do everything exactly like in 1 post.
I managed to do smaling.
Copied modified android.policy.jar back to phone, phone restarts, Android is upgrading.
Short press works, but after long-press there is no recent apps switcher, instead I get google now search and s search at the same time.
I'm 99% sure I made everything correct, cause I made it on my 2 phones (G900F and G900FD) and the result is the same.
@tdunham could you please help or anybody
kold11 said:
I do everything exactly like in 1 post.
I managed to do smaling.
Copied modified android.policy.jar back to phone, phone restarts, Android is upgrading.
Short press works, but after long-press there is no recent apps switcher, instead I get google now search and s search at the same time.
I'm 99% sure I made everything correct, cause I made it on my 2 phones (G900F and G900FD) and the result is the same.
@tdunham could you please help or anybody
Click to expand...
Click to collapse
This is supposed to make long pressing your home button bring up the recent apps switcher, not long pressing the menu button. Did you try that?
Good
Thanks a lot for answer.
You are right, my bad.
Home key brings recent apps.
But I think there is one important step missing for little experienced users (like me):
You have to change android.policy.jar permissions, cause my phone freaked out without it.
Wysłane z mojego SM-G900FD przy użyciu Tapatalka
Related
Short step by step write-up about how I changed the status bar clock color to red (because I like red )
NOTE BEFORE YOU START:
Standard disclaimer, I don't guarantee anything that might happen after following these steps, and I mean anything!! These steps worked for me and I have tried to include every minute step! My phone is running CM 3.9.9.1 but this should theoretically work on any ROM. But no guarantees.
1. Connect phone using USB and check that you can see your device using: adb devices
2. in your SDK/tools directory from command line do: adb pull /system/framework/services.jar services.jar
3. Make a backup of the services.jar file that just popped in the tools folder just in case!
4. Download smali and baksmali from http://code.google.com/p/smali/ and place them in the tools folder. Rename the files to baksmali.jar and smali.jar to save on typing later
5. Open the services.jar file with something such as winrar or 7zip or whatever you prefer
6. Copy out the classes.dex file to your SKD/tools folder
7. run following from command line: java -jar baksmali.jar -o classout/ classes.dex
8. Now browse to your new folders classout/com/android/server/status
9. Open the file StatusBarIcon.smali in something like notepad or context or any text editor
10. Locate a line that says: .line 46, under this line it should have something like:
const/high16 v6, -0x100
11. Change this to say: const/high16 v6, -0x1
12. Save the file
13. Now back to the command line and from your SDK/tools folder run: java -Xmx512M -jar smali.jar classout/ -o new-classes.dex
14. If the above finishes without errors you should have a file called new-classes.dex in your SDK/tools folder now that is the same size as your classes.dex file.
15. Rename the old classes.dex file to classes-old.dex and rename the new-classes.dex file to classes.dex
16. Open the services.jar file with your archiving tool again from step 5 and replace the existing classes.dex file with our new classes.dex we just created.
17. From command line run: adb remount
18. also from command line: adb push services.jar /system/framework/
19. Finally run: adb shell reboot
Your phone should now restart and after being very very patient (5+ mins i've had) the phone starts and your clock is now Red =o)))
Hope this worked out for you, too tired to change the other texts now...need sleep
.FxN
ps. Thanks to Cyanogen (in general), XDA-developers and this thread so; Ohsaka and mianosm and JF
nice... will try it out latter today... what would be the code for white color text? does this also modifies notification fonts?
To change it to white just change this line:
const/high16 v6, -0x100
to
const v6, -0x1
And for the date where is the line?
superatmel said:
And for the date where is the line?
Click to expand...
Click to collapse
date is in layout, status_bar.xml
Great write up! My problem is the OS I'm using uses odex files. I'm assuming the part I need to modify is in that file since my services.jar does not have classes.dex and its file size is only 1k. Do you know how to modify the odex file?
.line 45
.local v2, layoutParams:Landroid/widget/LinearLayout$LayoutParams;
const/high16 v6, 0x4180
invoke-virtual {v4, v6}, Landroid/widget/TextView;->setTextSize(F)V
.line 46
const v6, -0xe0e0f
invoke-virtual {v4, v6}, Landroid/widget/TextView;->setTextColor(I)V
.line 47
Click to expand...
Click to collapse
Ok, I got this far, and this is what I see... Which one is the color? And how do I find the codes for other colors? My clock is white right now... Want to change that...
zapote21 said:
Ok, I got this far, and this is what I see... Which one is the color? And how do I find the codes for other colors? My clock is white right now... Want to change that...
Click to expand...
Click to collapse
const/high16 v6, 0x4180 is the color dude, it was answered in the post when some asked whats the code for the color white.
setzer715 said:
Great write up! My problem is the OS I'm using uses odex files. I'm assuming the part I need to modify is in that file since my services.jar does not have classes.dex and its file size is only 1k. Do you know how to modify the odex file?
Click to expand...
Click to collapse
I have same problem: no classes.dexfile in services.jar, any ideas how to proceed?
Thanks fxn, worked for my Donut theme.
If you guys need help deodexing, I have a theme thread with full howto (including a link here) to help you out. Post #2 has it all.
thnx for this nice thread. i got a request. cud u plz tell me which line to edit to get clock in white in HERO rom?? i am editing rom for my HTC Hero and want to have the clock in White which is in black now. cheers
FxN: hi bro cud u plz tell me which file to edit to get black colored clock in status bar of Hero?? it wud be really appreciated. cheers
attached a zip containing statusbaricon.smali and statusbarservices.smali from hero
fxn said:
To change it to white just change this line:
const/high16 v6, -0x100
to
const v6, -0x1
Click to expand...
Click to collapse
I tried you directions and was able to change my clock, but I wanted it to be white, but what you wrote in the quoted post is the same thing you said to to change it to red as now I have a red clock. How do I get it to be white?
help with classout
On a mac, I keep getting "unable to access jarfile" when I enter:
java -jar Users/names/Desktop/android-sdk-mac_86/tools/baksmali.jar -o classout/ classes.dex
Any idea what I'm doing wrong here?
Is this thread still active? Ive got issues with deodexing services.odex file. The problem is, it wont Deodex.
aupeters said:
On a mac, I keep getting "unable to access jarfile" when I enter:
java -jar Users/names/Desktop/android-sdk-mac_86/tools/baksmali.jar -o classout/ classes.dex
Any idea what I'm doing wrong here?
Click to expand...
Click to collapse
i get the same thing but i'm on win 7
i do
C:\Android\AndroidSDK\tools>java -jar baksmali.jar -0 classout/ classes.dex
Invalid or corrupt jarfile baksmali.jar
I downloaded the baksmali (wrapper script) and went to rename and put a .jar at the end of the name.
please help...
I tried grab and use services.jar from another rom which has white clock...
also I tried this tutorial, but I can't get my clock to white...
I'm using samsung spica...
MFK DGAF said:
i get the same thing but i'm on win 7
i do
C:\Android\AndroidSDK\tools>java -jar baksmali.jar -0 classout/ classes.dex
Invalid or corrupt jarfile baksmali.jar
I downloaded the baksmali (wrapper script) and went to rename and put a .jar at the end of the name.
Click to expand...
Click to collapse
Try downloading Avabox...In the smali folder there is a folder called backsmali which has the files in it. Just take off the -1.1 at the end. These worked for me.
NisseGurra said:
I have same problem: no classes.dexfile in services.jar, any ideas how to proceed?
Click to expand...
Click to collapse
i have the same problem
Hi all,
im using Sms unread count widget from long time, but now i want to edit it a bit...
I've found this post in the forum http://forum.xda-developers.com/showthread.php?t=1226906 that explain how to edit .png file to change the orange highlight when pressing it.. but I have some troubles when im going to repack the apk.. (apktool says that the png is malformed :/)
the second thing is the color of the notification icon: it's red, and i want to change that color;
Someone already did it in this thread http://forum.xda-developers.com/showthread.php?t=1068950 , but it seems dead (the thread )
anyone could help me?
well, after one day of hard (!) work, I solved my problems...
Sharing my procedure for the community:
1. ApkTools:
The first thing to do is to decompile the .apk. And isnt that simple at it seems, becouse apktools needs some steps before working correctly:
1.a install jdk x86 (if you got x64 you need to uninstall and install the x86 version);
1.b add the paths for jdk (or prompt wont recognize your "java" commands);
1.c go to apktools folder with ms-prompt and type: "apktool if framework-res.apk";
Now apktools would work correctly.
To decompile our apk (for example sms.apk) we just need to write "apktools d sms.apk sms\"
2. Find the correct file and do the right change.
Not that easy. The decompiled files arent in java language but a sort of "machine language".. btw it's not that hard to understand.
My file is named "BadgeIcon.smali".. obviously it contains the instruction for drawning the badge.
After reading the code, looking for the words "color" and "round" or something that draw a red circle, i've found that:
Code:
.line 318
const/16 v9, 0xf0
const/4 v10, 0x0
const/4 v11, 0x0
invoke-static {v9, v10, v11}, Landroid/graphics/Color;->rgb(III)I
move-result v9
.line 319
const/16 v10, 0xa0
const/4 v11, 0x0
const/4 v23, 0x0
move/from16 v0, v23
invoke-static {v10, v11, v0}, Landroid/graphics/Color;->rgb(III)I
those 3 variables are the hex value of two rgb colors (the badge got a little dark shadow at bottom). So just change those values. Care about the const/16 and const/4 declaration.. const/4 is just for 0 value, if you change fo another value put const/16.
Save and exit.
3. Change the .9.png's for the pressed/focused shadow.
Regarding this you will discover that .9.png are a bit hard to modify without getting some errors. Here on the forum i've found lots of threads with lots of different methods to edit them. The simplest is this one: http://forum.xda-developers.com/showthread.php?t=1439208
really simple and it works!
So I've edited my two png's and saved.
4. Recompile the apk.
Got some troubles on this step, becouse my apktool wasnt configured that well.. but if you follow step 1 you should be ok.
Just write "apktool b sms\"
2 new directories appears in sms\ folder, and in the one named dist\ you'll find the apk.
5. Sign the apk.
Before installing the apk, you need to sign it, or android wont install it.
A good tool is that one: http://forum.xda-developers.com/showthread.php?t=1125626
Simple and quick. Just do the test signature and you can copy the apk to your phone and install.
That's all!
I've gotten this question a few times in the SuperSix thread so I decided i'd post this as its own to make it easier to find an search
(mods can move or delete this thread as needed)
So first thing to know about the Boomsound icon in the status bar, it's not referred to as boomsound anywhere in the smali, it's still referenced as the beats icon, because it honestly is just with a different coat of paint.
what you'll need:
APKTOOL (i'm not going to spend time on how to decompile and all that)
Text editor of some sort, I love me some Notepad ++
Deodex'd rom
Grab the Framework.jar from your rom and decompile it, then open your smali folder and navigate to
smali\android\media\AudioService$HTCBeatsEffect.smali
look for the following
HTML:
.method public showBeatsIcon(I)V
.locals 6
.param p1 # I
const/4 v5, 0x1
const/4 v4, 0x0
const/4 v3, 0x0
iget-boolean v0, p0, Landroid/media/AudioService$HtcBeatsEffect;->mNotificationOn:Z
if-eqz v0, :cond_0
iget v0, p0, Landroid/media/AudioService$HtcBeatsEffect;->mIconId:I
if-eq v0, p1, :cond_1
Change to:
const/4 v5, 0x0
it will look something like this:
HTML:
.method public showBeatsIcon(I)V
.locals 6
.param p1 # I
const/4 v5, 0x0
const/4 v4, 0x0
const/4 v3, 0x0
iget-boolean v0, p0, Landroid/media/AudioService$HtcBeatsEffect;->mNotificationOn:Z
if-eqz v0, :cond_0
iget v0, p0, Landroid/media/AudioService$HtcBeatsEffect;->mIconId:I
if-eq v0, p1, :cond_1
recompile, sign, and either push or flash it how you please.
Credit goes to @Gumby63 for finding the kill switch.
Devs and Chef's if this helped feel free to include it in your roms, and credit as you see fit (we'd def appreciate it though)
Boomsound icon removal walkthrough for Noobs like me
I don’t know about you, but I don’t find the Boomsound icon to be necessary. I can’t turn off Boomsound when using the phone’s speakers, and I don’t need an icon to tell me sound is playing because I HAVE FUNCTIONAL EARS. Here is an amazingly long tutorial to make a seemingly simple change (a single “1” becomes a “0” in the framework.jar system file), consolidating information from about 8 different sources I had to find via Google and XDA searching. I hope it benefits someone out there who is in the same boat I was!
Basic disclaimer: I take no responsibility for anything you choose to do to your phone based on these instructions. I can only say for sure that this worked for me on my Sprint HTC One (M8). Please make a nandroid backup through your recovery before starting just in case you mess anything up. Credit goes to thoughtlesskyle for the short tutorial he provided for me to build around and get this mod accomplished! Credit also goes to aguha1044 for his post from 29 August 2012 that I used to figure out the need for JDK and the CMD commands needed to decompile/recompile. Credit goes to Google and XDA for the information leading me to the baksmali/smali files somehow. Credit goes to me for deducing the adb push command with a lucky semi-educated guess.
Basic prerequisites (If you have questions about this part, you’re probably not ready for this mod):
i. Install ADB Tools (Android SDK). See here: http://developer.android.com/sdk/index.html
ii. Be unlocked and rooted. See here: http://forum.xda-developers.com/showthread.php?t=2709980
iii. Be S-Off. See here: http://firewater-soff.com/instructions/
Now to the details of actually removing that annoying icon:
Download APKTool here: https://code.google.com/p/android-apktool/downloads/list
For Windows, you need the first two download links.
Unzip them to a folder on your C: drive. I used C:\miniadb_m8\, which I will reference hereafter. You don’t need to do anything with them at this point; they just need to be here.
Download Java Development Kit (JDK) here: http://www.oracle.com/technetwork/java/javase/downloads/jdk-netbeans-jsp-142931.html
Accept the license agreement.
Use the 5th link if you’re on 64-bit Windows, or the 4th link if on 32-bit Windows.
It’s 261 MB, so have a snack. Once it’s downloaded, install it. Have dinner while you wait.
Download Baksmali/Smali files here: https://code.google.com/p/smali/downloads/list
I’m honestly not sure which are actually necessary, but download all 4 files and save them in the same folder from earlier (e.g., C:\miniadb_m8\)
Go to C:\minadb_M8\ (or whatever folder you’re using) in Windows. Hold Shift while you Right Click an empty area in that window (with nothing selected beforehand), and select “Open command window here.” (This option only appears if you hold Shift when you right click.)
You should see the command window, showing C:\miniadb_m8\
Connect your phone via USB. Make sure you have USB Debugging enabled (Settings --> Developer Options (you should have gotten this while rooting) –> USB Debugging).
In the command window, type:
adb pull /system/framework/framework.jar C:\miniadb_m8
Last part is the folder you’ve been using, where the file will be saved. Yes, the direction of the slashes is important!
apktool d framework.jar mod
“mod” is a folder that will be created to decompile the framework.jar into within the C:\miniadb_m8\ folder where you’re working.
Go to: C:\miniadb_m8\mod\smali\android\media\ and open the file “AudioService$HtcBeatsEffect.smali” with Notepad. Don’t let Windows search for a program to open it. Browse manually and choose Notepad.
See thoughtlesskyle’s post above this one for the tiny edit you need to make. It’s about 80% of the way towards the bottom of the file when browsing in Notepad. You can use Ctrl+F and search for “.method public showBeats” to find it quickly.
Go back to C:\miniadb_M8\ and delete the old framework.jar file (you don’t need it anymore and you’re about to create a new one with the modified value you just changed; or you can rename it to save it as a backup if you really want).
Back in the command window, type:
apktool b mod framework.jar
This recompiles the file you decompiled in order to modify it. You should now see a new framework.jar file in C:\miniadb_m8\, which was created from the mod folder you were buried in when you modified that “AudioService$HtcBeatsEffect.smali“ file. This is the one you’re going to put back in your phone.
adb push C:\miniadb_m8\framework.jar /system/framework/framework.jar
This replaces the original framework.jar file on your device with the one you just modified.
Restart your device. You’ll see a screen like you would see after an OTA update (Updating Android files… X/311… or whatever). Once you’re booted up, run anything that plays audio from your phone speakers, and admire the now-cleaner status bar without that annoying Boomsound icon!
Does this also disable the Beats icon if you have that option enabled in default.xml?
Captain_Throwback said:
Does this also disable the Beats icon if you have that option enabled in default.xml?
Click to expand...
Click to collapse
I don't see why it wouldn't, I haven't looked though
apparently @bimmerbot tested the beats effect and found this mod also killed that as well
Ok i think the most here knows the cool low.ram feature in newer Android roms,but in some cases its not used because
it can have issues with the transperancy in statusbar.
So most user need to deceide to have lowram but no great looking transparent statusbar,or in other case have trans statusbar but no lowram.
Here is a sollution to have low.ram feature in case you need it as alone,or when need both,im not sure its working on all devices and roms,its tested
on some different devices on different roms,but thats no garanty for 100%,please do it only when you have a lil knowledge
about this stuff,there is a high failrisk for beginner,so dont cry and learn by doing.
------
First, we need:
- Android device with rooted 4.4+ rom,deodexed.
- A nandroid backup,just in case
- Apktool or any thing like that and the knowledge to use it
- Notepad++ (on Windows)
- Its better to wipe dalvik before reboot the system when done.
------
Ok, so let's start:
Step 1:
Copy these files from your phone to your computer:
/system/framework/framework.jar
/system/priv-app/SystemUI.apk
/system/build.prop
------
Step 2:
open build.prop in notepad++, find this line:
"ro.config.low_ram="
if it say "true", skip to step 4 ,if it say "false", just change to "true" and reboot your phone,
if you can not find this line, or nothing change after you changed it to "true" and reboot, follow step 3.
------
Step 3:
(force enable low Ram)
Add this line to your build.prop:
"ro.config.low_ram.mod=true"
-------
Now use apktool etc. to decompile your framework.jar.
Navigate to \framework.jar.out\smali\android\app\ActivityManag er.smali, open it in notepad++ and find this line:
"ro.config.low_ram"
and change it to:
"ro.config.low_ram.mod"
-------
Compile it and move it back to your phone to replace the old one with it.Wipe dalvik and reboot,done.
-------
Step 4:
(force enable status bar transparent)
Decompile SystemUI.apk
Navigate to \SystemUI\smali\com\android\systemui\statusbar\phone\BarTransitions.smali and find these line:
"invoke-static {}, Landroid/app/ActivityManager;->isHighEndGfx()Z"
move-result v0
------
Change it to:
"const/4 v0, 0x1"
-------------
Compile it and do it on your phone to replace the old one with it.
Wipe dalvik and reboot your phone,done.
--------
WHEN YOU HAVE LUCK AND HAVE DONE IT RIGHT,THAN MAYBE IT LOOKS LIKE THE SECOND
PICTURE BELOW ME,THE FIRST IS BEFORE AND WITH BLACK STATBAR.
--------
AS I SAY BEFORE,I CANT GIVE A GARANTY FOR UNIVERSAL WORK!!!!
HAVE FUN-PRESENTED BY TEAM-OPTIMA!!!!!!!
-CALIBAN666- said:
"ro.config.low_ram"
Click to expand...
Click to collapse
Hey, without de-compile the apk, if you set low_ram in build.prop, then you can go to setting>performance and check the "force graphic high-end" then reboot, and you have again trasparent effects
However as far as i know adding ro.config.lowram it remove trasparent effect from system, no other about ram :'(
this should be a flag that developers can read from their apps and use custom setting for old phone, if they dont use it, there wont be nothing to do
change only "invoke-static {}, Landroid/app/ActivityManager;->isHighEndGfx()Z" to "const/4 v0, 0x1" or "invoke-static {}, Landroid/app/ActivityManager;->isHighEndGfx()Z" and "move-result v0" to "const/4 v0, 0x1"? Another question though does it matter if I have odexed apks and jar? or do I need to deodex them first before compiling?
deodex before
-CALIBAN666- said:
Step 4:
(force enable status bar transparent)
Decompile SystemUI.apk
Navigate to \SystemUI\smali\com\android\systemui\statusbar\phone\BarTransitions.smali and find these line:
"invoke-static {}, Landroid/app/ActivityManager;->isHighEndGfx()Z"
move-result v0
------
Change it to:
"const/4 v0, 0x1"
-------------
Compile it and do it on your phone to replace the old one with it.
Wipe dalvik and reboot your phone,done.
[/COLOR]
Click to expand...
Click to collapse
I don't understand here only. Help me!!
Extended Reboot Menu TW 4.4.2 NG2 ( De-Odexed )
Well as the title states, this is for the STOCK NG2 TW ROM. Although this is De-Odexed, one could possibly use this on an Odexed system as long as same odex file is deleted. One would have to try and see. The Flashable ZIP is made taking into account the user is De-Odexed. I do not recommend flashing to a Custom Rom as the ROM may contain special permissions/policies ( if added ) that the Rom Developer may have implemented or even may have require so the Custom Rom may run or function properly. As the Dev first....
================================================== =================
DISCLAIMER:
================================================== =================
================================================== =================
By YOU, the USER, flashing this file or manually pasting to modify your Android System, YOU understand and know what YOU are doing. I nor anyone will be held liable nor responsible for YOUR doing if your phone bricks. As always, as is suggested by many and myself, please make sure you perform a complete
NANDROID BACKUP
before flashing and/or modifying your OS or the mentioned stock .jar file. I also suggest YOU keep a separate copy of the stock .jar file handy, like in your External SDcard, if the phone decides not to boot up. Knowing this, YOU assume all responsibility for what happens as YOU, the USER, know and comprehend what YOU are doing and understand the consequences or severity of damages that can be brought to your
device by flashing or modifying your OS incorrectly.
You Have Been Warned !!
================================================== =================
What's Needed/Recommended:
Rooted Devise ( to extract the needed files Manually for backup )
Custom Recovery ( TWRP or CWMR/PhilZ for Flashing the ZIP )
Aroma File Browser/Explorer ( file type browser in CWMR/PhilZ Recovery )
If you can do it via ADB Commands then all power to you.....
I provided BOTH , the modded Sprint .jar (android.policy.jar) file and the flashable zip (NG2_4wayrbt.zip) below. If the flashable ZIP does not work for you let me know please.
What To Do:
You have two choices on installing the .jar file. You can either Flash the ZIP in your Custom Recovery or you can use some form of File Explorer via Custom Recovery ( like the Aroma File Explorer for CWMR ) or other means to copy & paste or push the .jar file to system/framework/. If you decide to do this manually, you will then need to set the file permissions to the modified android.policy.jar file to 0644 and/or check mark off as the picture provided below shows using the method chosen through the root permissions it provides. You can rename the "stock" .jar file with " .bak " at the end so you don't have to delete it from the framework folder if you so choose.
Clear " cache " and/or " dalvik cache " ONLY .........after flashing or manually pasting the mod. The flashable clears cache for you already.
Words of caution.....
if you attempt to do this manually and are still actively booted in your Android OS while modifying or deleting the .jar file, there is the highest probability that your phone will immediately reboot and you will not be able to boot up the OS again and remain stuck on the Samsung boot screen as the android.policy.jar is no longer visible to your OS. This is why you need to do this before booting up like in recovery.
================================================== ================= The .jar file is easily modified and the required files are easily found by searching the forums as I have. Use, extract, exhume, etc the files as you choose or please. I only ask to give proper credit. ================================================== =================
Thanks and credits go out to :
@tdunham
@CNexus
for the How-Too and the files needed for this MOD. If I missed providing someone the proper credit then please PM me or let me know.....
ENJOY!
Very nice. Don't forget screenshots.
You should also check out the large guide thread I created for the Galaxy S5.
I'm sure a lot of what's there can be used on the S4 since all the guides are based on 4.4.2 as well.
Link is in my sig (not viewable from the mobile app).
Will do. If I can get the S5 from the wife when she is not looking I will root it and go to town on it........ the S4 was hers until I got her the S5. I'll be jumping into a Note3 pretty soon as well....... just waiting on its arrival.
Also I am extremely sorry for the multiple threads started on the same MOD. Posting all this from my phone owned me.....
Thanks
Manually tested on L720T NG5, works flawlessly
Parkourkid93 said:
Manually tested on L720T NG5, works flawlessly
Click to expand...
Click to collapse
TY sir!
DarkAngel said:
TY sir!
Click to expand...
Click to collapse
You're welcome & thank you for the mod
I had posted this in a PM to another member and thought it may help others as well.
Please feel free to correct me in anything I may have stated incorrectly.
==============================================================================
I put this together on a whim so bare with me......I did use some excerpts from the main thread here but modified it some to include the information for NG2.
Original Thread here: http://forum.xda-developers.com/showpost.php?p=47555330&postcount=2
Okay at this point you stated you can smali, backsmali your own files which is great. I also use Note++ to open the smali files for modification unless you use
another program. From this point it will be a breeze for me to just state the facts from here on.......
Download the following resources files (GlobalActions$99$1.smali, GlobalActions$99$2.smali, GlobalActions$99.smali) [New: new patched resources for
non-working hot reboot option, download newPatchedResources]. These are the Original files if you need them.
Old Resource Files: http://www.mediafire.com/?6atf45l77q2dm5k
New Patched Resource Files: http://www.mediafire.com/?3rb893nzgjhj93n
This is the link for the zip of all the smali files that were modified. Uploaded to my GDrive :
https://docs.google.com/file/d/0B77dgB0lHYfiYTJIWDRITTZSbkE/edit?usp=docslist_api
Now like you asked, one will need to baksmali android.policy.jar with your desired program. I just use ROMToolsPCv3 as I just decompile the classes.dex file
only. I just open the jar file with 7-zip and pull only the classes.dex file and decompile it.
Okay once decompiled, open the classout folder and go to \com\android\internal\policy\impl where all the other GolbalActions$ smali's are located and paste
the three resource files I zipped for you there (GlobalActions$99$1.smali, GlobalActions$99$2.smali and GlobalActions$99), recompile and call it a day.....unless you want to modify the originals
above linked yourself ( New Resource Files) then continue reading below.
Open the GlobalActions.smali and change the GlobalActions$8 text to GlobalActions$99on both lines you see, and save it. You can easily find
it by searching for " mRestart ". Example of the code is below which can also be copied and pasted if you like.
Code:
[B][COLOR=royalblue]from this[/COLOR][/B]
.line 891
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$[COLOR=royalblue]8[/COLOR];
const v1, 0x10809b8
const v2, 0x10401d6
invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$[COLOR=#4169e1]8[/COLOR];-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
[B][COLOR=royalblue]to this[/COLOR][/B]
.line 891
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$[COLOR=royalblue]99[/COLOR];
const v1, 0x10809b8
const v2, 0x10401d6
invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$[COLOR=royalblue]99[/COLOR];-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
Now open GlobalActions$SinglePressAction.smali. Just between line ".end annotation" and "# instance fields", place your cursor and hit enter 2 times
to make room (i.e leave 2 lines empty above "# instance fields" and 2 lines bellow ".end annotation") to paste the code below (Blue one only).
Code:
[B][COLOR=red].end annotation[/COLOR][/B]
[COLOR=royalblue][B]# static fields[/B][/COLOR]
[COLOR=royalblue][B].field protected static rebootMode:I[/B][/COLOR]
[COLOR=royalblue][B].field protected static final rebootOptions:[Ljava/lang/String;[/B][/COLOR]
[B][COLOR=red]# instance fields[/COLOR][/B]
While your still in GlobalActions$SinglePressAction.smali, look for the code "# direct methods" and paste the code bellow (Blue one only):
Code:
[B][COLOR=red]# direct methods[/COLOR][/B]
[COLOR=royalblue][B].method static constructor <clinit>()V[/B][/COLOR]
[COLOR=royalblue][B] .registers 3[/B][/COLOR]
[COLOR=royalblue][B] const/4 v0, 0x4[/B][/COLOR]
[COLOR=royalblue][B] new-array v0, v0, [Ljava/lang/String;[/B][/COLOR]
[COLOR=royalblue][B] const/4 v1, 0x0[/B][/COLOR]
[COLOR=royalblue][B] const-string v2, "Reboot"[/B][/COLOR]
[COLOR=royalblue][B] aput-object v2, v0, v1[/B][/COLOR]
[COLOR=royalblue][B] const/4 v1, 0x1[/B][/COLOR]
[COLOR=royalblue][B] const-string v2, "Hot Reboot"[/B][/COLOR]
[COLOR=royalblue][B] aput-object v2, v0, v1[/B][/COLOR]
[COLOR=royalblue][B] const/4 v1, 0x2[/B][/COLOR]
[COLOR=royalblue][B] const-string v2, "Download"[/B][/COLOR]
[COLOR=royalblue][B] aput-object v2, v0, v1[/B][/COLOR]
[COLOR=royalblue][B] const/4 v1, 0x3[/B][/COLOR]
[COLOR=royalblue][B] const-string v2, "Recovery"[/B][/COLOR]
[COLOR=royalblue][B] aput-object v2, v0, v1[/B][/COLOR]
[COLOR=royalblue][B] sput-object v0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;[/B][/COLOR]
[COLOR=royalblue][B] return-void[/B][/COLOR]
[COLOR=royalblue][B].end method[/B][/COLOR]
[B][COLOR=red].method protected constructor <init>(II)V[/COLOR][/B]
Once done, Recompile (smali) your jar or the classes.dex file, which ever method you had done or prefer. If only doing the classes.dex file, you would only need to copy the modified file into the jar file overwriting the original one.
============================================
Additionally.....
If you want to change the "Extended Reboot Menu" text on top of the popup menu to what ever you like:
- Open the GlobalActions$99.smali you had pasted from the beginning and go to the following code below and make your change.
(Also.... if you delete this entire code, you will disable the head title of "Extended Reboot Menu")
Code:
const-string v2, "Extended Reboot Menu"
invoke-virtual {v1, v2}, Landroid/app/AlertDialog$Builder;->setTitle(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;
move-result-object v1
Also I did not have to change the access$xx or id's as I believe they were coincidentally the same........ I believe........ I just can't remember. To check
just do as it states at the bottom. I hope all this helps. Let me know if you still have questions......
If you are porting to other device, please make sure in GlobalActions$99.smali whether Landroid/content/context has the same access$xx as same in GlobalActions.smali or change it to be like the one in GlobalActions.smali. Also make sure the following ids in GlobalActions$99.smali are pointed to the correct ids in framework-res.apk:
0x104000a = 0x0104000a = "string" name="ok"
0x104 = 0x01040000 = "string" name="cancel"