[Guide] Create CSC features controller tab in settings menu

Search This thread

majdinj

Senior Member
Nov 25, 2006
980
3,442
AlAhsa
Hi guys,,
Today's tutorial will make us able to create new tab in settings menu by which we could control our ROM CSC features by toggles..


86m3.png
pb5u.png
qah7.png


This tutorial will be divided into 2 main sections:
Section #1: Creating new tab in settings menu (ROM CSC features controller)
Section #2: Creating toggle listener in apk that contains the csc feature that we want to control

So let's start.. :eek:

<< Section #1: Creating new tab in settings menu (ROM CSC features controller) >>​

First download the resources from attachment bellow.

- Decompile SecSettings.apk
- Navigate to res\xml folder and open settings_headers.xml and add this line wherever you want the new tab to appear in your settings menu later on:
Code:
<header android:icon="@drawable/ic_csc_controller" android:id="@id/csc_control" android:title="@string/csc_features_controller" android:fragment="com.android.settings.romhack.CscSettings" />
- Still in the same res\xml folder, paste csc_settings.xml there from resources file.
- Navigate to res\drawable-xhdpi folder and paste ic_csc_controller.png from resource file there.
- Navigate to res\values folder and open ids.xml file and add this line at the end:
Code:
<item type="id" name="csc_control">false</item>
- Navigate to res\values folder and open strings.xml and add these lines:
Code:
	<string name="csc_features_controller">ROM CSC features controller</string>
	<string name="how_csc_use">Tip:</string>
	<string name="how_csc_use_summary">After you made your choices, you may need to restart your device in order to load some csc features changes</string>
	<string name="glory_twlauncher">GloryROM TW Launcher CSC Features</string>
	<string name="twlauncher_tilt">Transition tilt effect</string>
	<string name="twlauncher_page_rotation">Home screens looping</string>
	<string name="twlauncher_edit_mode">Home screen edit menu</string>	
	<string name="glory_twcontacts">GloryROM TW Contacts CSC Features</string>
	<string name="twcontacts_photo">Contacts photos</string>
	<string name="twcontacts_contacts_call_btn">Contacts list call buttons</string>
	<string name="twcontacts_logs_call_btn">Logs list call buttons</string>
	<string name="glory_twbrowser">GloryROM TW Browser CSC Features</string>
	<string name="twbrowser_exit_option">Exit browser option</string>
	<string name="twbrowser_exit_prompt">Exit prompt</string>
	<string name="twbrowser_home_menu">Home page option</string>
	<string name="glory_twsettings">GloryROM TW Settings CSC Features</string>
	<string name="twsettings_call_msg_blk">Call/message block menu</string>
	<string name="twsettings_data_reset_password">Factory data reset password</string>
	<string name="twsettings_update_menu">Software update menu</string>
	<string name="csc_off">Disabled</string>
	<string name="csc_on">Enabled</string>
- Now you need to compile SecSettings.apk to create new ids in public.xml file..
- Now decompile the new SecSettings.apk, and go to res\values folder and open public.xml and locate this line:
Code:
    <public type="xml" name="csc_settings" id="[B][COLOR="Red"]0x7f07008e[/COLOR][/B]" />
Remember that id, we will use it later.
- Now go to smali\com\android\settings folder and paste the folder romhack there from resource file.
- Now open the new folder romhack, and open CscSettings.smali
- Search for the method ".method public onCreate(Landroid/os/Bundle;)V" and change the id here to the one in public.xml before:
Code:
const v1, [B][COLOR="Red"]0x7f07008e[/COLOR][/B]

That's all for SecSettings.apk, compile and push to your phone and test it.. You should have extra tab with several check boxes inside but still not functioned yet..

Now we need to add check box listeners for each csc feature in different apks...


N.B:
I have put several comments on CscSettings.smali, so you could extend your csc list in future just by following the comments in the smali and add new values in csc_settings.xml and strings.xml

 

Attachments

  • SecSettings_resources.rar
    13.5 KB · Views: 1,038

majdinj

Senior Member
Nov 25, 2006
980
3,442
AlAhsa
<< 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):
Code:
    .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):
Code:
    .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]
Make sure of v13 is reflecting consta/4 vx, 0x0 flag if you scrolled up at the beginning of the same method which includes this csc feature... see here to understand:
Code:
.method protected onCreate(Landroid/os/Bundle;)V
    .registers 16
    .param p1, "savedInstanceState"    # Landroid/os/Bundle;

    .prologue
    [B][COLOR="Red"]const/4 v13, 0x0[/COLOR][/B]

    const/4 v12, 0x1
- 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:
Code:
[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):
Code:
.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):
Code:
    .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):
Code:
    .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:
Code:
.method goBackOnePageOrQuit()V
    [B][COLOR="Red"].registers 5[/COLOR][/B]

    .prologue
it will be after adding new register like this:
Code:
.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):
Code:
    .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):
Code:
    .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:
Code:
    .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):
Code:
    .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]
Make sure of v2 is reflecting consta/4 vx, 0x0 flag if you scrolled up at the beginning of the same method which includes this csc feature... see here to understand:
Code:
.method public updateMenuState(Lcom/android/browser/Tab;Landroid/view/Menu;)V
    .registers 14

    .prologue
    const v10, 0x7f0d0155

    const v9, 0x7f0d0150

    const v8, 0x7f0d0156

    const/4 v1, 0x1

    [B][COLOR="Red"]const/4 v2, 0x0[/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:
Code:
    .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
Make sure of v2 is reflecting consta/4 vx, 0x0 flag if you scroll up at the beginning of the same method which includes this csc feature... see here to understand:
Code:
.method private updateHeaderList(Ljava/util/List;)V
    .registers 10
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List",
            "<",
            "Landroid/preference/PreferenceActivity$Header;",
            ">;)V"
        }
    .end annotation

    .prologue
    const/4 v4, 0x1

    [B][COLOR="Red"]const/4 v2, 0x0[/COLOR][/B]
- 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:
Code:
    :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):
Code:
    .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]
Make sure of v13 is reflecting consta/4 vx, 0x0 flag if you scrolled up at the beginning of the same method which includes this csc feature... see here to understand:
Code:
.method private createPreferenceHierarchy()Landroid/preference/PreferenceScreen;
    .registers 16

    .prologue
    const v12, 0x7f09001d

    const/4 v14, 0x1

    [B][COLOR="Red"]const/4 v13, 0x0[/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):
Code:
    .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,,

 

ildar2099

Senior Member
Apr 24, 2013
55
4
You wrote that goto different on different Rom. And how to learn how to insert "goto" here?

:cond_2b7
move v0, v1

goto/16 :goto_55

:cond_majdinj
invoke-interface {p1, v0}, Ljava/util/List;->remove(Ljava/lang/Object;)Z

goto/16 :goto_23
.end method
 

majdinj

Senior Member
Nov 25, 2006
980
3,442
AlAhsa
You wrote that goto different on different Rom. And how to learn how to insert "goto" here?

:cond_2b7
move v0, v1

goto/16 :goto_55

:cond_majdinj
invoke-interface {p1, v0}, Ljava/util/List;->remove(Ljava/lang/Object;)Z

goto/16 :goto_23
.end method

The code for "CscFeature_Setting_EnableMenuBlockCallMsg" in Settings.smali before editing is looked like this:
Code:
    .line 596
    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

    if-nez v3, :cond_23

    .line 598
    invoke-interface {p1, v0}, Ljava/util/List;->remove(Ljava/lang/Object;)Z

    goto/16 :goto_23
Usually the condition values (cond_xxx), goto values (goto_xxx) will differ according to ROM firmware, device or compiler used.
After you made all changes to this code, copy the last 2 lines and paste them at the end of the method. Here the last 2 lines are:
Code:
    .line 596
    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

    if-nez v3, :cond_23

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

    goto/16 :goto_[COLOR="Red"]23[/COLOR][/COLOR][/B]
Whatever goto_value you have, just copy it..!!
And to call these 2 lines, add the condition definition line before these 2 lines, so it can be called by your new line "if-eqz v3, :cond_majdinj". So it will be like this at the end:
Code:
    :cond_majdinj
    invoke-interface {p1, v0}, Ljava/util/List;->remove(Ljava/lang/Object;)Z

    goto/16 :goto_[B][COLOR="Red"]23[/COLOR][/B]
.end method

And sorry for late response,, I got things to do here buddy ;)

Cheers,,,


 
  • Like
Reactions: ildar2099

ildar2099

Senior Member
Apr 24, 2013
55
4
The code for "CscFeature_Setting_EnableMenuBlockCallMsg" in Settings.smali before editing is looked like this:
Code:
    .line 596
    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

    if-nez v3, :cond_23

    .line 598
    invoke-interface {p1, v0}, Ljava/util/List;->remove(Ljava/lang/Object;)Z

    goto/16 :goto_23
Usually the condition values (cond_xxx), goto values (goto_xxx) will differ according to ROM firmware, device or compiler used.
After you made all changes to this code, copy the last 2 lines and paste them at the end of the method. Here the last 2 lines are:
Code:
    .line 596
    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

    if-nez v3, :cond_23

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

    goto/16 :goto_[COLOR="Red"]23[/COLOR][/COLOR][/B]
Whatever goto_value you have, just copy it..!!
And to call these 2 lines, add the condition definition line before these 2 lines, so it can be called by your new line "if-eqz v3, :cond_majdinj". So it will be like this at the end:
Code:
    :cond_majdinj
    invoke-interface {p1, v0}, Ljava/util/List;->remove(Ljava/lang/Object;)Z

    goto/16 :goto_[B][COLOR="Red"]23[/COLOR][/B]
.end method

And sorry for late response,, I got things to do here buddy ;)

Cheers,,,



happened, but does not work
 

tkari4

Senior Member
Jan 24, 2010
2,231
6,982
This mod working on my device, but how to make checked by default? :confused:

android:defaultValue="true"

For example...

before:
Code:
<CheckBoxPreference android:title="@string/twsettings_call_msg_blk" android:key="call_message_block" android:summaryOn="@string/csc_on" android:summaryOff="@string/csc_off" />

after:
Code:
<CheckBoxPreference android:title="@string/twsettings_call_msg_blk" android:key="call_message_block" [COLOR="Blue"]android:defaultValue="true"[/COLOR] android:summaryOn="@string/csc_on" android:summaryOff="@string/csc_off" />
 
  • Like
Reactions: Kamy and bamzzz

Top Liked Posts

  • There are no posts matching your filters.
  • 22
    << 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):
    Code:
        .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):
    Code:
        .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]
    Make sure of v13 is reflecting consta/4 vx, 0x0 flag if you scrolled up at the beginning of the same method which includes this csc feature... see here to understand:
    Code:
    .method protected onCreate(Landroid/os/Bundle;)V
        .registers 16
        .param p1, "savedInstanceState"    # Landroid/os/Bundle;
    
        .prologue
        [B][COLOR="Red"]const/4 v13, 0x0[/COLOR][/B]
    
        const/4 v12, 0x1
    - 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:
    Code:
    [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):
    Code:
    .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):
    Code:
        .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):
    Code:
        .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:
    Code:
    .method goBackOnePageOrQuit()V
        [B][COLOR="Red"].registers 5[/COLOR][/B]
    
        .prologue
    it will be after adding new register like this:
    Code:
    .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):
    Code:
        .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):
    Code:
        .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:
    Code:
        .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):
    Code:
        .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]
    Make sure of v2 is reflecting consta/4 vx, 0x0 flag if you scrolled up at the beginning of the same method which includes this csc feature... see here to understand:
    Code:
    .method public updateMenuState(Lcom/android/browser/Tab;Landroid/view/Menu;)V
        .registers 14
    
        .prologue
        const v10, 0x7f0d0155
    
        const v9, 0x7f0d0150
    
        const v8, 0x7f0d0156
    
        const/4 v1, 0x1
    
        [B][COLOR="Red"]const/4 v2, 0x0[/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:
    Code:
        .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
    Make sure of v2 is reflecting consta/4 vx, 0x0 flag if you scroll up at the beginning of the same method which includes this csc feature... see here to understand:
    Code:
    .method private updateHeaderList(Ljava/util/List;)V
        .registers 10
        .annotation system Ldalvik/annotation/Signature;
            value = {
                "(",
                "Ljava/util/List",
                "<",
                "Landroid/preference/PreferenceActivity$Header;",
                ">;)V"
            }
        .end annotation
    
        .prologue
        const/4 v4, 0x1
    
        [B][COLOR="Red"]const/4 v2, 0x0[/COLOR][/B]
    - 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:
    Code:
        :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):
    Code:
        .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]
    Make sure of v13 is reflecting consta/4 vx, 0x0 flag if you scrolled up at the beginning of the same method which includes this csc feature... see here to understand:
    Code:
    .method private createPreferenceHierarchy()Landroid/preference/PreferenceScreen;
        .registers 16
    
        .prologue
        const v12, 0x7f09001d
    
        const/4 v14, 0x1
    
        [B][COLOR="Red"]const/4 v13, 0x0[/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):
    Code:
        .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,,

    21
    Hi guys,,
    Today's tutorial will make us able to create new tab in settings menu by which we could control our ROM CSC features by toggles..


    86m3.png
    pb5u.png
    qah7.png


    This tutorial will be divided into 2 main sections:
    Section #1: Creating new tab in settings menu (ROM CSC features controller)
    Section #2: Creating toggle listener in apk that contains the csc feature that we want to control

    So let's start.. :eek:

    << Section #1: Creating new tab in settings menu (ROM CSC features controller) >>​

    First download the resources from attachment bellow.

    - Decompile SecSettings.apk
    - Navigate to res\xml folder and open settings_headers.xml and add this line wherever you want the new tab to appear in your settings menu later on:
    Code:
    <header android:icon="@drawable/ic_csc_controller" android:id="@id/csc_control" android:title="@string/csc_features_controller" android:fragment="com.android.settings.romhack.CscSettings" />
    - Still in the same res\xml folder, paste csc_settings.xml there from resources file.
    - Navigate to res\drawable-xhdpi folder and paste ic_csc_controller.png from resource file there.
    - Navigate to res\values folder and open ids.xml file and add this line at the end:
    Code:
    <item type="id" name="csc_control">false</item>
    - Navigate to res\values folder and open strings.xml and add these lines:
    Code:
    	<string name="csc_features_controller">ROM CSC features controller</string>
    	<string name="how_csc_use">Tip:</string>
    	<string name="how_csc_use_summary">After you made your choices, you may need to restart your device in order to load some csc features changes</string>
    	<string name="glory_twlauncher">GloryROM TW Launcher CSC Features</string>
    	<string name="twlauncher_tilt">Transition tilt effect</string>
    	<string name="twlauncher_page_rotation">Home screens looping</string>
    	<string name="twlauncher_edit_mode">Home screen edit menu</string>	
    	<string name="glory_twcontacts">GloryROM TW Contacts CSC Features</string>
    	<string name="twcontacts_photo">Contacts photos</string>
    	<string name="twcontacts_contacts_call_btn">Contacts list call buttons</string>
    	<string name="twcontacts_logs_call_btn">Logs list call buttons</string>
    	<string name="glory_twbrowser">GloryROM TW Browser CSC Features</string>
    	<string name="twbrowser_exit_option">Exit browser option</string>
    	<string name="twbrowser_exit_prompt">Exit prompt</string>
    	<string name="twbrowser_home_menu">Home page option</string>
    	<string name="glory_twsettings">GloryROM TW Settings CSC Features</string>
    	<string name="twsettings_call_msg_blk">Call/message block menu</string>
    	<string name="twsettings_data_reset_password">Factory data reset password</string>
    	<string name="twsettings_update_menu">Software update menu</string>
    	<string name="csc_off">Disabled</string>
    	<string name="csc_on">Enabled</string>
    - Now you need to compile SecSettings.apk to create new ids in public.xml file..
    - Now decompile the new SecSettings.apk, and go to res\values folder and open public.xml and locate this line:
    Code:
        <public type="xml" name="csc_settings" id="[B][COLOR="Red"]0x7f07008e[/COLOR][/B]" />
    Remember that id, we will use it later.
    - Now go to smali\com\android\settings folder and paste the folder romhack there from resource file.
    - Now open the new folder romhack, and open CscSettings.smali
    - Search for the method ".method public onCreate(Landroid/os/Bundle;)V" and change the id here to the one in public.xml before:
    Code:
    const v1, [B][COLOR="Red"]0x7f07008e[/COLOR][/B]

    That's all for SecSettings.apk, compile and push to your phone and test it.. You should have extra tab with several check boxes inside but still not functioned yet..

    Now we need to add check box listeners for each csc feature in different apks...


    N.B:
    I have put several comments on CscSettings.smali, so you could extend your csc list in future just by following the comments in the smali and add new values in csc_settings.xml and strings.xml

    2
    This mod working on my device, but how to make checked by default? :confused:

    android:defaultValue="true"

    For example...

    before:
    Code:
    <CheckBoxPreference android:title="@string/twsettings_call_msg_blk" android:key="call_message_block" android:summaryOn="@string/csc_on" android:summaryOff="@string/csc_off" />

    after:
    Code:
    <CheckBoxPreference android:title="@string/twsettings_call_msg_blk" android:key="call_message_block" [COLOR="Blue"]android:defaultValue="true"[/COLOR] android:summaryOn="@string/csc_on" android:summaryOff="@string/csc_off" />
    1
    If you can affect, I found all the csc functions in framework2.jar
    Decompile and go to com\sec\android\app ;)