# A suggestion out to ROM developers for a smoother interface



## CrushD (Dec 29, 2011)

Hello all, just wanted to share a finding of mine to make the interface smoother.

I noticed that when I used the softkeys, animations on screen would stutter. For intance, in ADW I set my Home key to open and close the app drawer and noticed the animation was far more jittery than if using the icon on the dock. I thought it was a problem with ADW, but then I noticed the same issue with Pulse, if I used Back to close an article the interface would be super jittery compared to if I used the in-app button to go back.

So suspicious I turned on the Dev option to see Screen Refreshes, and indeed the navigation key area was going beserk with activity so I decided to edit out the animation out of SystemUI.apk, and lo and behold, by taking out the animation of the glow each time a softkey is pressed, the interface become MUCH MUCH smoother. For those of you looking to make the same change, I set the duration of animations found in KeyButtonView.smali to 0.

So just sharing some good info out to you ROM makers, cut down on the SoftKey animation duration for a smoother interface. (If you guys already knew this, then meh, it's just all the ROMs I've tried I've always seen the same jitteryness).


----------



## winner00 (Jun 6, 2011)

Nice find. I will have to try this out.


----------



## fronc (Aug 18, 2011)

Have you found a happy medium to maintain those slick animations, but not sacrifice performance? Is the lag present on the stock navbar, or only on the custom roms?


----------



## omniphil (Dec 19, 2011)

Whats involved with modifing the SystemUI.apk?

Sent from my AN10G2 using Tapatalk


----------



## fronc (Aug 18, 2011)

omniphil said:


> Whats involved with modifing the SystemUI.apk?
> 
> Sent from my AN10G2 using Tapatalk


http://rootzwiki.com/topic/13730-how-totutsoftkey-mod/
Check that out.


----------



## CrushD (Dec 29, 2011)

fronc said:


> Whats involved with modifing the SystemUI.apk?
> 
> Sent from my AN10G2 using Tapatalk


Yeah, if I could I'd just post my SystemUI.apk up for people to try, but it's mod/ROM dependent, so some people would lose things they might be used to. Which is why I posted this out as a good suggestion to Devs to incorporate in their ROMs moving forward. The link posted above by fronc may be useful, for a somewhat detailed explaination of what I did (if you don't know how to use these tools you can find how online):

Extract out Classes.dex from the apk using 7-zip.
Baksmali the Classes.dex to get editable code.
Go to com\android\systemui\statusbar\
Open KeyButtonView.smali up in notepad.
Find parts in the code where it says "setDuration(J)" (it'll be twice in the code, the first time is the animating of the glow when you first touch the softkey, the second instance in the code is when you release the softkey)
Right before the setDuration command you'll find a "const-wide/16 v1," followed by a hexidecimal, edit the hexidecimal to whatever you want, I choose "0x0" for a 0 animation duration.
Save your edits.
Use Smali to return code to a classes.dex form and place back into apk. Replace the apk on phone with your edited version.

So it's not too bad if you know what you're doing, otherwise, I really did just intend to let Devs know that this issue exists.


----------



## winner00 (Jun 6, 2011)

Thought I would tell you that I implemented this tweak into my CM9 Kang.


----------



## Chubbs Hand (Dec 19, 2011)

Awesome find. That makes a considerable difference.


----------



## Redflea (Jun 7, 2011)

winner00 said:


> Thought I would tell you that I implemented this tweak into my CM9 Kang.


And it's great...kudos to the OP, and thanks for implementing it, Winner.

Every ROM should have this fix...

Sent from my Galaxy Nexus using Tapatalk


----------



## bgill55 (Jun 11, 2011)

added this to my mod pack thank you sir!


----------



## omniphil (Dec 19, 2011)

CrushD said:


> Not really, Android really seems to prioritize animating the glow animation in the navbar, which I think is pretty dumb, and the gpu seems to lag when trying to manage different regions simultaneously. Maybe a ROM developer can find a way to reverse this, so that the screen gets refresh priority over the navbar. This lag is present in all ROMs, stock and custom I've ever tried. In the mod I did, the buttons still highlight, but the glow goes away instantly rather than gradually. The shorter the animation duration, the less time the GPU has to worry about refreshing two different regions.
> 
> Yeah, if I could I'd just post my SystemUI.apk up for people to try, but it's mod/ROM dependent, so some people would lose things they might be used to. Which is why I posted this out as a good suggestion to Devs to incorporate in their ROMs moving forward. The link posted above by fronc may be useful, for a somewhat detailed explaination of what I did (if you don't know how to use these tools you can find how online):
> 
> ...


I'm on the wiki page for smali, it mentions also needing Maven2 and git. But I think those are for source control and stuff like that?

Do we just need smali and baksmali?

I've got my classes.dex file and I'm gonna give it a whirl to modify it on my own.

EDIT - Ok, so i managed to get the file changed in both places to 0x0. put them all back into a new classes.dex file. and the I copied the classes.dex over the existing one and 7-Zipped up the whole bunch of files and directories into SystemUI.apk, at first I noticed mine was much smaller so I did it again with no compression and left it at "store" now the file was only a few byte off so that's close.

in root explorer I renamed the SystemUI.apk to SystemUIbackup.apk and copied in my new one. Rebooted... Nothing had change other than the wallpaper. I think went in and deleted the SystemUIback.apk and rebooted.

It booted up with no soft buttons at all ! Hmmmm, my first though, was how awesome it looked using the whole screen, it looks so NICE like that! Everything filled the screen so nicely. The obvious issue however is that I cant navigate around, lol... So I just did a nandroid restore and I am back to square one..

Any idea what I may have done wrong? What is the appropriate way to rezip the classes.dex back in? Here are my java commands...

java -jar baksmali-1.3.0.jar out/dexout/ classes.dex
java -Xmx512m -jar smali-1.3.0.jar -o new-classes.dex out/dexout/

I'm getting close


----------



## RMarkwald (Oct 19, 2011)

omniphil said:


> I'm on the wiki page for smali, it mentions also needing Maven2 and git. But I think those are for source control and stuff like that?
> 
> Do we just need smali and baksmali?
> 
> ...


You can use 7zip to open the archive, so you don't need to unzip/rezip it. You can remove the old classes.dex and replace it with your new one. Basically it is editing the insides without unzipping keeping the insides intact.

Sent from my GalaxyNexus using RootzWiki


----------



## nhat (Aug 21, 2011)

what lag are you talking about? i don't notice any lag with the stock launcher. stock as in not nova or adw.


----------



## CrushD (Dec 29, 2011)

omniphil said:


> I'm on the wiki page for smali, it mentions also needing Maven2 and git. But I think those are for source control and stuff like that?
> 
> Do we just need smali and baksmali?
> 
> ...


Hmm, your java commands look funny to me, just try:
java -jar baksmali-1.3.0.jar classes.dex
(this'll put everything in the default out\ folder, then after edits)
java -Xmx512m -jar smali-1.3.0.jar out -o classes-new.dex

Rename classes-new.dex and using 7-zip to place it back in the .apk should be completely fine, compressed or store shouldn't matter.

And yes, I've encountered that bug too, full-screen does look gorgeous, maybe it'd be nice to have a gesture app that simulates soft keys with gestures and just do away with the bottom bar ^^. Just a crazy idea to anyone daring enough. You could keep your phone usable without soft keys with the aid of apps like SwipePad


----------



## maha1o (Dec 27, 2011)

i have definitely noticed this before.. which is why i think DT took it out of his rom in 2.4.. another little tip that i noticed help improve the animation is disabling the page indicator in the home screen and app drawer if you are using a rom that has this option. the page indicators have a fade effect that im thinking is causing alot if screen lag.. hope this helps too


----------



## omniphil (Dec 19, 2011)

CrushD said:


> Hmm, your java commands look funny to me, just try:
> java -jar baksmali-1.3.0.jar classes.dex
> (this'll put everything in the default out\ folder, then after edits)
> java -Xmx512m -jar smali-1.3.0.jar out -o classes-new.dex
> ...


I went ahead and just opened up the .apk with 7zip and then dragged the modified file in there and it overwrote the one in the .apk, so that worked like a charm. But when I removed my stock SystemUI.apk and replaced with this new one and rebooted all the soft buttons were gone again.

Huh, I must be doing something wrong here....


----------



## CrushD (Dec 29, 2011)

omniphil said:


> I went ahead and just opened up the .apk with 7zip and then dragged the modified file in there and it overwrote the one in the .apk, so that worked like a charm. But when I removed my stock SystemUI.apk and replaced with this new one and rebooted all the soft buttons were gone again.
> 
> Huh, I must be doing something wrong here....


Hmm, are you replacing the file while the phone is still running? That can cause problems, it's best to introduce the file to the phone either through a flashable zip or what I usually do:
adb shell
su
stop
adb push (filename here) /system/app
reboot


----------



## mustbepbs (Nov 19, 2011)

Woo! This worked like a charm. I'm a total noob at this so I greatly appreciate the guide here. To those of you in my boat, I recommend taking a look at these videos by TheStericson; he goes through step by step using smali/baksmali on a windows machine.





 (Part 1)




 (Part 2)

I'm one step closer to actually knowing what I'm doing! Thanks!


----------



## omniphil (Dec 19, 2011)

CrushD said:


> Hmm, are you replacing the file while the phone is still running? That can cause problems, it's best to introduce the file to the phone either through a flashable zip or what I usually do:
> adb shell
> su
> stop
> ...


Yes, I was using root explorer to replace the file while it was running, I'll give your method a try and see how that works. Thanks!Side note: How easy is it to turn this into a flash able zip?


----------



## mustbepbs (Nov 19, 2011)

omniphil said:


> Yes, I was using root explorer to replace the file while it was running, I'll give your method a try and see how that works. Thanks!


What I did was rename the current SystemUI.apk to SystemUI.bak, and then copy and pasted using ES File Explorer the modified SystemUI.apk into /system/app and change the permissions to match the original one (rw- r-- r--), rebooted and worked like a charm.


----------



## omniphil (Dec 19, 2011)

mustbepbs said:


> What I did was rename the current SystemUI.apk to SystemUI.bak, and then copy and pasted using ES File Explorer the modified SystemUI.apk into /system/app and change the permissions to match the original one (rw- r-- r--), rebooted and worked like a charm.


Hmmmm, maybe I'm missing the permissions step. How do I set the permissions?

Side note: How did you move stuff in system with ES file explorer, I didn't think it could read root? That's why I had always used root explorer


----------



## mustbepbs (Nov 19, 2011)

omniphil said:


> Hmmmm, maybe I'm missing the permissions step. How do I set the permissions?
> 
> Side note: How did you move stuff in system with ES file explorer, I didn't think it could read root? That's why I had always used root explorer


Did you mount /system as writable? ES File Explorer has that option in the settings, never used Root Explorer before. In ES File Explorer, you long press an .apk and go to properties. From there you can set permissions. I don't know if settings the permissions does anything, but I wanted to keep it as original as I could so nothing would mess up. I've pushed things before into /system/app and not set permissions and things haven't worked, so I'm paranoid


----------



## combatmedic870 (Aug 31, 2011)

if someone could make a flashable zip for everyone.....that would be AWESOME!!


----------



## mild7intl (Dec 29, 2011)

If this has been mentioned before then sorry for double posting

I noticed that turning off the transition and opening animations in the development settings from 1x to off helped with the stutter. Its still there but I can say there's a good improvement.
Just my 2 c

Sent from my Galaxy Nexus using Tapatalk


----------



## Kancerstick (Dec 25, 2011)

would be great if this was working for codenamedroids rom. would love to try it!


----------



## omniphil (Dec 19, 2011)

mild7intl said:


> If this has been mentioned before then sorry for double posting
> 
> I noticed that turning off the transition and opening animations in the development settings from 1x to off helped with the stutter. Its still there but I can say there's a good improvement.
> Just my 2 c
> ...


So that brings up a good question. In the developer settings when you disable the animations and transitions to off is that doing the same thing as what this Mod is doing?


----------



## omniphil (Dec 19, 2011)

Ok, I finally got this working ok. It seems that the SystemUI.apk was getting corrupted a bit when I was copying it out. So what I did was make sure to run a 7zip "test archive" before I put it back to the phone. Before it was failing the test and the .apk was corrupt.

I used root explorer to delete and replace the file and set the permission to match. Reboot and it works!

So just a tip for anyone trying this, make sure you SystemUI.apk is a valid archive file before pushing it back to the phone.


----------

