Hello
Today I would like o present you how to add to Device Info the value read from Build.prop (like in CyanogenMOD)
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-apktool/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
Code:
apktool if framework-res.apk
Code:
apktool d Settings.apk
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" />
Code:
<Preference android:title="@string/your_rom_version" android:key="your_rom_version_key" android:summary="@string/your_rom_version_default" style="?android:preferenceInformationStyle" />
d)Save file
5)Add Title and Default value to your item
a)Open Settings/res/values/strings.xml
b)Add Before
Code:
</resources>
Code:
<string name="your_rom_version">My Rom Version</string>
<string name="your_rom_version_default">My Rom Version Value</string>
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
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
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
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
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!
Attachments
Last edited: