Related
Hello guys im here to share my knowledge since alot off member ask for this mod i mean how to added this option to ur rom
First of all i would like to thanks Jimmy Lam for his framework and android.policy.jar from which i learnt by comparing
Requirements
Attached File
Notepad++
Backsmali Manager
Apktool
Patience
Brain Off cource
Click to expand...
Click to collapse
Ok i have divided this Guide in Two Parts to make it easy
In First Part we will edit framework and in second part we will edit android policy.jar
Part-1
Decompile Your framework-res.apk and move to
Code:
framework-res\res\values
Open Strings.xml with notepad++ or any other tool you use
paste the following lines in the end
Code:
<string name="global_action_reboot_now">Restart</string>
<string name="global_action_reboot_recovery">Recovery</string>
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Close it and recompile.
Then again decompile and move to
Code:
framework-res\res\values
and note the following ids (you may have different)
Here we end our First Part.
Part-2
Decompile your android.policy.jar using backsmali managaer or any other tool
vDownload and extract the attached file to
Code:
android.policy\com\android\internal\policy\impl
Then open GlobalActions.smali
And do how i say
Before
Code:
.line 165
iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$2;
const v2, 0x104013c
invoke-direct {v1, p0, v12, v2}, 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
.line 185
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;
invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
After
Just Add the Bold ( For A7/A5 Users just copy paste )
Code:
.line 165
iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$2;
const v2, 0x104013a
invoke-direct {v1, p0, v12, v2}, 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
[B].line 183
iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$8;
const v2, [COLOR="Red"]0x104054d[/COLOR]
invoke-direct {v1, p0, v12, v2}, 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
.line 184
iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$9;
const v2, [COLOR="Red"]0x104054e[/COLOR]
invoke-direct {v1, p0, v12, v2}, Lcom/android/internal/policy/impl/GlobalActions$9;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z[/B]
.line 185
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;
invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
Note: Note Ids must be same as you noted in part 1
Code:
[COLOR="Red"]Only Replace last 7 digits of IDS when renaming in the above step [/COLOR]
Recompile and replace the classes.dex using Z-zip
Yipeee You Now have 3 Way boot:victory:
This Guide is tested by me and is working Fine
I have uploaded the Modded files for A5/A7/A7+ users so they can download and enjoy
Device Tested for this MOD
Karbonn A5
Karbonn A7
Karbonn A7+
Spice Mi355
Walton Primo
......Report yours if it works for you
Click to expand...
Click to collapse
Screenshot
Hit thanks to show your appreciation, it encourages me
reserved
one more reserved just in case
Tried this on a110 didnt get success.
Will try again and let u know.
Its not for touchwiz ROMs right
but how to change the icons of the restart and recovery option?
ahmed.zunaid said:
but how to change the icons of the restart and recovery option?
Click to expand...
Click to collapse
Thats a drawback of this MOD that it uses the icon of power off only
ahmed.zunaid said:
but how to change the icons of the restart and recovery option?
Click to expand...
Click to collapse
Inside framework res APK......Res folder....Hdpi folder....add two PNG and rename them to above names....
Sent from my Micromax A116 using Tapatalk 2
Dark4Droid said:
Inside framework res APK......Res folder....Hdpi folder....add two PNG and rename them to above names....
Sent from my Micromax A116 using Tapatalk 2
Click to expand...
Click to collapse
No need as the MOD uses the png of power off only
Is it only for ICS??
Sent from my Karbonn A9..
Ok.. This guide sparked my interest in getting this to work again - thank you.
So, it is working.. kind of.. But I broke the "Power off" option somehow.
This is what I did (only want Reboot, so I removed the Recovery option lines):
Added the strings and drawables to framework-res.. compiled, decompiled.. got my new public ids.
Added GlobalActions$9.smali to android.policy, and edited my GlobalActions.smali:
Original:
Code:
iget-object v0, v10, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$2;
const v2, 0x1080030
const v3, 0x1040142
invoke-direct {v1, v10, 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
iget-boolean v0, v10, Lcom/android/internal/policy/impl/GlobalActions;->isDeepSleepSupported:Z
if-eqz v0, :cond_51
iget-object v0, v10, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$3;
const v2, 0x108060d
const v3, 0x1040567
const v4, 0x1040568
invoke-direct {v1, v10, v2, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$3;-><init>(Lcom/android/internal/policy/impl/GlobalActions;III)V
Modded:
Code:
iget-object v0, v10, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$2;
const v2, 0x1080030
const v3, 0x1040142
invoke-direct {v1, v10, 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
[B]iget-object v0, v10, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$9;
const v2, 0x108064b
const v3, 0x10406aa
invoke-direct {v1, v10, v2, v3}, Lcom/android/internal/policy/impl/GlobalActions$9;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z[/B]
iget-boolean v0, v10, Lcom/android/internal/policy/impl/GlobalActions;->isDeepSleepSupported:Z
if-eqz v0, :cond_51
iget-object v0, v10, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$3;
const v2, 0x108060d
const v3, 0x1040567
const v4, 0x1040568
invoke-direct {v1, v10, v2, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$3;-><init>(Lcom/android/internal/policy/impl/GlobalActions;III)V
So, Reboot works with a new icon.. but it gives me the "Power off" prompts when I hit reboot (but reboots normally). And, the Power off option now gives no prompts and reboots the phone..
Any ideas for a simple fix?
EDIT: Got it working a little better now..
I cross-referenced this thread, and edited my ShutdownThread.smali, copied my existing GlobalActions$2.smali (the one with the Shutdown stuff in it), renamed it to GlobalActions$9 and added that "reboot" bit to it as suggested in the other guide.
Bro not working in jellybean will try and post if working in ICS later(now on jb )
Sent from my Micromax A120 Quadcore HD using xda premium
alteredlikeness said:
Ok.. This guide sparked my interest in getting this to work again - thank you.
So, it is working.. kind of.. But I broke the "Power off" option somehow.
This is what I did (only want Reboot, so I removed the Recovery option lines):
Added the strings and drawables to framework-res.. compiled, decompiled.. got my new public ids.
Added GlobalActions$9.smali to android.policy, and edited my GlobalActions.smali:
Original:
Code:
iget-object v0, v10, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$2;
const v2, 0x1080030
const v3, 0x1040142
invoke-direct {v1, v10, 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
iget-boolean v0, v10, Lcom/android/internal/policy/impl/GlobalActions;->isDeepSleepSupported:Z
if-eqz v0, :cond_51
iget-object v0, v10, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$3;
const v2, 0x108060d
const v3, 0x1040567
const v4, 0x1040568
invoke-direct {v1, v10, v2, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$3;-><init>(Lcom/android/internal/policy/impl/GlobalActions;III)V
Modded:
Code:
iget-object v0, v10, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$2;
const v2, 0x1080030
const v3, 0x1040142
invoke-direct {v1, v10, 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
[B]iget-object v0, v10, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$9;
const v2, 0x108064b
const v3, 0x10406aa
invoke-direct {v1, v10, v2, v3}, Lcom/android/internal/policy/impl/GlobalActions$9;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z[/B]
iget-boolean v0, v10, Lcom/android/internal/policy/impl/GlobalActions;->isDeepSleepSupported:Z
if-eqz v0, :cond_51
iget-object v0, v10, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$3;
const v2, 0x108060d
const v3, 0x1040567
const v4, 0x1040568
invoke-direct {v1, v10, v2, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$3;-><init>(Lcom/android/internal/policy/impl/GlobalActions;III)V
So, Reboot works with a new icon.. but it gives me the "Power off" prompts when I hit reboot (but reboots normally). And, the Power off option now gives no prompts and reboots the phone..
Any ideas for a simple fix?
EDIT: Got it working a little better now..
I cross-referenced this thread, and edited my ShutdownThread.smali, copied my existing GlobalActions$2.smali (the one with the Shutdown stuff in it), renamed it to GlobalActions$9 and added that "reboot" bit to it as suggested in the other guide.
Click to expand...
Click to collapse
Yeah actually this MOD uses every resource of Power Off but functions differently like Recovery will also show you power off prompt but will take you to recovery
Coudnt get it working on a110.
If u want to take a look up android.policy.jar tell me
.salil. said:
Coudnt get it working on a110.
If u want to take a look up android.policy.jar tell me
Click to expand...
Click to collapse
i am going to start developing on A110 as my friend has it and he wants a ROM from me so rather making only for him i will release it here also :angel: and i will try if it works on A110
karbonn A18
Hello guneet,
i am closely watching your every step towards success with a5.
can i ask you a favour?
i need this mod for karbonn a18 which runs on stock android 4.0.4
Pritesh.mohan said:
Hello guneet,
i am closely watching your every step towards success with a5.
can i ask you a favour?
i need this mod for karbonn a18 which runs on stock android 4.0.4
Click to expand...
Click to collapse
You can try it out with A18 and report in the thread
I don't find any credits.
is this your own work without reference?
shahulakthar said:
I don't find any credits.
is this your own work without reference?
Click to expand...
Click to collapse
Yeah this is my Own work and i have given thanks aka credits to the person which deserves that
The Droid Master said:
Yeah this is my Own work and i have given thanks aka credits to the person which deserves that
Click to expand...
Click to collapse
I missed 2nd line of ur post. Is there any success with a110? Any method to add them in JB?
shahulakthar said:
I missed 2nd line of ur post. Is there any success with a110? Any method to add them in JB?
Click to expand...
Click to collapse
Hmm bro i have not started my work for A110 as my friend(who has that device) is out of station so i will have to wait for him till then we(my team) is working on our Smart apps
This mod will make you able to have torch flash light while you are on LockScreen by long pressing on the home button...!!!
Actual mod was done by RobbieHood and eybee1970
Needed tools:
1) Backsmali/Smali program from here
2) Notepad++ program from here
3) WinRAR or 7-zip archiver
The procedure:
- Backsmali android.policy.jar
- Navigate to classout/com/android/internal/policy/impl/ folder
- We will be working on 3 smali files:
KeyguardViewMediator$4.smali
- Search for "packed-switch" and add the blue line just above "return-void":
Code:
.line 1255
iget v2, p1, Landroid/os/Message;->what:I
packed-switch v2, :pswitch_data_72
.line 1298
:goto_7
[B][COLOR="Blue"]:pswitch_7[/COLOR][/B]
return-void
.line 1257
- Search for ":catchall" and add these lines above it:
Code:
.line 1295
monitor-exit v1
goto :goto_[B][COLOR="Red"]7[/COLOR][/B]
[B][COLOR="Blue"] :pswitch_6e
iget-object v2, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator$4;->this$0:Lcom/android/internal/policy/impl/KeyguardViewMediator;
iget v3, p1, Landroid/os/Message;->arg1:I
if-eqz v3, :cond_majdi
move v3, v0
:goto_nj
#calls: Lcom/android/internal/policy/impl/KeyguardViewMediator;->handleSetTorch(Z)V
invoke-static {v2, v3}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->access$2400(Lcom/android/internal/policy/impl/KeyguardViewMediator;Z)V
goto :goto_[COLOR="Red"]7[/COLOR]
:cond_majdi
move v3, v1
goto :goto_nj[/COLOR][/B]
:catchall_7b
move-exception v0
monitor-exit v1
N.B: pay attention to number 7 in goto :goto_7 that could be different in your smali according to your ROM, make sure it is the same as the first one which is just above the new line ":pswitch_6e"
Click to expand...
Click to collapse
- Search for "nop" and another "nop" line bellow it (don't forget to leave empty line in between):
Code:
.line 1255
nop
[B][COLOR="Blue"]nop[/COLOR][/B]
- Now go to the end of smali and add these switches above ".end packed-switch" line:
Code:
:pswitch_data_72
.packed-switch 0x1
:pswitch_8
:pswitch_10
:pswitch_16
:pswitch_1c
:pswitch_22
:pswitch_28
:pswitch_2e
:pswitch_38
:pswitch_40
:pswitch_4c
:pswitch_52
:pswitch_58
:pswitch_64
[B][COLOR="Blue"]:pswitch_7
:pswitch_7
:pswitch_7
:pswitch_7
:pswitch_7
:pswitch_7
:pswitch_6e[/COLOR][/B]
.end packed-switch
.end method
N.B: if your smali has :pswitch_7 and :pswitch_6e by default, then use another :pswitch_value for :pswitch_7 and :pswitch_6e. If you do so, then don't forget to change :pswitch_7 and :pswitch_6e value in added codes from the beginning above as well
Click to expand...
Click to collapse
Save changes...
KeyguardViewMediator.smali
- Search for ".field private static final SET_HIDDEN:I = 0xc" and add this line bellow it (the blue one):
Code:
.field private static final SET_HIDDEN:I = 0xc
[B][COLOR="Blue"].field private static final SET_TORCH:I = 0x14[/COLOR][/B]
.field private static final SHOW:I = 0x2
- Search for ".field private mTelephonyManager:Landroid/telephony/TelephonyManager;" and add thses lines bellow it (the blue ones):
Code:
.field private mTelephonyManager:Landroid/telephony/TelephonyManager;
[B][COLOR="Blue"].field private mTorchEnabled:Z
.field private mTorchStateChanged:Z[/COLOR][/B]
.field private mUnlockSoundId:I
- Search for this method ".method public constructor <init>(Landroid/content/Context;Lcom/android/internal/policy/impl/PhoneWindowManager;Landroid/os/LocalPowerManager;)V" and add these lines (the blue ones):
Code:
.method public constructor <init>(Landroid/content/Context;Lcom/android/internal/policy/impl/PhoneWindowManager;Landroid/os/LocalPowerManager;)V
.registers 15
.parameter "context"
.parameter "callback"
.parameter "powerManager"
.prologue
.line 308
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 188
[B][COLOR="Blue"]const/4 v0, 0x1
iput-boolean v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchEnabled:Z[/COLOR][/B]
const/4 v0, 0x1
- Search for "const-string v0, "power"" and add these lines above it (the blue lines):
Code:
.line 311
iput-object p3, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mRealPowerManager:Landroid/os/LocalPowerManager;
.line 312
[B][COLOR="Blue"]const/4 v0, 0x0
iput-boolean v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchEnabled:Z
const/4 v0, 0x0
iput-boolean v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchStateChanged:Z[/COLOR][/B]
const-string v0, "power"
- Search for this method ".method static synthetic access$300(Lcom/android/internal/policy/impl/KeyguardViewMediator;I)V" and add this new method above it:
Code:
.method static synthetic access$2300(Lcom/android/internal/policy/impl/KeyguardViewMediator;Z)V
.registers 2
.parameter "x0"
.parameter "x1"
.prologue
.line 110
invoke-direct {p0, p1}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->handleSetHidden(Z)V
return-void
.end method
[B][COLOR="Blue"].method static synthetic access$[COLOR="Red"]2400[/COLOR](Lcom/android/internal/policy/impl/KeyguardViewMediator;Z)V
.registers 2
invoke-direct {p0, p1}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->handleSetTorch(Z)V
return-void
.end method[/COLOR][/B]
.method static synthetic access$300(Lcom/android/internal/policy/impl/KeyguardViewMediator;I)V
N.B: pay attention to $2400, that is increment to the method above it
Click to expand...
Click to collapse
- Search for the method ".method private handleHide()V" and add this line at end of this method (the blue one) just after "monitor-exit p0":
Code:
.method private handleHide()V
..
..
..
.line 1449
monitor-exit p0
[B][COLOR="Blue"]invoke-direct {p0}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->resetTorchState()V[/COLOR][/B]
goto :goto_18
:catchall_45
move-exception v0
monitor-exit p0
:try_end_47
.catchall {:try_start_1 .. :try_end_47} :catchall_45
throw v0
.end method
.method private handleKeyguardDone(Z)V
- Search for the method ".method private handleNotifyScreenOff()V" and add this line (the blue one) just above "return-void":
Code:
.method private handleNotifyScreenOff()V
.registers 3
.prologue
.line 1597
monitor-enter p0
.line 1598
:try_start_1
const-string v0, "KeyguardViewMediator"
const-string v1, "handleNotifyScreenOff"
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
.line 1599
iget-object v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mKeyguardViewManager:Lcom/android/internal/policy/impl/KeyguardViewManager;
invoke-virtual {v0}, Lcom/android/internal/policy/impl/KeyguardViewManager;->onScreenTurnedOff()V
.line 1600
monitor-exit p0
.line 1601
[B][COLOR="Blue"]invoke-direct {p0}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->resetTorchState()V[/COLOR][/B]
return-void
- Search for the method ".method private handleSetHidden(Z)V" and add this line (the blue one) above the defined condition in the method:
Code:
.method private handleSetHidden(Z)V
.registers 3
.parameter "isHidden"
.prologue
.line 688
monitor-enter p0
.line 689
:try_start_1
iget-boolean v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mHidden:Z
if-eq v0, p1, :cond_10
.line 690
iput-boolean p1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mHidden:Z
.line 691
invoke-direct {p0}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->updateActivityLockScreenState()V
.line 692
invoke-direct {p0}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->adjustUserActivityLocked()V
.line 693
invoke-direct {p0}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->adjustStatusBarLocked()V
.line 695
[B][COLOR="Blue"]invoke-direct {p0}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->resetTorchState()V[/COLOR][/B]
:cond_10
monitor-exit p0
- Search for the method ".method private handleShow()V" and add the following new method above it:
Code:
[B][COLOR="Blue"].method private handleSetTorch(Z)V
.registers 8
const/4 v5, 0x0
const/4 v4, 0x1
:try_start_2
iget-boolean v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchStateChanged:Z
if-nez v1, :cond_majdi
iput-boolean v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchEnabled:Z
const/4 v1, 0x1
iput-boolean v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchStateChanged:Z
:cond_[COLOR="Red"]b[/COLOR]
:goto_[COLOR="Red"]b[/COLOR]
return-void
:cond_majdi
iget-boolean v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchEnabled:Z
if-eq v1, p1, :cond_[COLOR="Red"]b[/COLOR]
iput-boolean p1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchEnabled:Z
new-instance v0, Landroid/content/Intent;
const-string v1, "net.cactii.flash2.TOGGLE_FLASHLIGHT"
invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
const-string v1, "net.cactii.flash2.EXTRA_DISABLE_NOTIFICATION"
const/4 v2, 0x1
invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Z)Landroid/content/Intent;
iget-object v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mContext:Landroid/content/Context;
invoke-virtual {v1, v0}, Landroid/content/Context;->sendBroadcast(Landroid/content/Intent;)V
:try_end_maj
.catch Ljava/lang/Exception; {:try_start_2 .. :try_end_maj} :catch_jdi
goto :goto_[COLOR="Red"]b[/COLOR]
:catch_jdi
move-exception v1
goto :goto_[COLOR="Red"]b[/COLOR]
.end method[/COLOR][/B]
.method private handleShow()V
N.B: pay attention to :cond_b and :goto_b that could be differ according to your ROM where b should be the exact the same first condition in this method ".method public isGlanceViewVisible()Z"
Code:
.method public isGlanceViewVisible()Z
.registers 2
.prologue
.line 666
iget-object v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mKeyguardViewManager:Lcom/android/internal/policy/impl/KeyguardViewManager;
if-eqz v0, [B][COLOR="Red"]:cond_b[/COLOR][/B]
.line 667
Click to expand...
Click to collapse
- Search for method ".method private handleShow()V", then search bellow for "Landroid/os/PowerManager$WakeLock;->release()V" and add these lines bellow it (the blue ones):
Code:
.method private handleShow()V
.registers 3
.prologue
.line 1400
monitor-enter p0
.line 1401
:try_start_1
const-string v0, "KeyguardViewMediator"
...
...
...
invoke-virtual {v0}, Landroid/os/PowerManager$WakeLock;->release()V
.line 1419
[B][COLOR="Blue"]const/4 v0, 0x1
iput-boolean v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchStateChanged:Z[/COLOR][/B]
monitor-exit p0
- Search for the method ".method private resetStateLocked()V" and add these lines (the blue ones) at the end before "return-void" line:
Code:
.method private resetStateLocked()V
.registers 4
...
...
invoke-virtual {v1, v0}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z
.line 809
[B][COLOR="Blue"]return-void
.end method
.method private resetTorchState()V
.registers 2
iget-boolean v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mTorchStateChanged:Z
if-eqz v0, :cond_[COLOR="Red"]8[/COLOR]
const/4 v0, 0x0
invoke-direct {p0, v0}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->handleSetTorch(Z)V
:cond_[COLOR="Red"]8[/COLOR][/COLOR][/B]
return-void
.end method
N.B: pay attention to :cond_8 that could be differ according to your ROM where 8 should be the exact the same first DEFINED condition in this method ".method private playSounds(Z)V"
Code:
.method private playSounds(Z)V
.registers 10
.parameter "locked"
.prologue
const/4 v5, 0x0
const/4 v4, 0x1
.line 1362
iget-boolean v0, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mSuppressNextLockSound:Z
if-eqz v0, :cond_9
.line 1363
iput-boolean v5, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mSuppressNextLockSound:Z
.line 1385
[B][COLOR="Red"]:cond_8[/COLOR][/B]
:goto_8
return-void
Click to expand...
Click to collapse
- Search for the method ".method public verifyUnlock(Landroid/view/WindowManagerPolicy$OnKeyguardExitResult;)V" and add this new method above it (the blue lines):
Code:
[B][COLOR="Blue"].method public setTorch(Z)V
.registers 7
const/16 v4, 0x14
const/4 v3, 0x0
iget-boolean v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mScreenOn:Z
if-eqz v1, :cond_newa
iget-object v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mHandler:Landroid/os/Handler;
invoke-virtual {v1, v4}, Landroid/os/Handler;->removeMessages(I)V
iget-object v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mHandler:Landroid/os/Handler;
if-eqz p1, :cond_newb
const/4 v2, 0x1
:goto_[COLOR="Red"]11[/COLOR]
invoke-virtual {v1, v4, v2, v3}, Landroid/os/Handler;->obtainMessage(III)Landroid/os/Message;
move-result-object v0
iget-object v1, p0, Lcom/android/internal/policy/impl/KeyguardViewMediator;->mHandler:Landroid/os/Handler;
invoke-virtual {v1, v0}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z
:cond_newa
return-void
:cond_newb
move v2, v3
goto :goto_[COLOR="Red"]11[/COLOR]
.end method[/COLOR][/B]
.method public verifyUnlock(Landroid/view/WindowManagerPolicy$OnKeyguardExitResult;)V
N.B: pay attention to :goto_11 that could be differ according to your ROM where 11 should be the exact the same goto action in this method ".method public isInputRestricted()Z"
Code:
.method public isInputRestricted()Z
.registers 2
..
..
[B][COLOR="Red"]:goto_11[/COLOR][/B]
return v0
:cond_12
const/4 v0, 0x0
goto :goto_11
.end method
Click to expand...
Click to collapse
Save changes..
PhoneWindowManager.smali
All changes here, will be in this method ".method public interceptKeyBeforeDispatching(Landroid/view/WindowManagerPolicy$WindowState;Landroid/view/KeyEvent;I)J"; so it is better to know from which part of smali this method starts and ends in order to not touch other methods!!
- First search for the method ".method public interceptKeyBeforeDispatching(Landroid/view/WindowManagerPolicy$WindowState;Landroid/view/KeyEvent;I)J",
- Search for "Lcom/android/internal/policy/impl/PhoneWindowManager;->mHomePressed:Z" and add these lines bellow it (the blue ones):
Code:
.method public interceptKeyBeforeDispatching(Landroid/view/WindowManagerPolicy$WindowState;Landroid/view/KeyEvent;I)J
.registers 56
...
...
...
...
.line 3364
:cond_2ba
if-nez v15, :cond_[B][COLOR="Red"]38c[/COLOR][/B]
.line 3365
move-object/from16 v0, p0
iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHomePressed:Z
[B][COLOR="Blue"]if-eqz v0, :cond_[COLOR="Red"]38c[/COLOR]
const/16 v3, 0x0[/COLOR][/B]
move/from16 v20, v0
N.B: pay attention to if-eqz v0, :cond_38c where the condition number 38c is the same as IF condition above it
Click to expand...
Click to collapse
- Search for this portion (you can search down for ".catch Landroid/os/RemoteException" to locate this portion) and add this line (the blue one):
Code:
.line 3373
invoke-interface/range {v44 .. v44}, Lcom/android/internal/statusbar/IStatusBarService;->cancelPreloadRecentApps()V
:try_end_2dd
.catch Landroid/os/RemoteException; {:try_start_2d4 .. :try_end_2dd} :catch_329
.line 3381
.end local v44 #statusbar:Lcom/android/internal/statusbar/IStatusBarService;
:cond_2dd
:goto_2dd
const/4 v3, 0x0
move-object/from16 v0, p0
iput-boolean v3, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHomePressed:Z
[B][COLOR="Blue"]invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->launchHomeFromHotKey()V[/COLOR][/B]
.line 3382
if-nez v36, :cond_32c
- Search down for "Lcom/android/internal/policy/impl/PhoneWindowManager$HomeKeyDoubleClickConcept;->setHomeDownEventSent()V" and add this new code after defined condition:
Code:
.line 3470
move-object/from16 v0, p0
iget-object v3, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHomeKeyDoubleClickConcept:Lcom/android/internal/policy/impl/PhoneWindowManager$HomeKeyDoubleClickConcept;
invoke-virtual {v3}, Lcom/android/internal/policy/impl/PhoneWindowManager$HomeKeyDoubleClickConcept;->setHomeDownEventSent()V
.line 3473
:cond_3a6
[B][COLOR="Blue"]new-instance v0, Ljava/io/File;
const-string v1, "/sdcard/Android"
invoke-direct {v0, v1}, Ljava/io/File;-><init>(Ljava/lang/String;)V
invoke-virtual {v0}, Ljava/io/File;->exists()Z
move-result v0
if-eqz v0, :cond_majdi
move-object/from16 v0, p0
iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mKeyguardMediator:Lcom/android/internal/policy/impl/KeyguardViewMediator;
move-object/from16 v3, v0
invoke-virtual/range {v3 .. v3}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->isShowingAndNotHidden()Z
move-result v3
if-eqz v3, :cond_majdi
move-object/from16 v0, p0
iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mKeyguardMediator:Lcom/android/internal/policy/impl/KeyguardViewMediator;
move-object/from16 v3, v0
move-object/from16 v0, v3
move v1, v15
invoke-virtual {v0, v1}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->setTorch(Z)V
rem-int/lit8 v3, v41, 0xf
if-nez v3, :cond_majdi
move-object/from16 v0, p0
iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mKeyguardMediator:Lcom/android/internal/policy/impl/KeyguardViewMediator;
move-object/from16 v3, v0
invoke-virtual/range {v3 .. v3}, Lcom/android/internal/policy/impl/KeyguardViewMediator;->pokeWakelock()V
:cond_majdi[/COLOR][/B]
const-wide/16 v3, 0x0
goto/16 :goto_8f
- Search down for "const/16 v3, 0xbb" (v3 may differ according to ROM) and do the following editing:
before:
Code:
.line 3635
:cond_[B][COLOR="Red"]536[/COLOR][/B] [B][COLOR="Green"]<-- we need to copy bellow condition over it[/COLOR][/B]
const/16 v3, 0xbb
move/from16 v0, v32
if-ne v0, v3, :cond_[B][COLOR="Red"]56f[/COLOR][/B] [B][COLOR="Green"]<-- we need to define new condition[/COLOR][/B]
.line 3637
move-object/from16 v0, p0
after:
Code:
.line 3635
:cond_[B][COLOR="Blue"]56f[/COLOR][/B]
const/16 v3, 0xbb
move/from16 v0, v32
if-ne v0, v3, :cond_[B][COLOR="Blue"]nj[/COLOR][/B]
.line 3637
move-object/from16 v0, p0
- Now we need to redefine mentioned cond_56f (it could be differ according to ROM), search UP for ".catch Landroid/content/ActivityNotFoundException;" and modify the IF-NE condition bellow it:
before:
Code:
.catch Landroid/content/ActivityNotFoundException; {:try_start_4fd .. :try_end_506} :catch_705
.line 3839
.end local v43 #shortcutIntent:Landroid/content/Intent;
:cond_506
:goto_506
const-wide/16 v3, -0x1
goto/16 :goto_8f
.line 3621
.end local v31 #kcm:Landroid/view/KeyCharacterMap;
:cond_50a
const/16 v3, 0x54
move/from16 v0, v32
if-ne v0, v3, [B][COLOR="Red"]:cond_536[/COLOR] [COLOR="Green"]<-- redefine this condition[/COLOR][/B]
.line 3622
if-eqz v15, :cond_522
after:
Code:
.catch Landroid/content/ActivityNotFoundException; {:try_start_4fd .. :try_end_506} :catch_705
.line 3839
.end local v43 #shortcutIntent:Landroid/content/Intent;
:cond_506
:goto_506
const-wide/16 v3, -0x1
goto/16 :goto_8f
.line 3621
.end local v31 #kcm:Landroid/view/KeyCharacterMap;
:cond_50a
const/16 v3, 0x54
move/from16 v0, v32
if-ne v0, v3, [B][COLOR="Blue"]:cond_56f[/COLOR][/B]
.line 3622
if-eqz v15, :cond_522
- Search down for "const/16 v3, 0xdb" (v3 may differ according to ROM) and change the condition value above it to the new condition from above mentioned edited code:
before:
Code:
.line 3654
.end local v16 #e:Landroid/os/RemoteException;
[B][COLOR="Red"]:cond_56f[/COLOR] [COLOR="Green"]<-- change it to the new condition[/COLOR][/B]
const/16 v3, 0xdb
move/from16 v0, v32
if-ne v0, v3, :cond_5a4
after:
Code:
.line 3654
.end local v16 #e:Landroid/os/RemoteException;
[B][COLOR="Blue"]:cond_nj[/COLOR][/B]
const/16 v3, 0xdb
move/from16 v0, v32
if-ne v0, v3, :cond_5a4
Save changes...
Now backsmali classsout folder to get new classes.dex file. Now Open android.policy.jar by WinRAR or 7-zip and drag and drop the new classes.dex file inside it; then push it to your device framework folder and fix permissions to chmod 644.
Download Torch.apk from attachment bellow and push it to your device app folder and fix permissions to chmod 644 as well... and viola.. lockscreen the device and do long pressing on home button to have torch flash light..:laugh:
If you could manage to shorten this tutorial by omitting unnecessary steps, then share your experience here please
thanks man
you're awesome
For those who want to make smali comparison, I attached the 3 mentioned smali before and after editing... So it will be easier to locate differences :laugh:
You can find them in the attachment bellow
wow a lot of work, and of course big thanks
your tutorials provide a real value for comunity, I have learned a lot with these.
thanks once again and keep up a great work!
p.s. waiting for someone to qoute op lol
edit: why your tutorials are not sticky threads (wondering)
Sent from my GT-N7000 using xda app-developers app
OMG ...
How you know all this???
You are boss..
Sent from my [email protected]£@×¥
my most loved app from robbie and miui roms. these however look like rocket science to me. therefore i'll leave this rocket science to the geniuses.
thank u. mcuh appreciatrd that everyone can now embed this wonderful feature into more roms.
With the steps that you have done in this mod, does long pressing the home button turn the torch on until the screen locks so that you can take your finger off the home button, or do you need to keep your finger on the home button the whole time for the torch to stay on?
daveyannihilation said:
With the steps that you have done in this mod, does long pressing the home button turn the torch on until the screen locks so that you can take your finger off the home button, or do you need to keep your finger on the home button the whole time for the torch to stay on?
Click to expand...
Click to collapse
press and hold = light on
release button = light off
sent from my G-Note
hara74 said:
press and hold = light on
release button = light off
sent from my G-Note
Click to expand...
Click to collapse
Thanks for the reply.
Is there any way of implementing the mods done in this thread: [MOD] [GUIDE] [JB BLK1] LockScreen Torch with toggle?
This actually keeps the torch on even after you release the home button, but it will turn off when the screen turns off either by timing out or pressing the lock button.
I tried to port it to Galaxy S II but I am not a master dev like majdinj so I couldn't get it to work. I am not too worried about the toggle to turn it on and off, but keeping the torch on after letting go of the home button would be great.
Thanks in advance,
Dave
sorry m8 I don't know,
maybe majdinj knows
sent from my G-Note
daveyannihilation said:
Thanks for the reply.
Is there any way of implementing the mods done in this thread: [MOD] [GUIDE] [JB BLK1] LockScreen Torch with toggle?
This actually keeps the torch on even after you release the home button, but it will turn off when the screen turns off either by timing out or pressing the lock button.
I tried to port it to Galaxy S II but I am not a master dev like majdinj so I couldn't get it to work. I am not too worried about the toggle to turn it on and off, but keeping the torch on after letting go of the home button would be great.
Thanks in advance,
Dave
Click to expand...
Click to collapse
You should pay attention to conditions buddy.. "You will not reach glory until you taste patience".. so try and try and try till you success :good:
majdinj said:
You should pay attention to conditions buddy.. "You will not reach glory until you taste patience".. so try and try and try till you success :good:
Click to expand...
Click to collapse
Thank you majdinj.
So what you're saying is, everywhere that I see a cond_ written in a method, I need to pay attention to where that cond is and what it does? Sorry, but smali code is like Swahili to me!
Thanks for your advice.
All the best,
Dave
Hi!
I'm having problem with PhoneWindowManager.smali. Most of the .line #### is not present. Should I add them? This is for Pristine ROM v4.0.
Sample.
On ".method public interceptKeyBeforeDispatching(Landroid/view/WindowManagerPolicy$WindowState;Landroid/view/KeyEvent;I)J"
I should add a line under;
" .line 3365
move-object/from16 v0, p0
iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHomePressed:Z"
but this codes are not present;
" .line 3364
:cond_2ba
if-nez v15, :cond_38c
.line 3365
move-object/from16 v0, p0
iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHomePressed:Z"
and so on. Any help please? Thanks!
Installed apk on alborak (lt5). Seems not working (even rebooted). Any idea, sir.
Sent from my GT-N7000 using xda premium
ive perfectly followed each step of yours when i push the apk and the jar file
my phone hangs on boot screen ://
im sure ive perfectly edited the files
Hi, installed apk on lt6 sweet v9. No success. This is a useful app, can you pls do something.
Sent from my GT-N7000 using xda premium
dsmas said:
Hi, installed apk on lt6 sweet v9. No success. This is a useful app, can you pls do something.
Sent from my GT-N7000 using xda premium
Click to expand...
Click to collapse
you cannot just install the apk you have to go thru the procedure in OP.
I was searching for this mod for a long time ago.. I just found it in TeamUnion ROM .. I like the ROM but after a while it drain my battery so fast.. so I decide to install one clean Stock ROM like ebyee's ROM and add some little mod like call recording and etc.. was searching for this mod but haven't ever could figure out how it works.. Thanks majdinj for posting it here :good:
Sorry for bumping this thread. I don't entirely understand the tutorial.
I believe I'm on an odex rom (where .apk and .odex are in /system/app), and I'm not sure if it'll work for me.
I've downloaded all the programs (backsmali/smali/notepad++), but I don't understand what the procedure says. What does it mean to backsmali android.policy.jar? Where do I get this android.policy.jar?
rcheung28 said:
Sorry for bumping this thread. I don't entirely understand the tutorial.
I believe I'm on an odex rom (where .apk and .odex are in /system/app), and I'm not sure if it'll work for me.
I've downloaded all the programs (backsmali/smali/notepad++), but I don't understand what the procedure says. What does it mean to backsmali android.policy.jar? Where do I get this android.policy.jar?
Click to expand...
Click to collapse
It's in /system/framework but you will also need android.policy.odex which you will need to deodex to be able to see the smali files.
There is a thread in Samsung Galaxy SII Original Android Development by sicopat here: http://forum.xda-developers.com/showthread.php?t=1208320 which states how to deodex a jar file.
You will also need all of the other jar files from /system/framework to be able to deodex it properly.
If you need a hand or some tips, just ask.
Sent from my GT-I9505 using Tapatalk 4 Beta
Hello xda members,
New day and new mod to learn, isn't it?
Today I will explain to you how to be able to change sound track by long pressing volume up or down while the screen is locked using stock Music Player and Google Play Music programs..
First I would like to say thanks to:
- xperiacle: who firstly port this mod to Galaxy Note.
- grilleld: who helped me by providing android.policy.jar from xperiacle ROM, so I could locate codes for this mod (I did some codes modifications to shortening the modding process , so it will be easy and straight forward).
Click to expand...
Click to collapse
OK let's start..
Needed tools:
1) Backsmali/Smali program (Check the utility I made for that here for windows users)
2) Notepad ++ from here.
The procedure:
- Backsmali android.policy.jar
- Navigate to com/android/internal/policy/impl/ folder and open PhoneWindowManager.smali
- Search for this static field ".field static final LONG_PRESS_POWER_SHUT_OFF:I = 0x2" and add this line bellow it (the blue one):
Code:
.field static final LONG_PRESS_POWER_SHUT_OFF:I = 0x2
[B][COLOR="Blue"].field private static final LONG_PRESS_TIMEOUT:I = 0x190[/COLOR][/B]
.field static final MINI_APP_DIALOG_LAYER:I = 0x5
Here you can set the timeout for long press event of volume rocker, here it is set to 400 millisecond (0x190).
Click to expand...
Click to collapse
- Search for this field ".field private mIsVisibleSPenGestureView:Z" and add these two lines bellow it (the blue ones):
Code:
.field private mIsVisibleSPenGestureView:Z
[B][COLOR="Blue"].field mIsVolumeAction:Z
.field mIsVolumeBlocking:Z[/COLOR][/B]
.field mKeyboardTapVibePattern:[J
- Search for the field ".field private mVolumeDownKeyTriggered:Z" and add this line bellow it (the blue one):
Code:
.field private mVolumeDownKeyTriggered:Z
[B][COLOR="Blue"].field mVolumeDownLongPress:Ljava/lang/Runnable;[/COLOR][/B]
.field private final mVolumeKeyLongPressforOneTouchReport:Ljava/lang/Runnable;
- Search for the field ".field private mVolumeUpKeyTriggered:Z" and add this line bellow it (the blue one):
Code:
.field private mVolumeUpKeyTriggered:Z
[B][COLOR="Blue"].field mVolumeUpLongPress:Ljava/lang/Runnable;[/COLOR][/B]
.field mWindowManager:Landroid/view/IWindowManager;
- Search for the method ".method public constructor <init>()V" and go to the end of this method and add these lines (the blue ones) before "return-void" line:
Code:
.line 7234
new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$36;
invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$36;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mScreenLockTimeout:Ljava/lang/Runnable;
[B][COLOR="Blue"]new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$Skip1;
invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$Skip1;-><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$Skip2;
invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$Skip2;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeDownLongPress:Ljava/lang/Runnable;[/COLOR][/B]
.line 8132
return-void
.end method
- Search for the method ".method handleVolumeKey(II)V" and add these lines above "invoke-static" line (the blue ones), and add extra condition line (the blue line) above "goto" command:
Code:
.method handleVolumeKey(II)V
.registers 8
.parameter "stream"
.parameter "keycode"
.prologue
.line 5405
[B][COLOR="Blue"]move-object/from16 v0, p0
iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeBlocking:Z
if-nez v0, :cond_c[/COLOR][/B]
invoke-static {}, Lcom/android/internal/policy/impl/PhoneWindowManager;->getAudioService()Landroid/media/IAudioService;
move-result-object v0
if-nez v0, :cond_d
[B][COLOR="Blue"]:cond_c[/COLOR][/B]
:goto_[B][COLOR="Blue"]c[/COLOR][/B]
return-void
Here we should change :goto_value to same as conditions we added, so it will be :goto_c
Click to expand...
Click to collapse
- Still in the same method, search down for "Landroid/os/PowerManager$WakeLock;->release()V" and change :goto value to the same as the one in the previous:
before:
Code:
iget-object v2, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBroadcastWakeLock:Landroid/os/PowerManager$WakeLock;
invoke-virtual {v2}, Landroid/os/PowerManager$WakeLock;->release()V
goto :goto_[B][COLOR="Red"]6[/COLOR][/B]
After:
Code:
iget-object v2, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBroadcastWakeLock:Landroid/os/PowerManager$WakeLock;
invoke-virtual {v2}, Landroid/os/PowerManager$WakeLock;->release()V
goto :goto_[B][COLOR="Blue"]c[/COLOR][/B]
- There is another one..!! Search down again for "Landroid/os/PowerManager$WakeLock;->release()V" and change :goto value to the same as the one in the previous step:
Before:
Code:
iget-object v2, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBroadcastWakeLock:Landroid/os/PowerManager$WakeLock;
invoke-virtual {v2}, Landroid/os/PowerManager$WakeLock;->release()V
goto :goto_[B][COLOR="Red"]6[/COLOR][/B]
After:
Code:
iget-object v2, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBroadcastWakeLock:Landroid/os/PowerManager$WakeLock;
invoke-virtual {v2}, Landroid/os/PowerManager$WakeLock;->release()V
goto :goto_[B][COLOR="Blue"]c[/COLOR][/B]
- Now at the end of the previous method ".method handleVolumeKey(II)V" and before the next method ".method public hasNavigationBar()Z", add these two new methods:
Code:
[B][COLOR="Blue"].method handleVolumeLongPress(I)V
.registers 6
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_majdi
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeUpLongPress:Ljava/lang/Runnable;
:goto_nj
iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;
sget v2, Lcom/android/internal/policy/impl/PhoneWindowManager;->LONG_PRESS_TIMEOUT:I
int-to-long v2, v2
invoke-virtual {v1, v0, v2, v3}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z
return-void
:cond_majdi
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeDownLongPress:Ljava/lang/Runnable;
goto :goto_nj
.end method
.method handleVolumeLongPressAbort()V
.registers 3
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][/B]
- Now search for the method ".method public interceptKeyBeforeQueueing(Landroid/view/KeyEvent;IZ)I", then search down for "Lcom/android/internal/policy/impl/PhoneWindowManager;->mSamsungVolumeControlThread:Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;" and add these lines ABOVE it (the blue ones):
Code:
:cond_51c
move-object/from16 v0, p0
[B][COLOR="Blue"]iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mScreenOnEarly:Z
if-nez v0, :cond_dinj
invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->isMusicActive()Z
move-result v29
if-eqz p0, :cond_dinj
move-object/from16 v0, p0
move/from16 v15, v19
invoke-virtual {v0, v15}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeLongPress(I)V
:cond_dinj
move-object/from16 v0, p0[/COLOR][/B]
iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSamsungVolumeControlThread:Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;
move-object/from16 v29, v0
- Still in the same method, and after adding the previous lines, just go down for few lines and you will see a line starts with a defined condition (:cond_), just add these lines (the blue ones) bellow that defined condition:
Code:
invoke-virtual/range {v29 .. v29}, Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;->start()V
goto/16 :goto_68
:cond_562
[B][COLOR="Blue"]if-nez v5, :cond_newa
move-object/from16 v0, p0
iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeBlocking:Z
if-eqz v0, :cond_newa
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_newa
move-object/from16 v0, p0
const/4 v3, 0x0
move/from16 v15, v19
invoke-virtual {v0, v3, v15}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeKey(II)V
:cond_newa[/COLOR][/B]
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 v29, v0
- Now at the end of the method ".method sendCloseSystemWindows(Ljava/lang/String;)V" and above the method ".method setAttachedWindowFrames(Landroid/view/WindowManagerPolicy$WindowState;IILandroid/view/WindowManagerPolicy$WindowState;ZLandroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;I)V" add this new method:
Code:
[B][COLOR="Blue"].method protected sendMediaButtonEvent(I)V
.registers 15
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
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][/B]
Save changes..
Now add the two extra smalis resources from the attachment in com/android/internal/policy/impl folder and recompile android.policy.jar and push to your phone and fix permissions to chmod 644.
PS: for those who want to compare smalis, I also attached PhoneWindowManager.smali BEFORE and AFTER changes applied.
Click to expand...
Click to collapse
Have fun..
you are 'Mr. Guide'!!! Sharing is caring!!!
Wow, you don't have limits in innovation ^^, great work, will try to implement that on my rom ^^.
Thanks a lot majdinj
Please anybody try to do it on MIUI
Thanks
Just done and tested, it works great ^^, thanks majdinj
eybee1970 said:
you are 'Mr. Guide'!!! Sharing is caring!!!
Click to expand...
Click to collapse
Welcome eybee,,,, :laugh:
ezaechiel said:
Just done and tested, it works great ^^, thanks majdinj
Click to expand...
Click to collapse
thank you for testing
Any chance of adding in a ticker box to enable and disable this mod? Would be nice
maskerwsk said:
Any chance of adding in a ticker box to enable and disable this mod? Would be nice
Click to expand...
Click to collapse
Me too would like to,,, but I need to study more how are these things done,,, In the meanwhile enjoy the mod
Wow another great guide released .Thanks a lot :thumbup:
Sent from my GT-I9082 using Tapatalk 2
majdinj said:
Me too would like to,,, but I need to study more how are these things done,,, In the meanwhile enjoy the mod
Click to expand...
Click to collapse
I guess we'd have to start with secsettings res/xml/XXXXXX and add the ticker to the layout. Then add the corresponding methods to the smali files.
I will have a crack at this aswell as it would be nice to add enable/disable action to most mods
maskerwsk said:
I guess we'd have to start with secsettings res/xml/XXXXXX and add the ticker to the layout. Then add the corresponding methods to the smali files.
I will have a crack at this aswell as it would be nice to add enable/disable action to most mods
Click to expand...
Click to collapse
That would be great
maskerwsk said:
I guess we'd have to start with secsettings res/xml/XXXXXX and add the ticker to the layout. Then add the corresponding methods to the smali files.
I will have a crack at this aswell as it would be nice to add enable/disable action to most mods
Click to expand...
Click to collapse
I will be happy to learn that from you if possible man :laugh:
Code is updated to include timeout delay before long press event to occur..
Hi majdinj
I tried to put 5 seconds delay but it seems it doesn't work. I have same delay if I put 2 or 5 seconds and it less than a second.
Maybe I don't use the good hex format for time.
Could you tell me how to set 2 seconds delay please?
ezaechiel said:
Hi majdinj
I tried to put 5 seconds delay but it seems it doesn't work. I have same delay if I put 2 or 5 seconds and it less than a second.
Maybe I don't use the good hex format for time.
Could you tell me how to set 2 seconds delay please?
Click to expand...
Click to collapse
tbh, I don't know if it support 5 seconds or not,,,
but in general, to convert numbers to hex, grab any converter online; if you use windows PC, then open calculator --> view --> programmer, here put your delay time in millisecond in Dec format then just switch format to hex to get your number.. So for 2 seconds = 2000 milliseconds = 7d0, so you should put 0x7d0 in your script to have 2 seconds delay
majdinj said:
tbh, I don't know if it support 5 seconds or not,,,
but in general, to convert numbers to hex, grab any converter online; if you use windows PC, then open calculator --> view --> programmer, here put your delay time in millisecond in Dec format then just switch format to hex to get your number.. So for 2 seconds = 2000 milliseconds = 7d0, so you should put 0x7d0 in your script to have 2 seconds delay
Click to expand...
Click to collapse
Ok that's what I do but I can't see difference .
Thanks for your answer
EDIT : My bad, I missed a change in your tutorial , it works great now, sorry majdinj
ezaechiel said:
Ok that's what I do but I can't see difference .
Thanks for your answer
EDIT : My bad, I missed a change in your tutorial , it works great now, sorry majdinj
Click to expand...
Click to collapse
My pleasure,,
When i use the tool for uncompress android policy jar file it shows in the endd that it cant find androidpolicy classout folder
what is wrong?
jirka607 said:
When i use the tool for uncompress android policy jar file it shows in the endd that it cant find androidpolicy classout folder
what is wrong?
Click to expand...
Click to collapse
Do you use backsmali? Because you edit 1.bat with the name of android.policity.jar, run 1.bat and you'll see classout folder.
Well i put file into folder called put file here
Load it using 5 into the bat
then i press 1 and in the end there is error when i choose yes
<< Power Menu Safe Mode Reboot Addon >>
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Hi xda mates,,
Have anyone of you heard about the android safe mode and for what it is used?
Well the safe mode does exist in android device to help you to uninstall any third party application that causes lag or trouble in your android OS or even boot loop that prevents you from uninstalling that app which causes the problem by the normal way.. This should be your first attempt to fix your phone before doing a full wipe..!!
To get into Safe Mode, you need to power off your phone then turn it on and then hold volume up and down until it boots completely,, You will find a little black babble in the left lower side of the phone that indicates that you are in safe mode.
To boot into safe mode using adb shell, you can try these commands:
Code:
setprop persist.sys.safemode 1
reboot
The following video will show how is the buttons combination done..
OK, I know the buttons combination could be like a pain in a$$, and because most of manufactures had disabled the long press way to boot into safe mode (thanks Samsung..!!!), so I thought of integrating it into power menu as in above screenshots using the shell commands as a source of my smali codes.. So here we go :laugh:
The Guide:
Needed Tools:
1) APK Tool. You can use APK Multi-Tool from here.
2) Baksmali Tool. You can use my manager from here.
3) Notepad++ for editing xml and smali from here.
4) And of course little amount of patience..!!!
The procedure:
The procedure will not be different from the usual integrating addons into power menu..!!
First of all, download the resources [View attachment PM_SafeMode_Resources.rar].
1) framework-res.apk
- Decompile framework-res.apk
- Go to res\drawable-xhdpi folder and put the image resources there [tw_ic_lock_safemode.png]
- Go to res\values folder and open strings.xml file and add the following line at the end before </resources> and save:
Code:
<string name="global_action_safemode_txt">Reboot to safe mode</string>
- Now Recompile your framework-res.apk to create new ids.. Now DECOMPILE the NEW framework-res.apk and go to res\values and open public.xml file and locate these 2 ids:
Code:
<public type="drawable" name="tw_ic_lock_safemode" id="0x01080a98" />
<public type="string" name="global_action_safemode_txt" id="0x01040785" />
N.B: You might have different id numbers, but don't wary, the principle will be the same..!!
Click to expand...
Click to collapse
Keep the public.xml file opened for the moment and let's go to the next step.
2) android.policy.jar
- Baksmali android.policy.jar
- Go to classout\com\android\internal\policy\impl folder and paste the smali resource there [GlobalActions$SafeMode.smali]
- Now in the same folder find GlobalActions.smali and open it.
- In GlobalActions.smali, find the instance fields section and go to its end and add the following blue line just after ".field private mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;":
Code:
.field private mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
[B][COLOR="Blue"].field private mSafeMode:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR][/B]
.field private mRingerModeReceiver:Landroid/content/BroadcastReceiver;
- Now, Search for "[Lcom/android/internal/policy/impl/GlobalActions$Action;" for power menu arrays and increase the number of arrays (the line above it) to accommodate the total number of new arrays:
Code:
.line 418
const/4 v1, 0x[B][COLOR="Red"]5[/COLOR][/B] [B][COLOR="Green"]<!--- You need to increase the arrays number here[/COLOR][/B]
new-array v1, v1, [Lcom/android/internal/policy/impl/GlobalActions$Action;
so it will be:
Code:
.line 418
const/4 v1, 0x[B][COLOR="Blue"]6[/COLOR][/B]
new-array v1, v1, [Lcom/android/internal/policy/impl/GlobalActions$Action;
- Now, above the newly modified "const/4 v1, 0x6" add these action lines:
Code:
new-instance [B][COLOR="Red"]v1[/COLOR][/B], Lcom/android/internal/policy/impl/GlobalActions$99;
const [B][COLOR="Red"]v2[/COLOR][/B], 0x10808ad
const [B][COLOR="Red"]v3[/COLOR][/B], 0x1040193
move-object/from16 [B][COLOR="Red"]v0, p0[/COLOR][/B]
invoke-direct {[B][COLOR="Red"]v1, v0, v2, v3[/COLOR][/B]}, Lcom/android/internal/policy/impl/GlobalActions$99;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
move-object/from16 [B][COLOR="Red"]v0, p0[/COLOR][/B]
iput-object [B][COLOR="Red"]v1, v0[/COLOR][/B], Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
[B][COLOR="Blue"]new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$SafeMode;
const v2, [COLOR="SeaGreen"]0x1080a98[/COLOR]
const v3, [COLOR="SeaGreen"]0x1040785[/COLOR]
move-object/from16 v0, p0
invoke-direct {v1, v0, v2, v3}, Lcom/android/internal/policy/impl/GlobalActions$SafeMode;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
move-object/from16 v0, p0
iput-object v1, v0, Lcom/android/internal/policy/impl/GlobalActions;->mSafeMode:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR][/B]
invoke-direct/range {p0 .. p0}, Lcom/android/internal/policy/impl/GlobalActions;->onAirplaneModeChanged()V
.line 418
const/4 v1, 0x6
new-array v1, v1, [Lcom/android/internal/policy/impl/GlobalActions$Action;
Here, the ids above are obtained from public.xml file from framework-res.apk. The first id will represent the image resource and the second id will represent the string resource (don't forget to omit the first 0).
Also pay attention to variables and parameters, it should be matched (the red v and p)
- Now we will add new array to show in power menu. So bellow modified "const/4 v1, 0x6" add new arrays to show after the last array:
Code:
.line 418
const/4 v1, 0x6
new-array v1, v1, [Lcom/android/internal/policy/impl/GlobalActions$Action;
...
...
const/4 [B][COLOR="Red"]v2[/COLOR][/B], 0x4
move-object/from16 [B][COLOR="Red"]v0, p0[/COLOR][/B]
iget-object [B][COLOR="Red"]v3, v0[/COLOR][/B], Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
aput-object [B][COLOR="Red"]v3, v1, v2[/COLOR][/B]
[B][COLOR="Blue"]const/4 v2, 0x5
move-object/from16 v0, p0
iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mSafeMode:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
aput-object v3, v1, v2[/COLOR][/B]
Again, you should match all variables and parameters (v and p values)
- Save changes.. smali (recompile)
Now push the finished framework-res.apk and android.policy.jar to framework folder in your device, fix permissions to 644 and reboot and viola you made it,,,
Pre-made mod:
You don't have technical skills to do all these complicated things..!! Here you can download the mod and flash it in your GT-N7000 device..
The mod is based on LT9 firmware and I suppose it will work on any LTx firmware increment number.
I have included:
- PM ScreenShot mod
- PM Safe mode reboot mod
- PM Fixed Hot reboot mod
- Volume rocker mod
All in one flashable file,, so what you are waiting for,, backup your phone and give it a try
Download
(md5 sum: 8f764c74e8ec63fc6072015668811fac)
Any ROM's developer can include this mod in his/her ROM without asking for permission, although small credit in the OP will be nice.. :good:
N.B: For toggle on and off of Power Menu addons, see post #3
Cheers,,
This is great
Adding Setting Toggle For Power Menu Addons
<< Adding Setting Toggle For Power Menu Addons >>
Let's increase the heat little bit..!! Do you want to add toggle to switch on and off the extra power menu addons like these pictures bellow:
OK let's start this extra step tutorial.. :victory:
I will assume you already add Safe Mode and Screenshot extra power menu addons..
1) android.policy.jar:
- Baksmali android.policy.jar
- Go to classout\com\android\internal\policy\impl folder
- Now, the truth is I didn't invent any new codes here, I traced one toggle-able power menu addon which is "accessibility", the tracing will take you into GlobalActions$3.smali, I opened it and I found this code in ".method public showConditional()Z"
Code:
.method public showConditional()Z
.registers 5
const/4 v0, 0x1
const/4 v1, 0x0
iget-object v2, p0, Lcom/android/internal/policy/impl/[B][COLOR="Red"]GlobalActions$3[/COLOR][/B];->this$0:Lcom/android/internal/policy/impl/GlobalActions;
# getter for: Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
invoke-static {v2}, Lcom/android/internal/policy/impl/GlobalActions;->access$200(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;
move-result-object v2
invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v2
const-string v3, "[B][COLOR="Red"]power_key_hold[/COLOR][/B]"
invoke-static {v2, v3, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v2
if-ne v2, v0, :cond_15
:goto_14
return v0
:cond_15
move v0, v1
goto :goto_14
.end method
- So what you need to do is to open GlobalActions$SafeMode.smali and GlobalActions$ScreenCap.smali and change the method ".method public showConditional()Z" to the previous method mentioned above.
Note:
Don't forget to change GlobalActions$3 to the name of smali you are using (i.e, GlobalActions$SafeMode.smali or GlobalActions$ScreenCap.smali).
You need to put new key for referral in your modified smali instead of "power_key_hold"
Click to expand...
Click to collapse
So by the end, GlobalActions$SafeMode.smali method will be:
Code:
.method public showConditional()Z
.registers 5
const/4 v0, 0x1
const/4 v1, 0x0
iget-object v2, p0, Lcom/android/internal/policy/impl/[B][COLOR="Blue"]GlobalActions$SafeMode[/COLOR][/B];->this$0:Lcom/android/internal/policy/impl/GlobalActions;
# getter for: Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
invoke-static {v2}, Lcom/android/internal/policy/impl/GlobalActions;->access$200(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;
move-result-object v2
invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v2
const-string v3, [B][COLOR="Blue"]"pm_safe_mode"[/COLOR][/B]
invoke-static {v2, v3, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v2
if-ne v2, v0, :cond_15
:goto_14
return v0
:cond_15
move v0, v1
goto :goto_14
.end method
.method public showDuringKeyguard()Z
.registers 2
.prologue
.line 389
const/4 v0, 0x1
return v0
.end method
And GlobalActions$ScreenCap.smali method will be:
Code:
.method public showConditional()Z
.registers 5
const/4 v0, 0x1
const/4 v1, 0x0
iget-object v2, p0, Lcom/android/internal/policy/impl/[B][COLOR="Blue"]GlobalActions$ScreenCap[/COLOR][/B];->this$0:Lcom/android/internal/policy/impl/GlobalActions;
# getter for: Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
invoke-static {v2}, Lcom/android/internal/policy/impl/GlobalActions;->access$200(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;
move-result-object v2
invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v2
const-string v3, [B][COLOR="Blue"]"pm_screenshot"[/COLOR][/B]
invoke-static {v2, v3, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v2
if-ne v2, v0, :cond_15
:goto_14
return v0
:cond_15
move v0, v1
goto :goto_14
.end method
- Save changes .. and that's for android.policy.jar
2) SecSettings.apk:
- Decompile SecSettings.apk
- Go to res\values folder and open strings.xml file and add these new resources at the end before </resources>:
Code:
<string name="PM_Glory_addons">GloryROM Power Menu Addons</string>
<string name="pm_safe_mode_title">Safe Mode Reboot</string>
<string name="pm_screenshot_title">Take Screenshot</string>
<string name="pm_on">Toggle is Enabled</string>
<string name="pm_off">Toggle is Disabled</string>
- Go to res\xml and open display_settings.xml and add these lines on the place you your addon to appear later on on the device:
Code:
<PreferenceCategory android:title="@string/PM_Glory_addons" android:key="PM_Glory_settings" />
<CheckBoxPreference android:title="@string/pm_safe_mode_title" android:key="pm_safe_mode" android:defaultValue="true" android:summaryOn="@string/pm_on" android:summaryOff="@string/pm_off" />
<CheckBoxPreference android:title="@string/pm_screenshot_title" android:key="pm_screenshot" android:defaultValue="true" android:summaryOn="@string/pm_on" android:summaryOff="@string/pm_off" />
- Now for the smali source, go to classout\com\android\settings folder and open DisplaySettings.smali.. Also here, I didn't invent new codes, I used mult-windows toggle codes as reference..!! I will use Blue color for Safe Mode toggle codes and Green color for Screenshot toggle codes. Add these lines to [# instance fields] section:
Code:
[B][COLOR="Blue"].field private mSafeModePref:Landroid/preference/CheckBoxPreference;[/COLOR]
[COLOR="Green"].field private mScreenShotPref:Landroid/preference/CheckBoxPreference;[/COLOR][/B]
- Search for ""key_multi_window"" and add these lines:
Code:
.line 570
const-string v11, "key_multi_window"
invoke-virtual {p0, v11}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v11
check-cast v11, Landroid/preference/CheckBoxPreference;
iput-object v11, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;
[B][COLOR="Blue"]const-string v11, "pm_safe_mode"
invoke-virtual {p0, v11}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v11
check-cast v11, Landroid/preference/CheckBoxPreference;
iput-object v11, p0, Lcom/android/settings/DisplaySettings;->mSafeModePref:Landroid/preference/CheckBoxPreference;[/COLOR]
[COLOR="Green"]const-string v11, "pm_screenshot"
invoke-virtual {p0, v11}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v11
check-cast v11, Landroid/preference/CheckBoxPreference;
iput-object v11, p0, Lcom/android/settings/DisplaySettings;->mScreenShotPref:Landroid/preference/CheckBoxPreference;[/COLOR][/B]
- Now search for the method ".method public onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/Preference;)Z" and search for ""multi_window_enabled"" to locate this part at the end:
Code:
.line 1021
:cond_15c
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;
invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, [B][COLOR="Red"]:cond_1c[/COLOR][/B]
.line 1022
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;
invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v0
.line 1023
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "multi_window_enabled"
if-eqz v0, :cond_177
:goto_172
invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
goto/16 :goto_1c
:cond_177
move v1, v2
goto :goto_172
.end method
Add new codes before [.end method] in the previous section, so that section will be like this:
Code:
.line 1021
:cond_15c
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;
invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, [B][COLOR="Blue"]:cond_SafeM[/COLOR][/B]
.line 1022
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;
invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v0
.line 1023
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "multi_window_enabled"
if-eqz v0, :cond_177
:goto_172
invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
goto/16 :goto_1c
:cond_177
move v1, v2
goto :goto_172
[B][COLOR="Blue"]:cond_SafeM
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mSafeModePref:Landroid/preference/CheckBoxPreference;
invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_ScSh
.line 1022
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mSafeModePref:Landroid/preference/CheckBoxPreference;
invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v0
.line 1023
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "pm_safe_mode"
if-eqz v0, :cond_majdiSafe
:goto_njsafe
invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
goto/16 :goto_1c
:cond_majdiSafe
move v1, v2
goto :goto_njsafe[/COLOR]
[B][COLOR="Green"]:cond_ScSh
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mScreenShotPref:Landroid/preference/CheckBoxPreference;
invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, [COLOR="Red"]:cond_1c[/COLOR]
.line 1022
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mScreenShotPref:Landroid/preference/CheckBoxPreference;
invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v0
.line 1023
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "pm_screenshot"
if-eqz v0, :cond_majdiSS
:goto_njSS
invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
goto/16 :goto_1c
:cond_majdiSS
move v1, v2
goto :goto_njSS[/COLOR][/B][/B]
.end method
- Pay attention to the red color condition..!!!
- Now go to the next method ".method public onResume()V" and search for ""multi_window_enabled"" and locate this part:
Code:
:cond_9d
sget-boolean v0, Lcom/android/settings/DisplaySettings;->UseMultiWindow:Z
if-eqz v0, [B][COLOR="Red"]:cond_c1[/COLOR][/B]
.line 847
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "multi_window_enabled"
invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
if-ne v3, v1, :cond_de
:goto_af
invoke-virtual {v0, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V
.line 848
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v1, "multi_window_enabled"
invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;
move-result-object v1
iget-object v3, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowModeObserver:Landroid/database/ContentObserver;
invoke-virtual {v0, v1, v2, v3}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V
line 850
:cond_c1
return-void
:cond_c2
move v0, v2
And do this modification:
Code:
:cond_9d
sget-boolean v0, Lcom/android/settings/DisplaySettings;->UseMultiWindow:Z
if-eqz v0, [B][COLOR="Blue"]:cond_Safemajdi[/COLOR][/B]
.line 847
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "multi_window_enabled"
invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
if-ne v3, v1, :cond_de
:goto_af
invoke-virtual {v0, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V
.line 848
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v1, "multi_window_enabled"
invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;
move-result-object v1
iget-object v3, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowModeObserver:Landroid/database/ContentObserver;
invoke-virtual {v0, v1, v2, v3}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V
[B][COLOR="Blue"].line 1000
:cond_Safemajdi
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mSafeModePref:Landroid/preference/CheckBoxPreference;
if-eqz v0, :cond_NewScSh
.line 1001
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mSafeModePref:Landroid/preference/CheckBoxPreference;
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "pm_safe_mode"
const/4 v1, 0x0
invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
if-eqz v3, :cond_noSafe
const/4 v1, 0x1
goto :goto_yesSafe
:cond_noSafe
const/4 v1, 0x0
:goto_yesSafe
invoke-virtual {v0, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V[/COLOR]
[COLOR="Green"].line 2000
:cond_NewScSh
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mScreenShotPref:Landroid/preference/CheckBoxPreference;
if-eqz v0, [COLOR="Red"]:cond_c1[/COLOR]
.line 2001
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mScreenShotPref:Landroid/preference/CheckBoxPreference;
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "pm_screenshot"
const/4 v1, 0x0
invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
if-eqz v3, :cond_noShot
const/4 v1, 0x1
goto :goto_yesShot
:cond_noShot
const/4 v1, 0x0
:goto_yesShot
invoke-virtual {v0, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V[/COLOR][/B]
.line 850
:cond_c1
return-void
:cond_c2
move v0, v2
- Also pay attention to the red color condition..!!!
- Save changes.. and that's all
For DisplaySettings.smali, I will attach the smali before and after, so you could use it to understand well
Also, I will attach the modified GlobalActions$SafeMode.smali and GlobalActions$ScreenCap.smali
Have fun,,, :good:
Another great mod from u brother.
Thanks for your efforr
Sent from my GT-N7000 using xda premium
Thank you!!!!!!!! Very very great Mod! Thanks bro!
mjrifath said:
Another great mod from u brother.
Thanks for your efforr
Sent from my GT-N7000 using xda premium
Click to expand...
Click to collapse
BVB-Fan said:
Thank you!!!!!!!! Very very great Mod! Thanks bro!
Click to expand...
Click to collapse
Thanks for testing mates
Now my phone sometimes reboot is that a bug ?
BVB-Fan said:
Now my phone sometimes reboot is that a bug ?
Click to expand...
Click to collapse
It is fine here,,,
could you tell me how it gets reboot? Is it after opening the power menu, or opening any other application, so I can reproduce it if it is a bug to fix it.
Try wiping cache and dalvik cache in the moment..
This comes when I opened an application then my Note freeze for a moment and it restarts. I wiped the Cache but the same problem.
Now I flashed my Rom (LTA) again and the problem is solved :thumbup:
BVB-Fan said:
This comes when I opened an application then my Note freeze for a moment and it restarts. I wiped the Cache but the same problem.
Now I flashed my Rom (LTA) again and the problem is solved :thumbup:
Click to expand...
Click to collapse
I think the mod is working fine isn't it??
Thanks God,, I didn't sleep well since last time,, you just save me bro,, :good:
thank you majdinj great job (as usual). on xxlta works fine
asmanao said:
thank you majdinj great job (as usual). on xxlta works fine
Click to expand...
Click to collapse
Thanks for testing bro
Toggle on and off of Power Menu addons, see post #3
Yeh! Now I feel bad about using up the 2nd post.
majdinj said:
Toggle on and off of Power Menu addons, see post #3
Click to expand...
Click to collapse
Great work thanks for tutorials. Just one idea, is it possible to get other toggles on power menu like wifi?
Sent from my GT-N7000 using Tapatalk 4
nokiamodeln91 said:
Yeh! Now I feel bad about using up the 2nd post.
Click to expand...
Click to collapse
No Problem mate,, It is good like this,, I have no complain about it since I already have post #3,, I hope it is clear guide (I spent the whole day to do it, a lot of bootloop happened but I got it to work at the end..!!!! and finally it is here :laugh
kmokhtar79 said:
Great work thanks for tutorials. Just one idea, is it possible to get other toggles on power menu like wifi?
Sent from my GT-N7000 using Tapatalk 4
Click to expand...
Click to collapse
If you have smali resource then yes,,, The good thing about safe mode smali is, it is made by shell commands and if you look at power off GlobalAction smali, you will see it is done by shell command too,,, So here is the trick that I used to create safe mode smali.
I don't think the wifi is going to be the same,, but we have already the quick toggle for that (on the moment..!!)... I will see if I can locate the wifi onClick / onPress method
Yes Perfect! as always.
Nice Mod!!!
Is it possible to create an icon on the home screen to invoke power menu instead of long press on power button?
Thank You
can it works backwards?
hi i'm actually stuck on safe mode on mi S3 (i know this isn't the right site for my model) but i think that this may be a solution, is anyway posible that we can disable the safe mode from de ROM itself?
EMSpilot said:
Is it possible to create an icon on the home screen to invoke power menu instead of long press on power button?
Thank You
Click to expand...
Click to collapse
There is a way to add the lock button to the status bar or the pull down menu.. Search for it..
[Guide] Full Screen Dialer - MM
DO NOT QUOTE THE OP WHEN POSTING!!!
This guide assumes you are already proficient at de/recompiling stock apk's.
Features:
- Choose between any custom background or solid or gradient color backgrounds
- Dialpad digits, letters, divider & digits pressed are colorable
- All options can be turned on or off so they will not conflict with installed themes
We are modifying SecContacts_M.apk.
These modification were done on a Note 5 - 6.0.1 smali. Yours may be different and you will need to adapt.
One user already pointed out that on the S7, the ap.smali edits are in an.smali
There is an example of the an.smali edits here: http://forum.xda-developers.com/showpost.php?p=68686947&postcount=61
*** Add new files attached to the bottom of this post.
res\values\ids.xml
Add new ID
Code:
<item type="id" name="gear_panel_bg_view">false</item>
smali\com\android\dialer\dialpad\DialpadFragment.smali
Add new fields.
Code:
# instance fields
[COLOR="blue"].field private final mFullscreenBG:Z
.field private final mThemeoverride:Z
[/COLOR]
Increase .locals by 3 and add new code in BLUE
Code:
.method private K()V
.locals [COLOR="blue"]7[/COLOR]
.
.
.
const v2, 0x7f0201cc ## type="drawable" name="dialpad_fragment_background"
[COLOR="blue"] iget-boolean v4, p0, Lcom/android/dialer/dialpad/DialpadFragment;->mFullscreenBG:Z
if-eqz v4, :cond_td
invoke-virtual {p0}, Lcom/android/dialer/dialpad/DialpadFragment;->getContext()Landroid/content/Context;
move-result-object v4
const-string v5, "dialpad_fragment_background_fullscreen" # This is your resource name
const-string v6, "drawable" # This is the resource type
invoke-static {v4, v5, v6}, Lcom/android/wubydax/IdUtils;->getIdentifier(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)I
move-result v2
:cond_td
[/COLOR] invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;
move-result-object v1
invoke-virtual {v0, v1}, Landroid/view/View;->setBackground(Landroid/graphics/drawable/Drawable;)V
goto :goto_1
.end method
Increase .locals by 3 and add new code in BLUE
Code:
.method private N()V
.locals [COLOR="blue"]5[/COLOR]
.
.
.
invoke-virtual {p0}, Lcom/android/dialer/dialpad/DialpadFragment;->getResources()Landroid/content/res/Resources;
move-result-object v0
const v1, 0x7f0201cd ## type="drawable" name="dialpad_fragment_bg"
[COLOR="blue"]iget-boolean v2, p0, Lcom/android/dialer/dialpad/DialpadFragment;->mFullscreenBG:Z
if-eqz v2, :cond_td
invoke-virtual {p0}, Lcom/android/dialer/dialpad/DialpadFragment;->getContext()Landroid/content/Context;
move-result-object v2
const-string v3, "dialpad_fragment_bg_fullscreen" # This is your resource name
const-string v4, "drawable" # This is the resource type
invoke-static {v2, v3, v4}, Lcom/android/wubydax/IdUtils;->getIdentifier(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)I
move-result v1
:cond_td
[/COLOR] invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;
Increase .locals by 3 and add new code in BLUE
Code:
.method private g(Landroid/view/View;)V
.locals [COLOR="blue"]5[/COLOR]
.
.
.
invoke-virtual {p0}, Lcom/android/dialer/dialpad/DialpadFragment;->getResources()Landroid/content/res/Resources;
move-result-object v0
const v1, 0x7f0201cc ## type="drawable" name="dialpad_fragment_background"
[COLOR="blue"]iget-boolean v2, p0, Lcom/android/dialer/dialpad/DialpadFragment;->mFullscreenBG:Z
if-eqz v2, :cond_td
invoke-virtual {p0}, Lcom/android/dialer/dialpad/DialpadFragment;->getContext()Landroid/content/Context;
move-result-object v2
const-string v3, "dialpad_fragment_background_fullscreen" # This is your resource name
const-string v4, "drawable" # This is the resource type
invoke-static {v2, v3, v4}, Lcom/android/wubydax/IdUtils;->getIdentifier(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)I
move-result v1
:cond_td
[/COLOR] invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;
move-result-object v0
invoke-virtual {p1, v0}, Landroid/view/View;->setBackground(Landroid/graphics/drawable/Drawable;)V
goto :goto_1
.end method
Add new code in BLUE
Code:
.method public b(Landroid/view/View;)V
.
.
.
const v0, 0x7f0e021a ## type="id" name="digits"
invoke-virtual {p1, v0}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Lcom/android/dialer/dialpad/EllipsisTextView;
iput-object v0, p0, Lcom/android/dialer/dialpad/DialpadFragment;->c:Lcom/android/dialer/dialpad/EllipsisTextView;
[COLOR="blue"]move-object/from16 v2, p0
invoke-virtual {v2, v0}, Lcom/android/dialer/dialpad/DialpadFragment;->setDialerDigitPressed(Landroid/widget/TextView;)V
[/COLOR]
iget-object v0, p0, Lcom/android/dialer/dialpad/DialpadFragment;->c:Lcom/android/dialer/dialpad/EllipsisTextView;
iget-object v2, p0, Lcom/android/dialer/dialpad/DialpadFragment;->v:Landroid/content/Context;
invoke-static {v2}, Lcom/android/dialer/dialpad/w;->a(Landroid/content/Context;)Lcom/android/dialer/dialpad/w;
move-result-object v2
invoke-virtual {v0, v2}, Lcom/android/dialer/dialpad/EllipsisTextView;->setKeyListener(Landroid/text/method/KeyListener;)V
Increase .locals by 5 and add new code in BLUE
Code:
.method public onCreateView(Landroid/view/LayoutInflater;Landroid/view/ViewGroup;Landroid/os/Bundle;)Landroid/view/View;
.locals [COLOR="blue"]10[/COLOR]
const/4 v4, 0x0
[COLOR="blue"] invoke-virtual {p0}, Lcom/android/dialer/dialpad/DialpadFragment;->setSDBackground()V
invoke-virtual {p0}, Lcom/android/dialer/dialpad/DialpadFragment;->setThemeOverride()V
[/COLOR]
sget-object v0, Lcom/android/dialer/dialpad/DialpadFragment;->O:Ljava/lang/String;
const-string/jumbo v1, "onCreateView >>>>>"
invoke-static {v0, v1}, Landroid/util/secutil/Log;->secI(Ljava/lang/String;Ljava/lang/String;)I
const v0, 0x7f030098 ## type="layout" name="dialpad_fragment"
[COLOR="blue"]iget-boolean v6, p0, Lcom/android/dialer/dialpad/DialpadFragment;->mFullscreenBG:Z
if-eqz v6, :cond_td
invoke-virtual {p0}, Lcom/android/dialer/dialpad/DialpadFragment;->getContext()Landroid/content/Context;
move-result-object v6
invoke-virtual {v6}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object v6
const-string v7, "dialpad_fragment_fullscreen" # This is the resource name
const-string v8, "layout" # this is resource type
invoke-virtual {p0}, Lcom/android/dialer/dialpad/DialpadFragment;->getContext()Landroid/content/Context;
move-result-object v9
invoke-virtual {v9}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
move-result-object v9
invoke-virtual {v6, v7, v8, v9}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I
move-result v0 #This now holds your id number
:cond_td
[/COLOR] invoke-virtual {p1, v0, p2, v4}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;
Add new methods to bottom of smali.
Code:
.method setDialerDigit(Landroid/widget/TextView;)V
.locals 3
iget-boolean v1, p0, Lcom/android/dialer/dialpad/DialpadFragment;->mThemeoverride:Z
if-eqz v1, :cond_td
invoke-virtual {p1}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v0
invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v1, "main_digit_color"
const v2, -0x1000000
invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
invoke-virtual {p1, v0}, Landroid/widget/TextView;->setTextColor(I)V
:cond_td
return-void
.end method
.method setDialerDigitPressed(Landroid/widget/TextView;)V
.locals 3
iget-boolean v1, p0, Lcom/android/dialer/dialpad/DialpadFragment;->mThemeoverride:Z
if-eqz v1, :cond_td
invoke-virtual {p1}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v0
invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v1, "main_digit_color_pressed"
const v2, -0x1000000
invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
invoke-virtual {p1, v0}, Landroid/widget/TextView;->setTextColor(I)V
:cond_td
return-void
.end method
.method setDialerLetter(Landroid/widget/TextView;)V
.locals 3
iget-boolean v1, p0, Lcom/android/dialer/dialpad/DialpadFragment;->mThemeoverride:Z
if-eqz v1, :cond_td
invoke-virtual {p1}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v0
invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v1, "main_letter_color"
const v2, -0x1000000
invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
invoke-virtual {p1, v0}, Landroid/widget/TextView;->setTextColor(I)V
:cond_td
return-void
.end method
.method public setSDBackground()V
.locals 5
invoke-virtual {p0}, Lcom/android/dialer/dialpad/DialpadFragment;->getContext()Landroid/content/Context;
move-result-object v0
invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v1, "enable_dialer_custom_bg"
const/4 v2, 0x0
invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
if-eqz v0, :cond_td
const/4 v0, 0x1
iput-boolean v0, p0, Lcom/android/dialer/dialpad/DialpadFragment;->mFullscreenBG:Z
:cond_td
return-void
.end method
.method public setThemeOverride()V
.locals 4
const/4 v2, 0x0
iput-boolean v2, p0, Lcom/android/dialer/dialpad/DialpadFragment;->mThemeoverride:Z
invoke-virtual {p0}, Lcom/android/dialer/dialpad/DialpadFragment;->getContext()Landroid/content/Context;
move-result-object v1
invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "dialer_theme_override"
const/4 v3, 0x0
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
if-eqz v1, :cond_td
const/4 v0, 0x1
iput-boolean v0, p0, Lcom/android/dialer/dialpad/DialpadFragment;->mThemeoverride:Z
:cond_td
return-void
.end method
Next smali...
smali\com\android\dialer\dialpad\DialpadKeyButton.smali
Increase .locals by 3 and add new code in BLUE
Code:
.method public a()V
.locals [COLOR="blue"]6[/COLOR]
.
.
.
invoke-virtual {p0}, Lcom/android/dialer/dialpad/DialpadKeyButton;->getResources()Landroid/content/res/Resources;
move-result-object v0
## entire dialpad background setup for transparency
const v1, 0x7f020072 ## type="drawable" name="call_dial_btn_bg_easy_dialpad_button_white" id="0x7f020072" />
[COLOR="blue"] invoke-virtual {p0}, Lcom/android/dialer/dialpad/DialpadKeyButton;->getContext()Landroid/content/Context;
move-result-object v3
invoke-virtual {v3}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "enable_dialer_custom_bg"
const/4 v5, 0x0
invoke-static {v3, v4, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
if-eqz v3, :cond_td
invoke-virtual {p0}, Lcom/android/dialer/dialpad/DialpadKeyButton;->getContext()Landroid/content/Context;
move-result-object v3
const-string v4, "call_dial_btn_bg_easy_dialpad_button_transparent" # This is your resource name
const-string v5, "drawable" # This is the resource type
invoke-static {v3, v4, v5}, Lcom/android/wubydax/IdUtils;->getIdentifier(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)I
move-result v1
:cond_td
[/COLOR] invoke-virtual {v0, v1, v2}, Landroid/content/res/Resources;->getDrawable(ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
move-result-object v0
invoke-virtual {p0, v0}, Lcom/android/dialer/dialpad/DialpadKeyButton;->setBackground(Landroid/graphics/drawable/Drawable;)V
goto :goto_0
.end method
Next smali...
smali\com\samsung\dialer\dialpad\ap.smali
Increase .locals by 3 and add new code in BLUE
Code:
.method private a(Landroid/widget/ImageView;Z)V
.locals [COLOR="blue"]4[/COLOR]
.
.
.
if-nez p1, :cond_0
:goto_0
return-void
:cond_0
if-eqz p2, :cond_1
const/4 v0, 0x0
invoke-virtual {p1, v0}, Landroid/widget/ImageView;->setVisibility(I)V
invoke-direct {p0}, Lcom/samsung/dialer/dialpad/ap;->c()I
move-result v0
invoke-virtual {p1, v0}, Landroid/widget/ImageView;->setImageResource(I)V
invoke-direct {p0}, Lcom/samsung/dialer/dialpad/ap;->f()I
move-result v0
[COLOR="blue"] invoke-virtual {p1}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v1
invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "dialer_theme_override"
const/4 v3, 0x0
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
if-eqz v1, :cond_td
invoke-virtual {p1}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v1
invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "main_letter_color"
const v3, -0x1000000
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
:cond_td
[/COLOR] invoke-static {v0}, Landroid/content/res/ColorStateList;->valueOf(I)Landroid/content/res/ColorStateList;
move-result-object v0
invoke-virtual {p1, v0}, Landroid/widget/ImageView;->setImageTintList(Landroid/content/res/ColorStateList;)V
Add new code in BLUE
Code:
.method private a(Landroid/widget/TextView;I)V
.locals 1
if-nez p1, :cond_0
:goto_0
return-void
:cond_0
iget-object v0, p0, Lcom/samsung/dialer/dialpad/ap;->s:[I
aget v0, v0, p2
invoke-virtual {p1, v0}, Landroid/widget/TextView;->setText(I)V
iget-object v0, p0, Lcom/samsung/dialer/dialpad/ap;->e:Landroid/graphics/Typeface;
invoke-virtual {p1, v0}, Landroid/widget/TextView;->setTypeface(Landroid/graphics/Typeface;)V
invoke-direct {p0}, Lcom/samsung/dialer/dialpad/ap;->e()I
move-result v0
invoke-virtual {p1, v0}, Landroid/widget/TextView;->setTextColor(I)V
[COLOR="Blue"]move-object/from16 v1, p0
invoke-virtual {v1, p1}, Lcom/samsung/dialer/dialpad/ap;->setDialerDigit(Landroid/widget/TextView;)V[/COLOR]
Add new code in BLUE
Code:
.method private b(Landroid/widget/TextView;I)V
.
.
.
invoke-virtual {p1, v0}, Landroid/widget/TextView;->setText(I)V
iget-object v0, p0, Lcom/samsung/dialer/dialpad/ap;->f:Landroid/graphics/Typeface;
invoke-virtual {p1, v0}, Landroid/widget/TextView;->setTypeface(Landroid/graphics/Typeface;)V
invoke-direct {p0}, Lcom/samsung/dialer/dialpad/ap;->f()I
move-result v0
invoke-virtual {p1, v0}, Landroid/widget/TextView;->setTextColor(I)V
[COLOR="blue"]move-object/from16 v1, p0
invoke-virtual {v1, p1}, Lcom/samsung/dialer/dialpad/ap;->setDialerLetter(Landroid/widget/TextView;)V
[/COLOR]
invoke-direct {p0, p1}, Lcom/samsung/dialer/dialpad/ap;->g(Landroid/widget/TextView;)V
iget-boolean v0, p0, Lcom/samsung/dialer/dialpad/ap;->d:Z
invoke-direct {p0, p1, v0}, Lcom/samsung/dialer/dialpad/ap;->a(Landroid/widget/TextView;Z)V
invoke-direct {p0, p1}, Lcom/samsung/dialer/dialpad/ap;->i(Landroid/widget/TextView;)V
goto :goto_0
.end method
Add new code in BLUE
Code:
.method private c(Landroid/view/View;)V
.locals 5
invoke-virtual {p0}, Lcom/samsung/dialer/dialpad/ap;->a()I
move-result v1
invoke-virtual {p0}, Lcom/samsung/dialer/dialpad/ap;->b()I
move-result v2
[COLOR="blue"] invoke-virtual {p1}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v0
invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v3, "dialer_theme_override"
const/4 v4, 0x0
invoke-static {v0, v3, v4}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
if-eqz v0, :cond_td
invoke-virtual {p1}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v0
invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v3, "main_divider_color"
const v2, -0x1000000
invoke-static {v0, v3, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v2
:cond_td[/COLOR]
const/4 v0, 0x0
:goto_0
Add new methods to the bottom of this smali.
Code:
.method setDialerDigit(Landroid/widget/TextView;)V
.locals 3
invoke-virtual {p1}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v0
invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v1, "dialer_theme_override"
const/4 v2, 0x0
invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
if-eqz v1, :cond_td
invoke-virtual {p1}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v0
invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v1, "main_digit_color"
const v2, -0x1000000
invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
invoke-virtual {p1, v0}, Landroid/widget/TextView;->setTextColor(I)V
:cond_td
return-void
.end method
.method setDialerLetter(Landroid/widget/TextView;)V
.locals 3
invoke-virtual {p1}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v0
invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v1, "dialer_theme_override"
const/4 v2, 0x0
invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
if-eqz v1, :cond_td
invoke-virtual {p1}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v0
invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v1, "main_letter_color"
const v2, -0x1000000
invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
invoke-virtual {p1, v0}, Landroid/widget/TextView;->setTextColor(I)V
:cond_td
return-void
.end method
Rom Control V2 Entries
[SOURCE CODE][DEV TOOL][SDK 21+]6thGear RomControl v2.+ for Devs by daxgirl
Add arrays
Code:
<string-array name="crop_entries">
<item>Center Crop (default)</item>
<item>Center Inside</item>
<item>Fit XY</item>
</string-array>
<string-array name="crop_values">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
<string-array name="custom_bg_type_entries">
<item>Image</item>
<item>Solid color</item>
<item>Gradient</item>
</string-array>
<string-array name="custom_bg_type_values">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
<string-array name="gradient_entries">
<item>Top to bottom</item>
<item>Bottom to top</item>
<item>Left to right</item>
<item>Right to left</item>
</string-array>
<string-array name="gradient_values">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
Add to your pref
Code:
<PreferenceCategory
android:title="Main Dialer Backgrounds and Colors" />
<PreferenceScreen
android:title="Main Dialer Options"
android:summary="Set backgrounds or color">
<com.wubydax.romcontrol.v2.prefs.MySwitchPreference
android:defaultValue="false"
android:key="enable_dialer_custom_bg"
android:summaryOff="Disabled"
android:summaryOn="Enabled \n> You must also enable custom colors and modify them or the dialpad will not be very visible."
android:title="Enable custom background"/>
<com.wubydax.romcontrol.v2.prefs.MyListPreference
android:defaultValue="0"
android:dependency="enable_dialer_custom_bg"
android:entries="@array/custom_bg_type_entries"
android:entryValues="@array/custom_bg_type_values"
android:key="dialer_custom_bg_type"
android:title="Background type"/>
<com.wubydax.romcontrol.v2.prefs.UriSelectionPreference
android:dependency="enable_dialer_custom_bg"
android:key="dialer_bg"
android:title="Select image for Background"/>
<com.wubydax.romcontrol.v2.prefs.MyListPreference
android:defaultValue="0"
android:dependency="enable_dialer_custom_bg"
android:entries="@array/crop_entries"
android:entryValues="@array/crop_values"
android:key="dialer_crop_type"
android:title="Set Image Scaling Type"/>
<com.wubydax.romcontrol.v2.prefs.ColorPickerPreference
android:defaultValue="#00000000"
android:dependency="enable_dialer_custom_bg"
android:key="dialer_bg_primary_color"
android:title="Select primary color"/>
<com.wubydax.romcontrol.v2.prefs.ColorPickerPreference
android:defaultValue="#00000000"
android:dependency="enable_dialer_custom_bg"
android:key="dialer_second_gradient_color"
android:title="Secondary Color (for gradient)"/>
<com.wubydax.romcontrol.v2.prefs.MyListPreference
android:defaultValue="0"
android:dependency="enable_dialer_custom_bg"
android:entries="@array/gradient_entries"
android:entryValues="@array/gradient_values"
android:key="dialer_bg_gradient_orientation"
android:title="Gradient orientation"/>
<com.wubydax.romcontrol.v2.prefs.MySeekBarPreference
android:defaultValue="255"
android:dependency="enable_dialer_custom_bg"
android:key="dialer_opacity"
app:maxValue="255"
android:title="Background Opacity"/>
<PreferenceCategory
android:title="Dialer Colors - disable if Theme conflicts" />
<com.wubydax.romcontrol.v2.prefs.MySwitchPreference
android:title="Digit and Letter Colors On/Off Toggle"
android:key="dialer_theme_override"
android:defaultValue="false"
android:summaryOn="Colors enabled"
android:summaryOff="Colors disabled" />
<com.wubydax.romcontrol.v2.prefs.ColorPickerPreference
android:title="Dialer Digits"
android:key="main_digit_color"
android:summary="Set digit color"
android:dependency="dialer_theme_override"
app:packageNameToKill="com.android.contacts"
android:defaultValue="#ff000000" />
<com.wubydax.romcontrol.v2.prefs.ColorPickerPreference
android:title="Dialer Letters"
android:key="main_letter_color"
android:summary="Choose letter color"
android:dependency="dialer_theme_override"
app:packageNameToKill="com.android.contacts"
android:defaultValue="#ff000000" />
<com.wubydax.romcontrol.v2.prefs.ColorPickerPreference
android:title="Dialer Divider"
android:key="main_divider_color"
android:summary="Choose divider color"
android:dependency="dialer_theme_override"
android:defaultValue="#ff000000" />
<com.wubydax.romcontrol.v2.prefs.ColorPickerPreference
android:title="Dialer Digits Pressed"
android:key="main_digit_color_pressed"
android:summary="Set digit color"
android:dependency="dialer_theme_override"
android:defaultValue="#ff000000" />
</PreferenceScreen>
Additional Notes:
- This is designed to be compatible with theme store themes. Enabling custom backgrounds or colors my conflict with themes.
Credits:
- This modification uses two really awesome modifications provided on my guide thread:
[Mod][GUIDE][CUSTOM VIEW] 6thGear Custom View for any app
and also I utilized the [How-To] Find view by ID without having to find public resource - APK Edition which has additional links provided for that one in Post #10.
I highly recommend the new method how to find public resource without public value. It has made this guide far easier for you!!! :highfive:
Reserved
Sorry sir.
I mod custumbackgound incallui so choise color and gradient ok but image not show. You have thng about this
Gửi từ SM-J710F của tôi bằng cách sử dụng Tapatalk
Works like a charm on s7 edge dialer. had to edit an.smali instead of ap.smali though. now to change that ugly green bar at the top. lol
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
thanks @tdunham for another awesome guide
OvrDriVE said:
Works like a charm on s7 edge dialer. had to edit an.smali instead of ap.smali though. now to change that ugly green bar at the top. lol
View attachment 3828063
thanks @tdunham for another awesome guide
Click to expand...
Click to collapse
Great job sir! Did you have any issue with the signature? I am using an older version of apktool on this one (just sticking with what I was using at the time) and ended up having to resign with TickleMyAndroid for it to work.
I know what you mean about the green. I created a different version for myself with slightly blue themed. If anyone would like to share their own customizations here as they accomplish them, I am sure it would be welcome.
These are the color edits I did to change green to blue.
Code:
<color name="dial_button_bg_easy_solid_green">#ff3ebf10</color>
<color name="dial_button_ripple_color">#4c6ebd52</color>
<color name="dialpad_button_left_icon_tint_color">#ff3ebf10</color>
<color name="dialpad_floating_action_button_color">#ff3ebf10</color>
<color name="dialpad_floating_action_button_color_call">#ff3ebf10</color>
<color name="dialpad_multisim_button_color_call">#ff3ebf10</color>
<color name="dialtacts_color_primary">#ff6ebd52</color>
<color name="dialtacts_status_bar_color">#ff6ebd52</color>
<color name="list_item_checkbox_color_on">#ff6ebd52</color>
On the OP, I have added credits with links to additional guides on some of the concepts and modifications used to create this little monster.
Please take the time to visit those posts if you are not familiar with them.
Tnx - Troy
sonnguyenpg said:
Sorry sir.
I mod custumbackgound incallui so choise color and gradient ok but image not show. You have thng about this
Click to expand...
Click to collapse
I cannot support InCallUI edits.
tdunham said:
Great job sir! Did you have any issue with the signature? I am using an older version of apktool on this one (just sticking with what I was using at the time) and ended up having to resign with TickleMyAndroid for it to work.
I know what you mean about the green. I created a different version for myself with slightly blue themed. If anyone would like to share their own customizations here as they accomplish them, I am sure it would be welcome.
Click to expand...
Click to collapse
Yes on S7 contact there is a signature issues that's gaves Parsing errors , just my friend he do it & told me about that , so i just told him to try it with new signature compiling , only this way can fixed Parsing errors ...
tdunham said:
Great job sir! Did you have any issue with the signature? I am using an older version of apktool on this one (just sticking with what I was using at the time) and ended up having to resign with TickleMyAndroid for it to work.
I know what you mean about the green. I created a different version for myself with slightly blue themed. If anyone would like to share their own customizations here as they accomplish them, I am sure it would be welcome.
Click to expand...
Click to collapse
i used apktool 2.2.0 dirty. i also dirty flashed it. but havn't tryed on a clean install yet. i did sign it though.
err my bad. it's a 2.2.0 snapshot i use
edit: just deleted seccontacts_m and /data/data for contacts and phone.. rebooted and flashed seccontacts_m and works like a charm. no parse error.
OvrDriVE said:
i used apktool 2.2.0 dirty. i also dirty flashed it. but havn't tryed on a clean install yet. i did sign it though.
err my bad. it's a 2.2.0 snapshot i use
edit: just deleted seccontacts_m and /data/data for contacts and phone.. rebooted and flashed seccontacts_m and works like a charm. no parse error.
Click to expand...
Click to collapse
Do you keep the original signature when compiling? Please report how you do your the recompiled.
I apktool use 2.1.2 dirty.
aceqott said:
Do you keep the original signature when compiling? Please report how you do your the recompiled.
I apktool use 2.1.2 dirty.
Click to expand...
Click to collapse
actually i use advancedapktool4.2.0, when i recompile i just by habit automatically tell it to sign the apk. it's probably a bad habit but hasn't failed me yet
I followed the guide without skipping a point, but the category "Dialer Colors - Theme disable if conflicts" nothing works.
Here I leave 3 smalis amending if someone can help me please.
I've already reviewed several times, I do not know what went wrong.
aceqott said:
I followed the guide without skipping a point, but the category "Dialer Colors - Theme disable if conflicts" nothing works.
Here I leave 3 smalis amending if someone can help me please.
I've already reviewed several times, I do not know what went wrong.
Click to expand...
Click to collapse
tdunham also here too , as im sure i did everything correctly my locales my edited same as mentioned on op , i even try it many times with s7/n5/s6 contact & all its same dialer colors not worked , sorry for not providing logs as i didn't find any fatal or error with contact , any help hint any idea , ? Thank u
Here my log maybe u can find something that i couldn't find it
https://mega.nz/#!Wt4mQZYQ!FRLwU_dzQAOu3gJudJUyJcuhJucrfcBAkGwNW9WSbOg
???
aceqott said:
I followed the guide without skipping a point, but the category "Dialer Colors - Theme disable if conflicts" nothing works.
Here I leave 3 smalis amending if someone can help me please.
I've already reviewed several times, I do not know what went wrong.
Click to expand...
Click to collapse
thereassaad said:
tdunham also here too , as im sure i did everything correctly my locales my edited same as mentioned on op , i even try it many times with s7/n5/s6 contact & all its same dialer colors not worked , sorry for not providing logs as i didn't find any fatal or error with contact , any help hint any idea , ? Thank u
Click to expand...
Click to collapse
Are you guys using Rom Control V2?
The filepreference toggle requires two smali edits if NOT using version 2 or it will never work.
Code:
.method public setThemeOverride()V
.
.
.
const-string v1, "/data/data/com.wubydax.romcontrol[COLOR="Red"].v2[/COLOR]/files/modcfg_theme_override"
tdunham said:
Are you guys using Rom Control V2?
The filepreference toggle requires two smali edits if NOT using version 2 or it will never work.
Code:
.method public setThemeOverride()V
.
.
.
const-string v1, "/data/data/com.wubydax.romcontrol[COLOR="Red"].v2[/COLOR]/files/modcfg_theme_override"
Click to expand...
Click to collapse
Im sure im using rom control v2 my friend
thereassaad said:
Im sure im using rom control v2 my friend
Click to expand...
Click to collapse
Well, that is the Boolean that controls the toggle in both smalis ap & DialpadFragment.
To test if it is not working, try removing any occurrences for mThemeoverride:Z
(this example is in ap.smali)
Code:
iget-boolean v1, p0, Lcom/samsung/dialer/dialpad/ap;->mThemeoverride:Z
if-eqz v1, :cond_td
.
.
.
:cond_td
tdunham said:
Well, that is the Boolean that controls the toggle in both smalis ap & DialpadFragment.
To test if it is not working, try removing any occurrences for mThemeoverride:Z
(this example is in ap.smali)
Code:
iget-boolean v1, p0, Lcom/samsung/dialer/dialpad/ap;->mThemeoverride:Z
if-eqz v1, :cond_td
.
.
.
:cond_td
Click to expand...
Click to collapse
U mean this right
iget-boolean v1, p0, Lcom/samsung/dialer/dialpad/ap;->mThemeoverride:Z
if-eqz v1, :cond_td
invoke-virtual {p1}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v0
invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v1, "main_digit_color"
const v2, -0x1000000
invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
invoke-virtual {p1, v0}, Landroid/widget/TextView;->setTextColor(I)V
:cond_td
If this one then not recompiled
Log
ther:
SecContacts_M_310716115726.apk\smali\com\samsung\dialer\dialpad\ap.smali[3177,4] no viable alternative at input 'return-void'
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file: com/samsung/dialer/dialpad/ap.smali
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:67)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:51)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:38)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:364)
at brut.androlib.Androlib.buildSources(Androlib.java:295)
at brut.androlib.Androlib.build(Androlib.java:278)
at brut.androlib.Androlib.build(Androlib.java:254)
at brut.apktool.Main.cmdBuild(Main.java:224)
at brut.apktool.Main.main(Main.java:84)
???
thereassaad said:
U mean this right
iget-boolean v1, p0, Lcom/samsung/dialer/dialpad/ap;->mThemeoverride:Z
if-eqz v1, :cond_td
invoke-virtual {p1}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v0
invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v1, "main_digit_color"
const v2, -0x1000000
invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
invoke-virtual {p1, v0}, Landroid/widget/TextView;->setTextColor(I)V
:cond_td
If this one then not recompiled
Log
ther:
SecContacts_M_310716115726.apk\smali\com\samsung\dialer\dialpad\ap.smali[3177,4] no viable alternative at input 'return-void'
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file: com/samsung/dialer/dialpad/ap.smali
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:67)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:51)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:38)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:364)
at brut.androlib.Androlib.buildSources(Androlib.java:295)
at brut.androlib.Androlib.build(Androlib.java:278)
at brut.androlib.Androlib.build(Androlib.java:254)
at brut.apktool.Main.cmdBuild(Main.java:224)
at brut.apktool.Main.main(Main.java:84)
???
Click to expand...
Click to collapse
I only ask you to remove three lines where they occur so I dont know what you did.
tdunham said:
Well, that is the Boolean that controls the toggle in both smalis ap & DialpadFragment.
To test if it is not working, try removing any occurrences for mThemeoverride:Z
(this example is in ap.smali)
Code:
iget-boolean v1, p0, Lcom/samsung/dialer/dialpad/ap;->mThemeoverride:Z
if-eqz v1, :cond_td
.
.
.
:cond_td
Click to expand...
Click to collapse
Remove these three lines everywhere(path is different in dialpadfragment and they may not be exactly the same) in both smalis to see if the problem is setting Boolean with filepref.