Would this method work for the screenshot in the power menu? ICS and gingerbread roms have it. I miss that feature greatly.
Sent from my SGH-T959 using XDA
Sent from my SGH-T959 using XDA
Would this method work for the screenshot in the power menu? ICS and gingerbread roms have it. I miss that feature greatly.
Sent from my SGH-T959 using XDA
: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
trying to get this to work on a samsung galaxy precedent AOSP ROM. having an issue with step 2 in the shutdownthread.smali. more specificaly this part
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
should i change the parts where it says (exp. :rebootDownload) to the string id? and if i do i get this error when compiling (mismatched input '0x010404bd' expecting END_METHOD_DIRECTIVE)
if i try to change the corrisponding parts from the code inserted above it i get this error
(AutoSmali_In\com\android\internal\app\ShutdownThread.smali[2337,18] no viable alternative at input '0x010404bd'
AutoSmali_In\com\android\internal\app\ShutdownThread.smali[2341,18] no viable alternative at input '0x010404bb'
AutoSmali_In\com\android\internal\app\ShutdownThread.smali[2345,18] no viable alternative at input '0x010404bc'
AutoSmali_In\com\android\internal\app\ShutdownThread.smali[2352,4] mismatched input '0x010404bd' expecting END_METHOD_DIRECTIVE)
any clue on a fix?
reread the TUt, specifically step 3 you don't put the resID's there they go in the globalActions
Pvy.
i got that part... i was just wondering if it would be diff cus its a diff phone. i know with LG phones you dont have to edit the shutdownthread.smali at all and it works just fine.
If you follow the tut it will work. If the stuff is already there don't re add it.
But you were editing the wrong area. The IDs don't go where you put them.
Pvy.
Sent from my LT18i using xda premium
if the stuff was there i wouldnt be doing this... and if it worked i wouldnt be posting... like i said before this is the sammy precedent im working n 100% AOSP. would u like the logcat errors?
sure go for it it may shed more light as to what the problem was i have a feeeling we are on 2 different pages...
100% AOSP as in your are compiling it first? then decompiling it to add mods? O_O
Pvy.
I/StatusBarPolicy( 3033): BAT. status:2 health:2
I/StatusBarPolicy( 3033): BAT. status:2 health:2
I/StatusBarPolicy( 3033): BAT. status:2 health:2
I/WindowManager( 2978): interceptKeyBeforeDispatching
W/KeyCharacterMap( 3055): No keyboard for id 0
W/KeyCharacterMap( 3055): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
W/dalvikvm( 2978): VFY: unable to resolve static field 47 (mReboot) in Lcom/android/internal/app/ShutdownThread;
W/dalvikvm( 2978): VFY: unable to resolve static field 47 (mReboot) in Lcom/android/internal/app/ShutdownThread;
W/dalvikvm( 2978): VFY: unable to resolve static field 47 (mReboot) in Lcom/android/internal/app/ShutdownThread;
I/WindowManager( 2978): interceptKeyBeforeDispatching
I/WindowManager( 2978): interceptKeyBeforeDispatching
I/WindowManager( 2978): interceptKeyBeforeDispatching
W/KeyCharacterMap( 2978): No keyboard for id 0
W/KeyCharacterMap( 2978): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
I/WindowManager( 2978): interceptKeyBeforeDispatching
W/dalvikvm( 2978): threadid=21: thread exiting with uncaught exception (group=0x40020560)
V/AudioPolicyManager( 2967): getDeviceForStrategy() from cache strategy 0, device 2
V/AudioPolicyManager( 2967): getOutput() stream 3, samplingRate 0, format 0, channels c, flags 0
E/AndroidRuntime( 2978): *** FATAL EXCEPTION IN SYSTEM PROCESS: WindowManagerPolicy
E/AndroidRuntime( 2978): java.lang.IllegalAccessError: tried to access field com.android.internal.app.ShutdownTh
read.mReboot from class com.android.internal.policy.impl.GlobalActions$8
E/AndroidRuntime( 2978): at com.android.internal.policy.impl.GlobalActions$8.onPress(GlobalActions.java:2
09)
E/AndroidRuntime( 2978): at com.android.internal.policy.impl.GlobalActions.onClick(GlobalActions.java:272
)
E/AndroidRuntime( 2978): at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertContr
oller.java:873)
E/AndroidRuntime( 2978): at android.widget.AdapterView.performItemClick(AdapterView.java:284)
E/AndroidRuntime( 2978): at android.widget.ListView.performItemClick(ListView.java:3513)
E/AndroidRuntime( 2978): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1812)
E/AndroidRuntime( 2978): at android.os.Handler.handleCallback(Handler.java:587)
E/AndroidRuntime( 2978): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 2978): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime( 2978): at com.android.server.WindowManagerService$PolicyThread.run(WindowManagerService
.java:611)
V/AudioPolicyManager( 2967): startOutput() output 1, stream 3, session 3
V/AudioPolicyManager( 2967): changeRefCount() stream 3, count 1
V/AudioPolicyManager( 2967): getDeviceForStrategy() from cache strategy 0, device 2
V/AudioPolicyManager( 2967): getNewDevice() selected device 2
V/AudioPolicyManager( 2967): setOutputDevice() output 1 device 2 delayMs 0
V/AudioPolicyManager( 2967): setOutputDevice() setting same device 2 or null device for output 1
V/AudioHardwareMSM72XX( 2967): open driver
V/AudioHardwareMSM72XX( 2967): get config
V/AudioHardwareMSM72XX( 2967): set config
V/AudioHardwareMSM72XX( 2967): buffer_size: 4800
V/AudioHardwareMSM72XX( 2967): buffer_count: 2
V/AudioHardwareMSM72XX( 2967): channel_count: 2
V/AudioHardwareMSM72XX( 2967): sample_rate: 44100
W/AudioFlinger( 2967): write blocked for 164 msecs, 1 delayed writes, thread 0xcea8
V/AudioPolicyManager( 2967): stopOutput() output 1, stream 3, session 3
V/AudioPolicyManager( 2967): changeRefCount() stream 3, count 0
V/AudioPolicyManager( 2967): getNewDevice() selected device 0
V/AudioPolicyManager( 2967): setOutputDevice() output 1 device 0 delayMs 0
V/AudioPolicyManager( 2967): setOutputDevice() setting same device 0 or null device for output 1
D/VoldCmdListener( 85): asec list
I/StatusBarPolicy( 3033): BAT. status:2 health:2
I/StatusBarPolicy( 3033): BAT. status:2 health:2
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
thats deff not the case. the images and the lines come up just fine after i push the power button but it does a FC vibration thingy when i click to select an option other then the original 3...
why do i sound like a broken record here. =\
Open the file in notepad xda is returning a 404 on it
Pvy
Sent from my LT18i using xda premium
its gotta be yall i dl'd it just fine just tested it... xda wont let me upload it as a txt it keeps failing.
.field public static mReboot:I
.field private static mReboot:Z
[B]".field public static[COLOR="Red"] mRebootInt:I[/COLOR]"[/B]
sget v1, Lcom/android/internal/app/ShutdownThread;->[COLOR="red"][B]mRebootInt:I[/B][/COLOR]
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"
save and closeCode:Code: const/4 v2, 0x1 sput v2, Lcom/android/internal/app/ShutdownThread;->[B][COLOR="red"]mRebootInt:I[/COLOR][/B]
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"
save and closeCode:Code: const/4 v2, 0x2 sput v2, Lcom/android/internal/app/ShutdownThread;->[B][COLOR="red"]mRebootInt:I[/COLOR][/B]
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:
save and closeCode:const/4 v2, 0x3 sput v2, Lcom/android/internal/app/ShutdownThread;->[B][COLOR="Red"]mRebootInt:I[/COLOR][/B]
compile android.policy
downloading now. xda does that sometimes
will update soon if i find somehting
Edit 1
you have two variables with the same name.
Code:.field public static mReboot:I .field private static mReboot:Z
Edit 2
Ok my 2 cents worth.
Change
".field public static mReboot:I"
to
".field public static mRebootInt:I"
in these places (red parts)
shutdown thread
line 29
line 2332Code:[B]".field public static[COLOR="Red"] mRebootInt:I[/COLOR]"[/B]
Code:sget v1, Lcom/android/internal/app/ShutdownThread;->[COLOR="red"][B]mRebootInt:I[/B][/COLOR]
then in the global action files that you made as well in this step (copy pasted from the OP
see how that goes. if you do all that and it still don't work link the new crash log and all the shutdownthread and globalactions files (zip them together and i will look at just them) dont need the entire frameworks
Pvy
works perfect man thanks for all your help!!! ill be sure your added into the credits of our rom. =)
works perfect man thanks for all your help!!! ill be sure your added into the credits of our rom. =)
<string name="reboot_recovery">Recovery</string>
<string name="reboot_download">Download</string>
<string name="reboot">Reboot</string>
<public type="string" name="reboot_recovery" id="0x010403c3" />
<public type="string" name="reboot_download" id="0x010403c4" />
<public type="string" name="reboot" id="0x010403c5" />
<public type="drawable" name="reboot" id="0x010803aa" />
<public type="drawable" name="recovery" id="0x010803ab" />
<public type="drawable" name="download" id="0x010803ac" />
.field public static mReboot:I
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
.line 531
invoke-static {}, Landroid/os/Power;->shutdown()V
.line 532
return-void
: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
const/4 v0, 0x3
new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
const/4 v0, 0x6
new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
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
const/4 v2, 0x1
sput v2, Lcom/android/internal/app/ShutdownThread;->mReboot:I
const/4 v2, 0x2
sput v2, Lcom/android/internal/app/ShutdownThread;->mReboot:I
const/4 v2, 0x3
sput v2, Lcom/android/internal/app/ShutdownThread;->mReboot:I
someone asked for this so here it is.
decompile android.policy
make a copy of GlobalActions$3.smali and name it to GlobalActions$7.smali open GlobalActions$7.smali
and replace all instances of GlobalActions$3 with GlobalActions$7
replace method onPress with this
Code:.method public onPress()V .registers 3 const-string v0, "Reboot Now" invoke-static {v0}, Landroid/os/Power;->reboot(Ljava/lang/String;)V return-void .end method
save and close
now open GlobalActions.smali
and in method createDialog
the first thing that we need to do is increase the array length by 1 so find this
and change toCode:const/4 v0, 0x3 new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
next we add the new menu item so on line 457 we add this next bit of code after "aput-object v2, v0, v1"Code:const/4 v0, 0x4 new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
framework-res already has a string for reboot so no modifications are needed to framework-resCode:const/4 v1, 0x3 # position in the menu array new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$7; const v3, 0x1080030 # power icon const v4, 0x10402af # reboot string 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
save and close then compile android.policy
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
const/4 v1, 0x4
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$8;
const v3, 0x1080434
const v4, 0x1040488
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, 0x1080435
const v4, 0x1040486
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
const/4 v1, 0x6
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$10;
const v3, 0x1080436
const v4, 0x1040487
invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$10;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
aput-object v2, v0, v1