[Galaxy Note GT-N7000 Android Development] majdinj:
Continue moddings!!

Extended Power Menu Addons (ScreenShot, Recovery, Download & Safe modes)

In this tutorial, we will modify 2 files; the framework-res.apk file and android.policy.jar file...

Here for the sake of tutorial, I will refer to ScreenShot resources by blue color lines, Recovery resources by green lines, download resources by orange lines and safe resources by pink lines.. Please download these resources first.

Smali resources credits to Robbie Hood for Screen Capture, tdunham for Download and Recovery smalis, and of course me for Safe mode smali.

A) framework-res.apk

1. Decompile framework-res.apk by APK-Multi Tool

2. Add your desired resources image to res\drawable-xhdpi folder, here they are [tw_ic_lock_screenshot.png], [tw_ic_lock_recovery.png], [tw_ic_lock_download.png] and [tw_ic_lock_safemode.png].

3. Go to res\values folder and open strings.xml file and add the following lines at the end before </resources>:

[COLOR="Blue"] <string name="global_action_screenshot_txt">Take screenshot</string>[/COLOR]
[COLOR="Green"] <string name="global_action_recovery_txt">Recovery Mode</string>[/COLOR]
[COLOR="DarkOrange"] <string name="global_action_download_txt">Download mode</string>[/COLOR]
[COLOR="Magenta"]<string name="global_action_safemode_txt">Reboot to safe mode</string>[/COLOR]

4. Now recompile your framework-res.apk THEN decompile it again; so we can have new generated ids in public.xml file in res\values folder.

5. In your new decompiled framework-res.apk, go to res\values folder and open public.xml file and locate the following lines for the added new image resources:

[COLOR="Blue"]<public type="drawable" name="tw_ic_lock_screenshot" id="0x01080a98" />[/COLOR]
[COLOR="Green"]<public type="drawable" name="tw_ic_lock_recovery" id="0x01080a9a" />[/COLOR]
[COLOR="DarkOrange"]<public type="drawable" name="tw_ic_lock_download" id="0x01080a99" />[/COLOR]
[COLOR="Magenta"]<public type="drawable" name="tw_ic_lock_safemode" id="0x01080a98" />[/COLOR]

and the following lines for the added new strings resources:

[COLOR="Blue"]<public type="string" name="global_action_screenshot_txt" id="0x01040784" />[/COLOR]
[COLOR="Green"]<public type="string" name="global_action_recovery_txt" id="0x01040785" />[/COLOR]
[COLOR="DarkOrange"]<public type="string" name="global_action_download_txt" id="0x01040786" />[/COLOR]
[COLOR="Magenta"]<public type="string" name="global_action_safemode_txt" id="0x01040785" />[/COLOR]

6. Leave public.xml file opened and go to the next step..

B) android.policy.jar

1. Backsmali android.policy.jar

2. Navigate to classout\com\android\internal\policy\impl folder and open GlobalActions.smali.

3. In the [# instance fields] section, add these new lines:

[COLOR="Blue"].field private mScreenCapture:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
[/COLOR]
[COLOR="Green"].field private mRecovery:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]

[COLOR="DarkOrange"].field private mDownload:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]

[COLOR="Magenta"].field private mSafeMode:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]

4. Search for "[Lcom/android/internal/policy/impl/GlobalActions$Action;" for power menu arrays and increase the number of arrays (the line above it) to accommodate the total number of new arrays..

.line 418
const/4 v1, 0x[B][COLOR="Purple"]5 <!--- You need to increase the arrays number here[/COLOR][/B]

new-array v1, v1, [Lcom/android/internal/policy/impl/GlobalActions$Action;

So the line will be:

.line 418
const/4 v1, 0x[B][COLOR="Purple"]9[/COLOR][/B]

new-array v1, v1, [Lcom/android/internal/policy/impl/GlobalActions$Action;

5. Now we will put listener actions for these added arrays.. so above the newly modified "const/4 v1, 0x9" add these action lines:

new-instance [COLOR="Red"]v1[/COLOR], Lcom/android/internal/policy/impl/GlobalActions$99;

const [COLOR="Red"]v2[/COLOR], 0x10808ad

const [COLOR="Red"]v3[/COLOR], 0x1040193

move-object/from16 [COLOR="Red"]v0, p0[/COLOR]

invoke-direct {[COLOR="Red"]v1, v0, v2, v3[/COLOR]}, Lcom/android/internal/policy/impl/GlobalActions$99;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V

move-object/from16 [COLOR="Red"]v0, p0[/COLOR]

iput-object [COLOR="Red"]v1, v0[/COLOR], Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

.line 416
invoke-direct/range {p0 .. p0}, Lcom/android/internal/policy/impl/GlobalActions;->onAirplaneModeChanged()V

[COLOR="Blue"]new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$ScreenCap;

const v2, 0x1080a98

const v3, 0x1040784

move-object/from16 v0, p0

invoke-direct {v1, v0, v2, v3}, Lcom/android/internal/policy/impl/GlobalActions$ScreenCap;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V

move-object/from16 v0, p0

iput-object v1, v0, Lcom/android/internal/policy/impl/GlobalActions;->mScreenCapture:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]

[COLOR="Green"] new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$Recovery;

const v2, 0x1080a9a

const v3, 0x1040785

move-object/from16 v0, p0

invoke-direct {v1, v0, v2, v3}, Lcom/android/internal/policy/impl/GlobalActions$Recovery;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V

move-object/from16 v0, p0

iput-object v1, v0, Lcom/android/internal/policy/impl/GlobalActions;->mRecovery:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
[/COLOR]
[COLOR="DarkOrange"] new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$Download;

const v2, 0x1080a99

const v3, 0x1040786

move-object/from16 v0, p0

invoke-direct {v1, v0, v2, v3}, Lcom/android/internal/policy/impl/GlobalActions$Download;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V

move-object/from16 v0, p0

iput-object v1, v0, Lcom/android/internal/policy/impl/GlobalActions;->mDownload:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]

[COLOR="Magenta"]new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$SafeMode;

const v2, 0x1080a98

const v3, 0x1040785

move-object/from16 v0, p0

invoke-direct {v1, v0, v2, v3}, Lcom/android/internal/policy/impl/GlobalActions$SafeMode;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V

move-object/from16 v0, p0

iput-object v1, v0, Lcom/android/internal/policy/impl/GlobalActions;->mSafeMode:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]

.line 418
const/4 v1, 0x9

As you can see here, the ids for each action are obtained from public.xml file from framework-res.apk. The first id in each action will represent the image resource and the second id will represent the string resource... See public.xml lines above and you will figure it out ;)..

6. Now we need to add new arrays to show in Power Menu.. So bellow modified "const/4 v1, 0x9" add new arrays to show after the last array:

.line 418
const/4 v1, 0x9

new-array v1, v1, [Lcom/android/internal/policy/impl/GlobalActions$Action;

const/4 v2, 0x0

move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mAccessiblityShortcut:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

aput-object v3, v1, v2
...
...
...
const/4 [COLOR="Red"]v2[/COLOR], 0x4

move-object/from16 [COLOR="Red"]v0, p0[/COLOR]

iget-object [COLOR="Red"]v3, v0[/COLOR], Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

aput-object [COLOR="Red"]v3, v1, v2[/COLOR]

[COLOR="Blue"] const/4 v2, 0x5

move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mScreenCapture:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

aput-object v3, v1, v2[/COLOR]

[COLOR="Green"] const/4 v2, 0x6

move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mRecovery:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

aput-object v3, v1, v2[/COLOR]

[COLOR="DarkOrange"] const/4 v2, 0x7

move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mDownload:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

aput-object v3, v1, v2[/COLOR]

[COLOR="Magenta"]const/4 v2, 0x8

move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mSafeMode:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

aput-object v3, v1, v2[/COLOR]

7. Now save changes and exit.

8. Copy smali resources for ScreenShot, Recovery, Download and Safe modes into classout\com\android\internal\policy\impl folder

9. Smali (recompile) the finished android.policy.jar

Now push the modified framework-res.apk and android.policy.jar to your phone.. This will be enough for new Power Menu recovery, download and safe modes addons but not for ScreenShot!! You need to push extra file to bin folder in your phone which is screenshot and fix permissions to rwsr-xr-x that is 04755 in updater-script language.

Results example:

Extra Step: Adding Setting Toggle For Power Menu Addons >>>

I will assume you already add Safe Mode and Screenshot extra power menu addons..

1) android.policy.jar:

- Baksmali android.policy.jar

- Go to classout\com\android\internal\policy\impl folder

- Open GlobalActions$SafeMode.smali and change the method ".method public showConditional()Z" to:

.method public showConditional()Z
.registers 5

const/4 v0, 0x1

const/4 v1, 0x0

iget-object v2, p0, Lcom/android/internal/policy/impl/[B][COLOR="Blue"]GlobalActions$SafeMode[/COLOR][/B];->this$0:Lcom/android/internal/policy/impl/GlobalActions;

# getter for: Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
invoke-static {v2}, Lcom/android/internal/policy/impl/GlobalActions;->access$200(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;

move-result-object v2

invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v2

const-string v3, [B][COLOR="Blue"]"pm_safe_mode"[/COLOR][/B]

invoke-static {v2, v3, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v2

if-ne v2, v0, :cond_15

:goto_14
return v0

:cond_15
move v0, v1

goto :goto_14
.end method

.method public showDuringKeyguard()Z
.registers 2

.prologue
.line 389
const/4 v0, 0x1

return v0
.end method

- Also, open GlobalActions$ScreenCap.smali and change the method ".method public showConditional()Z" to:

.method public showConditional()Z
.registers 5

const/4 v0, 0x1

const/4 v1, 0x0

iget-object v2, p0, Lcom/android/internal/policy/impl/[B][COLOR="Blue"]GlobalActions$ScreenCap[/COLOR][/B];->this$0:Lcom/android/internal/policy/impl/GlobalActions;

# getter for: Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
invoke-static {v2}, Lcom/android/internal/policy/impl/GlobalActions;->access$200(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;

move-result-object v2

invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v2

const-string v3, [B][COLOR="Blue"]"pm_screenshot"[/COLOR][/B]

invoke-static {v2, v3, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v2

if-ne v2, v0, :cond_15

:goto_14
return v0

:cond_15
move v0, v1

goto :goto_14
.end method

- Save changes .. and that's for android.policy.jar

2) SecSettings.apk:

- Decompile SecSettings.apk

- Go to res\values folder and open strings.xml file and add these new resources at the end before </resources>:

<string name="PM_Glory_addons">GloryROM Power Menu Addons</string>
<string name="pm_safe_mode_title">Safe Mode Reboot</string>
<string name="pm_screenshot_title">Take Screenshot</string>
<string name="pm_on">Toggle is Enabled</string>
<string name="pm_off">Toggle is Disabled</string>

- Go to res\xml and open display_settings.xml and add these lines on the place you your addon to appear later on on the device:

<PreferenceCategory android:title="@string/PM_Glory_addons" android:key="PM_Glory_settings" />
<CheckBoxPreference android:title="@string/pm_safe_mode_title" android:key="pm_safe_mode" android:defaultValue="true" android:summaryOn="@string/pm_on" android:summaryOff="@string/pm_off" />
<CheckBoxPreference android:title="@string/pm_screenshot_title" android:key="pm_screenshot" android:defaultValue="true" android:summaryOn="@string/pm_on" android:summaryOff="@string/pm_off" />

- Now for the smali source, go to classout\com\android\settings folder and open DisplaySettings.smali.. Also here, I didn't invent new codes, I used mult-windows toggle codes as reference..!! I will use Blue color for Safe Mode toggle codes and Green color for Screenshot toggle codes. Add these lines to [# instance fields] section:

[B][COLOR="Blue"].field private mSafeModePref:Landroid/preference/CheckBoxPreference;[/COLOR]

[COLOR="Green"].field private mScreenShotPref:Landroid/preference/CheckBoxPreference;[/COLOR][/B]

- In the method ".method public onCreate(Landroid/os/Bundle;)V", search for ""key_multi_window"" and add these lines:

.line 570
const-string v11, "key_multi_window"

invoke-virtual {p0, v11}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

move-result-object v11

check-cast v11, Landroid/preference/CheckBoxPreference;

iput-object v11, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

[B][COLOR="Blue"]const-string v11, "pm_safe_mode"

invoke-virtual {p0, v11}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

move-result-object v11

check-cast v11, Landroid/preference/CheckBoxPreference;

iput-object v11, p0, Lcom/android/settings/DisplaySettings;->mSafeModePref:Landroid/preference/CheckBoxPreference;[/COLOR]

[COLOR="Green"]const-string v11, "pm_screenshot"

invoke-virtual {p0, v11}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

move-result-object v11

check-cast v11, Landroid/preference/CheckBoxPreference;

iput-object v11, p0, Lcom/android/settings/DisplaySettings;->mScreenShotPref:Landroid/preference/CheckBoxPreference;[/COLOR][/B]

- Now search for the method ".method public onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/Preference;)Z" and search for ""multi_window_enabled"" to locate this part at the end:

.line 1021
:cond_15c
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

move-result v0

if-eqz v0, [B][COLOR="Red"]:cond_1c[/COLOR][/B]

.line 1022
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z

move-result v0

.line 1023
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v3

const-string v4, "multi_window_enabled"

if-eqz v0, :cond_177

:goto_172
invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

goto/16 :goto_1c

:cond_177
move v1, v2

goto :goto_172
.end method

Add new codes before [.end method] in the previous section, so that section will be like this:

.line 1021
:cond_15c
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

move-result v0

if-eqz v0, [B][COLOR="Blue"]:cond_SafeM[/COLOR][/B]

.line 1022
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z

move-result v0

.line 1023
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v3

const-string v4, "multi_window_enabled"

if-eqz v0, :cond_177

:goto_172
invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

goto/16 :goto_1c

:cond_177
move v1, v2

goto :goto_172

[B][COLOR="Blue"]:cond_SafeM
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mSafeModePref:Landroid/preference/CheckBoxPreference;

invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

move-result v0

if-eqz v0, :cond_ScSh

.line 1022
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mSafeModePref:Landroid/preference/CheckBoxPreference;

invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z

move-result v0

.line 1023
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v3

const-string v4, "pm_safe_mode"

if-eqz v0, :cond_majdiSafe

:goto_njsafe
invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

goto/16 :goto_1c

:cond_majdiSafe
move v1, v2

goto :goto_njsafe[/COLOR]

[B][COLOR="Green"]:cond_ScSh
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mScreenShotPref:Landroid/preference/CheckBoxPreference;

invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

move-result v0

if-eqz v0, [COLOR="Red"]:cond_1c[/COLOR]

.line 1022
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mScreenShotPref:Landroid/preference/CheckBoxPreference;

invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z

move-result v0

.line 1023
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v3

const-string v4, "pm_screenshot"

if-eqz v0, :cond_majdiSS

:goto_njSS
invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

goto/16 :goto_1c

:cond_majdiSS
move v1, v2

goto :goto_njSS[/COLOR][/B][/B]
.end method

- Pay attention to the red color condition..!!!

- Now go to the next method ".method public onResume()V" and search for ""multi_window_enabled"" and locate this part:

:cond_9d
sget-boolean v0, Lcom/android/settings/DisplaySettings;->UseMultiWindow:Z

if-eqz v0, [B][COLOR="Red"]:cond_c1[/COLOR][/B]

.line 847
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v3

const-string v4, "multi_window_enabled"

invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v3

if-ne v3, v1, :cond_de

:goto_af
invoke-virtual {v0, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V

.line 848
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v0

const-string v1, "multi_window_enabled"

invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;

move-result-object v1

iget-object v3, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowModeObserver:Landroid/database/ContentObserver;

invoke-virtual {v0, v1, v2, v3}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V

line 850
:cond_c1
return-void

:cond_c2
move v0, v2

And do this modification:

:cond_9d
sget-boolean v0, Lcom/android/settings/DisplaySettings;->UseMultiWindow:Z

if-eqz v0, [B][COLOR="Blue"]:cond_Safemajdi[/COLOR][/B]

.line 847
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v3

const-string v4, "multi_window_enabled"

invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v3

if-ne v3, v1, :cond_de

:goto_af
invoke-virtual {v0, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V

.line 848
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v0

const-string v1, "multi_window_enabled"

invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;

move-result-object v1

iget-object v3, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowModeObserver:Landroid/database/ContentObserver;

invoke-virtual {v0, v1, v2, v3}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V

[B][COLOR="Blue"].line 1000
:cond_Safemajdi
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mSafeModePref:Landroid/preference/CheckBoxPreference;

if-eqz v0, :cond_NewScSh

.line 1001
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mSafeModePref:Landroid/preference/CheckBoxPreference;

invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v3

const-string v4, "pm_safe_mode"

const/4 v1, 0x0

invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v3

if-eqz v3, :cond_noSafe

const/4 v1, 0x1

goto :goto_yesSafe

:cond_noSafe
const/4 v1, 0x0

:goto_yesSafe
invoke-virtual {v0, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V[/COLOR]

[COLOR="Green"].line 2000
:cond_NewScSh
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mScreenShotPref:Landroid/preference/CheckBoxPreference;

if-eqz v0, [COLOR="Red"]:cond_c1[/COLOR]

.line 2001
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mScreenShotPref:Landroid/preference/CheckBoxPreference;

invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v3

const-string v4, "pm_screenshot"

const/4 v1, 0x0

invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v3

if-eqz v3, :cond_noShot

const/4 v1, 0x1

goto :goto_yesShot

:cond_noShot
const/4 v1, 0x0

:goto_yesShot
invoke-virtual {v0, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V[/COLOR][/B]

.line 850
:cond_c1
return-void

:cond_c2
move v0, v2

- Also pay attention to the red color condition..!!!

- Save changes.. and that's all

Result example: