[Devs][Guide] Add Reboot Safestrap Recovery to power menu with toggle - Samsung Galaxy S8 ROMs, Kernels, Recoveries, & Oth

Credits goes to @sagitt67 and @daxgirl .
Credits for toggle goes to @tdunham main guide is here and @asc1977 for the guide here big thanks to them.
In this Guide we'll modify framework-res.apk and services.jar
framework-res.apk:
Download framework-res.zip that is attached below, extract and copy it in your decompiled framework-res.apk folder
now open res/values/arrays.xml
find <string-array name="config_globalActionsList"> and add blue
Code:
<string-array name="config_globalActionsList">
<item>power</item>
<item>datamode</item>
<item>airplane</item>
<item>restart</item>
<item>lockdown</item>
<item>bugreport</item>
<item>users</item>
[COLOR="blue"]<item>rebootsafestrap</item>[/COLOR]
<item>emergencymode</item>
<item>subscreen</item>
</string-array>
now go to res/values/strings.xml at very end and add blue
Code:
<string name="wifi_extender_notification_title">Wi-Fi extender on</string>
<string name="wifi_extender_notification_message">Tap here to set up.</string>
<string name="config_tspstate_threshold" />
[COLOR="blue"]<string name="tw_ic_do_restart_safestrap">Reboot Safestrap</string>[/COLOR]
</resources>
done with framework-res.apk recompile
Services.jar:
download services.zip that is attached below, extract and copy it in your decompiled services.jar folder
open smali/com/android/server/policy/GlobalActions.smali
add blue line in # instance fields
Code:
.field private mRestart:Lcom/android/server/policy/GlobalActions$SinglePressAction;
[COLOR="blue"].field private mRebootRecovery:Lcom/android/server/policy/GlobalActions$SinglePressAction;
[/COLOR]
.field mRestartIconResId:I
find .method private createDialog()Lcom/android/server/policy/GlobalActions$GlobalActionsDialog;
add blue
Code:
if-eqz v4, :cond_27b
const v4, 0x1080a58
.line 1642
:goto_11c
const v6, 0x104070e
.line 1639
move-object/from16 v0, p0
invoke-direct {v5, v0, v4, v6}, Lcom/android/server/policy/GlobalActions$21;-><init>(Lcom/android/server/policy/GlobalActions;II)V
move-object/from16 v0, p0
iput-object v5, v0, Lcom/android/server/policy/GlobalActions;->mRestart:Lcom/android/server/policy/GlobalActions$SinglePressAction;
[COLOR="Blue"]new-instance v4, Lcom/android/server/policy/GlobalActions$99;
move-object/from16 v0, p0
iget-object v0, v0, Lcom/android/server/policy/GlobalActions;->mContext:Landroid/content/Context;
invoke-virtual {v0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object v0
const-string v1, "tw_ic_do_restart_safestrap"
const-string v2, "drawable"
const-string v3, "android"
invoke-virtual {v0, v1, v2, v3}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I
move-result v5
move-object/from16 v0, p0
iget-object v0, v0, Lcom/android/server/policy/GlobalActions;->mContext:Landroid/content/Context;
invoke-virtual {v0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object v0
const-string v1, "tw_ic_do_restart_safestrap"
const-string v2, "string"
const-string v3, "android"
invoke-virtual {v0, v1, v2, v3}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I
move-result v6
move-object/from16 v0, p0
invoke-direct {v4, v0, v5, v6}, Lcom/android/server/policy/GlobalActions$99;-><init>(Lcom/android/server/policy/GlobalActions;II)V
move-object/from16 v0, p0
iput-object v4, v0, Lcom/android/server/policy/GlobalActions;->mRebootRecovery:Lcom/android/server/policy/GlobalActions$SinglePressAction;[/COLOR]
.line 1688
invoke-static {}, Lcom/samsung/android/feature/SemCscFeature;->getInstance()Lcom/samsung/android/feature/SemCscFeature;
move-result-object v4
const-string/jumbo v5, "CscFeature_Common_ConfigBikeMode"
invoke-virtual {v4, v5}, Lcom/samsung/android/feature/SemCscFeature;->getString(Ljava/lang/String;)Ljava/lang/String;
Now next part is tricky, add lines in blue and changes in green
Code:
const/4 v7, 0x1
move-object/from16 v0, p0
invoke-direct {v0, v6, v4, v5, v7}, Lcom/android/server/policy/GlobalActions;->addDialogItemsIfEnabled(ILcom/android/server/policy/GlobalActions$Action;Ljava/util/ArrayList;Z)Z
.line 1767
new-instance v4, Lcom/android/server/policy/GlobalActions$BugReportAction;
move-object/from16 v0, p0
invoke-direct {v4, v0}, Lcom/android/server/policy/GlobalActions$BugReportAction;-><init>(Lcom/android/server/policy/GlobalActions;)V
move-object/from16 v0, p0
iget-object v5, v0, Lcom/android/server/policy/GlobalActions;->mItems:Ljava/util/ArrayList;
[COLOR="blue"]const/16 v6, 0x100
const/4 v7, 0x1
move-object/from16 v0, p0
invoke-direct {v0, v6, v4, v5, v7}, Lcom/android/server/policy/GlobalActions;->addDialogItemsIfEnabled(ILcom/android/server/policy/GlobalActions$Action;Ljava/util/ArrayList;Z)Z
move-object/from16 v0, p0
iget-object v4, v0, Lcom/android/server/policy/GlobalActions;->mRebootRecovery:Lcom/android/server/policy/GlobalActions$SinglePressAction;
move-object/from16 v0, p0
iget-object v5, v0, Lcom/android/server/policy/GlobalActions;->mItems:Ljava/util/ArrayList;[/COLOR]
const/16 v6, [COLOR="Green"]0x200[/COLOR] [COLOR="Red"]#before was 0x100[/COLOR]
const/4 v7, 0x1
move-object/from16 v0, p0
invoke-direct {v0, v6, v4, v5, v7}, Lcom/android/server/policy/GlobalActions;->addDialogItemsIfEnabled(ILcom/android/server/policy/GlobalActions$Action;Ljava/util/ArrayList;Z)Z
now search for const-string/jumbo v4, "silent" and add blue line above it and green parts must match orange part
Code:
const-string/jumbo v4, "emergencymode"
invoke-virtual {v4, v11}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v4
if-eqz v4, :cond_381
.line 1835
move-object/from16 v0, p0
iget-object v4, v0, Lcom/android/server/policy/GlobalActions;->mItems:Ljava/util/ArrayList;
move-object/from16 v0, p0
iget-object v5, v0, Lcom/android/server/policy/GlobalActions;->mEmergency:Lcom/android/server/policy/GlobalActions$ToggleAction;
invoke-virtual {v4, v5}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
goto/16 :[COLOR="orange"]goto_2d9[/COLOR] #look that green part match this
.line 1836
:cond_381
[COLOR="Blue"]const-string/jumbo v4, "rebootsafestrap"
invoke-virtual {v4, v11}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v4
if-eqz v4, :cond_3da
move-object/from16 v0, p0
iget-object v4, v0, Lcom/android/server/policy/GlobalActions;->mItems:Ljava/util/ArrayList;
move-object/from16 v0, p0
iget-object v5, v0, Lcom/android/server/policy/GlobalActions;->mRebootRecovery:Lcom/android/server/policy/GlobalActions$SinglePressAction;
invoke-virtual {v4, v5}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
goto/16 :[COLOR="Green"]goto_2d9 [/COLOR]
:cond_3da[/COLOR]
const-string/jumbo v4, "silent"
next part is missing in Android 7 services.jar so we need to readd it for mod
find .method private addCustomDialogItems(Landroid/graphics/drawable/BitmapDrawable;Ljava/lang/String;Landroid/content/Intent;ILjava/util/ArrayListZ
add this above method
Code:
[COLOR="Blue"].method static synthetic access$500(Lcom/android/server/policy/GlobalActions;)Landroid/content/Context;
.locals 1
iget-object v0, p0, Lcom/android/server/policy/GlobalActions;->mContext:Landroid/content/Context;
return-object v0
.end method[/COLOR]
thats it, recompile and push to phone
Note: For me one time i get after reboot a loop of phone restarts, only one time happens. If it happen i solved it with wipe dalvik-cache and cache
Credits goes to @TheDriller for this part in this guide
Note: no need to change the code in GlobalActions$99.smali already done
GlobalActions$99.smali:
find .method public onPress()V and replace blue lines with red one
Code:
move-result-object v0
check-cast v0, Landroid/os/PowerManager;
[COLOR="Red"]const-string v1, "recovery"
invoke-virtual {v0, v1}, Landroid/os/PowerManager;->reboot(Ljava/lang/String;)V[/COLOR]
to
Code:
move-result-object v0
check-cast v0, Landroid/os/PowerManager;
[COLOR="Blue"]const-string v1, "su -c echo 1 > /data/.recovery_mode && su -c reboot now"
invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;
move-result-object v2
invoke-virtual {v2, v1}, Ljava/lang/Runtime;->exec(Ljava/lang/String;)Ljava/lang/Process;[/COLOR]

Wow thia makes things so much easier
Sent from my SM-G950U using Tapatalk

This is different on the Note 8 isn't it? I got as far as the services jar .method private createDialog()Lcom/android/server/policy/GlobalActions$GlobalActionsDialog; I input the blue text that was mentioned but I'm curious why in your sample does it not have .method private createDialog()Lcom/android/server/policy/GlobalActions$GlobalActionsDialog; before the blue text?
The Second batch of code with the green changes I had no idea where to input that and I couldn't find const/16 v6, 0x100 to change to 200 either
The step after that I was genuinely lost nothing matched what you had in your sample I felt like I was so close to getting it.
Thanks
SM-N950W

dillweedinc said:
This is different on the Note 8 isn't it? I got as far as the services jar .method private createDialog()Lcom/android/server/policy/GlobalActions$GlobalActionsDialog; I input the blue text that was mentioned but I'm curious why in your sample does it not have .method private createDialog()Lcom/android/server/policy/GlobalActions$GlobalActionsDialog; before the blue text?
The Second batch of code with the green changes I had no idea where to input that and I couldn't find const/16 v6, 0x100 to change to 200 either
The step after that I was genuinely lost nothing matched what you had in your sample I felt like I was so close to getting it.
Thanks
Click to expand...
Click to collapse
I will check them soon.
Maybe @JavixKGD can help you as he asked for the mod and he got it working on Note 8.

It is important to specify that this mod only applies to Nougat, it needs to be updated for Oreo.

I am using Nougat 7.1.1 on a note 8 sm-n950w with me's samfail firmware bl1 - I sent him a message thanks! I see it built into another firmware that is available but id rather build it into me's samfail firmy since there is some issues to be wrinkled out in the other custom firmwares.

This thread is more currently active than the Safestrap one. I'm just here looking for more information on how to flash ROMS while keeping your others. Like do I activate that slot then start flashing and do you know if it's possible to use Slick ROM as one of the slots? I'm rooted with Partcyborg on bootloader v2

xSl33p said:
This thread is more currently active than the Safestrap one. I'm just here looking for more information on how to flash ROMS while keeping your others. Like do I activate that slot then start flashing and do you know if it's possible to use Slick ROM as one of the slots? I'm rooted with Partcyborg on bootloader v2
Click to expand...
Click to collapse
Dont quote me on this but im pretty sure the slots arent 100% functional yet you can do backups and restore your system flash zips ect. , I know this thread is more active but you should really stick with the topic of the thread, your question would get answered there.
I got an answer from the guy you recommended afaneh92 thanks, it looks like I need to place the smalis in a different folder as they go over the limit, I dont have time right now but he also sent me his services .jar so I can see what the difference is I got some learning to do.
Thanks
Canadian Dilly.

dillweedinc said:
Dont quote me on this but im pretty sure the slots arent 100% functional yet you can do backups and restore your system flash zips ect. , I know this thread is more active but you should really stick with the topic of the thread, your question would get answered there.
I got an answer from the guy you recommended afaneh92 thanks, it looks like I need to place the smalis in a different folder as they go over the limit, I dont have time right now but he also sent me his services .jar so I can see what the difference is I got some learning to do.
Thanks
Canadian Dilly.
Click to expand...
Click to collapse
Im working on update and some fixes for the mod, then will rewrite this guide in the Note 8 section.

Related

[Team XPOSED][HOW-TO/MOD] LongPress Volume to Skip tracks

First of all, a big thanks to one_love_420 for doing this modification for our EVO LTEs. Now, of course I had to pick apart the mod and figure out how to do it for myself for future reference and low and behold, it worked.
I have attached a flashable zip to make this easier. It also includes the advanced power menu and long press home for recent apps. If you use Titanium Backup to odex the system apps, you must remove odex files before flashing OR before rebooting after flashing or you will get FCs.
Another Team XPOSED exclusive!
Step 1: grab android.policy.jar and decompile it OR extract classes.dex from it and use baksmali to decompile.
Step 2: navigate to com\android\internal\policy\impl\PhoneWindowManager.smali and open that.
Before we begin, let me add a legend so that you know what commands mean what.
Command Legend
FIND: This means search for
AFTER-ADD: This means after the line you've searched for, add the following below it. You can press enter to make a few lines. I would do 3 so that you can add whatever you need to in the middle, keeping the code looking the same.
FIND-AROUND: This means that you search around the previous FIND. Somewhere in the vicinity that's not really searchable for the first time because of multiple instances. Most of the time you can search with your eyes instead of with the actual search command.
REPLACE: You completely replace whatever you are told to replace with what comes after the REPLACE command.
REPLACE-WITH: This is roughly the same as REPLACE, but is used when there is nothing to FIND-AROUND.
REMOVE: You completely remove what is said below the REMOVE command.
ADD-BEFORE: This means after the line you've searched for, add the following above it. You can press enter to make a few lines. I would do 3 so that you can add whatever you need to in the middle, keeping the code looking the same.
Let us begin with actual smali code modifications.
Step 3: FIND
Code:
.field mIsHtcDockScreenAsHome:Z
AFTER-ADD
Code:
.field mIsLongPress:Z
FIND
Code:
.field private mVolumeDownKeyTriggered:Z
AFTER-ADD
Code:
.field mVolumeDownLongPress:Ljava/lang/Runnable;
FIND
Code:
.field private mVolumeUpKeyTriggered:Z
AFTER-ADD
Code:
.field mVolumeUpLongPress:Ljava/lang/Runnable;
.field mWakeAcquired:Z
FIND
Code:
iput-boolean v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsGuestMode:Z
AFTER-ADD
Code:
new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$VolumeLongPressF;
invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$VolumeLongPressF;-><init>
(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mVolumeUpLongPress:Ljava/lang/Runnable;
new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$VolumeLongPressR;
invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$VolumeLongPressR;-><init>
(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mVolumeDownLongPress:Ljava/lang/Runnable;
iput-boolean v2, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mWakeAcquired:Z
FIND
Code:
iget-object v3, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mBroadcastWakeLock:Landroid/os/PowerManager$WakeLock;
FIND-AROUND
Code:
throw v2
.end method
ADD-AFTER
Code:
.method handleVolumeLongPress(I)V
.locals 4
const/16 v1, 0x18
if-ne p1, v1, :cond_11
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mVolumeUpLongPress:Ljava/lang/Runnable;
:goto_6
iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mHandler:Landroid/os/Handler;
invoke-static {}, Landroid/view/ViewConfiguration;->getLongPressTimeout()I
move-result v2
int-to-long v2, v2
invoke-virtual {v1, v0, v2, v3}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z
return-void
:cond_11
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mVolumeDownLongPress:Ljava/lang/Runnable;
goto :goto_6
.end method
.method handleVolumeLongPressAbort()V
.locals 2
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mHandler:Landroid/os/Handler;
iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mVolumeUpLongPress:Ljava/lang/Runnable;
invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mHandler:Landroid/os/Handler;
iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mVolumeDownLongPress:Ljava/lang/Runnable;
invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V
return-void
.end method
FIND
Code:
:cond_215
const/16 v20, 0x0
goto :goto_201
:sswitch_218
const/16 v20, 0x19
FIND-AROUND
Code:
:sswitch_218
ADD-AFTER
Code:
if-nez v7, :cond_245
invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>handleVolumeLongPressAbort()V
move-object/from16 v0, p0
iget-boolean v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mWakeAcquired:Z
if-eqz v1, :cond_232
const-string v1, "lyapota"
const-string v2, "media_key WakeLock release"
invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
iget-object v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mBroadcastWakeLock:Landroid/os/PowerManager$WakeLock;
invoke-virtual {v1}, Landroid/os/PowerManager$WakeLock;->release()V
const/4 v2, 0x0
iput-boolean v2, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mWakeAcquired:Z
:cond_232
move-object/from16 v0, p0
iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsLongPress:Z
if-nez v0, :cond_245
and-int/lit8 v20, v18, 0x1
if-nez v20, :cond_245
const/16 v20, 0x3
move-object/from16 v0, p0
move/from16 v1, v20
invoke-virtual {v0, v1, v14}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeKey(II)V
:cond_245
FIND
Code:
invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->isMusicActive()Z
FIND-AROUND
Code:
if-eqz v20, :cond_2c
ADD-AFTER
Code:
move-object/from16 v0, p0
iget-boolean v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mWakeAcquired:Z
if-nez v1, :cond_320
const-string v1, "lyapota"
const-string v2, "media_key WakeLock acquire"
invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
iget-object v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mBroadcastWakeLock:Landroid/os/PowerManager$WakeLock;
invoke-virtual {v1}, Landroid/os/PowerManager$WakeLock;->acquire()V
const/4 v2, 0x1
iput-boolean v2, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mWakeAcquired:Z
:cond_320
FIND
Code:
and-int/lit8 v20, v18, 0x1
if-nez v20, :cond_2c
FIND-AROUND
Code:
const/16 v20, 0x3
REPLACE
Code:
const/16 v20, 0x3
WITH
Code:
const/4 v1, 0x0
FIND
Code:
move-object/from16 v0, p0
move/from16 v1, v20
REMOVE
Code:
move/from16 v1, v20
FIND
Code:
invoke-virtual {v0, v1, v14}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeKey(II)V
REPLACE-WITH
Code:
iput-boolean v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsLongPress:Z
invoke-virtual {v0, v14}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeLongPress
(I)V
FIND
Code:
.method setAttachedWindowFrames(Landroid/view/WindowManagerPolicy
$WindowState;IILandroid/view/WindowManagerPolicy
$WindowState;ZLandroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;)V
ADD-BEFORE
Code:
.method protected sendMediaButtonEvent(I)V
.locals 13
invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J
move-result-wide v1
new-instance v11, Landroid/content/Intent;
const-string v4, "android.intent.action.MEDIA_BUTTON"
const/4 v5, 0x0
invoke-direct {v11, v4, v5}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V
new-instance v0, Landroid/view/KeyEvent;
const/4 v5, 0x0
const/4 v7, 0x0
move-wide v3, v1
move v6, p1
invoke-direct/range {v0 .. v7}, Landroid/view/KeyEvent;-><init>(JJIII)V
const-string v4, "android.intent.extra.KEY_EVENT"
invoke-virtual {v11, v4, v0}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Parcelable;)
Landroid/content/Intent;
iget-object v4, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mContext:Landroid/content/Context;
const/4 v5, 0x0
invoke-virtual {v4, v11, v5}, Landroid/content/Context;->sendOrderedBroadcast
(Landroid/content/Intent;Ljava/lang/String;)V
new-instance v12, Landroid/content/Intent;
const-string v4, "android.intent.action.MEDIA_BUTTON"
const/4 v5, 0x0
invoke-direct {v12, v4, v5}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V
new-instance v3, Landroid/view/KeyEvent;
const/4 v8, 0x1
const/4 v10, 0x0
move-wide v4, v1
move-wide v6, v1
move v9, p1
invoke-direct/range {v3 .. v10}, Landroid/view/KeyEvent;-><init>(JJIII)V
const-string v4, "android.intent.extra.KEY_EVENT"
invoke-virtual {v12, v4, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Parcelable;)
Landroid/content/Intent;
iget-object v4, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mContext:Landroid/content/Context;
const/4 v5, 0x0
invoke-virtual {v4, v12, v5}, Landroid/content/Context;->sendOrderedBroadcast
(Landroid/content/Intent;Ljava/lang/String;)V
return-void
.end method
Step 4: Save file and compile android.policy.jar or use smali to compile classes.dex and replace inside of android.policy.jar
Step 5: Reboot into recovery and push to phone, clear Dalvik and if you use Titanium Backup to odex, you will have to remove the odex files from /system/app/ in adb by doing "adb shell rm /system/app/*.odex"
Step 6: Reboot and prosper!
freeza said:
First of all, a big thanks to one_love_420 for doing this modification for our EVO LTEs. Now, of course I had to pick apart the mod and figure out how to do it for myself for future reference and low and behold, it worked.
Another Team XPOSED exclusive!
Step 1: grab android.policy.jar and decompile it OR extract classes.dex from it and use baksmali to decompile.
Step 2: navigate to com\android\internal\policy\impl\PhoneWindowManager.smali and open that.
Before we begin, let me add a legend so that you know what commands mean what.
Command Legend
FIND: This means search for
AFTER-ADD: This means after the line you've searched for, add the following below it. You can press enter to make a few lines. I would do 3 so that you can add whatever you need to in the middle, keeping the code looking the same.
FIND-AROUND: This means that you search around the previous FIND. Somewhere in the vicinity that's not really searchable for the first time because of multiple instances. Most of the time you can search with your eyes instead of with the actual search command.
REPLACE: You completely replace whatever you are told to replace with what comes after the REPLACE command.
REPLACE-WITH: This is roughly the same as REPLACE, but is used when there is nothing to FIND-AROUND.
REMOVE: You completely remove what is said below the REMOVE command.
ADD-BEFORE: This means after the line you've searched for, add the following above it. You can press enter to make a few lines. I would do 3 so that you can add whatever you need to in the middle, keeping the code looking the same.
Let us begin with actual smali code modifications.
Step 3: FIND
Code:
.field mIsHtcDockScreenAsHome:Z
AFTER-ADD
Code:
.field mIsLongPress:Z
FIND
Code:
.field private mVolumeDownKeyTriggered:Z
AFTER-ADD
Code:
.field mVolumeDownLongPress:Ljava/lang/Runnable;
FIND
Code:
.field private mVolumeUpKeyTriggered:Z
AFTER-ADD
Code:
.field mVolumeUpLongPress:Ljava/lang/Runnable;
.field mWakeAcquired:Z
FIND
Code:
iput-boolean v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsGuestMode:Z
AFTER-ADD
Code:
new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$VolumeLongPressF;
invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$VolumeLongPressF;-><init>
(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mVolumeUpLongPress:Ljava/lang/Runnable;
new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$VolumeLongPressR;
invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$VolumeLongPressR;-><init>
(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mVolumeDownLongPress:Ljava/lang/Runnable;
iput-boolean v2, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mWakeAcquired:Z
FIND
Code:
iget-object v3, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mBroadcastWakeLock:Landroid/os/PowerManager$WakeLock;
FIND-AROUND
Code:
throw v2
.end method
ADD-AFTER
Code:
.method handleVolumeLongPress(I)V
.locals 4
const/16 v1, 0x18
if-ne p1, v1, :cond_11
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mVolumeUpLongPress:Ljava/lang/Runnable;
:goto_6
iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mHandler:Landroid/os/Handler;
invoke-static {}, Landroid/view/ViewConfiguration;->getLongPressTimeout()I
move-result v2
int-to-long v2, v2
invoke-virtual {v1, v0, v2, v3}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z
return-void
:cond_11
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mVolumeDownLongPress:Ljava/lang/Runnable;
goto :goto_6
.end method
.method handleVolumeLongPressAbort()V
.locals 2
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mHandler:Landroid/os/Handler;
iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mVolumeUpLongPress:Ljava/lang/Runnable;
invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mHandler:Landroid/os/Handler;
iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mVolumeDownLongPress:Ljava/lang/Runnable;
invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V
return-void
.end method
FIND
Code:
:cond_215
const/16 v20, 0x0
goto :goto_201
:sswitch_218
const/16 v20, 0x19
FIND-AROUND
Code:
:sswitch_218
ADD-AFTER
Code:
if-nez v7, :cond_245
invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>handleVolumeLongPressAbort()V
move-object/from16 v0, p0
iget-boolean v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mWakeAcquired:Z
if-eqz v1, :cond_232
const-string v1, "lyapota"
const-string v2, "media_key WakeLock release"
invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
iget-object v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mBroadcastWakeLock:Landroid/os/PowerManager$WakeLock;
invoke-virtual {v1}, Landroid/os/PowerManager$WakeLock;->release()V
const/4 v2, 0x0
iput-boolean v2, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mWakeAcquired:Z
:cond_232
move-object/from16 v0, p0
iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsLongPress:Z
if-nez v0, :cond_245
and-int/lit8 v20, v18, 0x1
if-nez v20, :cond_245
const/16 v20, 0x3
move-object/from16 v0, p0
move/from16 v1, v20
invoke-virtual {v0, v1, v14}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeKey(II)V
:cond_245
FIND
Code:
invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->isMusicActive()Z
FIND-AROUND
Code:
if-eqz v20, :cond_2c
ADD-AFTER
Code:
move-object/from16 v0, p0
iget-boolean v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mWakeAcquired:Z
if-nez v1, :cond_320
const-string v1, "lyapota"
const-string v2, "media_key WakeLock acquire"
invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
iget-object v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mBroadcastWakeLock:Landroid/os/PowerManager$WakeLock;
invoke-virtual {v1}, Landroid/os/PowerManager$WakeLock;->acquire()V
const/4 v2, 0x1
iput-boolean v2, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mWakeAcquired:Z
:cond_320
FIND
Code:
and-int/lit8 v20, v18, 0x1
if-nez v20, :cond_2c
FIND-AROUND
Code:
const/16 v20, 0x3
REPLACE
Code:
const/16 v20, 0x3
WITH
Code:
const/4 v1, 0x0
FIND
Code:
move-object/from16 v0, p0
move/from16 v1, v20
REMOVE
Code:
move/from16 v1, v20
FIND
Code:
invoke-virtual {v0, v1, v14}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeKey(II)V
REPLACE-WITH
Code:
iput-boolean v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsLongPress:Z
invoke-virtual {v0, v14}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeLongPress
(I)V
FIND
Code:
.method setAttachedWindowFrames(Landroid/view/WindowManagerPolicy
$WindowState;IILandroid/view/WindowManagerPolicy
$WindowState;ZLandroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;)V
ADD-BEFORE
Code:
.method protected sendMediaButtonEvent(I)V
.locals 13
invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J
move-result-wide v1
new-instance v11, Landroid/content/Intent;
const-string v4, "android.intent.action.MEDIA_BUTTON"
const/4 v5, 0x0
invoke-direct {v11, v4, v5}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V
new-instance v0, Landroid/view/KeyEvent;
const/4 v5, 0x0
const/4 v7, 0x0
move-wide v3, v1
move v6, p1
invoke-direct/range {v0 .. v7}, Landroid/view/KeyEvent;-><init>(JJIII)V
const-string v4, "android.intent.extra.KEY_EVENT"
invoke-virtual {v11, v4, v0}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Parcelable;)
Landroid/content/Intent;
iget-object v4, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mContext:Landroid/content/Context;
const/4 v5, 0x0
invoke-virtual {v4, v11, v5}, Landroid/content/Context;->sendOrderedBroadcast
(Landroid/content/Intent;Ljava/lang/String;)V
new-instance v12, Landroid/content/Intent;
const-string v4, "android.intent.action.MEDIA_BUTTON"
const/4 v5, 0x0
invoke-direct {v12, v4, v5}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V
new-instance v3, Landroid/view/KeyEvent;
const/4 v8, 0x1
const/4 v10, 0x0
move-wide v4, v1
move-wide v6, v1
move v9, p1
invoke-direct/range {v3 .. v10}, Landroid/view/KeyEvent;-><init>(JJIII)V
const-string v4, "android.intent.extra.KEY_EVENT"
invoke-virtual {v12, v4, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Parcelable;)
Landroid/content/Intent;
iget-object v4, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-
>mContext:Landroid/content/Context;
const/4 v5, 0x0
invoke-virtual {v4, v12, v5}, Landroid/content/Context;->sendOrderedBroadcast
(Landroid/content/Intent;Ljava/lang/String;)V
return-void
.end method
Step 4: Save file and compile android.policy.jar or use smali to compile classes.dex and replace inside of android.policy.jar
Step 5: Reboot into recovery and push to phone, clear Dalvik and if you use Titanium Backup to odex, you will have to remove the odex files from /system/app/ in adb by doing "adb shell rm /system/app/*.odex"
Step 6: Reboot and prosper!
I have attached a flashable zip to make this easier. It also includes the advanced power menu and long press home for recent apps.
Click to expand...
Click to collapse
You guys are at it again! Good work!
Sent from my EVO using Tapatalk 2
Nice Job freeza!
Yay freeza!
Way to Go!
People appreciate when mods are broken down, and can see what's happening underneath it all.
-Zanzibar
(Happy 4:20!)
Freeza yur the best man. Love this MOD. Gonna play with it now
Sent from my EVO using Tapatalk 2
Nice write up!
Sent from my EVO using Tapatalk 2
According to a few posts in flex360's rom thread it appears this mod causes the volume control in 3rd party apps such as pandora to act strangely. Some of the details are here http://forum.xda-developers.com/showpost.php?p=27789582&postcount=952 Is there any way to resolve this issue?
njfoses said:
According to a few posts in flex360's rom thread it appears this mod causes the volume control in 3rd party apps such as pandora to act strangely. Some of the details are here http://forum.xda-developers.com/showpost.php?p=27789582&postcount=952 Is there any way to resolve this issue?
Click to expand...
Click to collapse
Does it happen in Pandora? Because I just read that thread, and tried the volume keys in Pandora with screen on and off and they functioned as expected.
freeza said:
Does it happen in Pandora? Because I just read that thread, and tried the volume keys in pandora with screen on and off and they functioned as expected.
Click to expand...
Click to collapse
To be honest im not using the mod or that rom personally (only rooted not unlocked yet) i was just passing along information. Here is another post in that thread that says the issue happens in google play music http://forum.xda-developers.com/showpost.php?p=27776939&postcount=931
Thanks Freeza, I love this mod!
njfoses said:
To be honest im not using the mod or that rom personally (only rooted not unlocked yet) i was just passing along information. Here is another post in that thread that says the issue happens in google play music http://forum.xda-developers.com/showpost.php?p=27776939&postcount=931
Click to expand...
Click to collapse
Thanks for the heads-up! It appears as though my Google Play Music and Pandora are functioning as expected in regards to the volume keys. If anyone else can chime in and give their feedback, that would be awesome.
If you are going to post feedback, please do so with the following criteria:
-Do the volume keys work as expected in various music apps?
-What ROM are you using?
-Are you using the prepackaged flashable from this thread?
-If not, did you mod it yourself?
-If you did mod it, does yours also include longpress home for recent apps and advanced power menu?
-Any other information you think would be relevant
ZanzDroid said:
Yay freeza!
Way to Go!
People appreciate when mods are broken down, and can see what's happening underneath it all.
-Zanzibar
(Happy 4:20!)
Click to expand...
Click to collapse
lol it's always 420 some where zanzibar
Definitely appreciated just one thing what does, line then some # mean
Sent from my PC36100 using Tapatalk 2
Hi
Could U please help me do the same in htc wildfire s? I tried but this keywords cant be found in wfs PhoneWindowManager.smali.
Please help a little. I dont understand codes.
rename to remove .c
It gives me this after modification
Code:
C:\A>apktool b out
I: Checking whether sources has changed...
I: Smaling...
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file
: [email protected]
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:45)
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:33)
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:64)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:48)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:35)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:222)
at brut.androlib.Androlib.buildSources(Androlib.java:179)
at brut.androlib.Androlib.build(Androlib.java:170)
at brut.androlib.Androlib.build(Androlib.java:154)
at brut.apktool.Main.cmdBuild(Main.java:182)
at brut.apktool.Main.main(Main.java:67)
Hey freeza , thanks for all your stuff .
zozor said:
Hey freeza , thanks for all your stuff .
Click to expand...
Click to collapse
did it work for you? or are you just saying thanks

[HOW-TO] [LSJ] [4.1.2] Volume Rocker mod **26 NOV fixed**

Hello xda'ers.
Today I post this thread to help people who want volume rocker mod in their I9100.
This thread is not supposed to be a request thread, especially for non thanking people, but is open to help, support and debug (or improves).
For DEVs the how to on jelly bean [LSJ] (add green parts)
edit PhoneWindowManager.smali in android.policy.jar
Code:
.field private mIsSensorhubEnabled:Z
.field mIsSleepWithCameraOnTop:Z
.field private mIsTablet:Z
.field private mIsVisibleSPenGestureView:Z
[COLOR="YellowGreen"].field mIsVolumeAction:Z
.field mIsVolumeBlocking:Z
[/COLOR]
.field mKeyboardTapVibePattern:[J
.field mKeyguard:Landroid/view/WindowManagerPolicy$WindowState;
.field mKeyguardMediator:Lcom/android/internal/policy/impl/KeyguardViewMediator;
Code:
.field private mVolumeDownKeyTime:J
.field private mVolumeDownKeyTriggered:Z
[COLOR="YellowGreen"].field mVolumeDownLongPress:Ljava/lang/Runnable;[/COLOR]
.field private final mVolumeKeyLongPressforOneTouchReport:Ljava/lang/Runnable;
.field private mVolumeUpKeyConsumedByOneTouchReportChord:Z
.field private mVolumeUpKeyConsumedByScreenRecordChord:Z
.field private mVolumeUpKeyTime:J
.field private mVolumeUpKeyTriggered:Z
[COLOR="YellowGreen"].field mVolumeUpLongPress:Ljava/lang/Runnable;[/COLOR]
.field mWindowManager:Landroid/view/IWindowManager;
.field mWindowManagerFuncs:Landroid/view/WindowManagerPolicy$WindowManagerFuncs;
Code:
.line 7234
new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$35;
invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$35;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mScreenLockTimeout:Ljava/lang/Runnable;
[COLOR="YellowGreen"] .line 8130
new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$SkipNext;
invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$SkipNext;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeUpLongPress:Ljava/lang/Runnable;
.line 8131
new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$SkipPrev;
invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$SkipPrev;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeDownLongPress:Ljava/lang/Runnable;
[/COLOR]
.line 8132
return-void
.end method
Code:
.method handleVolumeKey(II)V
.registers 8
.parameter "stream"
.parameter "keycode"
.prologue
.line 5405
[COLOR="YellowGreen"] move-object/from16 v0, p0
iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeBlocking:Z
if-nez v0, :cond_c[/COLOR]
invoke-static {}, Lcom/android/internal/policy/impl/PhoneWindowManager;->getAudioService()Landroid/media/IAudioService;
move-result-object v0
.line 5406
.local v0, audioService:Landroid/media/IAudioService;
if-nez v0, :cond_7
.line 5437
[COLOR="YellowGreen"] :cond_c
:goto_c[/COLOR]
return-void
[COLOR="Red"]:goto_6[/COLOR]
Code:
.line 5435
iget-object v2, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBroadcastWakeLock:Landroid/os/PowerManager$WakeLock;
invoke-virtual {v2}, Landroid/os/PowerManager$WakeLock;->release()V
[COLOR="YellowGreen"]goto :goto_c[/COLOR]
[COLOR="Red"] goto :goto_6[/COLOR]
Code:
.line 5435
iget-object v2, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBroadcastWakeLock:Landroid/os/PowerManager$WakeLock;
invoke-virtual {v2}, Landroid/os/PowerManager$WakeLock;->release()V
[COLOR="YellowGreen"]goto :goto_c[/COLOR]
[COLOR="Red"]goto :goto_6[/COLOR]
add this just above .method public hasNavigationBar()Z
Code:
[COLOR="YellowGreen"].method handleVolumeLongPress(I)V
.registers 6
.parameter "keycode"
.prologue
const/4 v1, 0x1
move-object/from16 v0, p0
iput-boolean v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeBlocking:Z
const/4 v1, 0x0
iput-boolean v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeAction:Z
const/16 v1, 0x18
if-ne p1, v1, :cond_19
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeUpLongPress:Ljava/lang/Runnable;
.local v0, btnHandler:Ljava/lang/Runnable;
:goto_e
iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;
invoke-static {}, Landroid/view/ViewConfiguration;->getTapTimeout()I
move-result v2
int-to-long v2, v2
invoke-virtual {v1, v0, v2, v3}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z
return-void
.end local v0 #btnHandler:Ljava/lang/Runnable;
:cond_19
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeDownLongPress:Ljava/lang/Runnable;
.restart local v0 #btnHandler:Ljava/lang/Runnable;
goto :goto_e
.end method
.method handleVolumeLongPressAbort()V
.registers 3
.prologue
const/4 v1, 0x0
move-object/from16 v0, p0
iput-boolean v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeBlocking:Z
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;
iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeUpLongPress:Ljava/lang/Runnable;
invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;
iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeDownLongPress:Ljava/lang/Runnable;
invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V
return-void
.end method
[/COLOR]
Code:
.line 5838
:cond_388
:goto_388
[COLOR="YellowGreen"]if-eqz v5, :cond_mir[/COLOR]
[COLOR="Red"]if-eqz v5, :cond_4f3[/COLOR]
Code:
.line 5926
.end local v6 #ex:Landroid/os/RemoteException;
:cond_4c0
move-object/from16 v0, p0
[COLOR="YellowGreen"] iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mScreenOnEarly:Z
if-nez v0, :cond_new
invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->isMusicActive()Z
move-result v25
if-eqz v25, :cond_new
move-object/from16 v0, p0
move/from16 v14, v18
invoke-virtual {v0, v14}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeLongPress(I)V
:cond_new
move-object/from16 v0, p0
[/COLOR]
iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSamsungVolumeControlThread:Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;
move-object/from16 v27, v0
if-nez v27, :cond_68
Code:
.line 5934
.end local v26 #telephonyService:Lcom/android/internal/telephony/ITelephony;
[COLOR="Red"]:cond_4f3[/COLOR]
[COLOR="YellowGreen"]:cond_mir
if-nez v5, :cond_ko
move-object/from16 v0, p0
iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeBlocking:Z
if-eqz v0, :cond_ko
invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeLongPressAbort()V
move-object/from16 v0, p0
iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeAction:Z
if-nez v0, :cond_ko
move-object/from16 v0, p0
const/4 v3, 0x0
move/from16 v14, v18
invoke-virtual {v0, v3, v14}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeKey(II)V
:cond_ko[/COLOR]
move-object/from16 v0, p0
iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSamsungVolumeControlThread:Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;
move-object/from16 v27, v0
if-eqz v27, :cond_68
add this method under .method sendCloseSystemWindows(Ljava/lang/StringV
Code:
[COLOR="YellowGreen"].method protected sendMediaButtonEvent(I)V
.registers 15
.parameter "code"
.prologue
invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J
move-result-wide v1
.local v1, eventtime:J
new-instance v11, Landroid/content/Intent;
const-string v4, "android.intent.action.MEDIA_BUTTON"
const/4 v5, 0x0
invoke-direct {v11, v4, v5}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V
.local v11, downIntent:Landroid/content/Intent;
new-instance v0, Landroid/view/KeyEvent;
const/4 v5, 0x0
const/4 v7, 0x0
move-wide v3, v1
move v6, p1
invoke-direct/range {v0 .. v7}, Landroid/view/KeyEvent;-><init>(JJIII)V
.local v0, downEvent:Landroid/view/KeyEvent;
const-string v4, "android.intent.extra.KEY_EVENT"
invoke-virtual {v11, v4, v0}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Parcelable;)Landroid/content/Intent;
iget-object v4, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mContext:Landroid/content/Context;
const/4 v5, 0x0
invoke-virtual {v4, v11, v5}, Landroid/content/Context;->sendOrderedBroadcast(Landroid/content/Intent;Ljava/lang/String;)V
new-instance v12, Landroid/content/Intent;
const-string v4, "android.intent.action.MEDIA_BUTTON"
const/4 v5, 0x0
invoke-direct {v12, v4, v5}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V
.local v12, upIntent:Landroid/content/Intent;
new-instance v3, Landroid/view/KeyEvent;
const/4 v8, 0x1
const/4 v10, 0x0
move-wide v4, v1
move-wide v6, v1
move v9, p1
invoke-direct/range {v3 .. v10}, Landroid/view/KeyEvent;-><init>(JJIII)V
.local v3, upEvent:Landroid/view/KeyEvent;
const-string v4, "android.intent.extra.KEY_EVENT"
invoke-virtual {v12, v4, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Parcelable;)Landroid/content/Intent;
iget-object v4, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mContext:Landroid/content/Context;
const/4 v5, 0x0
invoke-virtual {v4, v12, v5}, Landroid/content/Context;->sendOrderedBroadcast(Landroid/content/Intent;Ljava/lang/String;)V
const/4 v8, 0x1
move-object/from16 v9, p0
iput-boolean v8, v9, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeAction:Z
return-void
.end method[/COLOR]
done.
now add the 2 subclasses attached and recompile.
Mirko ddd said:
Hello xda'ers.
Today I post this thread to help people who want volume rocker mod in their I9100.
Mod is based on kahvitara's one, but cleaned up and easier to implement; no SDcard path, minimum delay and ready to use.
This thread is not supposed to be a request thread, especially for non thanking people, but is open to help, support and debug (or improves).
here is the smali diffs, and u can find the untouched file before of applying the mod so u can compare and implement it easily.
Tested on I9100 (my phone) but will work on US clones, and most of ICS samsung touchwized phones with some rearranging.
Currently I m on LPX, if someone cares I can provide the zip, but only with this mod and reccommended ONLY to samsung stock deodexed roms LPX.
Click to expand...
Click to collapse
Another awwsome mod by Mirko.!! Always grt to hv you arnd mate :good:
geekynoob said:
Another awwsome mod by Mirko.!! Always grt to hv you arnd mate :good:
Click to expand...
Click to collapse
Inviato dal mio GT-I9100 con Tapatalk 2
Hi Mirko.
In your file you have this code. In the stock file I am comparing to and the PhoneWindowManager$KillConcept.smali file does not exist either. Is this part new code and new file?:
Code:
.line 3674
new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$KillConcept;
invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$KillConcept;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackLongPress:Ljava/lang/Runnable;
tdunham said:
Hi Mirko.
In your file you have this code. In the stock file I am comparing to and the PhoneWindowManager$KillConcept.smali file does not exist either. Is this part new code and new file?:
Code:
.line 3674
new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$KillConcept;
invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$KillConcept;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackLongPress:Ljava/lang/Runnable;
Click to expand...
Click to collapse
i don t understand, are we talking about backto kill or volume rocker?
Mirko ddd said:
i don t understand, are we talking about backto kill or volume rocker?
Click to expand...
Click to collapse
This is for Volume Rocker. I do not have those lines or (Killconcept file) in my code. I also download this: i9100_XWLPX_Deodexed_signed.zip hoping to have stock android.policy.jar for comparison and is does not exist there either. So I thought I would ask.
Edit: I feel foolish, you put code on Github that included code for back to kill mod. I should have noticed. You may want to remove that code to prevent confusion.
tdunham said:
This is for Volume Rocker. I do not have those lines or (Killconcept file) in my code. I also download this: i9100_XWLPX_Deodexed_signed.zip hoping to have stock android.policy.jar for comparison and is does not exist there either. So I thought I would ask.
Click to expand...
Click to collapse
mate.. kill concept smali has nothing to do with volume rocker
Mirko ddd said:
mate.. kill concept smali has nothing to do with volume rocker
Click to expand...
Click to collapse
Yes, no problem. I found out as soon as I posted. Thanks.
tdunham said:
Yes, no problem. I found out as soon as I posted. Thanks.
Click to expand...
Click to collapse
lol :silly:
MirkO You Are Really Great
updated to LSJ
reupdated
Nice work
One thing tho, a fast look and seems like you have a field missing:
.field mVolumeDownPress:Ljava/lang/Runnable;
LegendK95 said:
Nice work
One thing tho, a fast look and seems like you have a field missing:
.field mVolumeDownPress:Ljava/lang/Runnable;
Click to expand...
Click to collapse
lol is there, but it s not highlighted well, damn txt editor!
can u make it for odexed one please thanks
Thanks mate for the guide, gonna try it tomorrow.
MyLifeRocks10 said:
Thanks mate for the guide, gonna try it tomorrow.
Click to expand...
Click to collapse
yoshi it s easy to implement, later this week i ll try to improve it.
I am sorry for my ignorance. But what is this supposed to do?
MySeLfPT said:
I am sorry for my ignorance. But what is this supposed to do?
Click to expand...
Click to collapse
Mmh, in OP there s a zip to flash on LSJ jelly bean deodexed rom to get skip songs while screen is off.
And there s a tutorial too to help rom developers to include this feature into their own roms.
Hope u understand now
Mirko, during screen-off single press skips the song instead changing the volume, what did I wrong?
Btw, I think the "goto_6" doesn't need to be changed to "goto_c".

Modifying NfcNci.apk so that it doesn't care about Deodex.

Just for the sake of transparency Here is a quick rundown of the process for everyone to see.
High level overview:
1. ) baksmali classes.dex from NfcNci.apk
2. ) Mod the resulting smali.
3. ) smali, and inject back into NfcNci.apk
Since this is the dev section I will focus on step 2 you can read about steps 1 and 3 elsewhere. For the sake of this example I will be working with the system dump from the original release of the gt-i9505g (S4 Google Edition) System Software.
What you are looking for is this function contained in the NfcIntegrityChecker class:
Code:
.method public checkIntegrity(Ljava/lang/String;)Z
If we track back the exception error message that comes up in the debug log ("Client module is tampered"), you will see that the text is contained in the NfcService class within the function ".method public enforceNfcIntegrity()V"
Code:
.method public enforceNfcIntegrity()V
.locals 3
.prologue
.line 470
iget-object v1, p0, Lcom/android/nfc/NfcService;->mIntegrityChecker:Lcom/android/nfc/NfcIntegrityChecker;
monitor-enter v1
.line 471
:try_start_0
iget-object v0, p0, Lcom/android/nfc/NfcService;->mIntegrityChecker:Lcom/android/nfc/NfcIntegrityChecker;
invoke-virtual {v0}, Lcom/android/nfc/NfcIntegrityChecker;->getStatus()I
move-result v0
const/4 v2, 0x3
if-ne v0, v2, :cond_0
.line 472
new-instance v0, Ljava/lang/SecurityException;
const-string v2, "NfcIntegrityChecker is not on the proper status"
invoke-direct {v0, v2}, Ljava/lang/SecurityException;-><init>(Ljava/lang/String;)V
throw v0
.line 480
:catchall_0
move-exception v0
monitor-exit v1
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
throw v0
.line 475
:cond_0
:try_start_1
iget-object v0, p0, Lcom/android/nfc/NfcService;->mIntegrityChecker:Lcom/android/nfc/NfcIntegrityChecker;
invoke-virtual {v0}, Lcom/android/nfc/NfcIntegrityChecker;->getStatus()I
move-result v0
const/4 v2, 0x2
if-eq v0, v2, :cond_1
iget-object v0, p0, Lcom/android/nfc/NfcService;->mIntegrityChecker:Lcom/android/nfc/NfcIntegrityChecker;
const-string v2, "client"
invoke-virtual {v0, v2}, Lcom/android/nfc/NfcIntegrityChecker;->checkIntegrity(Ljava/lang/String;)Z
move-result v0
if-eqz v0, :cond_1
iget-object v0, p0, Lcom/android/nfc/NfcService;->mIntegrityChecker:Lcom/android/nfc/NfcIntegrityChecker;
const-string v2, "clientlib"
invoke-virtual {v0, v2}, Lcom/android/nfc/NfcIntegrityChecker;->checkIntegrity(Ljava/lang/String;)Z
move-result v0
if-nez v0, :cond_2
.line 478
:cond_1
new-instance v0, Ljava/lang/SecurityException;
const-string v2, "Client module is tampered"
invoke-direct {v0, v2}, Ljava/lang/SecurityException;-><init>(Ljava/lang/String;)V
throw v0
.line 480
:cond_2
monitor-exit v1
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
.line 481
return-void
.end method
If we follow the flow of the application we see that the code for this failure is only reached if the function call to
Code:
checkIntegrity(Ljava/lang/String;)Z
returns false, or the status is not properly set. (the 'Z' at the end means it returns a boolean).
There are two ways to handle this. We can either patch out the call to checkIntegrity entirely (jump over it, or literally remove the calls), or we can modify the checkIntegrity function so that it always returns true.
So, let's look at the checkIntegrity function:
Code:
.method public checkIntegrity(Ljava/lang/String;)Z
.locals 11
.parameter "type"
.prologue
const/4 v10, 0x2
const/4 v9, 0x1
const/4 v8, 0x0
.line 293
iget-object v5, p0, Lcom/android/nfc/NfcIntegrityChecker;->mModuleMap:Ljava/util/HashMap;
invoke-virtual {v5, p1}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v2
check-cast v2, Ljava/util/ArrayList;
.line 294
.local v2, modules:Ljava/util/ArrayList;,"Ljava/util/ArrayList<[Ljava/lang/String;>;"
const/4 v1, 0x0
.line 295
.local v1, module:[Ljava/lang/String;
const/4 v3, 0x1
.line 296
.local v3, ret:Z
invoke-virtual {v2}, Ljava/util/ArrayList;->size()I
move-result v4
.line 298
.local v4, size:I
const/4 v0, 0x0
.local v0, i:I
:goto_0
if-ge v0, v4, :cond_2
.line 299
invoke-virtual {v2, v0}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;
move-result-object v1
.end local v1 #module:[Ljava/lang/String;
check-cast v1, [Ljava/lang/String;
.line 301
.restart local v1 #module:[Ljava/lang/String;
if-eqz v1, :cond_0
array-length v5, v1
if-eq v5, v10, :cond_4
.line 302
:cond_0
sget-boolean v5, Lcom/android/nfc/NfcIntegrityChecker;->DBG:Z
if-eqz v5, :cond_1
const-string v5, "NfcIntegrityChecker"
const-string v6, "checkIntegrity module format error"
invoke-static {v5, v6}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
.line 303
:cond_1
const/4 v3, 0x0
.line 314
:cond_2
:goto_1
if-nez v3, :cond_3
iput v10, p0, Lcom/android/nfc/NfcIntegrityChecker;->mStatus:I
.line 316
:cond_3
return v3
.line 307
:cond_4
aget-object v5, v1, v8
aget-object v6, v1, v9
invoke-direct {p0, v5, v6}, Lcom/android/nfc/NfcIntegrityChecker;->checkModuleIntegrity(Ljava/lang/String;Ljava/lang/String;)Z
move-result v5
if-nez v5, :cond_6
.line 308
sget-boolean v5, Lcom/android/nfc/NfcIntegrityChecker;->DBG:Z
if-eqz v5, :cond_5
const-string v5, "NfcIntegrityChecker"
new-instance v6, Ljava/lang/StringBuilder;
invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V
const-string v7, "checkModuleIntegrity "
invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v6
aget-object v7, v1, v8
invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v6
const-string v7, " tampered : "
invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v6
aget-object v7, v1, v9
invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v6
invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v6
invoke-static {v5, v6}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
.line 309
:cond_5
const/4 v3, 0x0
.line 310
goto :goto_1
.line 298
:cond_6
add-int/lit8 v0, v0, 0x1
goto :goto_0
.end method
There is only one return statement, so this should be a simple matter of setting our value, and calling return. In some cases there is code that your application needs to run in order to function, so usually a light touch is a good idea, but in this case all of the code is there to run various checks so we can skip most of it.
The easiest way would be to replace the whole function with this:
Code:
.method public checkIntegrity(Ljava/lang/String;)Z
.locals 2
.parameter "type"
.prologue
const/4 v0, 0x1
return v0
.end method
But that method never sat right with me (old school c++ cracking I guess), so I prefer something like this:
add a goto, and modify the constant here:
.line 303
:cond_1
:goto_666
const/4 v3, 0x1
then add the following line to the beginning of the function (after the .prologue)
goto :goto_666
We end up with something like this:
Code:
.method public checkIntegrity(Ljava/lang/String;)Z
.locals 11
.parameter "type"
.prologue
const/4 v10, 0x2
const/4 v9, 0x1
const/4 v8, 0x0
goto :goto_666
.line 293
iget-object v5, p0, Lcom/android/nfc/NfcIntegrityChecker;->mModuleMap:Ljava/util/HashMap;
invoke-virtual {v5, p1}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v2
check-cast v2, Ljava/util/ArrayList;
.line 294
.local v2, modules:Ljava/util/ArrayList;,"Ljava/util/ArrayList<[Ljava/lang/String;>;"
const/4 v1, 0x0
.line 295
.local v1, module:[Ljava/lang/String;
const/4 v3, 0x1
.line 296
.local v3, ret:Z
invoke-virtual {v2}, Ljava/util/ArrayList;->size()I
move-result v4
.line 298
.local v4, size:I
const/4 v0, 0x0
.local v0, i:I
:goto_0
if-ge v0, v4, :cond_2
.line 299
invoke-virtual {v2, v0}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;
move-result-object v1
.end local v1 #module:[Ljava/lang/String;
check-cast v1, [Ljava/lang/String;
.line 301
.restart local v1 #module:[Ljava/lang/String;
if-eqz v1, :cond_0
array-length v5, v1
if-eq v5, v10, :cond_4
.line 302
:cond_0
sget-boolean v5, Lcom/android/nfc/NfcIntegrityChecker;->DBG:Z
if-eqz v5, :cond_1
const-string v5, "NfcIntegrityChecker"
const-string v6, "checkIntegrity module format error"
invoke-static {v5, v6}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
.line 303
:cond_1
:goto_666
const/4 v3, 0x1
.line 314
:cond_2
:goto_1
if-nez v3, :cond_3
iput v10, p0, Lcom/android/nfc/NfcIntegrityChecker;->mStatus:I
.line 316
:cond_3
return v3
.line 307
:cond_4
aget-object v5, v1, v8
aget-object v6, v1, v9
invoke-direct {p0, v5, v6}, Lcom/android/nfc/NfcIntegrityChecker;->checkModuleIntegrity(Ljava/lang/String;Ljava/lang/String;)Z
move-result v5
if-nez v5, :cond_6
.line 308
sget-boolean v5, Lcom/android/nfc/NfcIntegrityChecker;->DBG:Z
if-eqz v5, :cond_5
const-string v5, "NfcIntegrityChecker"
new-instance v6, Ljava/lang/StringBuilder;
invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V
const-string v7, "checkModuleIntegrity "
invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v6
aget-object v7, v1, v8
invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v6
const-string v7, " tampered : "
invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v6
aget-object v7, v1, v9
invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v6
invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v6
invoke-static {v5, v6}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
.line 309
:cond_5
const/4 v3, 0x0
.line 310
goto :goto_1
.line 298
:cond_6
add-int/lit8 v0, v0, 0x1
goto :goto_0
.end method
confirmed working
thanks again!
This is great, thanks for your contribution!
So does the integrity check call only have to do with access to the secure element? Or does it also eliminate the need to spoof device model for compatibility purposes?
CPA Poke said:
This is great, thanks for your contribution!
So does the integrity check call only have to do with access to the secure element? Or does it also eliminate the need to spoof device model for compatibility purposes?
Click to expand...
Click to collapse
It is just for the secure element. You can modify the wallet apk to bypass things like root checking, model versions, and carrier checks as well. It looks like the xposed framework patch that has been floating around does some of this, but it doesn't seem to patch the calls to read the device properties for device ID and such.
In my testing, I was able to replace all of those calls in the wallet app with constant strings containing "valid" values. This would kind of suck to have to do for each update... Though It would be a simple enough matter to write a script to do this automagically for each update. (Baksmali, sed/awk to find and replace in the smali, and smali to classes.dex) or write an xposed module to watch for calls to read prop values originating from wallet.
Sent from my GT-I9505G
Fenny said:
It is just for the secure element. You can modify the wallet apk to bypass things like root checking, model versions, and carrier checks as well. It looks like the xposed framework patch that has been floating around does some of this, but it doesn't seem to patch the calls to read the device properties for device ID and such.
In my testing, I was able to replace all of those calls in the wallet app with constant strings containing "valid" values. This would kind of suck to have to do for each update... Though It would be a simple enough matter to write a script to do this automagically for each update. (Baksmali, sed/awk to find and replace in the smali, and smali to classes.dex) or write an xposed module to watch for calls to read prop values originating from wallet.
Sent from my GT-I9505G
Click to expand...
Click to collapse
I think that's what the existing Xposed Wallet hack modules do (watch for the read prop values originating from Wallet). But for whatever reason it won't intercept the calls on initial setup, which is why you have to actually change the build.prop prior to initially setting up Wallet.
Fenny said:
It is just for the secure element. You can modify the wallet apk to bypass things like root checking, model versions, and carrier checks as well. It looks like the xposed framework patch that has been floating around does some of this, but it doesn't seem to patch the calls to read the device properties for device ID and such.
In my testing, I was able to replace all of those calls in the wallet app with constant strings containing "valid" values. This would kind of suck to have to do for each update... Though It would be a simple enough matter to write a script to do this automagically for each update. (Baksmali, sed/awk to find and replace in the smali, and smali to classes.dex) or write an xposed module to watch for calls to read prop values originating from wallet.
Sent from my GT-I9505G
Click to expand...
Click to collapse
if you had time to add a how-to to bypass root checking, model version and carrier check, I'd update it every time. wouldn't be a problem and I'd be happy to help out.
mrvirginia said:
if you had time to add a how-to to bypass root checking, model version and carrier check, I'd update it every time. wouldn't be a problem and I'd be happy to help out.
Click to expand...
Click to collapse
Bypassing Root:
Look at the com.google.android.apps.wallet.security.EnvironmentProperty class in the constructor method.
We're looking for this segment containing SU_COMMAND_LOCATIONS:
Code:
.line 70
new-array v0, v4, [Ljava/lang/String;
const-string v1, "/system/bin/su"
aput-object v1, v0, v3
const-string v1, "/system/xbin/su"
aput-object v1, v0, v2
sput-object v0, Lcom/google/android/apps/wallet/security/EnvironmentProperty;->SU_COMMAND_LOCATIONS:[Ljava/lang/String;
Note: These variable names change (v3, v4, etc...), usually they will be the const/4 numbers defined at the beginning of the method. Just make sure you use the one that contains 0.
Change this line from v4 (which contains the number 2)
Code:
new-array v0, v4, [Ljava/lang/String;
to v3 (which contains the number 0)
Code:
new-array v0, v3, [Ljava/lang/String;
Then simply delete the following lines:
Code:
const-string v1, "/system/bin/su"
aput-object v1, v0, v3
const-string v1, "/system/xbin/su"
aput-object v1, v0, v2
This will Set the environment property SU_COMMAND_LOCATIONS as an empty string array which will cause the checkDevice function in Lcom/google/android/apps/wallet/security/EnvironmentProperty$1 to simply break out of it's for loop and return 0 (which is what we want).
Bypassing device/carrier restrictions:
Here is a quick script I whipped up to replace the build prop calls automagically.
Usage would be something like:
Baksmali the classes.dex in your apk:
java -jar baksmali.jar your.apk -o outdir
Run the script (below):
/path/to/pwnprop.sh outdir
Do whatever other changes to the outdir directory.
Then smali:
java -jar smali.jar outdir -o classes.dex
Finally, winzip, lol. (If you actually use winzip imma kill you.)
The script:
Save this as pwnprop.sh (or whatever you feel like) and chmod +x
Code:
#!/bin/bash
do_replace ()
{
case $3 in
# Replace these with whatever device you want to clone.
MODEL)
ours="Galaxy Nexus";;
BRAND)
ours="Google" ;;
BOARD)
ours=""tuna"
ID)
ours="JDQ39E" ;;
PRODUCT)
ours="yakju" ;;
DEVICE)
ours="yakju" ;;
FINGERPRINT)
ours="google/yakju/maguro:4.2.2/JDQ39/573038:user/release-keys" ;;
*)
echo "Replacement property not defined: "$3" in "$1
return ;;
esac
sed -i 's{sget-object '$2', Landroid/os/Build;->'$3':Ljava/lang/String;{const-string '$2', "'$ours'"{g' $1
echo sed -i 's{sget-object '$2', Landroid/os/Build;->'$3':Ljava/lang/String;{const-string '$2', "'$ours'"{g' $1
}
OIFS=$IFS; IFS=$'\n'
for line in `grep -ro "[v0-9]*, Landroid/os/Build;->[A-Z]*" $ | sed 's{, Landroid/os/Build;->{:{'`
do
IFS=':'
temparray=($line)
if [ ${#temparray[@]} -eq 3 ]
then
do_replace $line
fi
IFS=$OIFS
done
CPA Poke said:
I think that's what the existing Xposed Wallet hack modules do (watch for the read prop values originating from Wallet). But for whatever reason it won't intercept the calls on initial setup, which is why you have to actually change the build.prop prior to initially setting up Wallet.
Click to expand...
Click to collapse
I think it actually just replaces the function that checks, "Is this device id allowed?" But for the initial setup the strings in build prop are sent to google where they can reject them server-side.
when trying to run the script, i keep getting a syntax error
pwnprop.sh: line 2: $'\r': command not found
pwnprop.sh: line 3: syntax error near unexpected token `$'\r''
'wnprop.sh: line 3: `do_replace ()
i'm doing:
bash pwnprop.sh classes
classes is my "outdir"
edit: alright, i've converted dos2unix. now i'm just getting errors that the file doesn't exist. argh, oh linux.
edit: zip has been updated to no longer check for su binary. still needs a device/carrier bypass restriction removed...
Fenny said:
I think it actually just replaces the function that checks, "Is this device id allowed?" But for the initial setup the strings in build prop are sent to google where they can reject them server-side.
Click to expand...
Click to collapse
Gotcha, that makes perfect sense.
mrvirginia said:
when trying to run the script, i keep getting a syntax error
pwnprop.sh: line 2: $'\r': command not found
pwnprop.sh: line 3: syntax error near unexpected token `$'\r''
'wnprop.sh: line 3: `do_replace ()
i'm doing:
bash pwnprop.sh classes
classes is my "outdir"
edit: alright, i've converted dos2unix. now i'm just getting errors that the file doesn't exist. argh, oh linux.
edit: zip has been updated to no longer check for su binary. still needs a device/carrier bypass restriction removed...
Click to expand...
Click to collapse
Make sure you have the sed, echo, and grep utilities installed and in your path.
Sent from my GT-I9505G
Fenny said:
Make sure you have the sed, echo, and grep utilities installed and in your path.
Sent from my GT-I9505G
Click to expand...
Click to collapse
i finally figured out what the problem was. iirc, i was running it as root or something. had the same problem when i tried using the Kitchen again a week or two ago and got it sorted so i'll attempt to run this again [hopefully] over the weekend and give everyone a working Wallet regardless of device so they won't have to do silly tweaks anymore with build.prop etc. thank you again, sir.
oh, did you ever figure out the SIM unlock issue?
Causes NFC to FC on official 4.3 with full wipe. Oddly, it works with dirty flash. Ideas?
[Edit]
Never mind. It was just a bad signature.
@ OP: this NfcNci mod works on TW firmware MF8.
maanz said:
@ OP: this NfcNci mod works on TW firmware MF8.
Click to expand...
Click to collapse
Good to hear. Sounds like this is a new feature in Samsung firmware. Still makes me wonder if non-samsung devices suffer the same fate. The function call is the same no matter which implementation of NfcNci you are using, but I suppose that each vendor's implementation of the integrity checks by necessesity will differ.
Sent from my GT-I9505G
@Fenny looks like Superuser (unsecure) check was removed from newest Wallet release on the Google Play Store
mrvirginia said:
@Fenny looks like Superuser (unsecure) check was removed from newest Wallet release on the Google Play Store
Click to expand...
Click to collapse
That is great news. Much less work to be done on it then.
Keep up the good work! You guys are close, I can feel it! I would offer to help this weekend, but I think I would just slow you down.
Sent from my Galaxy Nexus using XDA Premium 4 mobile app

[MOD] Samsung KeyBoard Swipe Color Change Found! - Updated Instructions

Okay, alot of dev's/themers been looking for this one...
If you use, please give credit, I spent many hours finding this Mod... Dont take credit for someone else's work...
This Mod will allow you to change the Samsung KeyBoard Swipe Color..(SamsungIME.apk)
Look for:
smali\com\diotek\ime\framework\view\AbstractKeyBoardView.smali
Search for -> .method private setTracePaintOptionsWithSettings()V
Click to see Org Code
Code:
.method private setTracePaintOptionsWithSettings()V
.locals 5
.prologue
const/16 v4, 0xff
const/4 v1, 0x1
const/4 v3, 0x0
.line 9829
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePaint:Landroid/graphics/Paint;
if-nez v0, :cond_0
.line 9830
new-instance v0, Landroid/graphics/Paint;
invoke-direct {v0}, Landroid/graphics/Paint;-><init>()V
iput-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePaint:Landroid/graphics/Paint;
.line 9832
:cond_0
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePoint:Ljava/util/ArrayList;
if-eqz v0, :cond_1
.line 9833
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePoint:Ljava/util/ArrayList;
invoke-virtual {v0}, Ljava/util/ArrayList;->clear()V
.line 9835
:cond_1
iput-short v3, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePointCount:S
.line 9836
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePaint:Landroid/graphics/Paint;
invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setAntiAlias(Z)V
.line 9837
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePaint:Landroid/graphics/Paint;
invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setDither(Z)V
.line 9838
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePaint:Landroid/graphics/Paint;
const/16 v1, 0xa5
const/16 v2, 0xf3
invoke-static {v4, v3, v1, v2}, Landroid/graphics/Color;->argb(IIII)I
Click to see what to change:
Code:
.method private setTracePaintOptionsWithSettings()V
.locals 5
.prologue
const/16 v4, [B][U][COLOR="Blue"]0xff[/COLOR][/U][/B] [B][COLOR="seagreen"]Change for Alpha Value - "0xff" [/COLOR][/B]
const/4 v1, 0x1
const/4 v3, [B][U][COLOR="Blue"]0x0[/COLOR][/U][/B] [B][COLOR="seaGreen"] - Change for Red Value - "0x0"[/COLOR][/B]
.line 9829
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePaint:Landroid/graphics/Paint;
if-nez v0, :cond_0
.line 9830
new-instance v0, Landroid/graphics/Paint;
invoke-direct {v0}, Landroid/graphics/Paint;-><init>()V
iput-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePaint:Landroid/graphics/Paint;
.line 9832
:cond_0
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePoint:Ljava/util/ArrayList;
if-eqz v0, :cond_1
.line 9833
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePoint:Ljava/util/ArrayList;
invoke-virtual {v0}, Ljava/util/ArrayList;->clear()V
.line 9835
:cond_1
iput-short v3, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePointCount:S
.line 9836
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePaint:Landroid/graphics/Paint;
invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setAntiAlias(Z)V
.line 9837
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePaint:Landroid/graphics/Paint;
invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setDither(Z)V
.line 9838
iget-object v0, p0, Lcom/diotek/ime/framework/view/AbstractKeyboardView;->mTracePaint:Landroid/graphics/Paint;
const/16 v1, [B][U][COLOR="Blue"]0xa5[/COLOR][/U][/B] [COLOR="seagreen"]- Change for Green Value - "0xa5"[/COLOR]
const/16 v2, [B][U][COLOR="Blue"]0xf3[/COLOR][/U][/B] [COLOR="seagreen"] - Change for Blue Value - "0xf3"[/COLOR]
invoke-static {v4, v3, v1, v2}, Landroid/graphics/Color;->argb(IIII)I
So what it boils down to is that the Swipe Color is what we call RGB color coding. I suggest a site like this to see values you can use:
Hex to RGB Color converter
Thats it folks.. swipe color squashed!!!!
Verified to work on N3 KeyBoards
A Little clarification on Instructions.
I was swamped with questions on how to edit and such.. So with @strongsteve help we dug more and here is an easier way to get your colors instead of trying to use RGB values..
change code:
Code:
const/16 v1, 0xa5
const/16 v2, 0xf3
to
Code:
const v3, 0x33
const v1, 0x66
const v2, 0xcc
Then just use any normal Hex Color code you would normally use!!!
In the above example I used 3366cc which is DarkHorse Blue..
I hope that helps
Thanks been looking for this myself. Great job!
Sent from my SCH-I545 using XDA Premium 4 mobile app
This has been long sought after....thanks for this and great work my friend! :highfive::good:
ALL Users must be reminded to give credit for this share, as, unless I am mistaken, it is not too many other places!
Sorry... can someone post what those lines should look like once they have been changed to a diff color? I'm not sure exactly what in those lines I should be changing (I do understand the color codes).
Sorry for the noobish question.
TheCelt said:
Sorry... can someone post what those lines should look like once they have been changed to a diff color? I'm not sure exactly what in those lines I should be changing (I do understand the color codes).
Sorry for the noobish question.
Click to expand...
Click to collapse
You would be changing the codes themselves.
i.e ff or a5, or whatever...
I will write up more in a bit..
Gunthermic said:
You would be changing the codes themselves.
i.e ff or a5, or whatever...
I will write up more in a bit..
Click to expand...
Click to collapse
Thanks for clarifying the coding changes.... one last (what I am sure if dumb) question. where does one find that file. I am rooted and searched the device for both "smali" and "diotek" using ES file Explorer and have not found the file referenced above.
TheCelt said:
Thanks for clarifying the coding changes.... one last (what I am sure if dumb) question. where does one find that file. I am rooted and searched the device for both "smali" and "diotek" using ES file Explorer and have not found the file referenced above.
Click to expand...
Click to collapse
Its contained inside the SamsungIME apk itself. It has to be decompiled and MODed
Gunthermic said:
Its contained inside the SamsungIME apk itself. It has to be decompiled and MODed
Click to expand...
Click to collapse
Got it. Thanks Gunthermic. Much appreciated.

[TUTORIAL]How To Add Advance Power Menu[3/1/2014]

Happy New Year...
This is my first tutorial of 2014. Today I will teach
you how to add Reboot and Recovery option in Power Menu.
Make sure you have a basic knowledge on how to compile/decompile .apk/.jar files.
framework-res.apk
Decompile framework-res.apk
[*]Navigate to framework-res.apk\res\drawable-hdpi
[*]Extract all the files from PNG folder (Download From Attachment)
[*]Navigate to framework-res.apk\res\values
[*]Open strings.xml file in file editor
[*]Add these line at the end
Code:
<string name="reboot">Reboot</string>
<string name="reboot_progress">Rebooting…</string>
<string name="reboot_confirm">Your phone will reboot</string>
<string name="recovery">Recovery</string>
<string name="recovery_progress">Rebooting into recovery…</string>
<string name="recovery_confirm">Your phone will reboot into recovery</string>
[*]Save the file
[*]Recompile your framework-res.apk
[*]Decompile framework-res.apk which you have recompiled a moment ago
[*]Navigate to framework-res.apk\res\values
[*]Open public.xml file in file editor
framework.jar
Decompile framework.jar
[*]Navigate to framework.jar\smali\com\android\internal\app
[*]Open ShutdownThread.smali file in file editor
[*]Search for .field private static mReboot:Z and add the red line only
Code:
.field private static final TAG:Ljava/lang/String; = "ShutdownThread"
[COLOR="Red"].field public static mReboot:I[/COLOR]
.field private static mReboot:Z
[*]Search for .local v1, pd:Landroid/app/ProgressDialog; and add the red lines only
Code:
.line 184
.local v1, pd:Landroid/app/ProgressDialog;
[COLOR="Red"]sget v2, Lcom/android/internal/app/ShutdownThread;->mReboot:I
if-eq v2, v5, :cond_1
if-nez v2, :cond_2[/COLOR]
const v2, 0x104014a
[COLOR="Red"]goto :goto_1
:cond_1
const v2, name="reboot"
goto :goto_1
:cond_2
const v2, name="recovery"
:goto_1[/COLOR]
invoke-virtual {p0, v2}, Landroid/content/Context;->getText(I)Ljava/lang/CharSequence;
move-result-object v2
[*]Search for invoke-virtual {v1, v2}, Landroid/app/ProgressDialog;->setTitle(Ljava/lang/CharSequenceV and add the red lines only
Code:
move-result-object v2
invoke-virtual {v1, v2}, Landroid/app/ProgressDialog;->setTitle(Ljava/lang/CharSequence;)V
.line 185
[COLOR="Red"]sget v2, Lcom/android/internal/app/ShutdownThread;->mReboot:I
if-eq v2, v5, :cond_3
if-nez v2, :cond_4[/COLOR]
const v2, 0x104014e
[COLOR="Red"]goto :goto_2
:cond_3
const v2, name="reboot_progress"
goto :goto_2
:cond_4
const v2, name="recovery_progress"
:goto_2[/COLOR]
invoke-virtual {p0, v2}, Landroid/content/Context;->getText(I)Ljava/lang/CharSequence;
move-result-object v2
[*]Search for .catch Ljava/lang/SecurityException; {:try_start_1 .. :try_end_1} :catch_0 and change the blue lines only
Code:
invoke-virtual {v2}, Landroid/os/PowerManager$WakeLock;->acquire()V
:try_end_1
.catch Ljava/lang/SecurityException; {:try_start_1 .. :try_end_1} :catch_0
.line 208
[COLOR="Blue"]:goto_3[/COLOR]
sget-object v2, Lcom/android/internal/app/ShutdownThread;->sInstance:Lcom/android/internal/app/ShutdownThread;
iput-object v6, v2, Lcom/android/internal/app/ShutdownThread;->mScreenWakeLock:Landroid/os/PowerManager$WakeLock;
.line 209
sget-object v2, Lcom/android/internal/app/ShutdownThread;->sInstance:Lcom/android/internal/app/ShutdownThread;
iget-object v2, v2, Lcom/android/internal/app/ShutdownThread;->mPowerManager:Landroid/os/PowerManager;
invoke-virtual {v2}, Landroid/os/PowerManager;->isScreenOn()Z
move-result v2
[COLOR="Blue"]if-eqz v2, :cond_5[/COLOR]
.line 211
:try_start_2
[*]Search for .catch Ljava/lang/SecurityException; {:try_start_2 .. :try_end_2} :catch_1 and change the blue lines only
Code:
:try_end_2
.catch Ljava/lang/SecurityException; {:try_start_2 .. :try_end_2} :catch_1
.line 222
[COLOR="Blue"]:cond_5
:goto_4[/COLOR]
sget-object v2, Lcom/android/internal/app/ShutdownThread;->sInstance:Lcom/android/internal/app/ShutdownThread;
new-instance v3, Lcom/android/internal/app/ShutdownThread$2;
[*]Search for .end local v0 #e:Ljava/lang/SecurityException; and change the blue lines only
Code:
iput-object v6, v2, Lcom/android/internal/app/ShutdownThread;->mCpuWakeLock:Landroid/os/PowerManager$WakeLock;
[COLOR="Blue"]goto :goto_3[/COLOR]
.line 215
.end local v0 #e:Ljava/lang/SecurityException;
:catch_1
move-exception v0
.line 216
.restart local v0 #e:Ljava/lang/SecurityException;
const-string v2, "ShutdownThread"
const-string v3, "No permission to acquire wake lock"
invoke-static {v2, v3, v0}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
.line 217
sget-object v2, Lcom/android/internal/app/ShutdownThread;->sInstance:Lcom/android/internal/app/ShutdownThread;
iput-object v6, v2, Lcom/android/internal/app/ShutdownThread;->mScreenWakeLock:Landroid/os/PowerManager$WakeLock;
[COLOR="Blue"]goto :goto_4[/COLOR]
.end method
.method public static reboot(Landroid/content/Context;Ljava/lang/String;Z)V
[*]Search for .method public static rebootOrShutdown(ZLjava/lang/StringV and change the blue line only
Code:
.end method
.method public static rebootOrShutdown(ZLjava/lang/String;)V
.locals 5
.parameter "reboot"
.parameter "reason"
.prologue
.line 403
[COLOR="Blue"]if-eqz p0, :cond_3[/COLOR]
.line 404
const-string v2, "ShutdownThread"
[*]Search for invoke-static {p1}, Landroid/os/Power;->reboot(Ljava/lang/StringV and add the red lines and change the blue lines only
Code:
:try_start_0
invoke-static {p1}, Landroid/os/Power;->reboot(Ljava/lang/String;)V
:try_end_0
[COLOR="Blue"].catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_1[/COLOR]
.line 428
:goto_0
const-string v2, "ShutdownThread"
const-string v3, "Performing low-level shutdown..."
invoke-static {v2, v3}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I
[COLOR="Red"]sget v1, Lcom/android/internal/app/ShutdownThread;->mReboot:I
const/4 v2, 0x1
if-eq v1, v2, :cond_0
const/4 v2, 0x2
if-eq v1, v2, :cond_1[/COLOR]
.line 429
invoke-static {}, Landroid/os/Power;->shutdown()V
.line 430
return-void
[COLOR="Red"]:cond_0
const-string/jumbo v4, "now"
invoke-static {v4}, Landroid/os/Power;->reboot(Ljava/lang/String;)V
return-void
:cond_1
:try_start_1
new-instance v1, Ljava/io/File;
const-string v4, "/cache/recovery/boot"
invoke-direct {v1, v4}, Ljava/io/File;-><init>(Ljava/lang/String;)V
.line 442
.restart local v1
invoke-virtual {v1}, Ljava/io/File;->exists()Z
move-result v4
if-nez v4, :cond_2
.line 443
invoke-virtual {v1}, Ljava/io/File;->createNewFile()Z
:try_end_1
.catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0
:catch_0
:cond_2
const-string/jumbo v4, "recovery"
invoke-static {v4}, Landroid/os/Power;->reboot(Ljava/lang/String;)V
return-void[/COLOR]
.line 407
[COLOR="Blue"]:catch_1[/COLOR]
move-exception v0
.line 408
.local v0, e:Ljava/lang/Exception;
const-string v2, "ShutdownThread"
[*]Search for .end local v0 #e:Ljava/lang/Exception; and change the blue lines only
Code:
.line 412
.end local v0 #e:Ljava/lang/Exception;
[COLOR="Blue"]:cond_3[/COLOR]
new-instance v1, Landroid/os/Vibrator;
invoke-direct {v1}, Landroid/os/Vibrator;-><init>()V
.line 414
.local v1, vibrator:Landroid/os/Vibrator;
const-wide/16 v2, 0x1f4
[COLOR="Blue"]:try_start_2[/COLOR]
invoke-virtual {v1, v2, v3}, Landroid/os/Vibrator;->vibrate(J)V
[COLOR="Blue"]:try_end_2
.catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_3[/COLOR]
.line 422
:goto_1
const-wide/16 v2, 0x1f4
[COLOR="Blue"]:try_start_3[/COLOR]
invoke-static {v2, v3}, Ljava/lang/Thread;->sleep(J)V
[COLOR="Blue"]:try_end_3
.catch Ljava/lang/InterruptedException; {:try_start_3 .. :try_end_3} :catch_2[/COLOR]
goto :goto_0
.line 423
[COLOR="Blue"]:catch_2[/COLOR]
move-exception v2
goto :goto_0
.line 415
[COLOR="Blue"]:catch_3[/COLOR]
move-exception v0
.line 417
.restart local v0 #e:Ljava/lang/Exception;
[*]Search for .local v1, longPressBehavior:I and change the blue lines only
Code:
.line 106
.local v1, longPressBehavior:I
const/4 v3, 0x2
[COLOR="Blue"]if-ne v1, v3, :cond_4[/COLOR]
const v2, 0x1040150
.line 110
.local v2, resourceId:I
:goto_1
const-string v3, "ShutdownThread"
new-instance v4, Ljava/lang/StringBuilder;
invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V
const-string v5, "Notifying thread to start shutdown longPressBehavior="
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
invoke-virtual {v4, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v4
invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v4
invoke-static {v3, v4}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
.line 112
[COLOR="Blue"]if-eqz p1, :cond_7[/COLOR]
.line 113
new-instance v0, Lcom/android/internal/app/ShutdownThread$CloseDialogReceiver;
[*]Search for invoke-direct {v3, p0}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/ContextV and add the red lines only
Code:
new-instance v3, Landroid/app/AlertDialog$Builder;
invoke-direct {v3, p0}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V
[COLOR="Red"]const v5, 0x1
sget v4, Lcom/android/internal/app/ShutdownThread;->mReboot:I
if-eq v4, v5, :cond_2
if-nez v4, :cond_3[/COLOR]
const v4, 0x104014a
[COLOR="Red"]goto :goto_2
:cond_2
const v4, name="reboot"
goto :goto_2
:cond_3
const v4, name="recovery"
:goto_2[/COLOR]
invoke-virtual {v3, v4}, Landroid/app/AlertDialog$Builder;->setTitle(I)Landroid/app/AlertDialog$Builder;
move-result-object v3
[*]Search for invoke-virtual {v3}, Landroid/app/AlertDialog;->show()V and add the red lines and change the blue lines only
Code:
sget-object v3, Lcom/android/internal/app/ShutdownThread;->sConfirmDialog:Landroid/app/AlertDialog;
invoke-virtual {v3}, Landroid/app/AlertDialog;->show()V
[COLOR="Blue"]goto/16 :goto_0[/COLOR]
.line 102
.end local v0 #closer:Lcom/android/internal/app/ShutdownThread$CloseDialogReceiver;
.end local v1 #longPressBehavior:I
.end local v2 #resourceId:I
:catchall_0
move-exception v3
:try_start_1
monitor-exit v4
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw v3
.line 106
.restart local v1 #longPressBehavior:I
[COLOR="Blue"]:cond_4[/COLOR]
[COLOR="Red"]const v3, 0x1
sget v2, Lcom/android/internal/app/ShutdownThread;->mReboot:I
if-eq v2, v3, :cond_5
if-nez v2, :cond_6[/COLOR]
const v2, 0x104014f
[COLOR="Blue"]goto/16 :goto_1[/COLOR]
[COLOR="Red"]:cond_5
const v2, name="reboot_confirm"
goto/16 :goto_1
:cond_6
const v2, name="recovery_confirm"
goto/16 :goto_1[/COLOR]
.line 132
.restart local v2 #resourceId:I
[COLOR="Blue"]:cond_7[/COLOR]
invoke-static {p0}, Lcom/android/internal/app/ShutdownThread;->beginShutdownSequence(Landroid/content/Context;)V
goto/16 :goto_0
.end method
[*]Now you have to find the names below
Code:
name="reboot"
name="recovery"
name="reboot_progress"
name="recovery_progress"
name="reboot_confirm"
name="recovery_confirm"
[*]You have to replace these name with hex ids from public.xml which is already opened in file editor
[*]For example search for name="reboot" in public.xml file
[*]In my case I have got
Code:
<public type="string" name="reboot" id="[COLOR="Blue"]0x01040548[/COLOR]" />
[*]The blue marked part is hex. Copy the hex and remove the 3rd digit. So 0x01040548 will be 0x1040548
[*]Now search for name="reboot" in ShutdownThread.smali file and replace name="reboot" with 0x1040548
[*]Do the same for other names too
[*]Save the file
[*]Recompile your framework.jar
android.policy.jar
Decompile android.policy.jar
[*]Navigate to android.policy.jar\smali\com\android\internal\policy\impl
[*]Extract all the files from SMALI folder (Download From Attachment)
[*]Open GlobalActions$2.smali file in file editor
[*]Search for invoke-static {v0}, Lcom/android/internal/policy/impl/GlobalActions;->access$100(Lcom/android/internal/policy/impl/GlobalActionsLandroid/content/Context; and add the red lines only
Code:
#getter for: Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
invoke-static {v0}, Lcom/android/internal/policy/impl/GlobalActions;->access$100(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;
move-result-object v0
const/4 v1, 0x1
[COLOR="Red"]const/4 p0, 0x0
sput p0, Lcom/android/internal/app/ShutdownThread;->mReboot:I[/COLOR]
invoke-static {v0, v1}, Lcom/android/internal/app/ShutdownThread;->shutdown(Landroid/content/Context;Z)V
.line 171
return-void
.end method
[*]Save the file
[*]Open GlobalActions.smali file in file editor
[*]Search for .method private createDialog()Landroid/app/AlertDialog; and change the blue lines only
Code:
.end method
.method private createDialog()Landroid/app/AlertDialog;
[COLOR="Blue"].locals 12[/COLOR]
.prologue
const/4 v9, 0x1
[*]Search for invoke-direct {v1, p0, v2, v3}, Lcom/android/internal/policy/impl/GlobalActions$2;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V and add the red lines only
Code:
invoke-direct {v1, p0, v2, v3}, Lcom/android/internal/policy/impl/GlobalActions$2;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
[COLOR="Red"]iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
invoke-virtual {v0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object v0
const-string v1, "reboot"
const-string v2, "string"
const-string v3, "android"
invoke-virtual {v0, v1, v2, v3}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I
move-result v10
if-nez v10, :cond_0
const-string v1, "reboot_system"
invoke-virtual {v0, v1, v2, v3}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I
move-result v10
if-eqz v10, :cond_1
:cond_0
const-string v1, "ic_lock_reboot"
const-string v2, "drawable"
invoke-virtual {v0, v1, v2, v3}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I
move-result v11
if-eqz v11, :cond_1
iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$7;
invoke-direct {v1, p0, v11, v10}, Lcom/android/internal/policy/impl/GlobalActions$7;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
:cond_1
iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
invoke-virtual {v0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object v0
const-string v1, "recovery"
const-string v2, "string"
const-string v3, "android"
invoke-virtual {v0, v1, v2, v3}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I
move-result v10
if-nez v10, :cond_2
const-string v1, "recovery_system"
invoke-virtual {v0, v1, v2, v3}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I
move-result v10
if-eqz v10, :cond_3
:cond_2
const-string v1, "ic_lock_recovery"
const-string v2, "drawable"
invoke-virtual {v0, v1, v2, v3}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I
move-result v11
if-eqz v11, :cond_3
iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$8;
invoke-direct {v1, p0, v11, v10}, Lcom/android/internal/policy/impl/GlobalActions$8;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z[/COLOR]
.line 183
[COLOR="Red"]:cond_3[/COLOR]
iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
iget-object v1, p0, Lcom/android/internal/policy/impl/GlobalActions;->mAirplaneModeOn:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
[*]Save the file
[*]Recompile your android.policy.jar
Please Note :
Take backup before doing anything.
Use Notepad++ to edit files.
Please read the tutorial properly befor editing files.
If you found any mistake in this tutorial then please let me know.
this is the one thing our xperia community was lacking of. Now it's fulfilled thanks for this :good:
Good Job bro
Thank u
WOW, really a nice guide, perfectly explained & noob Friendly
keep it coming
Great guide, will really help many people, not just to Arc owners but to all Xperia family
saqib nazm said:
this is the one thing our xperia community was lacking of. Now it's fulfilled thanks for this :good:
Click to expand...
Click to collapse
3andala said:
Good Job bro
Thank u
Click to expand...
Click to collapse
stanlin salu said:
WOW, really a nice guide, perfectly explained & noob Friendly
keep it coming
Click to expand...
Click to collapse
Ayush Singh said:
Great guide, will really help many people, not just to Arc owners but to all Xperia family
Click to expand...
Click to collapse
Thanks for these encouraging comments. You all are cordially welcome...
Awesome Guide
This is how its done!
Understanding that smali was a pain in the a**.
You just made this simpler to copy paste
Thank you!
Wonderful work man..
You ll soon be a great themer. Thanks for keeping 2011 xperias forum alive..:thumbup:
Cheers,
Vatsal
Nice work mate.. Nice write up. Way to go. Keep it up and hoping to see more of your works
Sent from my GT-P3110 using Tapatalk
Nice tutorial @BDFreak ...
Can you tell which apktool is recommended for use in this tutorial ?
karandpr said:
Nice tutorial @BDFreak ...
Can you tell which apktool is recommended for use in this tutorial ?
Click to expand...
Click to collapse
I am using THIS one. But I think you can use old versions too...
Ayush Singh said:
Great guide, will really help many people, not just to Arc owners but to all Xperia family
Click to expand...
Click to collapse
this is for Arc only, another xperia phone will be different .
in my TX, framework.jar dont have ShutdownThread.smali but it in services.jar
devilmaycry2020 said:
this is for Arc only, another xperia phone will be different .
in my TX, framework.jar dont have ShutdownThread.smali but it in services.jar
Click to expand...
Click to collapse
I meant all Xperia 2011 family
devilmaycry2020 said:
this is for Arc only, another xperia phone will be different .
in my TX, framework.jar dont have ShutdownThread.smali but it in services.jar
Click to expand...
Click to collapse
Would be the same for atleast the 2011 Xperia Line up
devilmaycry2020 said:
this is for Arc only, another xperia phone will be different .
in my TX, framework.jar dont have ShutdownThread.smali but it in services.jar
Click to expand...
Click to collapse
It's obvious that this will be different in 2012-13 xperias. But the main idea is quite same, like if you know where you have to look for
Nice tut! Its also not very complicated
i dont understand about "change the blue lines only" .what does it mean ? if my own different change it to same as yours ?
devilmaycry2020 said:
i dont understand about "change the blue lines only" .what does it mean ? if my own different change it to same as yours ?
Click to expand...
Click to collapse
Exactly. I mean yes...
BDFreak said:
Exactly. I mean yes...
Click to expand...
Click to collapse
i dont think so because i've modded this before and it work great but the only i missed was when i choose reboot or recovery it didn't show "Reboot" or "Recovery" tittle but only Power off. could you help me. thanks
basically my mod for TX as same as your but have some different
i can send to you all relate files for modding this, could you take a look to it. thanks
devilmaycry2020 said:
i dont think so because i've modded this before and it work great but the only i missed was when i choose reboot or recovery it didn't show "Reboot" or "Recovery" tittle but only Power off. could you help me. thanks
basically my mod for TX as same as your but have some different
i can send to you all relate files for modding this, could you take a look to it. thanks
Click to expand...
Click to collapse
Actually this tutorial is for 2011 Xperia phones. I didn't try in newer phones yet. But I will give it a try in my SP when times allow me.

Categories

Resources