[Xperia Arc Themes and Apps] Saqib Nazm:
This Guide will help you to add any application/options to Settings.apk. Well earlier My friend @sandy7 published a guide on how to add various options in Settings. So this extended guide will provide you the necessary knowledge on how to get resources about any app which needed to be added in Settings to include it as an option.

Requirements:

Any Tool that can Decompile & Recompile with it's requirements

Notepad++

1. How to add options/apps in main/general settings :

To add an app in Settings we need some resources of the app. This resources can be found by decompiling the app which we want to add & look for those in AndroidManifest.xml

Now, to add an app we need this resources to be added:

*android:targetPackage - the unique & original package name of the app

*android:action - the On click event of an app & it finds the activity of the app

*android:targetClass - the class which is called on calling Onclick action which opens the app when it is clicked

*android:title - the entry of the app in header & also in strings.xml

*android:icon - the icon which will be displayed for the app entry

Notes: android:targetClass, android:targetPackage & android:action can be found in AndroidManifest of the app. For some apps android:targetClass is not given directly. So it should be searched to find. I will tell you how to do that. android:title & android:icon can be written as per user.

As I explained a bit about the resources I will now move onto the main guide. I will take an app from playstore named "Rom Toolbox" as example & describe the ongoing process

i. 1st we need to decompile the Rom toolbox app & find the resources in AndroidManifest.xml

as we can see from the picture that I marked the android:targetPackage & android:targetClass. The target package is easy to find. Sometimes target class is also given directly. If it's not given directly like this app we will find it by searching for it in the lines which starts with <activity. Now if there's more than one activity search for the activity that matches with the target package to some extent. & one more thing I should make you clear about. In some apps you will find android:targetClass will just be a one word phrase. Like if we take Serajr's SystemUI Preference as example you will see that android:targetClass is ".SystemUIPreferencesActivity". In those cases we need to add the whole android:targetPackage before targetClass. For Serajr's SystemUI preference the android:targetPackage="com.serajr.systemui.preferences". So the android:targetClass="com.serajr.systemui.preferences.SystemUIPreferencesActivity".

So here for Rom Toolbox app we find

android:targetPackage="com.jrummy.liberty.toolbox"
android:targetClass="com.jrummy.apps.rom.toolbox.RomToolboxActivity"
android:action="android.intent.action.MAIN"

android:action doesn't always needed to be found, you can always use "android.intent.action.MAIN" as the on click event

ii. Now decompile Settings.xml & go to res\xml & open settings_header.xml with notepad++. Now chose a place where you want to make the entry. If we want to add the app under advanced settings then we need to create a header 1st. We also need to create an android:title & android:icon entry for the app. So this will be the entry in settings_header

</header>
<header android:title="@string/header_category_advanced" />
<header android:icon="@drawable/ic_settings_rom" android:title="@string/rom_toolbox">
<intent android:targetPackage="com.jrummy.liberty.toolbox" android:action="android.intent.action.MAIN" android:targetClass="com.jrummy.apps.rom.toolbox.RomToolboxActivity" />

The 1st header is for the advanced settings header. We need to make an entry of the same name in strings.xml.

The 2nd header is for the app & icon. We need to write the exact entry as title in strings.xml like I wrote "rom_toolbox". You can write anything as title just make sure it matches the app itself so that you can find it easily. So the settings_header will look like this

Now save it

iii. Now go to res\values & open strings.xml. We need to create two strings here. One for the advanced settings & another for the app. We already chose the string name for header as "header_category_advanced" & "rom_toolbox" for the Rom Toolbox app. So the entries in strings.xml will be

<string name="header_category_advanced">ADVANCED SETTINGS</string>
<string name="rom_toolbox">ROM Toolbox</string>

You can write anything where I wrote "ADVANCED SETTINGS" & "ROM Toolbox" It depends on you what you would like to see in settings as header.

So the strings.xml should be like this

Now save it.

iv. Now we need to place a png for the app in drawable folder with the name "ic_settings_rom" as it is given in the header of android:icon. Depending on your settings you either should have drawable hdpi or drawable mdpi folder. On my case I have drawable hdpi folder. 1st we need to look at the resolutions of the pngs which starts with ic_settings name. Well generally for drawable hdpi it is 48x48 & for drawable mdpi it is 32x32. So we need to resize the png in any of this resolutions depending on our drawable folder. You can take the png from the original app & resize it. In my case I resized it in 48x48 & placed it in drawable-hdpi folder.

v. Now you are ready to recompile again. Then try your newly modified settings. I will post a screenshot of mine

2. How to add options/apps in sub settings for example in display settings :

Here I will take On-screen-buttons app for an example in the ongoing process. We will add it in display_settings. Now, we need an extra resource called android:key when we want to add any app in sub settings. android:key is the keystore when the app is extracted using any app tool when created by the developer. As we cannot find the original android:key of the app, we will enter a value as android:key & give it's reference in the ids.xml

i. 1st decompile the On screen button app & search for resources in AndroidManifest.xml.

So we find android:targetPackage="cn.kyle.gn.NavBar" & as only one line here starts with <activity it is really easy to find android:targetClass="cn.kyle.gn.NavBar.GnNavBarActivity". android:action="com.android.intent.MAIN" even if it is not written in the manifest.

Now we need to make android:title which can be anything,we just need to refer it into strings.xml, android:key can be anything, we need to refer it in ids.xml & another entry is optional here which is android:summary which is the sub-header of the app. I give you my example what I have written as values of those resources

android:title="navienable_title"
android:key="on_screen"
android:summary="on_screen_summary"

Now as we fixed every resource & their values we will put the entry in res\xml in display_settings.xml. The entry will look like this

<PreferenceScreen android:title="@string/navienable_title" android:key="on_screen" android:summary="@string/on_screen_summary">
<intent android:targetPackage="cn.kyle.gn.NavBar" android:action="android.intent.action.MAIN" android:targetClass="cn.kyle.gn.NavBar.GnNavBarActivity" />
</PreferenceScreen>

The display_settings will look like this

Now save it

ii. Now go to res/values & open strings.xml. We need to make two entries here. One for the android:title="@string/navienable_title" & another for the android:summary="@string/on_screen_summary". Now we make the entries

<string name="navienable_title">On-Screen-Buttons</string>
<string name="on_screen_summary">Enable/Disable On-Screen-Buttons</string>

as I said before you can write anything inside >......</string> it depends on you what text you would like to be seen

The screenshot from strings.xml

Now save it.

iii. Now go to res\values\ids.xml & open it. We need to make an entry for the entry we made in display_settings as android:key. So the entry will be with the same value

<item type="id" name="on_screen">false</item>

So the ids.xml should be like this

Save it & recompile your edited Settings.apk. Here is a screenshot of the Settings I edited

2. How to add headers in Settings/about to display Developer Name & Rom Name :

i. Decompile Settings.apk & go to res\xml & open device_info_settings.xml. Now choose a place where you want to show your Rom Name & Developer name. The entries you need here are similar with the one's that already exist in the xml. So you can copy one line of entry & press enter then paste it & you can edit it to make the new entries. We need android:title & android:summary which will be shown in strings.xml. We need android:key which you can keep same as android:title to eliminate difficulties, but we don't need an entry in ids.xml this time as it is not an app for which we are making the entry for. Last of all we need a style entry which will be the same as others. So I will write my Rom name & developer name under Kernel_version entry here. The entries will be

<Preference android:title="@string/rom_header" android:key="rom_header" android:summary="@string/rom_name" style="?android:preferenceInformationStyle" />
<Preference android:title="@string/author_header" android:key="author_header" android:summary="@string/author_name" style="?android:preferenceInformationStyle" />

The device_info_settings.xml will look like this

Now save it.

ii. Now go to res\values\strings.xml to make the entries here. We need two entries for the Rom Name, one is for "@string/rom_header" & another for "@string/rom_name". Same we need for Devloper name, one entry for "@string/author_header" & another for "@string/author_name". So the entries will be

<string name="rom_header">Rom Name</string>
<string name="rom_name">X Rom</string>
<string name="author_header">Developed By</string>
<string name="author_name">Saqib Nazm</string>

I give my Rom name as "X Rom" for example. You can type anything as you like on rom_name & author_name

The strings.xml should look like this

Now save it & recompile. Enjoy your freshly made new Settings.apk. Here is a screenshot about how it looks

.........................................................................................................................................

At the end I want to say, I will try to explain it more by adding more examples so that you can add anything. Kindly give me credits for my work If it helps you in anyway possible. Like I am gonna give credits to those respective people for whom I could share this guide to you.

Credits:

Neroyoung - for always helping me & clearing my ideas

jerrytan93 - for helping me alot whenever I need him

gagan.u20 - for always saving me if I get stuck somewhere

singh_dd93 - for giving me a clear idea on some resources

sandy7 - who doesn't know his thread from where everyone can learn