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:
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:
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):
let the app work without the lockscreen keyguard enabled
and remove the notification in status bar when personal page is enbled
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
I would like to present you a guide on how to enable the Private Mode feature for deodexed roms...
Intro:
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:
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
like this:
Code:
.method public static isSupported()Z
.locals 1
.prologue
.line 2060
[COLOR="Red"]const/4 v0, 0x1[/COLOR]
return v0
.end method
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 :
and we're going to add const/4 v1, 0x1 like below:
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
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
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
Last edited: