FORUMS
Remove All Ads from XDA

[GUIDE] Add to Device Info the value read from Build.prop (like in CyanogenMOD)

111 posts
Thanks Meter: 31
 
By cheqolada, Senior Member on 10th July 2013, 02:52 PM
Post Reply Email Thread
Hello
Today I would like o present you how to add to Device Info the value read from Build.prop (like in CyanogenMOD)

NEED:
apktool : https://code.google.com/p/android-ap...downloads/list
Text Editor (I prefer Notepad++) : http://notepad-plus-plus.org/download/v6.4.2.html
Android SDK: http://developer.android.com/sdk/index.html
Zip editor (I prefer 7Zip): http://www.7-zip.org/download.html

1)Get framework-res.apk and Settings.apk from your device
Code:
adb pull /system/framework/framework-res.apk
adb pull /system/app/Settings.apk
2)"Install" framework-res.apk in your apktool
Code:
apktool if framework-res.apk
3)Decompile Settings.apk
Code:
apktool d Settings.apk
4)Add new Item in You Device Info view
a)Open Settings/res/xml/device_info_settings.xml
b)Add after
Code:
<Preference android:title="@string/build_number" android:key="build_number" android:summary="@string/device_info_default" style="?android:preferenceInformationStyle" />
this
Code:
<Preference android:title="@string/your_rom_version" android:key="your_rom_version_key" android:summary="@string/your_rom_version_default" style="?android:preferenceInformationStyle" />
c)Remember value from android:title , android:key and android:summary
d)Save file
5)Add Title and Default value to your item
a)Open Settings/res/values/strings.xml
b)Add Before
Code:
</resources>
this
Code:
<string name="your_rom_version">My Rom Version</string>
<string name="your_rom_version_default">My Rom Version Value</string>
c)Save File
6)Edit Settings/smali/com/android/settings/DeviceInfoSettings.smali
a)Find in file this
Code:
.line 83
    const-string v8, "firmware_version"

    invoke-virtual {p0, v10}, Lcom/android/settings/DeviceInfoSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

    move-result-object v8

    invoke-virtual {v8, v11}, Landroid/preference/Preference;->setEnabled(Z)V

    .line 84
    const-string v8, "baseband_version"

    const-string v9, "gsm.version.baseband"

    invoke-direct {p0, v8, v9}, Lcom/android/settings/DeviceInfoSettings;->setValueSummary(Ljava/lang/String;Ljava/lang/String;)V
    
	.line 85
    const-string v8, "device_model"

    sget-object v9, Landroid/os/Build;->MODEL:Ljava/lang/String;

    invoke-direct {p0, v8, v9}, Lcom/android/settings/DeviceInfoSettings;->setStringSummary(Ljava/lang/String;Ljava/lang/String;)V

    .line 86
    const-string v8, "build_number"

    sget-object v9, Landroid/os/Build;->DISPLAY:Ljava/lang/String;

    invoke-direct {p0, v8, v9}, Lcom/android/settings/DeviceInfoSettings;->setStringSummary(Ljava/lang/String;Ljava/lang/String;)V

    .line 87
    const-string v8, "kernel_version"

    invoke-virtual {p0, v8}, Lcom/android/settings/DeviceInfoSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

    move-result-object v8

    invoke-direct {p0}, Lcom/android/settings/DeviceInfoSettings;->getFormattedKernelVersion()Ljava/lang/String;

    move-result-object v9

    invoke-virtual {v8, v9}, Landroid/preference/Preference;->setSummary(Ljava/lang/CharSequence;)V
b)and Add before
Code:
.line 84
    const-string v8, "baseband_version"

    const-string v9, "gsm.version.baseband"

    invoke-direct {p0, v8, v9}, Lcom/android/settings/DeviceInfoSettings;->setValueSummary(Ljava/lang/String;Ljava/lang/String;)V
this
Code:
const-string v1, "your_rom_version_key"

const-string v2, "ro.yourromname"

invoke-direct {p0, v1, v2}, Lcom/android/settings/DeviceInfoSettings;->setValueSummary(Ljava/lang/String;Ljava/lang/String;)V
c)Save File
7)Compile Settings
a)apktool b Settings settings_new.apk
b)Open Base Settings.apk and Copy to setting_new.apk META-INF folder and AndroidManifest.xml
8)And the last
a)Rename settings_new.apk to Setting.apk
b)put new Settings.apk to your device
c)Move Settings.apk to /system/app and replace with old Settings.apk
d)Change Permision to rw-r--r--
e)add line
Code:
ro.yourromname=MyRomVersion.v3
to your build.prop
9)Reboot Phone!

Now you have Item in Device Menu which value can be changed without decompiling Layout Settings.apk
For example: I added "Wersja ION" value to android:title in string.xml and "CheQ.example" value to ro.yourromname in build.prop.
Screen:


Enjoy!
Attached Thumbnails
Click image for larger version

Name:	shot_000002.png
Views:	1183
Size:	20.3 KB
ID:	2106242  
The Following 3 Users Say Thank You to cheqolada For This Useful Post: [ View ] Gift cheqolada Ad-Free
11th July 2013, 02:57 AM |#2  
PineappleOwl's Avatar
Senior Member
Thanks Meter: 973
 
More
Working with GB sir?

Sent from my GT-S5360 using Tapatalk 2
11th July 2013, 08:50 AM |#3  
Aadi's Avatar
Senior Member
Thanks Meter: 291
 
More
Thumbs down
has the same thing from this thread http://forum.xda-developers.com/show....php?t=2238155 :P
11th July 2013, 09:14 AM |#4  
cheqolada's Avatar
OP Senior Member
Thanks Meter: 31
 
More
@3r41nl33n - Yes.
@Chain Hacker - Method to add new item in menu is same - but in SArnab©®s guide value is unchanged. In my value is read from build.prop
11th July 2013, 09:47 AM |#5  
Aadi's Avatar
Senior Member
Thanks Meter: 291
 
More
Thumbs up
Quote:
Originally Posted by cheqolada

@3r41nl33n - Yes.
@Chain Hacker - Method to add new item in menu is same - but in SArnab©®s guide value is unchanged. In my value is read from build.prop

but that was easier compared to yours anywayz great guide man.
21st July 2013, 07:31 PM |#6  
Member
Thanks Meter: 4
 
More
Thanks you! Nice guide.
6th August 2013, 05:47 PM |#7  
GuneetAtwal's Avatar
Senior Member
Flag Mohali
Thanks Meter: 5,311
 
Donate to Me
More
This guide is just a Copy of this Guide

http://forum.xda-developers.com/showthread.php?t=977211

Atleast you should have given her credits
11th August 2013, 09:44 AM |#8  
cheqolada's Avatar
OP Senior Member
Thanks Meter: 31
 
More
Quote:
Originally Posted by GuneetAtwal

This guide is just a Copy of this Guide

http://forum.xda-developers.com/showthread.php?t=977211

Atleast you should have given her credits

Sorry , I search Guide like My but i Can't find it. When I knew that there would add that. :S
1st October 2014, 04:16 AM |#9  
Member
Flag Ranchi
Thanks Meter: 11
 
More
Post Nice :D
Quote:
Originally Posted by cheqolada

Hello
Today I would like o present you how to add to Device Info the value read from Build.prop (like in CyanogenMOD)

NEED:
apktool : https://code.google.com/p/android-ap...downloads/list
Text Editor (I prefer Notepad++) : http://notepad-plus-plus.org/download/v6.4.2.html
Android SDK: http://developer.android.com/sdk/index.html
Zip editor (I prefer 7Zip): http://www.7-zip.org/download.html

1)Get framework-res.apk and Settings.apk from your device
Code:
adb pull /system/framework/framework-res.apk
adb pull /system/app/Settings.apk
2)"Install" framework-res.apk in your apktool
Code:
apktool if framework-res.apk
3)Decompile Settings.apk
Code:
apktool d Settings.apk
4)Add new Item in You Device Info view
a)Open Settings/res/xml/device_info_settings.xml
b)Add after
Code:
<Preference android:title="@string/build_number" android:key="build_number" android:summary="@string/device_info_default" style="?android:preferenceInformationStyle" />
this
Code:
<Preference android:title="@string/your_rom_version" android:key="your_rom_version_key" android:summary="@string/your_rom_version_default" style="?android:preferenceInformationStyle" />
c)Remember value from android:title , android:key and android:summary
d)Save file
5)Add Title and Default value to your item
a)Open Settings/res/values/strings.xml
b)Add Before
Code:
</resources>
this
Code:
<string name="your_rom_version">My Rom Version</string>
<string name="your_rom_version_default">My Rom Version Value</string>
c)Save File
6)Edit Settings/smali/com/android/settings/DeviceInfoSettings.smali
a)Find in file this
Code:
.line 83
    const-string v8, "firmware_version"

    invoke-virtual {p0, v10}, Lcom/android/settings/DeviceInfoSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

    move-result-object v8

    invoke-virtual {v8, v11}, Landroid/preference/Preference;->setEnabled(Z)V

    .line 84
    const-string v8, "baseband_version"

    const-string v9, "gsm.version.baseband"

    invoke-direct {p0, v8, v9}, Lcom/android/settings/DeviceInfoSettings;->setValueSummary(Ljava/lang/String;Ljava/lang/String;)V
    
	.line 85
    const-string v8, "device_model"

    sget-object v9, Landroid/os/Build;->MODEL:Ljava/lang/String;

    invoke-direct {p0, v8, v9}, Lcom/android/settings/DeviceInfoSettings;->setStringSummary(Ljava/lang/String;Ljava/lang/String;)V

    .line 86
    const-string v8, "build_number"

    sget-object v9, Landroid/os/Build;->DISPLAY:Ljava/lang/String;

    invoke-direct {p0, v8, v9}, Lcom/android/settings/DeviceInfoSettings;->setStringSummary(Ljava/lang/String;Ljava/lang/String;)V

    .line 87
    const-string v8, "kernel_version"

    invoke-virtual {p0, v8}, Lcom/android/settings/DeviceInfoSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

    move-result-object v8

    invoke-direct {p0}, Lcom/android/settings/DeviceInfoSettings;->getFormattedKernelVersion()Ljava/lang/String;

    move-result-object v9

    invoke-virtual {v8, v9}, Landroid/preference/Preference;->setSummary(Ljava/lang/CharSequence;)V
b)and Add before
Code:
.line 84
    const-string v8, "baseband_version"

    const-string v9, "gsm.version.baseband"

    invoke-direct {p0, v8, v9}, Lcom/android/settings/DeviceInfoSettings;->setValueSummary(Ljava/lang/String;Ljava/lang/String;)V
this
Code:
const-string v1, "your_rom_version_key"

const-string v2, "ro.yourromname"

invoke-direct {p0, v1, v2}, Lcom/android/settings/DeviceInfoSettings;->setValueSummary(Ljava/lang/String;Ljava/lang/String;)V
c)Save File
7)Compile Settings
a)apktool b Settings settings_new.apk
b)Open Base Settings.apk and Copy to setting_new.apk META-INF folder and AndroidManifest.xml
8)And the last
a)Rename settings_new.apk to Setting.apk
b)put new Settings.apk to your device
c)Move Settings.apk to /system/app and replace with old Settings.apk
d)Change Permision to rw-r--r--
e)add line
Code:
ro.yourromname=MyRomVersion.v3
to your build.prop
9)Reboot Phone!

Now you have Item in Device Menu which value can be changed without decompiling Layout Settings.apk
For example: I added "Wersja ION" value to android:title in string.xml and "CheQ.example" value to ro.yourromname in build.prop.
Screen:


Enjoy!

Hy! nice guide... btw do you knkw how to import tabs to device_info_settings.xml.... I have one in settings.xml... help would be appreciated...
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes