Or Continue to Thread: [ROM] LOL v. 1.4.2 (with kerne…
Find Your Device:
7th February 2011, 08:24 PM   |  #2  
OP Junior Member
Thanks Meter: 69
 
29 posts
Join Date:Joined: Feb 2011
Donate to Me
a little how to :)
ok, i wrote a little tutorial on how to create a powermenu
sorry for my english

************************************************** **********************************************
for first step i used this tutorial (i only removed the option "donwload"):
http://forum.xda-developers.com/showthread.php?t=811532


(copied from thread above)

Quote:
Originally Posted by untermensch

Step 1.

the first thing we need to do is add string and image resources to framwork-res
for this example I am using a stock JI6 ROM your resource id's will be different
if on another ROM

use apk_manager to decompile framework-res

open "res\values\strings.xml" and add our string resources

Code:
<string name="reboot_recovery">Recovery</string>
<string name="reboot">Reboot</string>
save and close

open "res\values\public.xml" and assign our strings resource id's

scroll until you get to the end of the "<public type="string"" id list
note the id of the last string, in this example it is "10403c2" sometimes
the id's are out of order so search for "10403c2 + 1" or "10403c3"
if the next id is unused then we can start assigning id's to the strings
we added.

Code:
<public type="string" name="reboot_recovery" id="0x010403c3" />
<public type="string" name="reboot" id="0x010403c5" />
now is a good time to add the image resources so add your icons to
"res\drawable-hdpi"
and assign id's to them the same way we did for the strings
in this example, using the example icons in the zip file I had

Code:
<public type="drawable" name="reboot" id="0x010803aa" />
<public type="drawable" name="recovery" id="0x010803ab" />
save and close

now framework-res has the resources needed for this mod use
apk_manager to compile.

step 2: (This part is based on untermensch's tutorial to which i have made serveral changes to let it work on LG)

now we are going to add the extra options to the power menu

decompile android.policy.jar with baksmali

open com\android\internal\policy\impl\GlobalActions.sma li and change the line 436 from

Code:
    const/4 v0, 0x3
to
Code:
    const/4 v0, 0x5
insert the following line at line 462 (the original line 462 becomes line 486)
(remember to change reboot and recovery's image/string id with the ones used in the first step)
Code:
    const/4 v1, 0x3

    new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$7;

    const v3, 0x10803e0 # reboot icon resource id

    const v4, 0x104039d # reboot string resource id 

    invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$7;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V

    aput-object v2, v0, v1

    const/4 v1, 0x4

    new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$8;

    const v3, 0x10803e1 # recovery icon resource id

    const v4, 0x104039c # recovery string resource id

    invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$8;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V

    aput-object v2, v0, v1
save and exit

(here starts my real job )

ok now copy GlobalActions$3.smali to GlobalActions$7.smali
edit GlobalActions$7.smali
search and replace all GlobalActions$3.smali to GlobalActions$7.smali
and change this line:
Code:
    const/4 v1, 0x1

    invoke-static {v0, v1}, Lcom/android/internal/app/ShutdownThread;->shutdown(Landroid/content/Context;Z)V
to
Code:
    const/4 v1, 0x1
	
    const-string v2, "now"
	
    invoke-static {v0, v2, v1}, Lcom/android/internal/app/ShutdownThread;->reboot(Landroid/content/Context;Ljava/lang/String;Z)V
save and exit

now copy GlobalActions$3.smali to GlobalActions$8.smali
edit GlobalActions$8.smali
search and replace all GlobalActions$3.smali to GlobalActions$8.smali
and change this line:
Code:
    const/4 v1, 0x1

    invoke-static {v0, v1}, Lcom/android/internal/app/ShutdownThread;->shutdown(Landroid/content/Context;Z)V
to
Code:
    const/4 v1, 0x1

    const-string v2, "recovery"
	
    invoke-static {v0, v2, v1}, Lcom/android/internal/app/ShutdownThread;->reboot(Landroid/content/Context;Ljava/lang/String;Z)V
save and exit

recompile android.policy.jar with smali
done
Last edited by PaoloM70; 11th February 2011 at 09:18 AM.
The Following 15 Users Say Thank You to PaoloM70 For This Useful Post: [ View ]