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

Discussion in 'Porting Advice/Help' started by bigrushdog, Jan 11, 2011.

  1. bigrushdog

    bigrushdog<b>Forum Donator</b>

    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.
     
  2. ThijsWTF

    ThijsWTFMembers

    Jan 9, 2011
    14
    0
    21
    Thanks, great mods! :D
     
  3. Heart

    HeartMembers

    Nov 15, 2010
    28
    1
    20
    Thanks!

    Some small useful hints:

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

     
  4. jcbbiggs

    jcbbiggsMembers

    Jan 9, 2011
    104
    0
    26
    Lockscreen Timeout Mod

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

    bigrushdog<b>Forum Donator</b>

    Should be the same com.android.policy. hit up the live chat.
     
  6. treken

    trekenMembers

    Jan 24, 2011
    58
    0
    16
    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
     
  7. Worked greAt without issues for two weeks straight! Thanks for the great writeup :)
     
  8. roenano

    roenanoMembers

    Nov 7, 2010
    722
    26
    65
    Israel
    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
     
  9. newark_b

    newark_bMembers

    Jan 27, 2011
    22
    0
    11
    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?
     
  10. jcbbiggs

    jcbbiggsMembers

    Jan 9, 2011
    104
    0
    26
    ninjamorph - should be in the market...
     
  11. bump for great justice
     
  12. bump for justice
     

Share Our Site