[MultiDevice]Bigrushdog's Weekly Mods How To [Must Learn!!!]


bigrushdog

<b>Forum Donator</b>
7 Nov 2010
247
38
Alright Guys. This thread is long overdue. I am going to cover the mods that I provide on a weekly basis. The information provided should apply to most MIUI ports, regardless of device. Therefore, it is in the Port Section.

There are three areas of interest I wish to cover. They include status bar mods, the lockscreen timeout mod, and the disable wallpaper scroll mod. Most of these mods are the work of other developers. I merely ported the information to MIUI.

I strongly recommend you nandroid backup prior to flashing anything, ever. ( Like you could actually sue me if you bork your phone! But all the devs put a disclaimer, so I'll follow suit ;D )

Let's start with the Status Bar Mods. I implemented the instructions in SteelH's Thread on XDA. Credit for these mods go to JsChiSurf (the Ultimate Smali Superstar!) and pardonmyfreedom (don't know where you dwell, but thank you!)

In order to pull of these mods, you need to know how to use smali / baksmali. This is not a tutorial on these applications. Simply do a google search to learn these easy applications.

The status bar mods require you to use smali / baksmali to decompile and compile the classes.dex in Services.jar

Let's start with Hide USB Debug Icon

Navigate to com\android\server\NotificationManagerService.smali and open the smali file with your favorite code / text editor.

Search for the following line of code
Code:
iput v7, v6, Landroid/app/Notification;->icon:I
and comment it out with the "#" symbol

Code:
#iput v7, v6, Landroid/app/Notification;->icon:I
Save and compile.


Next we will hide the Clock Icon (most popular!)

Navigate to com/android/server/status/StatusBarPolicy.smali and open the smali file with you favorite code / text editor.

Search for the following line of code ( Roughly around line 574 )

Code:
invoke-direct {p0}, Lcom/android/server/status/StatusBarPolicy;->updateClock()V
Find the line of code and place the following directly below it.
Code:
invoke-virtual {p2, v3, v6}, Lcom/android/server/status/StatusBarService;->setIconVisibility(Landroid/os/IBinder;Z)V
Save and compile.

Moving on to Hide Battery Icon.


Navigate to com/android/server/status/StatusBarPolicy.smali and open the smali file with you favorite code / text editor.

Search for the following line of code ( Roughly around line 623 )

Code:
iput-object v3, p0, Lcom/android/server/status/StatusBarPolicy;->mBatteryIcon:Landroid/os/IBinder;
Find the line of code and place the following directly below it.
Code:
invoke-virtual {p2, v3, v6}, Lcom/android/server/status/StatusBarService;->setIconVisibility(Landroid/os/IBinder;Z)V
Save and compile.


Lockscreen Timeout Mod

I take all credit for this mod. It took me about a week to find the correct class, method, and variable to control this. By default, the lockscreen will timeout and kill the display in five seconds from being turned on. How is it that the MIUI developers can bless us with this truly awesome lockscreen, with animated EQ graphics, music controls, and missed call and text notification, and only give us five seconds to take it all in? Well, let's do something about it. Let's increase the Lockscreen Timeout to 30 seconds!

Decompile com.android.policy and navigate to KeyguardViewMediator.smali. Open with your favorite code / text editor.

Scroll to line 2566 (roughly, depending on how the code changes in the weekly's) and find the following line
Code:
const/16 v0, 0x1388
Notice that "1388" hex which is equal to 5000 Milliseconds, or 5 seconds.

Change to
Code:
const/16 v0, 0x7530
Which equals 30000 milliseconds or 30 seconds.

Save and compile.

Note: Feel free to experiment with other values. However, I don't think you will be able to exceed 0xFFFF.

DISABLE WALLPAPER SCROLLING

This mod was created by Sampson. I am posting it here to keep the post consistent with my weekly releases.

Extract classes.dex from Launcher2.apk and decompile using baksmali.

Navigate to com/android/launcher2/Launcher.smali. Open Launcher.smali with your favorite text / code editor.

Search for the following line of code with your text editor's search function.

Code:
invoke-virtual {v4, v5, v1}, Landroid/app/WallpaperManager;->suggestDesiredDimensions(II)V

Directly above this line, you will see the following...
Code:
mul-int/lit8 v5, v3, 0x2

Change the "2" to a "1" so it looks like

Code:
mul-int/lit8 v5, v3, 0x1

Save and compile classes,dex. Now in this case, you need to drop your new classes.dex back into the Launcher2.apk you pulled the original from.
 
Thanks!

Some small useful hints:

http://code.google.com/p/smali/

Originally Posted by xak944

Here are some VERY BASIC directions. Use at your own risk. They worked for me.

  1. Make a backup of your services.jar on your device (or alternatively make a nandroid backup): adb shell cp /system/framework/services.jar /system/framework/services.jar.bak
  2. Get services.jar from your device: adb pull /system/framework/services.jar .
  3. Extract classes.dex from services.jar
  4. Decompile the .dex file: java -jar baksmali.jar classes.dex -o outputdir
  5. Make desired edits to the files now in outputdir/
  6. Recompile the .dex file: java -Xmx512M -jar smali.jar outputdir/ -o classes.dex
  7. Add the new (modified) classes.dex file to the existing services.jar file (which is actually a zip file)
  8. Cross your fingers and push services.jar back to your device: adb push services.jar /system/framework/services.jar
  9. Reboot device: adb reboot

In addition to these steps, I wanted to mention a few things... these might be obvious to most, but hopefully they help someone.

- to extract and re-add classes.dex from/to services.jar, use winzip
- to modify the .smali files that Steel mentions, use notepad
- you will need to mount /system as read/write before you can push services.jar back to the phone
- it took a long time for my phone to reboot... i got pretty nervous

thanks again, I love not having the alarm and gps icons taking up space
 
Lockscreen Timeout Mod

Decompile com.android.policy and navigate to KeyguardViewMediator.smali.- cannot find KeyguardViewMediator, running 1.1.7 for D1? any suggestions, please
 
Lockscreen Timeout Mod

Decompile com.android.policy and navigate to KeyguardViewMediator.smali.- cannot find KeyguardViewMediator, running 1.1.7 for D1? any suggestions, please

Should be the same com.android.policy. hit up the live chat.
 
I see that you can edit the battery icon. How do you edit it so that it will be vertical instead of horizontal?

Sent from my HTC Incredible using the miui-dev.com Forums App
 
Worked greAt without issues for two weeks straight! Thanks for the great writeup :)
 
Will try few of this on next release!!
Many thanks for the guides.

Sent from my HTC Desire using the miui-dev.com Forums App
 
Does anyone know if it is possible to decompile/compile .jars or .apks from the phone itself (CWM, Terminal Emulator, Gscript), rather than software on a PC?