[GUIDE][4.x] Add items to Settings.apk / Change Layout

Search This thread

Quinny899

Recognized Developer / Recognized Contributor
Jan 26, 2011
9,427
8,752
26
Salford, Greater Manchester, UK
quinny898.co.uk
Welcome to this mini guide of how to add items and change the layout of the Settings.apk

Each part of this guide will be rated on how hard it is for the general person. (Out of 5 stars, 5 being hardest)

So, without further ado, here we go:

Stuff You'll Need for the guide
Apktool (And therefore Java too)
A suitable Text Editor for your OS. For Windows, Notepad++ is best, for Linux I recommend Geany In this guide I will be using Geany on Ubuntu
Zipsigner on your device (for ease of use)
adb
NOTE: If you are using Linux, run everything, including apktool and your text editor/file manager as ROOT/SUDO

Do this first: Decompiling Settings.apk
Difficulty: ★★☆☆☆
1.) Open a command window in a suitable location, where apktool.jar is also located
1.) Pull your apk from your device
Code:
adb pull /system/app/Settings.apk
2.) Pull and install the framework from your device to apktool
Code:
adb pull /system/framework/framework-res.apk
Code:
java -jar apktool.jar if framework-res.apk
3.) Decompile your Settings.apk
Code:
java -jar apktool.jar d -s Settings.apk
(No source is needed)

Editing the Strings of your Settings apk
Difficulty: ★★☆☆☆

1.) Open a file manager and go to where the Settings has decompiled to
2.) Locate and open res/xml/settings_headers.xml in your text editor
3.) Now you can find the header you wish to edit. In this one we will change "Developer settings" to "Noobs keep out"
We need to change the string referenced in this code:
Code:
<header android:icon= [user=3944923]@drawab[/user]le/ic_settings_development" android:id="@id/development_settings" android:title="@string/development_settings_title" android:fragment="com.android.settings.DevelopmentSettings" />
The android:title reference is what we need to change, so open your Strings.xml, for your language (if it's not in there, open the default one)
Find (use Ctrl+F) the string that we earlier found, so I would search for "development_settings_title"
Code:
<string name="development_settings_title">Developer options</string>
Change the bit between the > and the < to what you want:
Code:
<string name="development_settings_title">Noobs keep out</string>
4.) Save and proceed to recompiling


Editing the Settings option's icon
Difficulty: ★★★☆☆

1.) Open a file manager and go to where the Settings has decompiled to
2.) Locate and open res/xml/settings_headers.xml in your text editor
3.) Locate the header you wish to change. In this one we will edit the "Development Settings" to have the "ic_settings_advanced" icon (included in CM based ROMs only)
4.) Find the header you want to edit, we want to edit this one:
Code:
<header android:icon= [user=3944923]@drawab[/user]le/ic_settings_development"  android:id="@id/development_settings"  android:title="@string/development_settings_title"  android:fragment="com.android.settings.DevelopmentSettings" />
5.) Edit the android:icon location to the icon you wish to have. The icons are in res/drawable-hdpi, mdpi, ldpi and xhdpi (depending on ROM)
We want to change it to ic_settings_advanced, so ours will look like:
Code:
<header android:icon= [user=3944923]@drawab[/user]le/ic_settings_advanced" android:id="@id/development_settings" android:title="@string/development_settings_title" android:fragment="com.android.settings.DevelopmentSettings" />
6.) If you don't want to add icons, proceed to recompiling
7.) Adding icons:
To get icons that fit, see this zip from Google: Download
i) Find the icon you wish to add, make sure it fits your screen's icon resolution (can be found with the dimension of current ic_settings icons in the apk)
ii) Copy it to the correct folder (hdpi, mdpi, xhdpi, ldpi)
iii) Name it something similar (ic_settings_<name>)
iv) Refer to it in the xml, using @drawable/ic_settings_<name>
8.) Proceed to recompiling


Adding options to the settings headers
Difficulty: ★★★★☆

Note: In adding settings you can open things such as GooManager for updates quickly and easily from the menu with "About phone" and "Developer settings" in it
1.) Open your decompiled settings_headers.xml
2.) Locate where you want to add an option, and add a new line:
Add this code:
Code:
<header android:icon= [user=3944923]@drawab[/user]le/ic_settings_name" android:id="@id/id" android:title="@string/title">
        <intent android:targetPackage="pkgName" android:action="android.intent.action.MAIN" android:targetClass="pkgName.Activity" />
    </header>
3.) What to change:
Change android:icon to the icon you want (for more info see "adding/changing icons")
Add a title to values/strings.xml and reference it in android:title
Change the android:targetPackage to the package name of the app you want to open. This can be found in the AndroidManifest of that particular app
Change the android:targetClass to the package name, followed by the activity you want to open, again found in that particular app's AndroidManifest
Change the android:id to an id that you can add in values/ids.xml (or delete it if you want)
4.) Proceed to recompiling


Adding dividers to settings
Difficulty: ★★★☆☆

Adding to the main settings screen:
1.) Open your settings_headers.xml
2.) Locate where you want to add a divider
3.) Add the following code:
Code:
<header android:id="@id/id" android:title="@string/title" />
Stuff to change:
Change the android:id to one that you added in values/ids.xml (or delete it if you want)
Change the android:title to your title in strings.xml
4.) If that's all you want, proceed to recompiling
Adding to the submenus:
1.) Open the submenu that you want to edit's xml (they're quite obvious of which one is which)
2.) Locate where you want to add a divider
3.) Add the following code:
At the start of where you want to have the divider
Code:
<PreferenceScreen android:title="@string/title" android:key="key">
Just before the next divider:
Code:
</PreferenceScreen>
Stuff to change:
Change the android:title to your title in strings.xml
Change the key to whatever you want
4.) Proceed to recompiling

Reordering Settings
Difficulty: ★★☆☆☆

1.) Open either the settings_headers.xml or a submenu, the process is the same
2.) Cut and paste the different options to your desired order
3.) That's all, proceed to recompiling


Adding items to submenus
Want to add a "Credits" option to your "About device" menu? This is what you need
Difficulty: ★★★☆☆

1.) Open your submenu xml you want (device_info_settings.xml is the about device submenu)
2.) Find your desired location of your new option and make a new line
3.) Paste the following code:
Code:
<Preference android:title="@string/title" android:key="key" android:summary="@string/summary" style="?android:preferenceInformationStyle" />
Stuff to change:
Change android:title to the title you added in values/strings.xml
Change android:key to whatever you want
Change android:summary to the longer text that you want that you added to values/strings.xml
4.) Proceed to recompiling


Bonus: Forcing "Developer settings" to be available by default on 4.2
Difficulty: ★★☆☆☆

1.) Open the settings_headers.xml
2.) Locate the following code:
Code:
<header android:icon= [user=3944923]@drawab[/user]le/ic_settings_development" android:id="@id/development_settings" android:title="@string/development_settings_title" android:fragment="com.android.settings.DevelopmentSettings" />
3.) Change the id from development_settings to development_settings_force
Code:
<header android:icon= [user=3944923]@drawab[/user]le/ic_settings_development"  android:id="@id/development_settings_force"  android:title="@string/development_settings_title"  android:fragment="com.android.settings.DevelopmentSettings" />
4.) Open values/ids.xml
5.) Add the following line:
Code:
<item type="id" name="development_settings_force">false</item>
6.) Proceed to recompiling


Do this last: Recompiling
Difficulty: ★★☆☆☆
1.) Re-open the command window that you used to decompile, in the same location
2.) Run the following code:
Code:
java -jar apktool.jar b Settings
3.) Push the new, unsigned apk to your device:
Code:
adb push Settings/dist/Settings.apk /sdcard/
4.) On the device, open Zipsigner and select the Settings.apk using the in/out button
5.) On the dropdown, select "platform"
6.) Press sign
7.) When it's done, run the following codes in the command window on the PC:
(Note: Some people might need to run 'adb root' first)
Code:
adb remount
Code:
adb shell cp /system/app/Settings.apk /system/app/Settings.bak
Code:
adb shell cp /sdcard/Settings-signed.apk /system/app/Settings.apk
8.) Reboot your device, you are done

Troubleshooting:
My apk doesn't recomplile!
Look in the command window, it should tell you where the error is, and try to fix it. If you can't, post the error log here and I/someone else will try to help

My new settings doesn't appear!
Did you sign it properly? Try that again. Else, you're out of luck

Something else is wrong!!!!1111
Leave a reply and wait, don't spam, and someone (if not me) will try to help

Screenshots for inspiration:

attachment.php

What I did:
Added an option to update, opens GooManager, using ic_action_mark from the zip from Google
Added an option that opens SuperSU, icon from the newer Settings.apk in ParanoidAndroid
Changed the title and icon of Developer Settings, as well as forcing it to always be there
Reordered the developer settings, and added different dividers
 
Last edited:

Plays2

Senior Member
Sep 4, 2011
266
123
Peachtree City
What the heck does this mean?


Code:
Plays2s-iMac:Folder Plays2$ java -jar apktool.jar b Settings
Exception in thread "main" brut.androlib.AndrolibException: brut.directory.DirectoryException: java.util.zip.ZipException: error in opening zip file
	at brut.androlib.Androlib.readMetaFile(Androlib.java:164)
	at brut.androlib.Androlib.build(Androlib.java:183)
	at brut.androlib.Androlib.build(Androlib.java:176)
	at brut.apktool.Main.cmdBuild(Main.java:228)
	at brut.apktool.Main.main(Main.java:79)
Caused by: brut.directory.DirectoryException: java.util.zip.ZipException: error in opening zip file
	at brut.directory.ZipRODirectory.<init>(ZipRODirectory.java:55)
	at brut.directory.ZipRODirectory.<init>(ZipRODirectory.java:38)
	at brut.androlib.res.util.ExtFile.getDirectory(ExtFile.java:55)
	at brut.androlib.Androlib.readMetaFile(Androlib.java:160)
	... 4 more
Caused by: java.util.zip.ZipException: error in opening zip file
	at java.util.zip.ZipFile.open(Native Method)
	at java.util.zip.ZipFile.<init>(ZipFile.java:127)
	at java.util.zip.ZipFile.<init>(ZipFile.java:143)
	at brut.directory.ZipRODirectory.<init>(ZipRODirectory.java:53)
	... 7 more

I'm on mac btw
 

Quinny899

Recognized Developer / Recognized Contributor
Jan 26, 2011
9,427
8,752
26
Salford, Greater Manchester, UK
quinny898.co.uk
Re: [GUIDE][4.0+] Add items to Settings.apk / Change Layout

What the heck does this mean?


Code:
Plays2s-iMac:Folder Plays2$ java -jar apktool.jar b Settings
Exception in thread "main" brut.androlib.AndrolibException: brut.directory.DirectoryException: java.util.zip.ZipException: error in opening zip file
at brut.androlib.Androlib.readMetaFile(Androlib.java:164)
at brut.androlib.Androlib.build(Androlib.java:183)
at brut.androlib.Androlib.build(Androlib.java:176)
at brut.apktool.Main.cmdBuild(Main.java:228)
at brut.apktool.Main.main(Main.java:79)
Caused by: brut.directory.DirectoryException: java.util.zip.ZipException: error in opening zip file
at brut.directory.ZipRODirectory.<init>(ZipRODirectory.java:55)
at brut.directory.ZipRODirectory.<init>(ZipRODirectory.java:38)
at brut.androlib.res.util.ExtFile.getDirectory(ExtFile.java:55)
at brut.androlib.Androlib.readMetaFile(Androlib.java:160)
... 4 more
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:127)
at java.util.zip.ZipFile.<init>(ZipFile.java:143)
at brut.directory.ZipRODirectory.<init>(ZipRODirectory.java:53)
... 7 more

I'm on mac btw

It can't open the apk for some reason, check it's there and not corrupted

Sent from my ARCHOS 80G9 using Tapatalk HD
 

russell664

Senior Member
Dec 2, 2010
1,183
2,313
28
Somewhere you can't imagine...
Hey I thought I would ask this here, i have extra options etc... in my AOSP settings. However, when I add the same strings to my HTC settings.apk, nothing ever shows up do you guys have any suggestions?

Thanks in advance. :)
 

forzaakill

New member
Jun 28, 2012
2
0
Code:
C:\Users\Hakan\Desktop\android compile\esas>java -jar apktool.jar b Settings
I: Checking whether resources has changed...
I: Building resources...
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.Androl
ibException: brut.common.BrutException: could not exec command: [aapt, p, --min-
sdk-version, 15, --target-sdk-version, 15, -F, C:\Users\Hakan\AppData\Local\Temp
\APKTOOL4787001507934327803.tmp, -0, arsc, -I, C:\Users\Hakan\apktool\framework\
1.apk, -S, C:\Users\Hakan\Desktop\android compile\esas\Settings\res, -M, C:\User
s\Hakan\Desktop\android compile\esas\Settings\AndroidManifest.xml]
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:358)
        at brut.androlib.Androlib.buildResources(Androlib.java:283)
        at brut.androlib.Androlib.build(Androlib.java:206)
        at brut.androlib.Androlib.build(Androlib.java:176)
        at brut.apktool.Main.cmdBuild(Main.java:228)
        at brut.apktool.Main.main(Main.java:79)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not
 exec command: [aapt, p, --min-sdk-version, 15, --target-sdk-version, 15, -F, C:
\Users\Hakan\AppData\Local\Temp\APKTOOL4787001507934327803.tmp, -0, arsc, -I, C:
\Users\Hakan\apktool\framework\1.apk, -S, C:\Users\Hakan\Desktop\android compile
\esas\Settings\res, -M, C:\Users\Hakan\Desktop\android compile\esas\Settings\And
roidManifest.xml]
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:357)
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:336)
        ... 5 more
Caused by: brut.common.BrutException: could not exec command: [aapt, p, --min-sd
k-version, 15, --target-sdk-version, 15, -F, C:\Users\Hakan\AppData\Local\Temp\A
PKTOOL4787001507934327803.tmp, -0, arsc, -I, C:\Users\Hakan\apktool\framework\1.
apk, -S, C:\Users\Hakan\Desktop\android compile\esas\Settings\res, -M, C:\Users\
Hakan\Desktop\android compile\esas\Settings\AndroidManifest.xml]
        at brut.util.OS.exec(OS.java:93)
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:355)
        ... 6 more
Caused by: java.io.IOException: Cannot run program "aapt": CreateProcess error=2
, [B]Sistem belirtilen dosyay? bulam?yor[/B]
        at java.lang.ProcessBuilder.start(Unknown Source)
        at java.lang.Runtime.exec(Unknown Source)
        at java.lang.Runtime.exec(Unknown Source)
        at brut.util.OS.exec(OS.java:84)
        ... 7 more
Caused by: java.io.IOException: CreateProcess error=2, [B]Sistem belirtilen dosyay?
 bulam?yor[/B]
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(Unknown Source)
        at java.lang.ProcessImpl.start(Unknown Source)
        ... 11 more

C:\Users\Hakan\Desktop\android compile\esas>


Means system cant find the file in English. What should I do?
 

Diaz1999

Senior Member
Oct 13, 2012
696
584
HEX 5375726162617961
Google Pixel 2
Code:
C:\Users\Hakan\Desktop\android compile\esas>java -jar apktool.jar b Settings
I: Checking whether resources has changed...
I: Building resources...
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.Androl
ibException: brut.common.BrutException: could not exec command: [aapt, p, --min-
sdk-version, 15, --target-sdk-version, 15, -F, C:\Users\Hakan\AppData\Local\Temp
\APKTOOL4787001507934327803.tmp, -0, arsc, -I, C:\Users\Hakan\apktool\framework\
1.apk, -S, C:\Users\Hakan\Desktop\android compile\esas\Settings\res, -M, C:\User
s\Hakan\Desktop\android compile\esas\Settings\AndroidManifest.xml]
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:358)
        at brut.androlib.Androlib.buildResources(Androlib.java:283)
        at brut.androlib.Androlib.build(Androlib.java:206)
        at brut.androlib.Androlib.build(Androlib.java:176)
        at brut.apktool.Main.cmdBuild(Main.java:228)
        at brut.apktool.Main.main(Main.java:79)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not
 exec command: [aapt, p, --min-sdk-version, 15, --target-sdk-version, 15, -F, C:
\Users\Hakan\AppData\Local\Temp\APKTOOL4787001507934327803.tmp, -0, arsc, -I, C:
\Users\Hakan\apktool\framework\1.apk, -S, C:\Users\Hakan\Desktop\android compile
\esas\Settings\res, -M, C:\Users\Hakan\Desktop\android compile\esas\Settings\And
roidManifest.xml]
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:357)
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:336)
        ... 5 more
Caused by: brut.common.BrutException: could not exec command: [aapt, p, --min-sd
k-version, 15, --target-sdk-version, 15, -F, C:\Users\Hakan\AppData\Local\Temp\A
PKTOOL4787001507934327803.tmp, -0, arsc, -I, C:\Users\Hakan\apktool\framework\1.
apk, -S, C:\Users\Hakan\Desktop\android compile\esas\Settings\res, -M, C:\Users\
Hakan\Desktop\android compile\esas\Settings\AndroidManifest.xml]
        at brut.util.OS.exec(OS.java:93)
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:355)
        ... 6 more
Caused by: java.io.IOException: Cannot run program "aapt": CreateProcess error=2
, [B]Sistem belirtilen dosyay? bulam?yor[/B]
        at java.lang.ProcessBuilder.start(Unknown Source)
        at java.lang.Runtime.exec(Unknown Source)
        at java.lang.Runtime.exec(Unknown Source)
        at brut.util.OS.exec(OS.java:84)
        ... 7 more
Caused by: java.io.IOException: CreateProcess error=2, [B]Sistem belirtilen dosyay?
 bulam?yor[/B]
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(Unknown Source)
        at java.lang.ProcessImpl.start(Unknown Source)
        ... 11 more

C:\Users\Hakan\Desktop\android compile\esas>


Means system cant find the file in English. What should I do?

I thought that's your aapt is error :rolleyes:
 

ghpk

Senior Member
Dec 29, 2010
472
132
India
Can this method be used to Remove the "Airplane Mode" Icon I have it under "Notification Drawer"
My phones new 4.1.1 ROM has annoying Airplane Mode button which I accidentially touch many times.
I have following buttons
WIFI, Bluetooth, GPS, Data Conn, Airplane

I have the root access as well as complete flash-able ROM provided by service center.

Any Help ?
 

Diaz1999

Senior Member
Oct 13, 2012
696
584
HEX 5375726162617961
Google Pixel 2
Can this method be used to Remove the "Airplane Mode" Icon I have it under "Notification Drawer"
My phones new 4.1.1 ROM has annoying Airplane Mode button which I accidentially touch many times.
I have following buttons
WIFI, Bluetooth, GPS, Data Conn, Airplane

I have the root access as well as complete flash-able ROM provided by service center.

Any Help ?
Yes you can
 

iWilliBlecha

Senior Member
Feb 7, 2013
237
389
I signed the spk correct and added it to my rom, but after flashing the settings app does not appear! Sadly...
What can I do!
 

mimi_atmam

Senior Member
Apr 18, 2013
85
44
29
New Delhi
www.facebook.com

I decompiled the apk , opened up the settings_headers.xml but there is nothing as such as shown in this thread :( :/ . I am using notepad++ in windows and its showing something like this


Code:
  Œ    è  !          *              
         (   :   D   q   t   ‰   ’   »   î     >  G  {  *  Ç  ð  #  Z  „  ¼  ä    N  u    Å  ò    id title fragment icon action breadCrumbTitle android **http://schemas.android.com/apk/res/android    preference-headers header &&com.android.settings.wifi.WifiSettings 00com.android.settings.bluetooth.BluetoothSettings %%com.android.settings.DataUsageSummary %%com.android.settings.WirelessSettings intent 11com.android.settings.OPERATOR_APPLICATION_SETTING ""com.android.settings.SoundSettings $$com.android.settings.DisplaySettings &&com.android.settings.deviceinfo.Memory 00com.android.settings.fuelgauge.PowerUsageSummary 44com.android.settings.applications.ManageApplications ''com.android.settings.users.UserSettings 55com.android.settings.MANUFACTURER_APPLICATION_SETTING %%com.android.settings.LocationSettings %%com.android.settings.SecuritySettings ??com.android.settings.inputmethod.InputMethodAndLanguageSettings $$com.android.settings.PrivacySettings %%android.settings.ADD_ACCOUNT_SETTINGS %%com.android.settings.DateTimeSettings **com.android.settings.AccessibilitySettings ((com.android.settings.DevelopmentSettings ''com.android.settings.DeviceInfoSettings  €     Ð áã -         ÿÿÿÿ       $      ÿÿÿÿÿÿÿÿ	              L      ÿÿÿÿÿÿÿÿ
                   ÿÿÿÿ  Ø      ÿÿÿÿ          ÿÿÿÿÿÿÿÿ
    t      ÿÿÿÿÿÿÿÿ
                  ÿÿÿÿ  s        ÿÿÿÿ  Ù      ÿÿÿÿ  Ó                     ÿÿÿÿÿÿÿÿ
    t   !   ÿÿÿÿÿÿÿÿ
                  ÿÿÿÿ  b        ÿÿÿÿ  Ú      ÿÿÿÿ  j                  %   ÿÿÿÿÿÿÿÿ
    t   (   ÿÿÿÿÿÿÿÿ
                  ÿÿÿÿ  d        ÿÿÿÿ  Û      ÿÿÿÿ  5      
     
       ,   ÿÿÿÿÿÿÿÿ
    L   /   ÿÿÿÿÿÿÿÿ
                   ÿÿÿÿ  Ü               8   2   ÿÿÿÿÿÿÿÿ                              2   ÿÿÿÿÿÿÿÿ       3   ÿÿÿÿÿÿÿÿ
    ˆ   6   ÿÿÿÿÿÿÿÿ
                  ÿÿÿÿ  1        ÿÿÿÿ  Ý      ÿÿÿÿ  ï                     ÿÿÿÿ  ð     ;   ÿÿÿÿÿÿÿÿ
    L   >   ÿÿÿÿÿÿÿÿ
                   ÿÿÿÿ  Þ      ÿÿÿÿ       ?   ÿÿÿÿÿÿÿÿ
    t   B   ÿÿÿÿÿÿÿÿ
                  ÿÿÿÿ  n        ÿÿÿÿ  ß


The above code is taken when opened in notepad , as i cannot copy from notepad++ . Instead of the yyy , notepad++ is showing NUL , NUL , CAN , US codes .


Maybe something with the text formatting . I dont know XML . what to do ??


And where can i find strings.xml , or values.xml ??


[ Okay i am a noob here :/ ]
 

Quinny899

Recognized Developer / Recognized Contributor
Jan 26, 2011
9,427
8,752
26
Salford, Greater Manchester, UK
quinny898.co.uk
I decompiled the apk , opened up the settings_headers.xml but there is nothing as such as shown in this thread :( :/ . I am using notepad++ in windows and its showing something like this


Code:
  Œ    è  !          *              
         (   :   D   q   t   ‰   ’   »   î     >  G  {  *  Ç  ð  #  Z  „  ¼  ä    N  u    Å  ò    id title fragment icon action breadCrumbTitle android **http://schemas.android.com/apk/res/android    preference-headers header &&com.android.settings.wifi.WifiSettings 00com.android.settings.bluetooth.BluetoothSettings %%com.android.settings.DataUsageSummary %%com.android.settings.WirelessSettings intent 11com.android.settings.OPERATOR_APPLICATION_SETTING ""com.android.settings.SoundSettings $$com.android.settings.DisplaySettings &&com.android.settings.deviceinfo.Memory 00com.android.settings.fuelgauge.PowerUsageSummary 44com.android.settings.applications.ManageApplications ''com.android.settings.users.UserSettings 55com.android.settings.MANUFACTURER_APPLICATION_SETTING %%com.android.settings.LocationSettings %%com.android.settings.SecuritySettings ??com.android.settings.inputmethod.InputMethodAndLanguageSettings $$com.android.settings.PrivacySettings %%android.settings.ADD_ACCOUNT_SETTINGS %%com.android.settings.DateTimeSettings **com.android.settings.AccessibilitySettings ((com.android.settings.DevelopmentSettings ''com.android.settings.DeviceInfoSettings  €     Ð áã -         ÿÿÿÿ       $      ÿÿÿÿÿÿÿÿ              L      ÿÿÿÿÿÿÿÿ
                   ÿÿÿÿ  Ø      ÿÿÿÿ          ÿÿÿÿÿÿÿÿ
    t      ÿÿÿÿÿÿÿÿ
                  ÿÿÿÿ  s        ÿÿÿÿ  Ù      ÿÿÿÿ  Ó                     ÿÿÿÿÿÿÿÿ
    t   !   ÿÿÿÿÿÿÿÿ
                  ÿÿÿÿ  b        ÿÿÿÿ  Ú      ÿÿÿÿ  j                  %   ÿÿÿÿÿÿÿÿ
    t   (   ÿÿÿÿÿÿÿÿ
                  ÿÿÿÿ  d        ÿÿÿÿ  Û      ÿÿÿÿ  5      
     
       ,   ÿÿÿÿÿÿÿÿ
    L   /   ÿÿÿÿÿÿÿÿ
                   ÿÿÿÿ  Ü               8   2   ÿÿÿÿÿÿÿÿ                              2   ÿÿÿÿÿÿÿÿ       3   ÿÿÿÿÿÿÿÿ
    ˆ   6   ÿÿÿÿÿÿÿÿ
                  ÿÿÿÿ  1        ÿÿÿÿ  Ý      ÿÿÿÿ  ï                     ÿÿÿÿ  ð     ;   ÿÿÿÿÿÿÿÿ
    L   >   ÿÿÿÿÿÿÿÿ
                   ÿÿÿÿ  Þ      ÿÿÿÿ       ?   ÿÿÿÿÿÿÿÿ
    t   B   ÿÿÿÿÿÿÿÿ
                  ÿÿÿÿ  n        ÿÿÿÿ  ß


The above code is taken when opened in notepad , as i cannot copy from notepad++ . Instead of the yyy , notepad++ is showing NUL , NUL , CAN , US codes .


Maybe something with the text formatting . I dont know XML . what to do ??


And where can i find strings.xml , or values.xml ??


[ Okay i am a noob here :/ ]

You didn't decompile, you extracted. Decompile it using apktool

Sent from my GALAXY NEXUS using Tapatalk 4 (VIP)
 

Gus194

Senior Member
Jun 10, 2012
579
107
Can you make a video on how to Add options to the settings headers? I keep on getting SystemUI Crashes when i try to open up settings on my ROM. ._.
 

gps3dx

Senior Member
Jan 24, 2010
792
401
HTC Desire
Samsung Galaxy Tab 10.1
Remove "Background Data" Notification

I wish to permanently use the "Restrict background data" feature ( under settings->data usage ), but the problem is that when I enable that feature, I always get a notification, asking me to "touch to remove" that feature... But I just don't wish to do that, even by mistake!

I don't know what and where to change:
I used "apktool" to unpack the apk, but again - which file should I change ? what value/line should I delete ?
My rom is VJ's AOKP v2.2, so "Settings.apk" file is from that rom's version.

Any help would be great !:highfive:
 
Last edited:

jacknb1ack

Member
Mar 29, 2013
45
72
Yogyakarta
hello, thanks for this great tuts ...

i want to ask something, currently i am using stock rom for Lenovo s890 using Android 4.1.1

in settings > developer options is only show 3 options (adb, stay awake, and allow mock location), can i add more of developer settings like force hw ui, animation speed, etc. i can't figure out where to find this. i am looking at development_prefs.xml and everything is there.

please anyone know how to add / show more options in developer setting ?

thanks,
jacknb1ack
 

Top Liked Posts

  • There are no posts matching your filters.
  • 206
    Welcome to this mini guide of how to add items and change the layout of the Settings.apk

    Each part of this guide will be rated on how hard it is for the general person. (Out of 5 stars, 5 being hardest)

    So, without further ado, here we go:

    Stuff You'll Need for the guide
    Apktool (And therefore Java too)
    A suitable Text Editor for your OS. For Windows, Notepad++ is best, for Linux I recommend Geany In this guide I will be using Geany on Ubuntu
    Zipsigner on your device (for ease of use)
    adb
    NOTE: If you are using Linux, run everything, including apktool and your text editor/file manager as ROOT/SUDO

    Do this first: Decompiling Settings.apk
    Difficulty: ★★☆☆☆
    1.) Open a command window in a suitable location, where apktool.jar is also located
    1.) Pull your apk from your device
    Code:
    adb pull /system/app/Settings.apk
    2.) Pull and install the framework from your device to apktool
    Code:
    adb pull /system/framework/framework-res.apk
    Code:
    java -jar apktool.jar if framework-res.apk
    3.) Decompile your Settings.apk
    Code:
    java -jar apktool.jar d -s Settings.apk
    (No source is needed)

    Editing the Strings of your Settings apk
    Difficulty: ★★☆☆☆

    1.) Open a file manager and go to where the Settings has decompiled to
    2.) Locate and open res/xml/settings_headers.xml in your text editor
    3.) Now you can find the header you wish to edit. In this one we will change "Developer settings" to "Noobs keep out"
    We need to change the string referenced in this code:
    Code:
    <header android:icon= [user=3944923]@drawab[/user]le/ic_settings_development" android:id="@id/development_settings" android:title="@string/development_settings_title" android:fragment="com.android.settings.DevelopmentSettings" />
    The android:title reference is what we need to change, so open your Strings.xml, for your language (if it's not in there, open the default one)
    Find (use Ctrl+F) the string that we earlier found, so I would search for "development_settings_title"
    Code:
    <string name="development_settings_title">Developer options</string>
    Change the bit between the > and the < to what you want:
    Code:
    <string name="development_settings_title">Noobs keep out</string>
    4.) Save and proceed to recompiling


    Editing the Settings option's icon
    Difficulty: ★★★☆☆

    1.) Open a file manager and go to where the Settings has decompiled to
    2.) Locate and open res/xml/settings_headers.xml in your text editor
    3.) Locate the header you wish to change. In this one we will edit the "Development Settings" to have the "ic_settings_advanced" icon (included in CM based ROMs only)
    4.) Find the header you want to edit, we want to edit this one:
    Code:
    <header android:icon= [user=3944923]@drawab[/user]le/ic_settings_development"  android:id="@id/development_settings"  android:title="@string/development_settings_title"  android:fragment="com.android.settings.DevelopmentSettings" />
    5.) Edit the android:icon location to the icon you wish to have. The icons are in res/drawable-hdpi, mdpi, ldpi and xhdpi (depending on ROM)
    We want to change it to ic_settings_advanced, so ours will look like:
    Code:
    <header android:icon= [user=3944923]@drawab[/user]le/ic_settings_advanced" android:id="@id/development_settings" android:title="@string/development_settings_title" android:fragment="com.android.settings.DevelopmentSettings" />
    6.) If you don't want to add icons, proceed to recompiling
    7.) Adding icons:
    To get icons that fit, see this zip from Google: Download
    i) Find the icon you wish to add, make sure it fits your screen's icon resolution (can be found with the dimension of current ic_settings icons in the apk)
    ii) Copy it to the correct folder (hdpi, mdpi, xhdpi, ldpi)
    iii) Name it something similar (ic_settings_<name>)
    iv) Refer to it in the xml, using @drawable/ic_settings_<name>
    8.) Proceed to recompiling


    Adding options to the settings headers
    Difficulty: ★★★★☆

    Note: In adding settings you can open things such as GooManager for updates quickly and easily from the menu with "About phone" and "Developer settings" in it
    1.) Open your decompiled settings_headers.xml
    2.) Locate where you want to add an option, and add a new line:
    Add this code:
    Code:
    <header android:icon= [user=3944923]@drawab[/user]le/ic_settings_name" android:id="@id/id" android:title="@string/title">
            <intent android:targetPackage="pkgName" android:action="android.intent.action.MAIN" android:targetClass="pkgName.Activity" />
        </header>
    3.) What to change:
    Change android:icon to the icon you want (for more info see "adding/changing icons")
    Add a title to values/strings.xml and reference it in android:title
    Change the android:targetPackage to the package name of the app you want to open. This can be found in the AndroidManifest of that particular app
    Change the android:targetClass to the package name, followed by the activity you want to open, again found in that particular app's AndroidManifest
    Change the android:id to an id that you can add in values/ids.xml (or delete it if you want)
    4.) Proceed to recompiling


    Adding dividers to settings
    Difficulty: ★★★☆☆

    Adding to the main settings screen:
    1.) Open your settings_headers.xml
    2.) Locate where you want to add a divider
    3.) Add the following code:
    Code:
    <header android:id="@id/id" android:title="@string/title" />
    Stuff to change:
    Change the android:id to one that you added in values/ids.xml (or delete it if you want)
    Change the android:title to your title in strings.xml
    4.) If that's all you want, proceed to recompiling
    Adding to the submenus:
    1.) Open the submenu that you want to edit's xml (they're quite obvious of which one is which)
    2.) Locate where you want to add a divider
    3.) Add the following code:
    At the start of where you want to have the divider
    Code:
    <PreferenceScreen android:title="@string/title" android:key="key">
    Just before the next divider:
    Code:
    </PreferenceScreen>
    Stuff to change:
    Change the android:title to your title in strings.xml
    Change the key to whatever you want
    4.) Proceed to recompiling

    Reordering Settings
    Difficulty: ★★☆☆☆

    1.) Open either the settings_headers.xml or a submenu, the process is the same
    2.) Cut and paste the different options to your desired order
    3.) That's all, proceed to recompiling


    Adding items to submenus
    Want to add a "Credits" option to your "About device" menu? This is what you need
    Difficulty: ★★★☆☆

    1.) Open your submenu xml you want (device_info_settings.xml is the about device submenu)
    2.) Find your desired location of your new option and make a new line
    3.) Paste the following code:
    Code:
    <Preference android:title="@string/title" android:key="key" android:summary="@string/summary" style="?android:preferenceInformationStyle" />
    Stuff to change:
    Change android:title to the title you added in values/strings.xml
    Change android:key to whatever you want
    Change android:summary to the longer text that you want that you added to values/strings.xml
    4.) Proceed to recompiling


    Bonus: Forcing "Developer settings" to be available by default on 4.2
    Difficulty: ★★☆☆☆

    1.) Open the settings_headers.xml
    2.) Locate the following code:
    Code:
    <header android:icon= [user=3944923]@drawab[/user]le/ic_settings_development" android:id="@id/development_settings" android:title="@string/development_settings_title" android:fragment="com.android.settings.DevelopmentSettings" />
    3.) Change the id from development_settings to development_settings_force
    Code:
    <header android:icon= [user=3944923]@drawab[/user]le/ic_settings_development"  android:id="@id/development_settings_force"  android:title="@string/development_settings_title"  android:fragment="com.android.settings.DevelopmentSettings" />
    4.) Open values/ids.xml
    5.) Add the following line:
    Code:
    <item type="id" name="development_settings_force">false</item>
    6.) Proceed to recompiling


    Do this last: Recompiling
    Difficulty: ★★☆☆☆
    1.) Re-open the command window that you used to decompile, in the same location
    2.) Run the following code:
    Code:
    java -jar apktool.jar b Settings
    3.) Push the new, unsigned apk to your device:
    Code:
    adb push Settings/dist/Settings.apk /sdcard/
    4.) On the device, open Zipsigner and select the Settings.apk using the in/out button
    5.) On the dropdown, select "platform"
    6.) Press sign
    7.) When it's done, run the following codes in the command window on the PC:
    (Note: Some people might need to run 'adb root' first)
    Code:
    adb remount
    Code:
    adb shell cp /system/app/Settings.apk /system/app/Settings.bak
    Code:
    adb shell cp /sdcard/Settings-signed.apk /system/app/Settings.apk
    8.) Reboot your device, you are done

    Troubleshooting:
    My apk doesn't recomplile!
    Look in the command window, it should tell you where the error is, and try to fix it. If you can't, post the error log here and I/someone else will try to help

    My new settings doesn't appear!
    Did you sign it properly? Try that again. Else, you're out of luck

    Something else is wrong!!!!1111
    Leave a reply and wait, don't spam, and someone (if not me) will try to help

    Screenshots for inspiration:

    attachment.php

    What I did:
    Added an option to update, opens GooManager, using ic_action_mark from the zip from Google
    Added an option that opens SuperSU, icon from the newer Settings.apk in ParanoidAndroid
    Changed the title and icon of Developer Settings, as well as forcing it to always be there
    Reordered the developer settings, and added different dividers
    4
    Re: [GUIDE][4.0+] Add items to Settings.apk / Change Layout

    Nice write up :)

    TEAM MiK
    MikROMs Since 3/13/11
    4
    @OP, here's what I've done

    Anyway big thanks to you, sometimes pressing Thanks button it not enough :)

    via XDA for Timescape™
    2
    Re: [GUIDE][4.0+] Add items to Settings.apk / Change Layout

    What the heck does this mean?


    Code:
    Plays2s-iMac:Folder Plays2$ java -jar apktool.jar b Settings
    Exception in thread "main" brut.androlib.AndrolibException: brut.directory.DirectoryException: java.util.zip.ZipException: error in opening zip file
    at brut.androlib.Androlib.readMetaFile(Androlib.java:164)
    at brut.androlib.Androlib.build(Androlib.java:183)
    at brut.androlib.Androlib.build(Androlib.java:176)
    at brut.apktool.Main.cmdBuild(Main.java:228)
    at brut.apktool.Main.main(Main.java:79)
    Caused by: brut.directory.DirectoryException: java.util.zip.ZipException: error in opening zip file
    at brut.directory.ZipRODirectory.<init>(ZipRODirectory.java:55)
    at brut.directory.ZipRODirectory.<init>(ZipRODirectory.java:38)
    at brut.androlib.res.util.ExtFile.getDirectory(ExtFile.java:55)
    at brut.androlib.Androlib.readMetaFile(Androlib.java:160)
    ... 4 more
    Caused by: java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:127)
    at java.util.zip.ZipFile.<init>(ZipFile.java:143)
    at brut.directory.ZipRODirectory.<init>(ZipRODirectory.java:53)
    ... 7 more

    I'm on mac btw

    It can't open the apk for some reason, check it's there and not corrupted

    Sent from my ARCHOS 80G9 using Tapatalk HD
    2
    Either of works fine, I see a couple people prefer adb, I did it both ways and as you can see I'm trying to make it work. I'm sure the I'm missing something that's causing it rather than it being the different extraction methods

    ATTN.

    Alex A.
    Thanks for the reply. I asked because grabbing it straight from my rom's zip didn't seem to work for me. I hope pulling via adb produces a different result. I feel like I'm doing something wrong when decompiling and recompiling, but I don't think so since I don't get any errors.

    ---------- Post added at 11:29 PM ---------- Previous post was at 10:53 PM ----------

    Is this normal for recompiling an AOSP Settings.apk? I pulled directly from system/priv-app/ on my phone with adb.
    Code:
    c:\Windows>apktool b Settings
    I: Using Apktool 2.0.3
    I: Copying Settings classes.dex file...
    I: Checking whether resources has changed...
    I: Building resources...
    warning: string 'cell_broadcast_settings_summary' has no default translation.
    warning: string 'experimental_webview' has no default translation.
    warning: string 'experimental_webview_summary' has no default translation.
    warning: string 'nfc_payment_ask' has no default translation.
    warning: string 'print_services_title' has no default translation.
    warning: string 'wifi_display_available_devices' has no default translation.
    warning: string 'wifi_display_disconnect_text' has no default translation.
    warning: string 'wifi_display_disconnect_title' has no default translation.
    warning: string 'wifi_display_paired_devices' has no default translation.
    warning: string 'wifi_display_search_for_devices' has no default translation.
    warning: string 'wifi_display_searching_for_devices' has no default translation.
    warning: string 'wifi_display_settings_empty_list_wifi_display_disabled' has no default translation.
    warning: string 'wifi_display_settings_empty_list_wifi_display_off' has no default translation.
    warning: string 'wifi_display_status_available' has no default translation.
    warning: string 'wifi_display_summary_disabled' has no default translation.
    warning: string 'wifi_display_summary_off' has no default translation.
    warning: string 'wifi_display_summary_on' has no default translation.
    warning: string 'wimax_settings_summary' has no default translation.
    I: Building apk file...
    
    c:\Windows>


    ---------- Post added 9th March 2016 at 12:18 AM ---------- Previous post was 8th March 2016 at 11:29 PM ----------

    I found out what I've been doing wrong now. First off, for all of you reading this, don't sign the Settings.apk. What you need to do is when you recompile your Settings.apk open up the original apk and the modified one with 7-Zip and copy over the AndroidManifest.xml and META-INF folder from the original apk over to the modified one. After that, adb push over to your phone into /system/priv-app/, and make sure you set the permissions to -rw-r--r-- After that just reboot and you should be all set.