Related
Well, this a very simple guide on adding 6 lockscreen mod to your rom.
Files To be downloaded :
1. android.policy.zip
2. Lidroid-res.apk
3. Lidroid-Parts
Files to be Affected :
1. android.policy.jar
2. systemui.apk (only if you have added 14 status bar toggles before)
Steps :
-Pullout android.policy.jar from '/system/framework' (Must be Deodexed)
-Decompile it (Please dont expect a guide on how to decompile)
-Extract the android.policy.zip file
-copy the smali folder to directory where you decompiled your android.policy.jar
-Now open this file android.policy.jar.out\smali\com\android\internal\policy\impl\KeyguardUpdateMonitor.smali and make the following changes :
-At the begining after '#annonations' search for this line "Lcom/android/internal/policy/impl/KeyguardUpdateMonitor$AirplaneModeChangeCallback;"
after that add this line
Code:
Lcom/android/internal/policy/impl/KeyguardUpdateMonitor$MediaStateCallback;,
-Now find this line ".field private mLockscreenWallpaperDrawable:Landroid/graphics/drawable/Drawable;"
-Below it paste this line
Code:
.field private mMediaCallbacks:Ljava/util/ArrayList;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/ArrayList",
"<",
"Lcom/android/internal/policy/impl/KeyguardUpdateMonitor$MediaStateCallback;",
">;"
}
.end annotation
.end field
-Find this line ".field private mWallpaperModeValue:I"
and jus below paste this
Code:
.field private timezone:Ljava/lang/String;
-Now find this method ".method private handleSimStateChange(Lcom/android/internal/policy/impl/KeyguardUpdateMonitor$SimArgsV"
and above it paste this :
Code:
.method private handleMediaUpdate(IILandroid/net/Uri;)V
.locals 5
.parameter "isPlaying"
.parameter "isStop"
.parameter "mediaUri"
.prologue
const/4 v4, 0x0
const/4 v3, 0x1
.line 467
if-ne p1, v3, :cond_0
move v0, v3
.line 468
.local v0, bIsPlaying:Z
:goto_0
if-ne p2, v3, :cond_1
move v1, v3
.line 470
.local v1, bIsStop:Z
:goto_1
const/4 v2, 0x0
.local v2, i:I
:goto_2
iget-object v3, p0, Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;->mMediaCallbacks:Ljava/util/ArrayList;
invoke-virtual {v3}, Ljava/util/ArrayList;->size()I
move-result v3
if-ge v2, v3, :cond_2
.line 471
iget-object v3, p0, Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;->mMediaCallbacks:Ljava/util/ArrayList;
invoke-virtual {v3, v2}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;
move-result-object v3
check-cast v3, Lcom/android/internal/policy/impl/KeyguardUpdateMonitor$MediaStateCallback;
invoke-interface {v3, v0, v1, p3}, Lcom/android/internal/policy/impl/KeyguardUpdateMonitor$MediaStateCallback;->onMediaUpdated(ZZLandroid/net/Uri;)V
.line 470
add-int/lit8 v2, v2, 0x1
goto :goto_2
.end local v0 #bIsPlaying:Z
.end local v1 #bIsStop:Z
.end local v2 #i:I
:cond_0
move v0, v4
.line 467
goto :goto_0
.restart local v0 #bIsPlaying:Z
:cond_1
move v1, v4
.line 468
goto :goto_1
.line 473
.restart local v1 #bIsStop:Z
.restart local v2 #i:I
:cond_2
return-void
.end method
-Now find this line ".method public getFailedAttempts()I"
above it again paste this :
Code:
.method public getChangedTimeZone()Ljava/lang/String;
.locals 1
.prologue
.line 1131
iget-object v0, p0, Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;->timezone:Ljava/lang/String;
return-object v0
.end method
this one's last for this file , search for ".method public isDevicePluggedIn()Z"
and above it paste :
Code:
.method public isDeviceCharged()Z
.locals 2
.prologue
.line 866
iget v0, p0, Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;->mBatteryLevel:I
const/16 v1, 0x64
if-lt v0, v1, :cond_0
const/4 v0, 0x1
:goto_0
return v0
:cond_0
const/4 v0, 0x0
goto :goto_0
.end method
-Now close this file and open "\smali\com\android\internal\policy\impl\LockPatternKeyguardView"
-Search for this method now ".method createLockScreen()Landroid/view/View;"
Find this (Jus one line below)
Code:
.prologue
.line 868
below it paste this :
Code:
const/4 v2, 0x0
const/4 v0, 0x0
iget-object v3, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mContext:Landroid/content/Context;
invoke-virtual {v3}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "lockscreen_style_pref"
invoke-static {v3, v4, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
const/4 v2, 0x1
if-eq v2, v0, :cond_3
const/4 v2, 0x2
if-eq v2, v0, :cond_3
const/4 v2, 0x3
if-eq v2, v0, :cond_3
const/4 v2, 0x4
if-eq v2, v0, :cond_3
const/4 v2, 0x5
if-eq v2, v0, :cond_3
if-eqz v0, :cond_0
.line 869
const/4 v2, 0x0
const/4 v0, 0x0
iget-object v3, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mContext:Landroid/content/Context;
invoke-virtual {v3}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "lockscreen_style_pref"
invoke-static {v3, v4, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
const/4 v2, 0x6
if-eq v2, v0, :cond_2
const/4 v2, 0x7
if-eq v2, v0, :cond_1
:cond_0
new-instance v0, Lcom/android/internal/policy/impl/LockScreen;
iget-object v1, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mContext:Landroid/content/Context;
iget-object v2, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mConfiguration:Landroid/content/res/Configuration;
iget-object v3, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mLockPatternUtils:Lcom/android/internal/widget/LockPatternUtils;
iget-object v4, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mUpdateMonitor:Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;
iget-object v5, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mKeyguardScreenCallback:Lcom/android/internal/policy/impl/KeyguardScreenCallback;
invoke-direct/range {v0 .. v5}, Lcom/android/internal/policy/impl/LockScreen;-><init>(Landroid/content/Context;Landroid/content/res/Configuration;Lcom/android/internal/widget/LockPatternUtils;Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;Lcom/android/internal/policy/impl/KeyguardScreenCallback;)V
goto :goto_0
:cond_1
new-instance v0, Lcom/android/internal/policy/impl/LockScreen;
iget-object v1, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mContext:Landroid/content/Context;
iget-object v2, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mConfiguration:Landroid/content/res/Configuration;
iget-object v3, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mLockPatternUtils:Lcom/android/internal/widget/LockPatternUtils;
iget-object v4, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mUpdateMonitor:Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;
iget-object v5, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mKeyguardScreenCallback:Lcom/android/internal/policy/impl/KeyguardScreenCallback;
invoke-direct/range {v0 .. v5}, Lcom/android/internal/policy/impl/LockScreen;-><init>(Landroid/content/Context;Landroid/content/res/Configuration;Lcom/android/internal/widget/LockPatternUtils;Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;Lcom/android/internal/policy/impl/KeyguardScreenCallback;)V
goto :goto_0
:cond_2
after ':cond_2' there will be your default lockscreen so dont leave any line between them.
After the end of your default lockscreen , it might be like this
" invoke-direct/range {v0 .. v5}, Lcom/android/internal/policy/impl/CircleLockScreen;-><init>(Landroid/content/Context;Landroid/content/res/Configuration;Lcom/android/internal/widget/LockPatternUtils;Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;Lcom/android/internal/policy/impl/KeyguardScreenCallbackV
"
paste this
Code:
:goto_0
then on the next line after "return-object v0"
paste this
Code:
:cond_3
new-instance v0, Lcom/android/internal/policy/impl/CyanogenLockScreen;
iget-object v1, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mContext:Landroid/content/Context;
iget-object v2, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mConfiguration:Landroid/content/res/Configuration;
iget-object v3, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mLockPatternUtils:Lcom/android/internal/widget/LockPatternUtils;
iget-object v4, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mUpdateMonitor:Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;
iget-object v5, p0, Lcom/android/internal/policy/impl/LockPatternKeyguardView;->mKeyguardScreenCallback:Lcom/android/internal/policy/impl/KeyguardScreenCallback;
invoke-direct/range {v0 .. v5}, Lcom/android/internal/policy/impl/CyanogenLockScreen;-><init>(Landroid/content/Context;Landroid/content/res/Configuration;Lcom/android/internal/widget/LockPatternUtils;Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;Lcom/android/internal/policy/impl/KeyguardScreenCallback;)V
goto :goto_0
Now you may save and close the file.
Now recompile the android.policy.jar and push it to /system/framework with lidroid-res.apk .
Also Push the Lidroid-Parts.apk to '/system/app'
In case If you already have 14 toggles in the status bar adding this may affect it resulting in force closes . So to fix it follow this :
*Prooceed here only if you have 14 status bar toggles mod in your rom*
1.Decompile SystemUI.apk
2.Delete these two folders (if present) : /smali/com/lidroid & /smali/lidroid
3.Download Status_bar_fix from attachments below.
4.Extract it and copy the smali folder to your decompiled SystemUI.apk
5.Recompile and push the SystemUI.apk back to /system/app
Credits
Lidroid - This Mod Isnt Possible without him.
Regarding any help please prefer commenting on this thread rather than sending PM's.
nice guide :good:
Cool... Great guide... Thanks Aryan ^_^
Does the 6 lockscreen include ICS lockscreen? And do I have to download lidroid res? I already had it in my current rom ...
Sent from my GT-S5360 using xda app-developers app
advance user :|
I can't wait for the update.
Please update soon sir
:good::good::good:
ocoot said:
advance user :|
Click to expand...
Click to collapse
its actually quite easy. .
AvijitGhosh82 said:
Does the 6 lockscreen include ICS lockscreen? And do I have to download lidroid res? I already had it in my current rom ...
Sent from my GT-S5360 using xda app-developers app
Click to expand...
Click to collapse
Yes...the new res file contains resources for cyanogen lockscreens..
Waiting for 14 toggle fix!!
Sent from my GT-S5360 using XDA
Good one thanks pratyush
If my status bar is themed, what happens when I add lidroid res apk? Does the theme stay or go away? Thanks.
Sent from my GT-S5360 using xda app-developers app
awesome guide siirrr...:good: but my Status bar FC :laugh:
Creed when are u going to put d 14 toggle fix??
Sent from my GT-S6102 using xda premium
Bhocan said:
awesome guide siirrr...:good: but my Status bar FC :laugh:
Click to expand...
Click to collapse
Was busy for a bit...will put up the status bar fix today !!
pratyush.creed said:
Was busy for a bit...will put up the status bar fix today !!
Click to expand...
Click to collapse
Ohkz.. Gr8.. Eagerly w8ing!!!.
Dude 1 more qs?? Dude u hav put d code for only 6 lockscreens.. But actually there are 9 rite??
Sent from my GT-S6102 using xda premium
Only 6 in this...
Means u knoe how to make only 6 work or in this post there are 6 only?? Coz in ur Rom its 8 and in cyanogen 9...
Sent from my GT-S6102 using xda premium
Status Bar fix added to the guide ... Do not forget to sign your apps after applying it
pratyush.creed said:
Status Bar fix added to the guide ... Do not forget to sign your apps after applying it
Click to expand...
Click to collapse
putting modded classes.dex and res in original systemUI.apk will not work?
The fix you've added....do we have to use it AFTER the lockscreen adding part? Or is it a separate part?
Sent from my GT-S5360 using xda app-developers app
Creed can u add 2 more lockscreens??
Sent from my GT-S6102 using xda premium
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
its not hards guide but seems like u must have EPM [extended power menu] first before do this mod go to this threads for futher info how to added EPM to your rom http://forum.xda-developers.com/archive/index.php/t-811532.html or u can experimenting by this mod
here original threads about 4wayboot itself http://forum.xda-developers.com/showthread.php?t=1573032
Requirment:
-Brains
-Patient
-notepad++
-apktool,baksmali.jar or vts(use vts its awesome)
-attached file
ok here we go:
What you need to do is:
-Decompile android.policy.jar of your rom
-Copy attached folder to yours
-Open GlobalActions.smali
-Search line "Lcom/android/internal/policy/impl/GlobalActions$5;" ( some roms might have different number on shutdown button. You find right one by for example tracing shutdown icon id )
-Change number 5 to 99 ( two of them )
Before
Code:
Code:
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$5;
const v3, 0x1080030
const v4, 0x1040121
invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$5;->(Lcom/android/internal/policy/impl/GlobalActions;II)V
After
Code:
Code:
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$99;
const v3, 0x1080030
const v4, 0x1040121
invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$99;->(Lcom/android/internal/policy/impl/GlobalActions;II)V
-Open GlobalActions$SinglePressAction.smali
-Before line "# instance fields"
paste following code
Code:
Code:
# static fields
.field protected static rebootMode:I
.field protected static final rebootOptions:[Ljava/lang/String;
-Then after line "# direct methods"
paste following code
Code:
Code:
.method static constructor <clinit>()V
.registers 3
const/4 v0, 0x5
new-array v0, v0, [Ljava/lang/String;
const/4 v1, 0x0
const-string v2, "Reboot"
aput-object v2, v0, v1
const/4 v1, 0x1
const-string v2, "Hot Boot"
aput-object v2, v0, v1
const/4 v1, 0x2
const-string v2, "Download"
aput-object v2, v0, v1
const/4 v1, 0x3
const-string v2, "Recovery"
aput-object v2, v0, v1
const/4 v1, 0x4
const-string v2, "Shutdown"
aput-object v2, v0, v1
sput-object v0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;
return-void
.end method
-So your file should look something like this after those changes
Code:
Code:
.class abstract Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
.super Ljava/lang/Object;
.source "GlobalActions.java"
# interfaces
.implements Lcom/android/internal/policy/impl/GlobalActions$Action;
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lcom/android/internal/policy/impl/GlobalActions;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x40a
name = "SinglePressAction"
.end annotation
# static fields
.field protected static rebootMode:I
.field protected static final rebootOptions:[Ljava/lang/String;
# instance fields
.field private final mIconResId:I
.field private final mMessageResId:I
# direct methods
.method static constructor <clinit>()V
.registers 3
const/4 v0, 0x5
new-array v0, v0, [Ljava/lang/String;
const/4 v1, 0x0
const-string v2, "Reboot"
aput-object v2, v0, v1
const/4 v1, 0x1
const-string v2, "Hot Boot"
aput-object v2, v0, v1
const/4 v1, 0x2
const-string v2, "Download"
aput-object v2, v0, v1
const/4 v1, 0x3
const-string v2, "Recovery"
aput-object v2, v0, v1
const/4 v1, 0x4
const-string v2, "Shutdown"
aput-object v2, v0, v1
sput-object v0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;
return-void
.end method
.method protected constructor (II)V
.registers 3
.parameter "iconResId"
.........
.........
compile jar and u are done
enjoy ur new mod
ss:
http://img.tapatalk.com/6703df6f-8b96-e620.jpg
enjoy
this is the mod file requireds
http://forum.xda-developers.com/attachment.php?attachmentid=974608&d=1333178584
credit:
untermensch(EPM mod GUide)
kahvitahra(4way boot mod):good::highfive::laugh:
reserved for future mod:
How to change shutdown method popup name to everything u desire
open globalaction$99
it look like this
# virtual methods
.method public onPress()V
.registers 7
const/4 v5, 0x5
new-instance v1, Landroid/app/AlertDialog$Builder;
iget-object v2, p0, Lcom/android/internal/policy/impl/GlobalActions$99;->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$000(Lcom/android/internal/policy/impl/GlobalActionsLandroid/content/Context;
move-result-object v2
invoke-direct {v1, v2}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/ContextV
const-string v2, "shutdown Method" ---------------------------(change this to your desire menu name)
invoke-virtual {v1, v2}, Landroid/app/AlertDialog$Builder;->setTitle(Ljava/lang/CharSequenceLandroid/app/AlertDialog$Builder;
move-result-object v1 bla bla bla.......
Click to expand...
Click to collapse
const-string v2, "shutdown Method" (change this to your desire menu name)
recompile and enjoy
reserved for Q&A
Q: When I press restart/shutdown button I can only see title and "ok" and "cancel" -buttons. See photo
{
"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"
}
A: You have incorrect number of empty lines between lines you pasted in GlobalActions$SinglePressAction.smali. You should have two (2) empty lines to previous "# annotations" and to next "# instance fields" from "# static fields" that you pasted.
Also check that added method have <clinit> at the end. See following screenshot.
Thanks to chudy_85 and mialwe for pointing these to all. [/QUOTE]
reserved for fun
Thank's for create a 4way boot
:thumbup::thumbup:
Sent from my GT-S5360 using xda app-developers app
GREATE GUIDE
work in galaxymini sir ?
For gb only bro
Sent from my GT-S5360 using xda app-developers app
evanlocked said:
reserved for fun
Click to expand...
Click to collapse
One night with 4 cup of coffee to find "id's" on public.xml...... :laugh::laugh:
zalzondabuzz said:
One night with 4 cup of coffee to find "id's" on public.xml...... :laugh::laugh:
Click to expand...
Click to collapse
Monggo brad patient on it
Sent from my GT-S5360 using xda premium
This is definitely a must-try. Thanks for this.
bumslayer said:
This is definitely a must-try. Thanks for this.
Click to expand...
Click to collapse
Yow bro its usefull insteads epm its hards to do,
This method more simple than epm
Sent from my GT-S5360 using xda premium
thanks bro! nice guide! i manage to make it for COD Rom. cheers!:good:
ianczarina said:
thanks bro! nice guide! i manage to make it for COD Rom. cheers!:good:
Click to expand...
Click to collapse
Sure bro just try it
Sent from my GT-S5360 using xda premium
ianczarina said:
thanks bro! nice guide! i manage to make it for COD Rom. cheers!:good:
Click to expand...
Click to collapse
Did you have to do the EPM mod as well in order to make it work. I skipped it because my eyes were getting watery and my head was spinning. However, 4way-boot didn't work for me. I guess evanlocked was right when he said the EPM mod is needed.
bumslayer said:
Did you have to do the EPM mod as well in order to make it work. I skipped it because my eyes were getting watery and my head was spinning. However, 4way-boot didn't work for me. I guess evanlocked was right when he said the EPM mod is needed.
Click to expand...
Click to collapse
No bro u can trick it I think u must tracing ur power off icon I'd first in ur framework then change it
Sent from my GT-S5360 using xda app-developers app
@bumslayers he made it posted for cod rom :good:
Sent from my GT-S5360 using xda app-developers app
Well I managed to make it work without making the very difficult EPM mod, hurray! Thank you so much, evanlocked!
However, download mode does not work on my deodexed DXLF2 ROM. Any ideas?
bumslayer said:
Well I managed to make it work without making the very difficult EPM mod, hurray! Thank you so much, evanlocked!
However, download mode does not work on my deodexed DXLF2 ROM. Any ideas?
Click to expand...
Click to collapse
Post ss here I wanna see bro
Edit:download mode not exactly works its becouse the path of it same like lidroid rom download mode not work properly
Sent from my GT-S5360 using xda app-developers app
EPM is hard.Should invest some time on it.May be this weekend.
sent while doin' some burnouts
b16h22 said:
EPM is hard.Should invest some time on it.May be this weekend.
sent while doin' some burnouts
Click to expand...
Click to collapse
Nope bro u can implement 4way boot by seeking the poweroff icon I'd in ur frameworks like bumslayers did he already implemented it without epm in stock deodexed dxlf2
Sent from my GT-S5360 using xda app-developers app
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
Hello there !!!
I would like to present you a guide on how to enable the Private Mode feature for deodexed roms...
Intro:
when you trip knox this feature isn't supposed to work anymore, basically because it checks the security of your device and since knox is voided is not anymore for Samsung standards. i recently found out thanks to @Goldie that the reason is deodex, since even if you trip knox and you're on stock rom and wipe data you can still access the partition after is wiped
what i did was running a log while enabling the P.M. and i got that it "failed to get key value from SecureProperties"
Actions: << kitkat guide >> for Lollipop search for post 141
decompiling the app we find that navigating to /smali/com/samsung/android/personalpage/service/util/ there is a smali called SecureProperties.smali
opening it we found:
Code:
# direct methods
.method public constructor <init>(Landroid/content/Context;)V
.locals 1
.param p1, "context" # Landroid/content/Context;
.prologue
.line 59
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 52
const/4 v0, 0x0
iput-object v0, p0, Lcom/samsung/android/personalpage/service/util/SecureProperties;->mImpl:Lcom/samsung/android/personalpage/service/util/SecureProperties$PropertiesImpl;
.line 62
invoke-static {p1}, Lcom/samsung/android/personalpage/service/util/SecureProperties$SecureStorageProperties;->getInstance(Landroid/content/Context;)Lcom/samsung/android/personalpage/service/util/SecureProperties$PropertiesImpl;
move-result-object v0
iput-object v0, p0, Lcom/samsung/android/personalpage/service/util/SecureProperties;->mImpl:Lcom/samsung/android/personalpage/service/util/SecureProperties$PropertiesImpl;
.line 64
iget-object v0, p0, Lcom/samsung/android/personalpage/service/util/SecureProperties;->mImpl:Lcom/samsung/android/personalpage/service/util/SecureProperties$PropertiesImpl;
if-nez v0, :cond_0
.line 65
invoke-static {p1}, Lcom/samsung/android/personalpage/service/util/SecureProperties$NonSecureProperties;->getInstance(Landroid/content/Context;)Lcom/samsung/android/personalpage/service/util/SecureProperties$PropertiesImpl;
move-result-object v0
iput-object v0, p0, Lcom/samsung/android/personalpage/service/util/SecureProperties;->mImpl:Lcom/samsung/android/personalpage/service/util/SecureProperties$PropertiesImpl;
.line 67
:cond_0
return-void
.end method
this will get the value from framework and we don't want it
so basically we're now going make it read that the framework is still odex by adding a line in the method above like below:
Code:
# direct methods
.method public constructor <init>(Landroid/content/Context;)V
.locals 1
.param p1, "context" # Landroid/content/Context;
.prologue
.line 59
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 52
const/4 v0, 0x0
iput-object v0, p0, Lcom/samsung/android/personalpage/service/util/SecureProperties;->mImpl:Lcom/samsung/android/personalpage/service/util/SecureProperties$PropertiesImpl;
.line 62
invoke-static {p1}, Lcom/samsung/android/personalpage/service/util/SecureProperties$SecureStorageProperties;->getInstance(Landroid/content/Context;)Lcom/samsung/android/personalpage/service/util/SecureProperties$PropertiesImpl;
move-result-object v0
[COLOR="Lime"] const/4 v0, 0x0[/COLOR]
iput-object v0, p0, Lcom/samsung/android/personalpage/service/util/SecureProperties;->mImpl:Lcom/samsung/android/personalpage/service/util/SecureProperties$PropertiesImpl;
.line 64
iget-object v0, p0, Lcom/samsung/android/personalpage/service/util/SecureProperties;->mImpl:Lcom/samsung/android/personalpage/service/util/SecureProperties$PropertiesImpl;
if-nez v0, :cond_0
.line 65
invoke-static {p1}, Lcom/samsung/android/personalpage/service/util/SecureProperties$NonSecureProperties;->getInstance(Landroid/content/Context;)Lcom/samsung/android/personalpage/service/util/SecureProperties$PropertiesImpl;
move-result-object v0
iput-object v0, p0, Lcom/samsung/android/personalpage/service/util/SecureProperties;->mImpl:Lcom/samsung/android/personalpage/service/util/SecureProperties$PropertiesImpl;
.line 67
:cond_0
return-void
.end method
adding the line const/4 v0, 0x0 overrides the one from secure storage with a null value and makes it load the PrivateFsKey value from properties.xml and enabling the feature
so we're done.. just save the smali, recompile and.. enjoy....
optional editing you can apply to the app: (curtesy of @Goldie )
force secure storage to true ( be supported):
in smali/com/sec/android/securestorage/SecureStorage.smali change the .method public static isSupported()Z
like this:
Code:
.method public static isSupported()Z
.locals 1
.prologue
.line 2060
[COLOR="Red"]const/4 v0, 0x1[/COLOR]
return v0
.end method
with the const/4 v0, 0x1 we're forcing it to load a positive value and saing it is supported anyway, instead of loading the value from output
let the app work without the lockscreen keyguard enabled
in smali/com/samsung/android/personalpage/service/PersonalPageService.smali search for new-instance v0, Lcom/android/internal/widget/LockPatternUtils;
the code is now looking like this in stock :
Code:
new-instance v0, Lcom/android/internal/widget/LockPatternUtils;
iget-object v1, p0, Lcom/samsung/android/personalpage/service/PersonalPageService;->mContext:Landroid/content/Context;
invoke-direct {v0, v1}, Lcom/android/internal/widget/LockPatternUtils;-><init>(Landroid/content/Context;)V
.line 282
.local v0, "lockPatternUtils":Lcom/android/internal/widget/LockPatternUtils;
invoke-virtual {v0}, Lcom/android/internal/widget/LockPatternUtils;->isSecure()Z
move-result v1
if-nez v1, :cond_0
.line 283
const/4 v1, 0x1
invoke-direct {p0, v1}, Lcom/samsung/android/personalpage/service/PersonalPageService;->showPrivateModeDialog(Z)V
.line 288
.end local v0 # "lockPatternUtils":Lcom/android/internal/widget/LockPatternUtils;
:cond_0
const/4 v1, 0x1
invoke-direct {p0, v1}, Lcom/samsung/android/personalpage/service/PersonalPageService;->handleChangePrivateMode(Z)V
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
and we're going to add const/4 v1, 0x1 like below:
Code:
new-instance v0, Lcom/android/internal/widget/LockPatternUtils;
iget-object v1, p0, Lcom/samsung/android/personalpage/service/PersonalPageService;->mContext:Landroid/content/Context;
invoke-direct {v0, v1}, Lcom/android/internal/widget/LockPatternUtils;-><init>(Landroid/content/Context;)V
.line 282
.local v0, "lockPatternUtils":Lcom/android/internal/widget/LockPatternUtils;
invoke-virtual {v0}, Lcom/android/internal/widget/LockPatternUtils;->isSecure()Z
move-result v1
[COLOR="Red"]const/4 v1, 0x1[/COLOR]
if-nez v1, :cond_0
.line 283
const/4 v1, 0x1
invoke-direct {p0, v1}, Lcom/samsung/android/personalpage/service/PersonalPageService;->showPrivateModeDialog(Z)V
.line 288
.end local v0 # "lockPatternUtils":Lcom/android/internal/widget/LockPatternUtils;
:cond_0
const/4 v1, 0x1
invoke-direct {p0, v1}, Lcom/samsung/android/personalpage/service/PersonalPageService;->handleChangePrivateMode(Z)V
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
and remove the notification in status bar when personal page is enbled
in smali/com/samsung/android/personalpage/service/util/PersonalPageNotiManager.smali search for .method private static secretModeSetNotification(Landroid/app/NotificationManager;IIIIII)V
chance the whole method to retur void so it won't load the notification like this
Code:
.method private static secretModeSetNotification(Landroid/app/NotificationManager;IIIIII)V
.locals 9
.param p0, "notificationManager" # Landroid/app/NotificationManager;
.param p1, "nMoodId" # I
.param p2, "nTitleId" # I
.param p3, "nTextId" # I
.param p4, "nTickerId" # I
.param p5, "nId" # I
.param p6, "nIndicatorState" # I
.prologue
const/4 v8, 0x0
return-void
.end method
for those not able to enable the private mode with stock rom it is more likely due to wipe not done, or foldermount or any other app that replaces the sdcard binary
no credits need except for samsung that actually made this nice feature...
i just want to thank @daxgirl for moral help first and for helping me making the guide more clear as possible
Seriously, you're the best! This is AMAZING! Absolutely superb job, Wuby!
Sent from my SM-G900F using Tapatalk
It WOOOORRRRRRKKKKSSSSSS! GENIUS!
Sent from my SM-G900F using Tapatalk
Working here to, appreciate the zip, thanks. (NeatROM v2.3)
SM-G900W8 / 0x1
Great guide @Wuby986 ! I am sure many moders & users will benefit from your clean work ! What a nice and simple guide . Private mode can have it's uses, finally !
With friendship,
Thomas
thanks magician wuby, :good: it works perfectly
Samsung stock odex NG2 not work
Tamerlan2009 said:
Samsung stock odex NG2 not work
Click to expand...
Click to collapse
You need to delete the odex file of the apk. The zip replaced the apk. But the odex is still there. Delete it and it should work.
Find PersonalPageService.apk. in /system/priv-app and see if you have PersonalPageService.odex. delete it.
Sent from my SM-G900F using Tapatalk
daxgirl said:
You need to delete the odex file of the apk. The zip replaced the apk. But the odex is still there. Delete it and it should work.
Find PersonalPageService.apk. in /system/priv-app and see if you have PersonalPageService.odex. delete it.
Sent from my SM-G900F using Tapatalk
Click to expand...
Click to collapse
long the file has been deleted) that I just did not do. still does not work
Tamerlan2009 said:
long the file has been deleted) that I just did not do. still does not work
Click to expand...
Click to collapse
Then I suggest opening the actual deodexed apk for ng2 base and modding it according to the guide. Maybe there are differences.
Sent from my SM-G900F using Tapatalk
daxgirl said:
Then I suggest opening the actual deodexed apk for ng2 base and modding it according to the guide. Maybe there are differences.
Sent from my SM-G900F using Tapatalk
Click to expand...
Click to collapse
did not work.
Tamerlan2009 said:
did not work.
Click to expand...
Click to collapse
When you say it doesn't work, what do you mean? What happens when you start private mode?
Also, since this is a development thread, log cat is usually the best way for troubleshooting. Present your log cat or the output of your log cat error. Since "doesn't work" is really a wide range of issues.
Sent from my SM-G900F using Tapatalk
daxgirl said:
When you say it doesn't work, what do you mean? What happens when you start private mode?
Also, since this is a development thread, log cat is usually the best way for troubleshooting. Present your log cat or the output of your log cat error. Since "doesn't work" is really a wide range of issues.
Sent from my SM-G900F using Tapatalk
Click to expand...
Click to collapse
here is what : Failed to enable private mode. Please try again
Tamerlan2009 said:
here is what : Failed to enable private mode. Please try again
Click to expand...
Click to collapse
Please provide a log cat of your error and/or your modified smali/apk.
Sent from my SM-G900F using Tapatalk
Thank's ....
Working perfectly ???[emoji6] [emoji106] [emoji106]
SM-G900F ___abym
daxgirl said:
Please provide a log cat of your error and/or your modified smali/apk.
Sent from my SM-G900F using Tapatalk
Click to expand...
Click to collapse
log and modified apk
Tamerlan2009 said:
log and modified apk
Click to expand...
Click to collapse
Your error is the same as if the file hasn't been modified. I will have a look at the apk and let you know.
Sent from my SM-G900F using Tapatalk
---------- Post added at 07:08 PM ---------- Previous post was at 06:51 PM ----------
Tamerlan2009 said:
log and modified apk
Click to expand...
Click to collapse
I just pushed the app you uploaded into my device and it works immidiately. Even though yours is from ng2 and I am on ng9. So the problem is on your device with something else. from your log I can see some errors on secure storage disabled... could that be the problem?
Your smali is modified correctly, your apk works on my device flawlessly. So it's something in your settings that's blocking it. Maybe one of the build.prop configs? Sorry I can't help more at this point. I will have a deeper look into your log cat. Cheers!
Edit: make sure you don't have it installed in both /system/app and /system/priv-app.
Edit: noticed something else. If you wipe data to the apk after it was working, it never enables again. Maybe wiping all data will help. I will have to try it later. My guess is since you removed the apk and the odex file it wiped data for the app, since it was removed before pushing the new one. I hope wiping data to the device will solve this. Still have to try.
Edit: wiping all data fixed it again. No problem. All works.
Sent from my SM-G900F using Tapatalk
Not that I have an S5 or using this MOD but I just want to thank @wuby986 and @daxgirl for their continuous support and contributions to XDA developers forum. You guys rocks:good:
I will probably try it on my Note 3 S5 port
oluwaponmile said:
Not that I have an S5 or using this MOD but I just want to thank @wuby986 and @daxgirl for their continuous support and contributions to XDA developers forum. You guys rocks:good:
I will probably try it on my Note 3 S5 port
Click to expand...
Click to collapse
Thanks, mate! Nice to see you around! You're on Jamal's port I see from your posts there. Quite a nice rom I hear! I can't say if the note3 is capable of having personal page partition, but I would really like to know if it works! Drop a line if it does! ???
Sent from my SM-G900F using Tapatalk
Wow, im so excited when this guide release :good:. Is this method can be working (Flash the zip file) on Ported S5 ROM on Note 3? I was looking for this most everyday to fix it (Private Mode). But im too noob on this manner. Still learn some knowledge, my finger keep searching non stop :crying: