[Galaxy Note GT-N7000 Themes and Apps] majdinj:
<<

Section #2:

Creating toggle listener in apk that contains the csc feature that we want to control >>​

Here, we will add check box listeners for each csc feature in different apks

Ok, let's start :victory:

★ TW Launcher ★

- Baksmali SecLauncher2.apk

- Navigate to classout\com\android\launcher2 folder and open Launcher.smali

- Search for "CscFeature_Launcher_HomeScreenEditMode" and add blue lines and delete red line (pay attention to condition value):

.line 299
.end local v0 # "IsProvisioned":Z
:cond_95
:goto_95
[B][COLOR="RoyalBlue"]invoke-virtual {p0}, Lcom/android/launcher2/Launcher;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v9

const-string v10, "edit_mode"

invoke-static {v9, v10, v13}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v9

if-eqz v9, :cond_a3[/COLOR] [COLOR="Green"]#<!-- The condition value should be the same as deleted red one bellow[/COLOR][/B]

invoke-static {}, Lcom/sec/android/app/CscFeature;->getInstance()Lcom/sec/android/app/CscFeature;

move-result-object v9

const-string v10, "CscFeature_Launcher_HomeScreenEditMode"

invoke-virtual {v9, v10}, Lcom/sec/android/app/CscFeature;->getEnableStatus(Ljava/lang/String;)Z

move-result v9

[B][COLOR="RoyalBlue"]const/4 v9, 0x1[/COLOR][/B]

[B][COLOR="Red"]if-eqz v9, :cond_a3[/COLOR][/B]

- Search for "CscFeature_Launcher_DisableTiltEffect" and add blue lines and delete red line (pay attention to condition value):

.line 302
:cond_a3
[B][COLOR="RoyalBlue"]invoke-virtual {p0}, Lcom/android/launcher2/Launcher;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v9

const-string v10, "tilt_effect"

invoke-static {v9, v10, v13}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v9

if-nez v9, :cond_b1[/COLOR] [COLOR="Green"]#<!-- The condition value should be the same as deleted red one bellow[/COLOR][/B]

invoke-static {}, Lcom/sec/android/app/CscFeature;->getInstance()Lcom/sec/android/app/CscFeature;

move-result-object v9

const-string v10, "CscFeature_Launcher_DisableTiltEffect"

invoke-virtual {v9, v10}, Lcom/sec/android/app/CscFeature;->getEnableStatus(Ljava/lang/String;)Z

move-result v9

[B][COLOR="RoyalBlue"]const/4 v9, 0x1[/COLOR][/B]

[B][COLOR="Red"]if-eqz v9, :cond_b1[/COLOR][/B]

- Save changes.

- Navigate to classout\com\android\launcher2 folder and open PagedView.smali

- Search for method ".method private isLoopingDisabledInCSC()Z" and change the whole method to:

[B][COLOR="RoyalBlue"].method private isLoopingDisabledInCSC()Z
.registers 5

const/4 v0, 0x0

const/4 v1, 0x1

invoke-virtual {p0}, Lcom/android/launcher2/PagedView;->getContext()Landroid/content/Context;

move-result-object v2

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

move-result-object v2

const-string v3, "page_rotation"

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

move-result v2

if-eqz v2, :cond_majdinj

invoke-static {}, Lcom/sec/android/app/CscFeature;->getInstance()Lcom/sec/android/app/CscFeature;

move-result-object v1

const-string v2, "CscFeature_Launcher_DisablePageRotation"

invoke-virtual {v1, v2}, Lcom/sec/android/app/CscFeature;->getEnableStatus(Ljava/lang/String;)Z

move-result v0

return v0

:cond_majdinj
return v1
.end method[/COLOR][/B]

- Save changes.. and compile

★ TW Contacts ★

- Baksmali SecContacts.apk

- Navigate to classout\com\android\contacts\list folder and open ContactEntryListAdapter.smali

- Search for ""CscFeature_Contact_DisableContactPhoto"" and add blue lines and delete red line (pay attention to condition value):

.method protected bindQuickContact(Lcom/android/contacts/list/ContactListItemView;ILandroid/database/Cursor;III)V
.registers 14
.param p1, "view" # Lcom/android/contacts/list/ContactListItemView;
.param p2, "partitionIndex" # I
.param p3, "cursor" # Landroid/database/Cursor;
.param p4, "photoIdColumn" # I
.param p5, "contactIdColumn" # I
.param p6, "lookUpKeyColumn" # I

.prologue
.line 764
[B][COLOR="RoyalBlue"]iget-object v0, p0, Lcom/android/contacts/list/ContactEntryListAdapter;->mContext:Landroid/content/Context;

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

move-result-object v0

const-string v1, "contacts_list_photo"

const/4 v2, 0x0

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

move-result v0

if-nez v0, :cond_10[/COLOR] [COLOR="Green"]#<!-- The condition value should be the same as deleted red one bellow[/COLOR][/B]

invoke-static {}, Lcom/sec/android/app/CscFeature;->getInstance()Lcom/sec/android/app/CscFeature;

move-result-object v0

const-string v4, "CscFeature_Contact_DisableContactPhoto"

invoke-virtual {v0, v4}, Lcom/sec/android/app/CscFeature;->getEnableStatus(Ljava/lang/String;)Z

move-result v0

[B][COLOR="RoyalBlue"]const/4 v0, 0x1[/COLOR][/B]

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

- Save changes.

- Navigate to classout\com\android\contacts\list folder and open DefaultContactListAdapter.smali

- Search for ""CscFeature_Contact_EnableCallButtonInList"" and add blue lines and delete red line (pay attention to condition value):

.line 455
:goto_8b
[B][COLOR="RoyalBlue"]iget-object v2, p0, Lcom/android/contacts/list/DefaultContactListAdapter;->mContext:Landroid/content/Context;

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

move-result-object v2

const-string v8, "contacts_list_call_btn"

const/4 v0, 0x0

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

move-result v2

if-eqz v2, :cond_c4[/COLOR] [COLOR="Green"]#<!-- The condition value should be the same as deleted red one bellow[/COLOR][/B]

invoke-static {}, Lcom/sec/android/app/CscFeature;->getInstance()Lcom/sec/android/app/CscFeature;

move-result-object v0

const-string v2, "CscFeature_Contact_EnableCallButtonInList"

invoke-virtual {v0, v2}, Lcom/sec/android/app/CscFeature;->getEnableStatus(Ljava/lang/String;)Z

move-result v0

[B][COLOR="RoyalBlue"]const/4 v0, 0x1[/COLOR][/B]

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

iget-boolean v0, p0, Lcom/android/contacts/list/DefaultContactListAdapter;->mShowCallButton:Z

[B][COLOR="RoyalBlue"]const/4 v0, 0x1[/COLOR][/B]

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

- Save changes.

- Navigate to classout\com\sec\android\app\dialertab\calllog and open CallLogAdapter.smali

- Search for ""CscFeature_Contact_EnableCallButtonInList"", there will be 2 results, we will be working on the 2nd one. Now add blue lines and delete red line (pay attention to condition value):

.line 1358
[B][COLOR="RoyalBlue"]move-object/from16 v0, p0

iget-object v5, v0, Lcom/sec/android/app/dialertab/calllog/CallLogAdapter;->mContext:Landroid/content/Context;

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

move-result-object v18

const-string v19, "logs_list_call_btn"

const/16 v20, 0x0

invoke-static/range {v18 .. v20}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v18

if-eqz v18, :cond_257[/COLOR] [COLOR="Green"]#<!-- The condition value should be the same as deleted red one bellow[/COLOR][/B]

invoke-static {}, Lcom/sec/android/app/CscFeature;->getInstance()Lcom/sec/android/app/CscFeature;

move-result-object v5

const-string v6, "CscFeature_Contact_EnableCallButtonInList"

invoke-virtual {v5, v6}, Lcom/sec/android/app/CscFeature;->getEnableStatus(Ljava/lang/String;)Z

move-result v5

[B][COLOR="RoyalBlue"]const/4 v5, 0x1[/COLOR][/B]

[B][COLOR="Red"]if-eqz v5, :cond_257[/COLOR][/B]

- Save changes... Compile.

N.B:

You may get FC if you open phone app, to overcome that, you need to set compiling compression level to 0 or drag and drop the modified classes.dex in the original SecContacts.apk then push to phone.

★ TW Browser ★

- Baksmali SecBrowser.apk

- Navigate to classout\com\android\browser folder and open Controller.smali

- In the method ".method goBackOnePageOrQuit()V" add extra register to accommodate our new code:

.method goBackOnePageOrQuit()V
[B][COLOR="Red"].registers 5[/COLOR][/B]

.prologue

it will be after adding new register like this:

.method goBackOnePageOrQuit()V
[B][COLOR="RoyalBlue"].registers 6[/COLOR][/B]

.prologue

- In the same method, search for "CscFeature_Web_EnablePromptToExit", there will be 3 results, we will be working on the first one. Now add blue lines and delete red line (pay attention to condition value):

.line 4117
:cond_31
[B][COLOR="RoyalBlue"]invoke-virtual {p0}, Lcom/android/browser/Controller;->getContext()Landroid/content/Context;

move-result-object v1

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

move-result-object v1

const-string v2, "browser_exit_prompt"

const/4 v4, 0x0

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

move-result v1

if-eqz v1, :cond_49[/COLOR] [COLOR="Green"]#<!-- The condition value should be the same as deleted red one bellow[/COLOR][/B]

invoke-static {}, Lcom/sec/android/app/CscFeature;->getInstance()Lcom/sec/android/app/CscFeature;

move-result-object v1

const-string v2, "CscFeature_Web_EnablePromptToExit"

invoke-virtual {v1, v2}, Lcom/sec/android/app/CscFeature;->getEnableStatus(Ljava/lang/String;)Z

move-result v1

[B][COLOR="RoyalBlue"]const/4 v1, 0x1[/COLOR][/B]

[B][COLOR="Red"]if-eqz v1, :cond_49[/COLOR][/B]

- Now in the method ".method public onPrepareOptionsMenu(Landroid/view/Menu;)Z", search for "CscFeature_Web_AddOptionToTerminate" and add blue lines and delete red line (pay attention to condition value):

.line 2318
:goto_58
[COLOR="RoyalBlue"][B]invoke-virtual {p0}, Lcom/android/browser/Controller;->getContext()Landroid/content/Context;

move-result-object v0

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

move-result-object v0

const-string v1, "browser_exit_option"

const/4 v2, 0x0

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

move-result v0

if-eqz v0, :cond_71[/COLOR] [COLOR="Green"]#<!-- The condition value should be the same as deleted red one bellow[/COLOR][/B]

invoke-static {}, Lcom/sec/android/app/CscFeature;->getInstance()Lcom/sec/android/app/CscFeature;

move-result-object v0

const-string v1, "CscFeature_Web_AddOptionToTerminate"

invoke-virtual {v0, v1}, Lcom/sec/android/app/CscFeature;->getEnableStatus(Ljava/lang/String;)Z

move-result v0

[B][COLOR="RoyalBlue"]const/4 v0, 0x1[/COLOR][/B]

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

- In the method ".method public onOptionsItemSelected(Landroid/view/MenuItem;)Z", search for "CscFeature_Web_AddOptionToTerminate" and add this blue line:

.line 2652
:pswitch_1b4
invoke-static {}, Lcom/sec/android/app/CscFeature;->getInstance()Lcom/sec/android/app/CscFeature;

move-result-object v0

const-string v1, "CscFeature_Web_AddOptionToTerminate"

invoke-virtual {v0, v1}, Lcom/sec/android/app/CscFeature;->getEnableStatus(Ljava/lang/String;)Z

move-result v0

[B][COLOR="RoyalBlue"]const/4 v0, 0x1[/COLOR][/B]

if-eqz v0, :cond_2c

- In the method ".method public updateMenuState" search for "CscFeature_Web_EnableHomepageOption" and add blue lines and delete red line (pay attention to condition value):

.line 2351
[B][COLOR="RoyalBlue"]invoke-virtual {p0}, Lcom/android/browser/Controller;->getContext()Landroid/content/Context;

move-result-object v4

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

move-result-object v4

const-string v7, "browser_home_page"

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

move-result v4

if-nez v4, :cond_5a[/COLOR] [COLOR="Green"]#<!-- The condition value should be the same as deleted red one bellow[/COLOR][/B]

invoke-static {}, Lcom/sec/android/app/CscFeature;->getInstance()Lcom/sec/android/app/CscFeature;

move-result-object v4

const-string v7, "CscFeature_Web_EnableHomepageOption"

invoke-virtual {v4, v7}, Lcom/sec/android/app/CscFeature;->getEnableStatus(Ljava/lang/String;)Z

move-result v4

[B][COLOR="RoyalBlue"]const/4 v4, 0x1[/COLOR][/B]

[B][COLOR="Red"]if-nez v4, :cond_5a[/COLOR][/B]

- Save changes... Compile.

★ TW Settings Menu ★

- Baksmali SecSettings.apk

- Navigate to classout\com\android\settings folder and open Settings.smali

- In the method ".method private updateHeaderList(Ljava/util/List;)V", search for ""CscFeature_Setting_EnableMenuBlockCallMsg"" and add blue lines and delete red line:

.line 596
[B][COLOR="RoyalBlue"]invoke-virtual {p0}, Lcom/android/settings/Settings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v3

const-string v6, "call_message_block"

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

move-result v3

if-eqz v3, :cond_majdinj[/COLOR][/B]

invoke-static {}, Lcom/sec/android/app/CscFeature;->getInstance()Lcom/sec/android/app/CscFeature;

move-result-object v3

const-string v6, "CscFeature_Setting_EnableMenuBlockCallMsg"

invoke-virtual {v3, v6}, Lcom/sec/android/app/CscFeature;->getEnableStatus(Ljava/lang/String;)Z

move-result v3

[B][COLOR="RoyalBlue"]const/4 v3, 0x1[/COLOR][/B]

[B][COLOR="Red"]if-nez v3, :cond_23[/COLOR][/B]

.line 598
[B][COLOR="Red"]invoke-interface {p1, v0}, Ljava/util/List;->remove(Ljava/lang/Object;)Z[/COLOR][/B]

goto/16 :goto_23

- Copy the last 2 lines in the above code (goto_23 could differ according to ROM) and go to the end of method and add defined condition and those 2 lines:

:cond_2b7
move v0, v1

goto/16 :goto_55

[B][COLOR="RoyalBlue"]:cond_majdinj
invoke-interface {p1, v0}, Ljava/util/List;->remove(Ljava/lang/Object;)Z

goto/16 :goto_23[/COLOR][/B]
.end method

- Save changes.

- Navigate to classout\com\android\settings folder and open SecuritySettings.smali

- In the method ".method private createPreferenceHierarchy()Landroid/preference/PreferenceScreen;", search for "CscFeature_Setting_EnableFactoryResetPasswordWhenNoSIM" and add blue lines and delete red line (pay attention to condition value):

.line 503
:cond_2f2
[B][COLOR="RoyalBlue"]invoke-virtual {p0}, Lcom/android/settings/SecuritySettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v10

const-string v11, "security_data_reset_pass"

invoke-static {v10, v11, v13}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v10

if-eqz v10, :cond_32b[/COLOR] [COLOR="Green"]#<!-- The condition value should be the same as deleted red one bellow[/COLOR][/B]

invoke-static {}, Lcom/sec/android/app/CscFeature;->getInstance()Lcom/sec/android/app/CscFeature;

move-result-object v10

const-string v11, "CscFeature_Setting_EnableFactoryResetPasswordWhenNoSIM"

invoke-virtual {v10, v11}, Lcom/sec/android/app/CscFeature;->getEnableStatus(Ljava/lang/String;)Z

move-result v10

[B][COLOR="RoyalBlue"]const/4 v10, 0x1[/COLOR][/B]

[B][COLOR="Red"]if-eqz v10, :cond_32b[/COLOR][/B]

- Save changes.

- Navigate to classout\com\android\settings folder and open DeviceInfoSettings.smali

- Search for "CscFeature_Setting_DisableMenuSoftwareUpdate" and add blue lines and delete red line (pay attention to condition value):

.line 320
[B][COLOR="RoyalBlue"]invoke-virtual/range {p0 .. p0}, Lcom/android/settings/DeviceInfoSettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v24

const-string v25, "software_update_menu"

const/16 v26, 0x0

invoke-static/range {v24 .. v26}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v6

if-nez v6, :cond_315 [/COLOR] [COLOR="Green"]#<!-- The condition value should be the same as deleted red one bellow[/COLOR][/B]

invoke-static {}, Lcom/sec/android/app/CscFeature;->getInstance()Lcom/sec/android/app/CscFeature;

move-result-object v24

const-string v25, "CscFeature_Setting_DisableMenuSoftwareUpdate"

invoke-virtual/range {v24 .. v25}, Lcom/sec/android/app/CscFeature;->getEnableStatus(Ljava/lang/String;)Z

move-result v24

[B][COLOR="RoyalBlue"]const/16 v24, 0x1[/COLOR][/B]

[B][COLOR="Red"]const/16 v25, 0x1

move/from16 v0, v24

move/from16 v1, v25

if-ne v0, v1, :cond_315[/COLOR][/B]

- Save changes... compile.

That's all... push all modified files into your device,,

Your new ROM CSC features controller is functioned properly now :cool:

Cheers,,