Android 13 — Add overlay to modify the charging prompt

Problem Analysis

When android13 is powered on and charging, it will show that it is charging and will be fully charged after… The client asked for him to be removed. It is very simple to change a string. However, for the convenience of subsequent development, we use the overlay method without changing the original code.

Code Location

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]

Specific code

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"?>\\ + <!-- \\ + /**\\ + * Copyright (c) 2009, The Android Open Source Project\\ + *\\ + * Licensed under the Apache License, Version 2.0 (the "License");\\ + * you may not use this file except in compliance with the License.\\ + * You may obtain a copy of the License at\\ + *\\ + * http://www.apache.org/licenses/LICENSE-2.0\\ + *\\ + * Unless required by applicable law or agreed to in writing, software\\ + * distributed under the License is distributed on an "AS IS" BASIS,\\ + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\ + * See the License for the specific language governing permissions and\\ + * limitations under the License.\\ + */\\ + -->\\ + \\ + <resources xmlns:android="http://schemas.android.com/apk/res/android"\\ + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">\\ + <string name="keyguard_indication_charging_time_wireless" msgid="577856646141738675">"<xliff:g id="PERCENTAGE">%2$s</xliff:g></string>\\ + <string name="keyguard_indication_charging_time" msgid="6492711711891071502">"<xliff:g id="PERCENTAGE">%2$s</xliff:g></string>\\ + <string name="keyguard_indication_charging_time_fast" msgid="8390311020603859480">"<xliff:g id="PERCENTAGE">%2$s</xliff:g></string>\\ + <string name="keyguard_indication_charging_time_slowly" msgid="301936949731705417">"<xliff:g id="PERCENTAGE">%2$s</xliff:g></string>\\ + <string name="keyguard_indication_charging_time_dock" msgid="6150404291427377863">"<xliff:g id="PERCENTAGE">%2$s</xliff:g></string>\\ + </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"?>\\ + <!--\\ + /**\\ + * Copyright (c) 2009, The Android Open Source Project\\ + *\\ + * Licensed under the Apache License, Version 2.0 (the "License");\\ + * you may not use this file except in compliance with the License.\\ + * You may obtain a copy of the License at\\ + *\\ + * http://www.apache.org/licenses/LICENSE-2.0\\ + *\\ + * Unless required by applicable law or agreed to in writing, software\\ + * distributed under the License is distributed on an "AS IS" BASIS,\\ + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\ + * See the License for the specific language governing permissions and\\ + * limitations under the License.\\ + */\\ + -->\\ + <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">\\ + <!-- Indication on the keyguard that is shown when the device is wirelessly charging. [CHAR LIMIT=80]-->\\ + <string name="keyguard_indication_charging_time_wireless"><xliff:g id="percentage" example="20%">%2$s</xliff:g></string>\\ + \\ + <!-- Indication on the keyguard that is shown when the device is charging. [CHAR LIMIT=50]-->\\ + <string name="keyguard_indication_charging_time"><xliff:g id="percentage">%2$s</xliff:g></string>\\ + \\ + <!-- Indication on the keyguard that is shown when the device is charging rapidly. Should match keyguard_plugged_in_charging_fast [CHAR LIMIT=50]-->\\ + <string name="keyguard_indication_charging_time_fast"><xliff:g id="percentage">%2$s</xliff:g></string>\\ + \\ + <!-- Indication on the keyguard that is shown when the device is charging slowly. Should match keyguard_plugged_in_charging_slowly [CHAR LIMIT=50]-->\\ + <string name="keyguard_indication_charging_time_slowly"><xliff:g id="percentage">%2$s</xliff:g></string>\\ + \\ + <!-- Indication on the keyguard that is shown when the device is dock charging. [CHAR LIMIT=80]-->\\ + <string name="keyguard_indication_charging_time_dock"><xliff:g id="percentage" example="20%">%2$s</xliff:g></string>\\ + </resources>

Code Analysis

Add macros in the devices and build the overlay. Then make the code that needs to be modified consistent with the path behind the alps directory.

Create a folder shortcut:

mkdir -p XXX

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