【 在BaiduApk中添加资源】移植厂商功能

示例:触摸按键灯工作模式

准备工作:
反编译厂商Settings.apk
ifdir vendor/system/framework/
apktool d vendor/system/app/Settings.apk
grep "buttonlight" -r

得到下面内容

Settings/smali/com/android/settings/DisplaySettings.smali: const-string v6, "persist.ty.buttonlight.support"
Settings/smali/com/android/settings/DisplaySettings.smali: const-string v6, "buttonlight_setting"
Settings/smali/com/android/settings/DisplaySettings.smali: const-string v6, "buttonlight_mode"
Settings/smali/com/android/settings/DisplaySettings.smali: .local v0, buttonlight:I
Settings/smali/com/android/settings/DisplaySettings.smali: const-string v10, "buttonlight_setting"
Settings/smali/com/android/settings/DisplaySettings.smali: .end local v0 #buttonlight:I
Settings/smali/com/android/settings/DisplaySettings.smali: .restart local v0 #buttonlight:I
Settings/smali/com/android/settings/DisplaySettings.smali: const-string v4, "buttonlight_setting"
Settings/smali/com/android/settings/DisplaySettings.smali: const-string v5, "buttonlight_mode"
Settings/res/values-zh-rCN/strings.xml: 触摸按键灯工作模式
Settings/res/values-zh-rCN/arrays.xml:
Settings/res/values-zh-rCN/arrays.xml:
Settings/res/xml/display_settings.xml: Settings/res/values/strings.xml: Touch-key light work pattern
Settings/res/values/arrays.xml:
Settings/res/values/arrays.xml:
Settings/res/values/public.xml: Settings/res/values/public.xml: Settings/res/values/public.xml:

一.配置Makefile
因为要修改的是百度的Settings.apk所有在Makefile,所以需要在 baidu_modify_apps := 这里添加 Settings
baidu_modify_apps := Settings

二.创建相应的文件路径以及文件
具体操作请看教程
课程 基础(八)Coron常用开发技巧[替函数 补接口 改资源 作定制]
http://bbs.os.baidu.com/thread-146490-1-1.html

1.Settings/res/values/strings.xml

mkdir -p Settings/res/values
cd Settings/res/values/
gedit strings.xml &

2.Settings/res/values/arrays.xml
方法同上

三.添加资源

<add-resource />
<add-resource type="xxx" name="xxx" />

Settings/res/values/strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<add-resource type="string" name="buttonlight_setting" />
<string name="buttonlight_setting">Touch-key light work pattern</string>
</resources>

Settings/res/values/arrays.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<add-resource type="array" name="buttonlight_entries" />
<string-array name="buttonlight_entries">
<item>1.5 seconds</item>
<item>5 seconds</item>
<item>Always off</item>
<item>Always on</item>
<item>In the dark</item>
</string-array>
<add-resource type="array" name="buttonlight_values" />
<string-array name="buttonlight_values">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
</string-array>
</resources>

注意:arrays.xml中 一开始我就是在这里犯错,打包时总是编译不过去{:15_830:}

values-zh-rCN 简体 values-zh-rTW 繁体 同上做相应的添加即可
资源部分就添加完成了.

smali部分就不举例了,在百度中插入相关厂商代码即可
其实是我还没插对:$