Android 13 ---添加overlay修改充电提示语

问题分析

android13开机充电时会显示正在充电将于...后充满。客户要求把他去掉。很简单就是一个字符串的改动。但是为了后续开发的便捷性我们使用overlay覆盖的方式,不改变原来的代码。

代码位置

alps/device/mediatek/system/common/device.mk
alps/device/mediatek/system/common/overlay/n7701/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values-zh-rCN/strings.xml    [new file with mode: 0755]
alps/device/mediatek/system/common/overlay/n7701/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/strings.xml    [new file with mode: 0755]

具体代码

diff --git a/alps/device/mediatek/system/common/device.mk b/alps/device/mediatek/system/common/device.mk
index aaf4ffb..c43715a 100755 (executable)
--- a/alps/device/mediatek/system/common/device.mk
+++ b/alps/device/mediatek/system/common/device.mk
@@ -3987,4 +3987,7 @@ ifneq ($(strip $(MTK_BASIC_PACKAGE)), yes)
 PRODUCT_COPY_FILES += vendor/mediatek/proprietary/frameworks/base/data/etc/msync_ctrl_table.xml:system/etc/msync_ctrl_table.xml:mtk
 PRODUCT_COPY_FILES += vendor/mediatek/proprietary/frameworks/opt/msync-lib/lib/msync-lib.jar:system/framework/msync-lib.jar:mtk
 endif
+
+PRODUCT_PACKAGE_OVERLAYS += $(LOCAL_PATH)/overlay/n7701
+
 $(call inherit-product-if-exists, vendor/xw/project/xw_project.mk)
\ No newline at end of file
diff --git a/alps/device/mediatek/system/common/overlay/n7701/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values-zh-rCN/strings.xml b/alps/device/mediatek/system/common/overlay/n7701/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values-zh-rCN/strings.xml
new file mode 100755 (executable)
index 0000000..8cbde7b
--- /dev/null
+++ b/alps/device/mediatek/system/common/overlay/n7701/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values-zh-rCN/strings.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!-- \r
+/**\r
+ * Copyright (c) 2009, The Android Open Source Project\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+ -->\r
+\r
+<resources xmlns:android="http://schemas.android.com/apk/res/android"\r
+    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">\r
+    <string name="keyguard_indication_charging_time_wireless" msgid="577856646141738675">"<xliff:g id="PERCENTAGE">%2$s</xliff:g></string>\r
+    <string name="keyguard_indication_charging_time" msgid="6492711711891071502">"<xliff:g id="PERCENTAGE">%2$s</xliff:g></string>\r
+    <string name="keyguard_indication_charging_time_fast" msgid="8390311020603859480">"<xliff:g id="PERCENTAGE">%2$s</xliff:g></string>\r
+    <string name="keyguard_indication_charging_time_slowly" msgid="301936949731705417">"<xliff:g id="PERCENTAGE">%2$s</xliff:g></string>\r
+    <string name="keyguard_indication_charging_time_dock" msgid="6150404291427377863">"<xliff:g id="PERCENTAGE">%2$s</xliff:g></string>\r
+</resources>
\ No newline at end of file
diff --git a/alps/device/mediatek/system/common/overlay/n7701/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/strings.xml b/alps/device/mediatek/system/common/overlay/n7701/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/strings.xml
new file mode 100755 (executable)
index 0000000..3c3243b
--- /dev/null
+++ b/alps/device/mediatek/system/common/overlay/n7701/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/strings.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<!--\r
+/**\r
+ * Copyright (c) 2009, The Android Open Source Project\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+-->\r
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">\r
+ <!-- Indication on the keyguard that is shown when the device is wirelessly charging. [CHAR LIMIT=80]-->\r
+    <string name="keyguard_indication_charging_time_wireless"><xliff:g id="percentage" example="20%">%2$s</xliff:g>></string>\r
+\r
+    <!-- Indication on the keyguard that is shown when the device is charging. [CHAR LIMIT=50]-->\r
+    <string name="keyguard_indication_charging_time"><xliff:g id="percentage">%2$s</xliff:g></string>\r
+\r
+    <!-- Indication on the keyguard that is shown when the device is charging rapidly. Should match keyguard_plugged_in_charging_fast [CHAR LIMIT=50]-->\r
+    <string name="keyguard_indication_charging_time_fast"><xliff:g id="percentage">%2$s</xliff:g></string>\r
+\r
+    <!-- Indication on the keyguard that is shown when the device is charging slowly. Should match keyguard_plugged_in_charging_slowly [CHAR LIMIT=50]-->\r
+    <string name="keyguard_indication_charging_time_slowly"><xliff:g id="percentage">%2$s</xliff:g></string>\r
+\r
+    <!-- Indication on the keyguard that is shown when the device is dock charging. [CHAR LIMIT=80]-->\r
+    <string name="keyguard_indication_charging_time_dock"><xliff:g id="percentage" example="20%">%2$s</xliff:g></string>\r
+</resources>

代码分析

在devices里面添加宏,建好overlay。然后把需要修改的代码同alps目录后的路径一致。

创建文件夹快捷方式

mkdir -p XXX

eg:
mkdir -p device/mediatek/system/common/overlay/n7701/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值