Friday, 4 August 2017
Edit Settings apk On Your Own
Edit Settings apk On Your Own
Stuff Youll Need for the guide :-
1) Apktool (And therefore Java too)
2) A suitable Text Editor For Windows, Notepad++ is best.
3) Zipsigner on your device (for ease of use).
4) adb .
Do this first:
Decompiling Settings.apk
**** 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
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 i will change "Developer settings" to "EXPERTS ONLY"
We need to change the string referenced in this code:
Code:
<header android_icon="@drawable/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 its 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">EXPERTS ONLY</string>
4.) Save and proceed to recompiling
__________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________
Editing The Settings Options Icon
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="@drawable/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="@drawable/ic_settings_advanced" android_id="@id/development_settings" android_title="@string/development_settings_title" android_fragment="com.android.settings.DevelopmentSettings" />
6.) If you dont want to add icons, proceed to recompiling
7.) Adding icons:
To get icons that fit, Google Search For Icons
i) Find the icon you wish to add, make sure it fits your screens 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
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="@drawable/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
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 apps 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
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 thats all you want, proceed to recompiling
Adding to the submenus:
1.) Open the submenu that you want to edits xml
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
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.) Thats all, proceed to recompiling
_______________________________________________________________________________________________________________________
_______________________________________________________________________________________________________________________
Adding Items To Submenus
Want to add a "Credits" option to your "About device" menu? This is what you need
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
__________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________
Do This last:
Recompiling Settings.apk:
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 its 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
1) Apktool (And therefore Java too)
2) A suitable Text Editor For Windows, Notepad++ is best.
3) Zipsigner on your device (for ease of use).
4) adb .
Do this first:
Decompiling Settings.apk
**** 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
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 i will change "Developer settings" to "EXPERTS ONLY"
We need to change the string referenced in this code:
Code:
<header android_icon="@drawable/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 its 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">EXPERTS ONLY</string>
4.) Save and proceed to recompiling
__________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________
Editing The Settings Options Icon
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="@drawable/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="@drawable/ic_settings_advanced" android_id="@id/development_settings" android_title="@string/development_settings_title" android_fragment="com.android.settings.DevelopmentSettings" />
6.) If you dont want to add icons, proceed to recompiling
7.) Adding icons:
To get icons that fit, Google Search For Icons
i) Find the icon you wish to add, make sure it fits your screens 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
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="@drawable/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
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 apps 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
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 thats all you want, proceed to recompiling
Adding to the submenus:
1.) Open the submenu that you want to edits xml
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
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.) Thats all, proceed to recompiling
_______________________________________________________________________________________________________________________
_______________________________________________________________________________________________________________________
Adding Items To Submenus
Want to add a "Credits" option to your "About device" menu? This is what you need
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
__________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________
Do This last:
Recompiling Settings.apk:
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 its 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
download file now