Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[REF] How to add Reboot to power menu (updated 10/21/2010)

OP untermensch

2nd August 2012, 07:28 AM   |  #241  
Senior Member
Flag Bogor
Thanks Meter: 190
 
524 posts
Join Date:Joined: Dec 2010
More
i am trying to do the step 1, and it gives me error
i have checked if wheter the id like "0x01040391" is used or not, and if it's used i would change it into unused id
but still it gives me an error

the screenshot of error is uploaded on this post, please help me

could anyone here help me ?
i am not using samsung vibrant but maybe if you have successfully compiled the framework-res.apk you could help me with this
thanks in advance, any suggestion will be appreciated
Attached Thumbnails
Click image for larger version

Name:	apk-error.jpg
Views:	726
Size:	71.3 KB
ID:	1236640   Click image for larger version

Name:	error-log.jpg
Views:	734
Size:	90.0 KB
ID:	1236642   Click image for larger version

Name:	public2.jpg
Views:	721
Size:	70.1 KB
ID:	1236643   Click image for larger version

Name:	strings1.jpg
Views:	701
Size:	66.4 KB
ID:	1236644  
The Following User Says Thank You to Actura For This Useful Post: [ View ]
2nd August 2012, 11:17 AM   |  #242  
bigfau's Avatar
Recognized Contributor / Recognized Developer
Flag Zanesville, Ohio
Thanks Meter: 10,809
 
5,059 posts
Join Date:Joined: Oct 2010
Donate to Me
More
The 4 Way Reboot mod is a lot easier. A lot easier.The only modification for 4Way is to androidpolicy.jar. No edits or modifications to framework-res.apk at all. Told you it was easy. Lol. My 2 cent.

http://forum.xda-developers.com/show...php?p=24235582


Sent from my SAMSUNG-SGH-I717 using Tapatalk 2
Last edited by bigfau; 2nd August 2012 at 11:26 AM.
The Following 2 Users Say Thank You to bigfau For This Useful Post: [ View ]
26th September 2012, 02:38 PM   |  #243  
Crackion's Avatar
Member
Flag Caracas
Thanks Meter: 2
 
42 posts
Join Date:Joined: Sep 2012
More
HI, help?
Quote:
Originally Posted by Actura

i am trying to do the step 1, and it gives me error
i have checked if wheter the id like "0x01040391" is used or not, and if it's used i would change it into unused id
but still it gives me an error

the screenshot of error is uploaded on this post, please help me

could anyone here help me ?
i am not using samsung vibrant but maybe if you have successfully compiled the framework-res.apk you could help me with this
thanks in advance, any suggestion will be appreciated

Hi, i could help you if you upload your original framework-res.apk file , it seems 0x0140391/0x0140392 are not free id's, are you tried to ensure thats those id's are not asigned to another string?, upload
framewokr-res.apk
public.xml
strings.xml

originals to check them,

---------- Post added at 08:01 AM ---------- Previous post was at 07:57 AM ----------

Hi, bigfau, how did you add menu's icons in android.policy? i've already gotten the EPM, but without icons, and did you changed default "Shutdown" string to Restart?

---------- Post added at 08:08 AM ---------- Previous post was at 08:01 AM ----------

Hi i have that lines in my .smali too, originaly there's only

.field public static mReboot:I

when i add the second line, they look just like you described, must i to do excactly you have said for Rookie407
The Following User Says Thank You to Crackion For This Useful Post: [ View ]
26th September 2012, 05:12 PM   |  #244  
Crackion's Avatar
Member
Flag Caracas
Thanks Meter: 2
 
42 posts
Join Date:Joined: Sep 2012
More
Question Question about sizes
Even when my framework-res.apk "edited" has more lines than my framework-res.apk "original",, The first one's size is less than original... Why?, Is this because the compression level? what do you say guys!
28th September 2012, 10:51 PM   |  #245  
Crackion's Avatar
Member
Flag Caracas
Thanks Meter: 2
 
42 posts
Join Date:Joined: Sep 2012
More
Red face Icon in shutdown method menu
Hey guys look at this hahahahah im trying to add an icon to Shutdown Method Menu and I got this:

http://i49.tinypic.com/347zpr5.png

Almost get it .
20th November 2012, 02:29 PM   |  #246  
Yahyailham's Avatar
Senior Member
Flag Surabaya
Thanks Meter: 59
 
162 posts
Join Date:Joined: Sep 2012
Donate to Me
More
excuse me sir, I have a problem when try to make this EPM in my framework-res, the download selection is blank(like in the attachment), can u help me solve this problem? my framework-res in Attachment and my phone is Galaxy Y thats in LDPI screen, plz help me..
thanks before...
Attached Thumbnails
Click image for larger version

Name:	SC20121120-202923.png
Views:	322
Size:	31.4 KB
ID:	1496982  
Attached Files
File Type: apk framework-res.apk - [Click for QR Code] (4.15 MB, 23 views)
Last edited by Yahyailham; 20th November 2012 at 02:32 PM.
29th December 2012, 09:37 AM   |  #247  
n00BXperia's Avatar
Senior Member
Thanks Meter: 199
 
307 posts
Join Date:Joined: Aug 2012
More
will it work on any GB ROM ?
7th January 2013, 08:35 PM   |  #248  
Junior Member
Thanks Meter: 2
 
29 posts
Join Date:Joined: Jan 2013
Unhappy can't find
Quote:
Originally Posted by untermensch


next we need to modify Samsung's shutdown method to accept 3 more options
so decompile framework and open "com\android\internal\app\ShutdownThread.smali "

since we are going to pass an integer to ShutdownThread and then evaluate
that integer when the code runs we have to have a spot for the integer so
add this to line 37

Code:
.field public static mReboot:I
then in method run at line 1463 add this code before "invoke-static {}, Landroid/os/Power;->shutdown()V"
Code:
sget v1, Lcom/android/internal/app/ShutdownThread;->mReboot:I
	
const/4 v2, 0x1
	
if-eq v1, v2, :reboot
	
const/4 v2, 0x2
	
if-eq v1, v2, :rebootRecovery
	
const/4 v2, 0x3
	
if-eq v1, v2, :rebootDownload
then after this code on about line 1477
Code:
.line 531
invoke-static {}, Landroid/os/Power;->shutdown()V

.line 532
return-void
add this code
Code:
:reboot
	
const-string v4, "now"
	
invoke-static {v4}, Landroid/os/Power;->reboot(Ljava/lang/String;)V

return-void
	
:rebootRecovery
	
const-string v4, "recovery"
	
invoke-static {v4}, Landroid/os/Power;->reboot(Ljava/lang/String;)V

return-void
	
:rebootDownload
	
const-string v4, "download"
	
invoke-static {v4}, Landroid/os/Power;->reboot(Ljava/lang/String;)V

return-void
save and close

compile framework

this part is the one am having trouble cause this code "invoke-static {}, Landroid/os/Power;->shutdown()V" doesn't exist in my shutdownThread.xml. can you please help me on this one..Thank sir for the help..

this is my shutdownThread.xml from my stock 2.3.6 rom in my alcatel ot-918N phone.
ShutdownThread
20th January 2013, 05:32 PM   |  #249  
viijay4b7's Avatar
Senior Member
Flag Chennai
Thanks Meter: 346
 
528 posts
Join Date:Joined: Jan 2012
More
Quote:
Originally Posted by untermensch

this is the final method that will add reboot,recovery and download options
to the power menu updated 10/21/2010

================================================== ==========
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 "values\strings.xml" and add our string resources

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

open "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_download" id="0x010403c4" />
<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" />
<public type="drawable" name="download" id="0x010803ac" />
save and close

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

================================================== ==========
Step 2.

next we need to modify Samsung's shutdown method to accept 3 more options
so decompile framework and open "com\android\internal\app\ShutdownThread.smali "

since we are going to pass an integer to ShutdownThread and then evaluate
that integer when the code runs we have to have a spot for the integer so
add this to line 37
Code:
.field public static mReboot:I
then in method run at line 1463 add this code before "invoke-static {}, Landroid/os/Power;->shutdown()V"
Code:
sget v1, Lcom/android/internal/app/ShutdownThread;->mReboot:I
	
const/4 v2, 0x1
	
if-eq v1, v2, :reboot
	
const/4 v2, 0x2
	
if-eq v1, v2, :rebootRecovery
	
const/4 v2, 0x3
	
if-eq v1, v2, :rebootDownload
then after this code on about line 1477
Code:
.line 531
invoke-static {}, Landroid/os/Power;->shutdown()V

.line 532
return-void
add this code
Code:
:reboot
	
const-string v4, "now"
	
invoke-static {v4}, Landroid/os/Power;->reboot(Ljava/lang/String;)V

return-void
	
:rebootRecovery
	
const-string v4, "recovery"
	
invoke-static {v4}, Landroid/os/Power;->reboot(Ljava/lang/String;)V

return-void
	
:rebootDownload
	
const-string v4, "download"
	
invoke-static {v4}, Landroid/os/Power;->reboot(Ljava/lang/String;)V

return-void
save and close

compile framework

================================================== ==========
Step 3.

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

decompile android.policy

open "com\android\internal\policy\impl\GlobalActions.sm ali"

the first thing that we need to do is increase the array length by 3
so in method createDialog on line 431 change this
Code:
const/4 v0, 0x3

new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
to this
Code:
const/4 v0, 0x6

new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
now add the new menu items this is where the resource id's that we added
to framework-res com into play so on line 457 after "aput-object v2, v0, v1"
add this code
Code:
    const/4 v1, 0x3

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

    const v3, 0x10803aa # reboot icon resource id

    const v4, 0x10403c5 # 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, 0x10803ab # recovery icon resource id

    const v4, 0x10403c3 # 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

    const/4 v1, 0x5

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

    const v3, 0x10803ac # download icon resource id

    const v4, 0x10403c4 # download string resource id

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

    aput-object v2, v0, v1
make sure to change the resource id's to match what you added to to framework-res

save and close

next add the code that runs when the menu item is pressed

copy GlobalActions$3.smali and name it GlobalActions$7.smali
open GlobalActions$7 and replace all instances of GlobalActions$3
with GlobalActions$7 then add this code to line 52 before
"invoke-static {v0, v1}, Lcom/android/internal/app/ShutdownThread;->shutdown(Landroid/content/Context;Z)V"
Code:
const/4 v2, 0x1
	
sput v2, Lcom/android/internal/app/ShutdownThread;->mReboot:I
save and close

copy GlobalActions$3.smali and name it GlobalActions$8.smali
open GlobalActions$8 and replace all instances of GlobalActions$3
with GlobalActions$8 then add this code to line 52 before
"invoke-static {v0, v1}, Lcom/android/internal/app/ShutdownThread;->shutdown(Landroid/content/Context;Z)V"
Code:
const/4 v2, 0x2
	
sput v2, Lcom/android/internal/app/ShutdownThread;->mReboot:I
save and close

copy GlobalActions$3.smali and name it GlobalActions$9.smali
open GlobalActions$9 and replace all instances of GlobalActions$3
with GlobalActions$9 then add this code to line 52 before
"invoke-static {v0, v1}, Lcom/android/internal/app/ShutdownThread;->shutdown(Landroid/content/Context;Z)V"
Code:
const/4 v2, 0x3
	
sput v2, Lcom/android/internal/app/ShutdownThread;->mReboot:I
save and close

compile android.policy

done test on the phone.

flash the attached update.zip with the stock updater.

I have started to add reboot and recovery options to my phone MMX a110

The following thread has details of what I've done. Please suggest me to move further.

I am stuck at globalAction.smali
http://forum.xda-developers.com/show...4#post36944844
21st January 2013, 08:32 PM   |  #250  
Br1cK'd's Avatar
Recognized Developer
Flag Colorado
Thanks Meter: 1,879
 
2,375 posts
Join Date:Joined: Sep 2010
Donate to Me
More
Re: [REF] How to add Reboot to power menu (updated 10/21/2010)
Hate to be the one to burst your bubble. This tutorial hasn't applied to any firmware after GingerBread. From ICS and up, the google code changed, and these steps won't work. Sorry, wish I had better news for you.

Edit - Come to think of it, these exact steps didn't work on GB either, eclipse and froyo with a TWIZ interface they did, but since then a lot of the code has changed.

Give a man a fish and he will eat for a day, teach that same man to use Google Search, and he can answer his own questions for the rest of his life.
Last edited by Br1cK'd; 21st January 2013 at 11:15 PM.

The Following 2 Users Say Thank You to Br1cK'd For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes