[MOD][GUIDE] ICS+ Tabbed settings(MIUI Like)

BigSplit

Senior Member
Jan 7, 2012
549
818
0


So I came across this thread a week or more back and implemented it in my ICS rom, but I wasn't happy with it(various reasons but mostly because it is gesture based). So I abandoned it. Fast forward a couple days, jumping from project to project, idea to idea and I somehow ended up porting the latest ICS version of ShenduOS. Then boom, the settings app was *almost* exactly what I wanted. It featured a more natural swiping from tab to tab, similar to most launchers.

So I stripped the code for the tabs from the shendu settings app, stripped that code of any Shendu specific code and re-coded portions of the smali code so I could add it to the settings app of the ICS rom I use as my daily driver. What I ended up with is what seems to be something thats pretty generic and not rom specific.


So now I share with you what *should* work with any ICS+ rom. This guide will be very similar to the one I linked to above.

THIS SHOULD ALSO WORK ON OTHER DEVICES BUT I CANNOT TEST TO BE SURE

Prerequisites:
-experience decompiling/recompiling apk's with APKTool
-experience signing apks
-experience editing/theming apks

I will not go into any of the above any more then just saying when to preform certain actions......

GUIDE:

1. First you will need to decompile the Settings.apk from your ROM with apktool

2. Download the Settings.zip I attached to this post

3. Unzip the Settings.zip and copy the 'res' and 'smali' folders to your decompiled Settings.apk folder(merge with existing folders of the same names)

4. Open 'res/values/strings.xml' from the decompiled settings apk in your favorite text editor and add the following to the end of the list of strings...
Code:
    <string name="personalized_setting">Personal</string>
    <string name="device_setting">System</string>
    <string name="app_setting">Applications</string>
5. Open 'res/values/ids.xml' from the decompiled settings apk in your favorite text editor and add the following to the end of the list of ID's
Code:
    <item type="id" name="linearLayout1">false</item>
    <item type="id" name="personalized_tab">false</item>
    <item type="id" name="device_tab">false</item>
    <item type="id" name="app_tab">false</item>
    <item type="id" name="cursor">false</item>
    <item type="id" name="vPager">false</item>
6.Now you must recompile the settings.apk. This is because APKtool will give resource ID's to certain resources we added during this process, we need these generated ID's in the following steps because the code access's some resources directly by the ID's.

7. Decompile the Newly recompiled APK again, from here on out I will assume your editing this newly recompiled/decompiled version.

8. With this step it is very easy to make a typo, so please make sure you are paying Extra attention to details during this step.
-Open up 'res/values/public.xml' and you will find lines similar to the following.
Code:
<public type="id" name="[COLOR="Red"]vPager[/COLOR]" id="[U]0x7f08022a[/U]" />
-Below I will give you a list of .smali file names, each file is located in the 'smali/com/android/settings/' folder of your decompiled settings.apk
- Each file name will be followed by a line similar to above, you need to search the smali files for the ID(underlined in the example above)
- Then search the public.xml I told you to open above for the name for each line(red in example above)
- Replace the ID in the smali file with the one you located in the public.xml
Code:
!--MainSettings.smali--!
    <public type="id" name="vPager" id="0x7f08022a" />
    <public type="id" name="cursor" id="0x7f080229" />
    <public type="id" name="app_tab" id="0x7f080168" />
    <public type="id" name="device_tab" id="0x7f080228" />
    <public type="id" name="personalized_tab" id="0x7f080227" />
    <public type="layout" name="mainsetting" id="0x7f040090" />
	
	
!--DeviceSettings.smali--!
    <public type="xml" name="device_settings_headers" id="0x7f050051" />

	
!--AppSettings.smali--!
    <public type="xml" name="app_settings_headers" id="0x7f050052" />
	
!--PersonalSettings.smali--!
    <public type="xml" name="personal_settings_headers" id="0x7f050053" />
9. Now open up the 'AndroidManifest.xml' of your decompiled settings.apk in a text editor.
-Find a section similar to the below....
Code:
<activity android:label="@string/settings_label_launcher" android:name="Settings" android:taskAffinity="com.android.settings" android:clearTaskOnLaunch="true" android:launchMode="singleTop">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.settings.SETTINGS" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
The important parts you are looking for are 'name="Settings" and the 'android.intent.category.LAUNCHER' lines, there *should* only be a single section with these.
Change this section to the below:
Code:
        <activity android:label="@string/settings_label_launcher" android:name="Settings">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
Directly above that section copy/paste the following code:
Code:
<activity android:name="MainSetting" android:theme="@android:style/Theme.NoTitleBar"  android:taskAffinity="com.android.settings" android:launchMode="singleTask">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.settings.SETTINGS" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:label="@string/settings_label_launcher" android:name="PersonalSettings" android:taskAffinity="com.android.settings" android:launchMode="singleTask">
            <intent-filter>
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity android:label="@string/settings_label_launcher" android:name="DeviceSettings" android:taskAffinity="com.android.settings" android:launchMode="singleTask">
            <intent-filter>
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity android:label="@string/settings_label_launcher" android:name="AppSettings" android:taskAffinity="com.android.settings" android:launchMode="singleTask">
            <intent-filter>
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
10. You are now done with this round of modifications, its time to recompile the APK. Because this is a system app and we edited AndroidManifest.xml we must sign this recompiled Apk before pushing it to the system. You can try using any of the keys that come with whatever apk signing tool you use, but you will more then likely end up with a Settings.apk that wont show as being installed. To overcome this on ASOP roms I download and sign system apks with the platfrom keys from CyanogenMod's android_build github. If everything goes well and you push the new signed apk to the system, your settings app should now look similar to this when you open it.


11. What you have is 3 tabs with no settings. I left this for you to do, as each rom has its own specific settings options. Most ASOP roms store the main page of settings options in the 'res/xml/settings_headers.xml'. Copy/paste/reorganize each of these options into the 'app_settings_headers.xml', 'device_settings_headers.xml' and 'personal_settings_headers.xml' files which are also located in 'res/xml/'.

12. After all is said and done above, you *may* need to edit/theme the 'res/layout/mainsettings.xml' to suit your roms specific look.


NOTE:
If you are attempting this on a Non-ASOP Rom or are having trouble you may need to follow these additional instructions



And to finally end this, here are some screenshots where I added this feature to the settings.apk of our twistedmodICS rom by pwn.


 

Attachments

Last edited:

Nathan Ali Ashari

Senior Member
Jan 31, 2013
151
327
0
jakarta
hello BigSplit.....after I followed your tutorial. I get this in apktool

C: \ Documents and Settings \ server \ Desktop \ ICS Apktool> apkto
I: Checking Whether sources has changed ...
I: Smaling ...
I: Checking Whether resources has changed ...
I: Building resources ...
AAPT: warning: string 'dsds_dsds_device_status' has no def
\ Documents and Settings \ server \ Desktop \ ICS Apktool \ Settings
AAPT: warning: string 'dsdsdevice_status' has no default t
ents and Settings \ server \ Desktop \ ICS Apktool \ Settings \ res;
I: Building apk file ...

C: \ Documents and Settings \ server \ Desktop \ ICS Apktool> apkto
I: Checking Whether sources has changed ...
I: Checking Whether resources has changed ...
I: Building apk file ...

C: \ Documents and Settings \ server \ Desktop \ ICS Apktool>

and I try to push my settings and my settings disappeared after reboot. help me to fix this problem .. thks
 

BigSplit

Senior Member
Jan 7, 2012
549
818
0
thanks Bro for the guide :)

but I'm still confuse with this

Quote :
"To overcome this on ASOP roms I
download and sign system apks with the
platfrom keys from CyanogenMod's
android_build github. "

can you guide that too ?

Thanks in advance :)
Google for a guide about signing apks. Most tutorials will have you sign apks with test keys, I gave you a link in that sentence you quoted directly to the files I said you should use in signing instead.
 

CNexus

Senior Member
May 17, 2012
9,009
13,993
263
~/android
Google for a guide about signing apks. Most tutorials will have you sign apks with test keys, I gave you a link in that sentence you quoted directly to the files I said you should use in signing instead.
thanks Bro for the guide :)

but I'm still confuse with this

Quote :
"To overcome this on ASOP roms I
download and sign system apks with the
platfrom keys from CyanogenMod's
android_build github. "

can you guide that too ?

Thanks in advance :)
Dont worry, I got you

HOW TO SIGN APKS/ZIPS
Note: Java needs to be installed for this to work

1. Download the signapk.zip file from my mediafire

http://www.mediafire.com/#8gjgusqbct8q2

2. Extract it and read the "usage.txt"

3. Download the .pk8 and .pem files that BigSplit linked to and copy those into the extracted "signapk" directory

4. Open a command prompt window in the "signapk" extracted directory (Shift+RightClick > Open command prompt here)

5. Run the command in the "usage.txt", substituting your downloaded ".pem" file and your downloaded ".pk8" file and the Settings.apk file in the appropriate places

Command should look something like this

Code:
java -jar signapk.jar downloaded-certificate-HERE.pem download-key-HERE.pk8 SettingsAppHere.apk Settings-signed.apk
The "settings-signed.apk" part can be changed to anything, thats just the signed output file

"SettingsAppHere.apk" is the Settings app you are modding

Sent from my PG06100
 
Last edited:

Adi_aishiteru

Senior Member
Apr 21, 2012
558
688
0
Bandar Lampung
Dont worry, I got you

HOW TO SIGN APKS/ZIPS
Note: Java needs to be installed for this to work

1. Download the signapk.zip file from my mediafire

http://www.mediafire.com/#8gjgusqbct8q2

2. Extract it and read the "usage.txt"

3. Download the .pk8 and .pem files that BigSplit linked to and copy those into the extracted "signapk" directory

4. Open a command prompt window in the "signapk" extracted directory (Shift+RightClick > Open command prompt here)

5. Run the command in the "usage.txt", substituting your downloaded ".pem" file and your downloaded ".pk8" file and the Settings.apk file in the appropriate places

Command should look something like this

Code:
java -jar signapk.jar downloaded-certificate-HERE.pem download-key-HERE.pk8 SettingsAppHere.apk Settings-signed.apk
The "settings-signed.apk" part can be changed to anything, thats just the signed output file

"SettingsAppHere.apk" is the Settings app you are modding

Sent from my PG06100
How about ApkMultitools ?
I ussualy use ApkMultitools to decompile/compile/sign.apk

Sent from my GT-I8150 using xda app-developers app
 

BigSplit

Senior Member
Jan 7, 2012
549
818
0
Sir ... Can you make this for me. I always fail at boot time ... my settings are always lost. probably because I could not find - <public type="layout" name="mainsetting" id="0x7f040090" /> in public.xml,
im st23i 4.0.4. thks sir ..
So you are on a stock firmware? If so, I would guess that the other packages are not signed with the same keys I linked to since its a stock ROM and not asop. The only thing you can do then is to attempt to re-sign every system apk/jar with a new signature(which I've never been successful at doing).

And the mainsetting will only show up in the public xml AFTER you compile it, then decompile it again. The only reason it wouldnt show up is if you are not placing the files i posted in the correct directories or not recompiling/decompiling when I said to.
 
Last edited: