FORUMS

[MOD][GUIDE][HOWTO] * Enable Private Mode with custom rom*

2,144 posts
Thanks Meter: 2,537
 
By Wuby986, Senior Member on 14th October 2014, 12:19 AM
Post Reply Email Thread
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

    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 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
const/4 v0, 0x1

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

    const/4 v1, 0x1

    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
The Following 78 Users Say Thank You to Wuby986 For This Useful Post: [ View ] Gift Wuby986 Ad-Free
14th October 2014, 12:25 AM |#2  
daxgirl's Avatar
Senior Member
Flag Jerusalem
Thanks Meter: 9,321
 
More
Seriously, you're the best! This is AMAZING! Absolutely superb job, Wuby!

Sent from my SM-G900F using Tapatalk
The Following 11 Users Say Thank You to daxgirl For This Useful Post: [ View ] Gift daxgirl Ad-Free
14th October 2014, 12:44 AM |#3  
daxgirl's Avatar
Senior Member
Flag Jerusalem
Thanks Meter: 9,321
 
More
It WOOOORRRRRRKKKKSSSSSS! GENIUS!

Sent from my SM-G900F using Tapatalk
Attached Thumbnails
Click image for larger version

Name:	uploadfromtaptalk1413243863767.png
Views:	10538
Size:	191.4 KB
ID:	2970301  
The Following 7 Users Say Thank You to daxgirl For This Useful Post: [ View ] Gift daxgirl Ad-Free
14th October 2014, 02:12 AM |#4  
ragz's Avatar
Senior Member
Flag Regina, Saskatchewan
Thanks Meter: 559
 
More
Working here to, appreciate the zip, thanks. (NeatROM v2.3)

SM-G900W8 / 0x1
The Following 2 Users Say Thank You to ragz For This Useful Post: [ View ] Gift ragz Ad-Free
14th October 2014, 06:18 AM |#5  
Senior Member
Thanks Meter: 5,562
 
Donate to Me
More
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
The Following 3 Users Say Thank You to DaOldMan For This Useful Post: [ View ] Gift DaOldMan Ad-Free
14th October 2014, 09:29 AM |#6  
BoBCatRoM's Avatar
Recognized Themer
Thanks Meter: 7,592
 
More
thanks magician wuby, it works perfectly
The Following 2 Users Say Thank You to BoBCatRoM For This Useful Post: [ View ] Gift BoBCatRoM Ad-Free
14th October 2014, 03:16 PM |#7  
Senior Member
Thanks Meter: 792
 
More
Samsung stock odex NG2 not work
14th October 2014, 03:22 PM |#8  
daxgirl's Avatar
Senior Member
Flag Jerusalem
Thanks Meter: 9,321
 
More
Quote:
Originally Posted by Tamerlan2009

Samsung stock odex NG2 not work

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
The Following User Says Thank You to daxgirl For This Useful Post: [ View ] Gift daxgirl Ad-Free
14th October 2014, 03:32 PM |#9  
Senior Member
Thanks Meter: 792
 
More
Quote:
Originally Posted by daxgirl

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


long the file has been deleted) that I just did not do. still does not work
14th October 2014, 03:34 PM |#10  
daxgirl's Avatar
Senior Member
Flag Jerusalem
Thanks Meter: 9,321
 
More
Quote:
Originally Posted by Tamerlan2009

long the file has been deleted) that I just did not do. still does not work

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
14th October 2014, 03:51 PM |#11  
Senior Member
Thanks Meter: 792
 
More
Quote:
Originally Posted by daxgirl

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

did not work.
Post Reply Subscribe to Thread

Tags
guide, private mode

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes