• Android13---下拉状态栏添加阅读模式(MTK平台)


    问题

    客户需求,阅读模式开关要加到状态栏里面。

    代码位置

    具体代码

    1. diff --git a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/drawable/ic_qs_reader_off.xml b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/drawable/ic_qs_reader_off.xml
    2. new file mode 100755 (executable)
    3. index 0000000..082c75c
    4. --- /dev/null
    5. +++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/drawable/ic_qs_reader_off.xml
    6. @@ -0,0 +1,7 @@
    7. +<?xml version="1.0" encoding="utf-8"?>\r
    8. +<vector android:name="root" android:height="48.0dip" android:width="48.0dip" android:alpha="1.0" android:viewportWidth="1024.0" android:viewportHeight="1024.0"\r
    9. + xmlns:android="http://schemas.android.com/apk/res/android">\r
    10. + <group android:name="ic_signal_reader">\r
    11. + <path android:name="head1" android:fillColor="#ff676f73" android:pathData="M375.466667 477.866667 170.666667 477.866667c-20.48 0-34.133333 13.653333-34.133333 34.133333s13.653333 34.133333 34.133333 34.133333l204.8 0c20.48 0 34.133333-13.653333 34.133333-34.133333S395.946667 477.866667 375.466667 477.866667zM307.2 648.533333 170.666667 648.533333c-20.48 0-34.133333 13.653333-34.133333 34.133333s13.653333 34.133333 34.133333 34.133333l136.533333 0c20.48 0 34.133333-13.653333 34.133333-34.133333S327.68 648.533333 307.2 648.533333zM375.466667 307.2 170.666667 307.2c-20.48 0-34.133333 13.653333-34.133333 34.133333s13.653333 34.133333 34.133333 34.133333l204.8 0c20.48 0 34.133333-13.653333 34.133333-34.133333S395.946667 307.2 375.466667 307.2zM853.333333 307.2l-102.4 0c-20.48 0-34.133333 13.653333-34.133333 34.133333s13.653333 34.133333 34.133333 34.133333l102.4 0c20.48 0 34.133333-13.653333 34.133333-34.133333S873.813333 307.2 853.333333 307.2zM955.733333 136.533333 614.4 136.533333c-40.96 0-78.506667 17.066667-102.4 47.786667C488.106667 153.6 450.56 136.533333 409.6 136.533333L68.266667 136.533333C30.72 136.533333 0 167.253333 0 204.8l0 614.4c0 37.546667 30.72 68.266667 68.266667 68.266667l341.333333 0c40.96 0 78.506667-17.066667 102.4-47.786667 23.893333 27.306667 61.44 47.786667 102.4 47.786667l341.333333 0c37.546667 0 68.266667-30.72 68.266667-68.266667L1024 204.8C1024 167.253333 993.28 136.533333 955.733333 136.533333zM477.866667 750.933333c0 37.546667-30.72 68.266667-68.266667 68.266667L102.4 819.2c-20.48 0-34.133333-13.653333-34.133333-34.133333L68.266667 238.933333c0-20.48 13.653333-34.133333 34.133333-34.133333l307.2 0c37.546667 0 68.266667 30.72 68.266667 68.266667L477.866667 750.933333zM955.733333 785.066667c0 20.48-13.653333 34.133333-34.133333 34.133333l-307.2 0c-37.546667 0-68.266667-30.72-68.266667-68.266667L546.133333 273.066667c0-37.546667 30.72-68.266667 68.266667-68.266667l307.2 0c20.48 0 34.133333 13.653333 34.133333 34.133333L955.733333 785.066667zM853.333333 477.866667l-204.8 0c-20.48 0-34.133333 13.653333-34.133333 34.133333s13.653333 34.133333 34.133333 34.133333l204.8 0c20.48 0 34.133333-13.653333 34.133333-34.133333S873.813333 477.866667 853.333333 477.866667z" />\r
    12. + </group>\r
    13. +</vector>
    14. \ No newline at end of file
    15. diff --git a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/drawable/ic_qs_reader_on.xml b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/drawable/ic_qs_reader_on.xml
    16. new file mode 100755 (executable)
    17. index 0000000..41a7c30
    18. --- /dev/null
    19. +++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/drawable/ic_qs_reader_on.xml
    20. @@ -0,0 +1,7 @@
    21. +<?xml version="1.0" encoding="utf-8"?>\r
    22. +<vector android:name="root" android:height="48.0dip" android:width="48.0dip" android:alpha="1.0" android:viewportWidth="1024.0" android:viewportHeight="1024.0"\r
    23. + xmlns:android="http://schemas.android.com/apk/res/android">\r
    24. + <group android:name="ic_signal_reader">\r
    25. + <path android:name="head1" android:fillColor="#ffffffff" android:pathData="M375.466667 477.866667 170.666667 477.866667c-20.48 0-34.133333 13.653333-34.133333 34.133333s13.653333 34.133333 34.133333 34.133333l204.8 0c20.48 0 34.133333-13.653333 34.133333-34.133333S395.946667 477.866667 375.466667 477.866667zM307.2 648.533333 170.666667 648.533333c-20.48 0-34.133333 13.653333-34.133333 34.133333s13.653333 34.133333 34.133333 34.133333l136.533333 0c20.48 0 34.133333-13.653333 34.133333-34.133333S327.68 648.533333 307.2 648.533333zM375.466667 307.2 170.666667 307.2c-20.48 0-34.133333 13.653333-34.133333 34.133333s13.653333 34.133333 34.133333 34.133333l204.8 0c20.48 0 34.133333-13.653333 34.133333-34.133333S395.946667 307.2 375.466667 307.2zM853.333333 307.2l-102.4 0c-20.48 0-34.133333 13.653333-34.133333 34.133333s13.653333 34.133333 34.133333 34.133333l102.4 0c20.48 0 34.133333-13.653333 34.133333-34.133333S873.813333 307.2 853.333333 307.2zM955.733333 136.533333 614.4 136.533333c-40.96 0-78.506667 17.066667-102.4 47.786667C488.106667 153.6 450.56 136.533333 409.6 136.533333L68.266667 136.533333C30.72 136.533333 0 167.253333 0 204.8l0 614.4c0 37.546667 30.72 68.266667 68.266667 68.266667l341.333333 0c40.96 0 78.506667-17.066667 102.4-47.786667 23.893333 27.306667 61.44 47.786667 102.4 47.786667l341.333333 0c37.546667 0 68.266667-30.72 68.266667-68.266667L1024 204.8C1024 167.253333 993.28 136.533333 955.733333 136.533333zM477.866667 750.933333c0 37.546667-30.72 68.266667-68.266667 68.266667L102.4 819.2c-20.48 0-34.133333-13.653333-34.133333-34.133333L68.266667 238.933333c0-20.48 13.653333-34.133333 34.133333-34.133333l307.2 0c37.546667 0 68.266667 30.72 68.266667 68.266667L477.866667 750.933333zM955.733333 785.066667c0 20.48-13.653333 34.133333-34.133333 34.133333l-307.2 0c-37.546667 0-68.266667-30.72-68.266667-68.266667L546.133333 273.066667c0-37.546667 30.72-68.266667 68.266667-68.266667l307.2 0c20.48 0 34.133333 13.653333 34.133333 34.133333L955.733333 785.066667zM853.333333 477.866667l-204.8 0c-20.48 0-34.133333 13.653333-34.133333 34.133333s13.653333 34.133333 34.133333 34.133333l204.8 0c20.48 0 34.133333-13.653333 34.133333-34.133333S873.813333 477.866667 853.333333 477.866667z" />\r
    26. + </group>\r
    27. +</vector>
    28. \ No newline at end of file
    29. diff --git a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values-zh-rCN/xw_strings.xml b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values-zh-rCN/xw_strings.xml
    30. new file mode 100755 (executable)
    31. index 0000000..d38a881
    32. --- /dev/null
    33. +++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values-zh-rCN/xw_strings.xml
    34. @@ -0,0 +1,25 @@
    35. +<?xml version="1.0" encoding="utf-8"?>
    36. +<!--
    37. +/**
    38. + * Copyright (c) 2014, The Android Open Source Project
    39. + *
    40. + * Licensed under the Apache License, Version 2.0 (the "License");
    41. + * you may not use this file except in compliance with the License.
    42. + * You may obtain a copy of the License at
    43. + *
    44. + * http://www.apache.org/licenses/LICENSE-2.0
    45. + *
    46. + * Unless required by applicable law or agreed to in writing, software
    47. + * distributed under the License is distributed on an "AS IS" BASIS,
    48. + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    49. + * See the License for the specific language governing permissions and
    50. + * limitations under the License.
    51. + */
    52. +-->
    53. +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    54. +
    55. + <string name="xw_show_network_speed">"实时网速"</string>
    56. + <string name="xw_reader">"阅读模式"</string>
    57. +
    58. +</resources>
    59. +
    60. diff --git a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/config.xml b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/config.xml
    61. old mode 100644 (file)
    62. new mode 100755 (executable)
    63. index 1a89f12..d590517
    64. --- a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/config.xml
    65. +++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/config.xml
    66. @@ -74,7 +74,7 @@
    67. <!-- The default tiles to display in QuickSettings -->
    68. <string name="quick_settings_tiles_default" translatable="false">
    69. - internet,bt,flashlight,dnd,alarm,airplane,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle
    70. + internet,bt,flashlight,dnd,alarm,airplane,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,xwreader
    71. </string>
    72. <!-- The class path of the Safety Quick Settings Tile -->
    73. @@ -87,7 +87,7 @@
    74. <!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" -->
    75. <string name="quick_settings_tiles_stock" translatable="false">
    76. - internet,bt,flashlight,dnd,alarm,airplane,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,color_correction
    77. + internet,bt,flashlight,dnd,alarm,airplane,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,color_correction,xwreader
    78. </string>
    79. <!-- The tiles to display in QuickSettings -->
    80. diff --git a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/xw_strings.xml b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/xw_strings.xml
    81. new file mode 100755 (executable)
    82. index 0000000..7381dd3
    83. --- /dev/null
    84. +++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/xw_strings.xml
    85. @@ -0,0 +1,209 @@
    86. +<?xml version="1.0" encoding="utf-8"?>
    87. +<!--
    88. +/**
    89. + * Copyright (c) 2014, The Android Open Source Project
    90. + *
    91. + * Licensed under the Apache License, Version 2.0 (the "License");
    92. + * you may not use this file except in compliance with the License.
    93. + * You may obtain a copy of the License at
    94. + *
    95. + * http://www.apache.org/licenses/LICENSE-2.0
    96. + *
    97. + * Unless required by applicable law or agreed to in writing, software
    98. + * distributed under the License is distributed on an "AS IS" BASIS,
    99. + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    100. + * See the License for the specific language governing permissions and
    101. + * limitations under the License.
    102. + */
    103. +-->
    104. +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    105. +
    106. + <string name="usb_insert_on" translatable="false">Charger Is Connected.</string>
    107. + <string name="usb_insert_off" translatable="false">Charger Has Pulled Up.</string>
    108. +
    109. + <string name="used_ram">"Used"</string>
    110. + <string name="free_ram">"Free"</string>
    111. + <string name="total_ram">"Total"</string>
    112. + <string name="memery_clean_ram">"Memory optimization to optimal state"</string>
    113. + <string name="clean_view_string">"Clean"</string>
    114. + <!-- Suffix added to a number to signify size in bytes. -->
    115. + <string name="byteShort">B</string>
    116. + <!-- Suffix added to a number to signify size in kilobytes. -->
    117. + <string name="kilobyteShort">K</string>
    118. + <!-- Suffix added to a number to signify size in megabytes. -->
    119. + <string name="megabyteShort">M</string>
    120. + <!-- Suffix added to a number to signify size in gigabytes. -->
    121. + <string name="gigabyteShort">G</string>
    122. + <!-- Suffix added to a number to signify size in terabytes. -->
    123. + <string name="terabyteShort">T</string>
    124. + <!-- Suffix added to a number to signify size in petabytes. -->
    125. + <string name="petabyteShort">P</string>
    126. +
    127. + <string name="xw_normal">Sound</string>
    128. + <string name="xw_vibrate">Vibrate</string>
    129. + <string name="xw_silent">Silent</string>
    130. + <string name="xw_data_connection">Mobile data</string>
    131. + <string name="xw_screen_recorder">Screen Recorder</string>
    132. +
    133. +
    134. + <string name="speed">%s/s</string>
    135. + <string name="fileSizeSuffix">%1$s"\n"%2$s</string>
    136. +
    137. + <string name="xw_show_network_speed">Network Speed</string>
    138. + <string name="xw_reader">Reader-M</string>
    139. +
    140. + <string name="xw_low_battery_flashlight_canot_use">Low Battery, Flashlight not available!</string>
    141. +
    142. + <string name="screenshot" translatable="false">ScreenShot</string>
    143. +
    144. + <string name="battery_full" translatable="false">battery full</string>
    145. +
    146. + <!-- Advanced restart menu -->
    147. + <!-- Button to restart the device, within the Restart Options dialog -->
    148. + <string name="global_action_restart_system">System</string>
    149. + <!-- Button to restart the device into recovery mode, within the Restart Options dialog -->
    150. + <string name="global_action_restart_recovery">Recovery</string>
    151. + <!-- Button to restart the device into bootloader mode, within the Restart Options dialog -->
    152. + <string name="global_action_restart_bootloader">Bootloader</string>
    153. + <!-- Button to restart the device into download mode, within the Restart Options dialog -->
    154. + <string name="global_action_restart_download">Download</string>
    155. + <!-- Button to restart the device into fastboot mode, within the Restart Options dialog -->
    156. + <string name="global_action_restart_fastboot">Fastbootd</string>
    157. +
    158. + <!-- Restart progress dialog. This is shown if the user chooses to restart the device. -->
    159. + <string name="global_action_restart_progress">Restarting\u2026</string>
    160. + <!-- Restart to recovery mode progress dialog. This is shown if the user chooses to restart the device. -->
    161. + <string name="global_action_restart_recovery_progress">Restarting to recovery mode\u2026</string>
    162. + <!-- Restart to bootloader mode progress dialog. This is shown if the user chooses to restart the device. -->
    163. + <string name="global_action_restart_bootloader_progress">Restarting to bootloader mode\u2026</string>
    164. + <!-- Restart to download mode progress dialog. This is shown if the user chooses to restart the device. -->
    165. + <string name="global_action_restart_download_progress">Restarting to download mode\u2026</string>
    166. + <!-- Restart to fastboot mode progress dialog. This is shown if the user chooses to restart the device. -->
    167. + <string name="global_action_restart_fastboot_progress">Restarting to fastbootd mode\u2026</string>
    168. +
    169. + <!-- Label for current user in power menu options dialog -->
    170. + <string name="global_action_current_user">Current</string>
    171. +
    172. + <!-- Navigation bar dpad -->
    173. + <string name="accessibility_dpad_left">Cursor left</string>
    174. + <string name="accessibility_dpad_right">Cursor right</string>
    175. +
    176. + <!-- Custom QS tiles -->
    177. + <!-- ADB over network QS tile -->
    178. + <string name="quick_settings_network_adb_label">ADB over network</string>
    179. + <string name="quick_settings_network_adb_no_network">no network</string>
    180. +
    181. + <!-- Ambient display QS tile -->
    182. + <string name="quick_settings_ambient_display_label">Ambient display</string>
    183. + <string name="accessibility_quick_settings_ambient_display_off">Ambient display off.</string>
    184. + <string name="accessibility_quick_settings_ambient_display_on">Ambient display on.</string>
    185. + <string name="accessibility_quick_settings_ambient_display_changed_off">Ambient display turned off.</string>
    186. + <string name="accessibility_quick_settings_ambient_display_changed_on">Ambient display turned on.</string>
    187. +
    188. + <!-- Caffeine QS tile -->
    189. + <string name="quick_settings_caffeine_label">Caffeine</string>
    190. + <string name="accessibility_quick_settings_caffeine_off">Caffeine off.</string>
    191. + <string name="accessibility_quick_settings_caffeine_on">Caffeine on.</string>
    192. +
    193. + <!-- Heads up QS tile -->
    194. + <string name="quick_settings_heads_up_label">Heads up</string>
    195. + <string name="accessibility_quick_settings_heads_up_off">Heads up off.</string>
    196. + <string name="accessibility_quick_settings_heads_up_on">Heads up on.</string>
    197. + <string name="accessibility_quick_settings_heads_up_changed_off">Heads up turned off.</string>
    198. + <string name="accessibility_quick_settings_heads_up_changed_on">Heads up turned on.</string>
    199. +
    200. + <!-- Reader mode QS tile -->
    201. + <string name="quick_settings_reading_mode">Reading mode</string>
    202. + <string name="accessibility_quick_settings_reading_mode_on">Reading mode on.</string>
    203. + <string name="accessibility_quick_settings_reading_mode_off">Reading mode off.</string>
    204. + <string name="accessibility_quick_settings_reading_mode_changed_on">Reading mode turned on.</string>
    205. + <string name="accessibility_quick_settings_reading_mode_changed_off">Reading mode turned off.</string>
    206. +
    207. + <!-- Sync QS tile -->
    208. + <string name="quick_settings_sync_label">Sync</string>
    209. + <string name="accessibility_quick_settings_sync_off">Sync off.</string>
    210. + <string name="accessibility_quick_settings_sync_on">Sync on.</string>
    211. + <string name="accessibility_quick_settings_sync_changed_off">Sync turned off.</string>
    212. + <string name="accessibility_quick_settings_sync_changed_on">Sync turned on.</string>
    213. +
    214. + <!-- System Profiles QS tile -->
    215. + <string name="quick_settings_profiles_label">System profiles</string>
    216. + <string name="accessibility_quick_settings_profiles_off">Profiles off.</string>
    217. + <string name="accessibility_quick_settings_profiles">Profile: <xliff:g id="profile" example="Default">%s</xliff:g>.</string>
    218. + <string name="accessibility_quick_settings_profiles_changed_off">Profiles turned off.</string>
    219. + <string name="accessibility_quick_settings_profiles_changed">Profile changed to <xliff:g id="profile" example="Default">%s</xliff:g>.</string>
    220. +
    221. + <!-- USB tethering QS tile -->
    222. + <string name="quick_settings_usb_tether_label">USB tethering</string>
    223. +
    224. + <!-- Volume panel QS tile -->
    225. + <string name="quick_settings_volume_panel_label">Volume panel</string>
    226. +
    227. + <!-- VPN QS tile -->
    228. + <string name="quick_settings_vpn_label">VPN</string>
    229. + <string name="quick_settings_vpn_connect_dialog_title">Connect to\u2026</string>
    230. + <string name="vpn_credentials_hint">Please enter your credentials for connecting to <xliff:g id="name">%s</xliff:g></string>
    231. + <string name="vpn_credentials_username">Username</string>
    232. + <string name="vpn_credentials_password">Password</string>
    233. + <string name="vpn_credentials_dialog_connect">Connect</string>
    234. +
    235. + <!-- Content description of the location tile in quick settings when on, battery saving mode (not shown on the screen). [CHAR LIMIT=NONE] -->
    236. + <string name="accessibility_quick_settings_location_battery_saving">Location reporting: battery saving mode.</string>
    237. + <!-- Content description of the location tile in quick settings when on, sensors only mode (not shown on the screen). [CHAR LIMIT=NONE] -->
    238. + <string name="accessibility_quick_settings_location_gps_only">Location reporting: sensors only mode.</string>
    239. + <!-- Content description of the location tile in quick settings when on, high accuracy mode (not shown on the screen). [CHAR LIMIT=NONE] -->
    240. + <string name="accessibility_quick_settings_location_high_accuracy">Location reporting: high accuracy mode.</string>
    241. +
    242. + <!-- QuickSettings: Location (On, low-power) [CHAR LIMIT=NONE] -->
    243. + <string name="quick_settings_location_battery_saving_label">Battery saving</string>
    244. + <string name="quick_settings_location_battery_saving_label_twoline">Battery\nsaving</string>
    245. + <!-- QuickSettings: Location (On, gps-only) [CHAR LIMIT=NONE] -->
    246. + <string name="quick_settings_location_gps_only_label">Device only</string>
    247. + <string name="quick_settings_location_gps_only_label_twoline">Device\nonly</string>
    248. + <!-- QuickSettings: Location (On, high-accuracy) [CHAR LIMIT=NONE] -->
    249. + <string name="quick_settings_location_high_accuracy_label">High accuracy</string>
    250. + <string name="quick_settings_location_high_accuracy_label_twoline">High\naccuracy</string>
    251. +
    252. + <!-- QuickSettings: Location detail panel title [CHAR LIMIT=NONE] -->
    253. + <string name="quick_settings_location_detail_title">Location</string>
    254. + <!-- QuickSettings: Location detail panel menu title [CHAR LIMIT=NONE] -->
    255. + <string name="quick_settings_location_detail_menu_title">Select mode:</string>
    256. + <!-- [CHAR LIMIT=30] Location detail panel, high accuracy location mode -->
    257. + <string name="quick_settings_location_detail_mode_high_accuracy_title">High accuracy</string>
    258. + <!-- [CHAR LIMIT=30] Location detail panel, battery saving location mode -->
    259. + <string name="quick_settings_location_detail_mode_battery_saving_title">Battery saving</string>
    260. + <!-- [CHAR LIMIT=30] Location detail panel, device only location mode -->
    261. + <string name="quick_settings_location_detail_mode_sensors_only_title">Device only</string>
    262. + <!-- [CHAR LIMIT=130] Location detail panel, description for high accuracy mode -->
    263. + <string name="quick_settings_location_detail_mode_high_accuracy_description">Use GPS, Wi\u2011Fi, Bluetooth, or cellular networks to determine location</string>
    264. + <!-- [CHAR LIMIT=130] Location detail panel, description for battery saving mode -->
    265. + <string name="quick_settings_location_detail_mode_battery_saving_description">Use Wi\u2011Fi, Bluetooth, or cellular networks to determine location</string>
    266. + <!-- [CHAR LIMIT=130] Location detail panel, description for sensors only mode -->
    267. + <string name="quick_settings_location_detail_mode_sensors_only_description">Use GPS to determine location</string>
    268. +
    269. + <!-- Name of the battery status bar icon. -->
    270. + <string name="status_bar_battery">Battery</string>
    271. +
    272. + <string name="status_bar_settings">Settings</string>
    273. +<string name="qs_media">Media</string>
    274. +
    275. + <string name="qs_device">Devices</string>
    276. +
    277. +
    278. + <!-- AOD QS tile -->
    279. + <string name="quick_settings_aod_label">AOD</string>
    280. + <string name="quick_settings_aod_off_powersave_label">AOD off\nBattery saver</string>
    281. +
    282. + <!--20190517 pjz add sim operator -->
    283. + <string name="operator_cmcc" >"CMCC"</string>
    284. + <string name="operator_cucc" >"CUCC"</string>
    285. + <string name="operator_ctcc" >"CTCC"</string>
    286. +
    287. + <string name="txt_shutdown" >"Power off"</string>
    288. + <string name="txt_restart" >"Restart"</string>
    289. + <string name="txt_emergency" >"Emergent mode"</string>
    290. + <string name="hint_shutdown" >"Tap again to turn off your phone"</string>
    291. + <string name="hint_restart" >"Tap again to restart your phone"</string>
    292. +
    293. +</resources>
    294. +
    295. diff --git a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
    296. old mode 100644 (file)
    297. new mode 100755 (executable)
    298. index c987283..d7841a3
    299. --- a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
    300. +++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
    301. @@ -71,6 +71,7 @@ import javax.inject.Inject;
    302. import javax.inject.Provider;
    303. import dagger.Lazy;
    304. +import com.android.systemui.qs.tiles.XwReaderTile;
    305. @SysUISingleton
    306. public class QSFactoryImpl implements QSFactory {
    307. @@ -109,6 +110,8 @@ public class QSFactoryImpl implements QSFactory {
    308. private final Lazy<QSHost> mQsHostLazy;
    309. private final Provider<CustomTile.Builder> mCustomTileBuilderProvider;
    310. +
    311. + private final Provider<XwReaderTile> mXwReaderTileProvider; //lyz add Reading mode
    312. @Inject
    313. public QSFactoryImpl(
    314. @@ -142,7 +145,8 @@ public class QSFactoryImpl implements QSFactory {
    315. Provider<QuickAccessWalletTile> quickAccessWalletTileProvider,
    316. Provider<QRCodeScannerTile> qrCodeScannerTileProvider,
    317. Provider<OneHandedModeTile> oneHandedModeTileProvider,
    318. - Provider<ColorCorrectionTile> colorCorrectionTileProvider) {
    319. + Provider<ColorCorrectionTile> colorCorrectionTileProvider,
    320. + Provider<XwReaderTile> xwReaderTileProvider) {
    321. mQsHostLazy = qsHostLazy;
    322. mCustomTileBuilderProvider = customTileBuilderProvider;
    323. @@ -175,6 +179,7 @@ public class QSFactoryImpl implements QSFactory {
    324. mQRCodeScannerTileProvider = qrCodeScannerTileProvider;
    325. mOneHandedModeTileProvider = oneHandedModeTileProvider;
    326. mColorCorrectionTileProvider = colorCorrectionTileProvider;
    327. + mXwReaderTileProvider = xwReaderTileProvider;
    328. }
    329. /** Creates a tile with a type based on {@code tileSpec} */
    330. @@ -260,6 +265,9 @@ public class QSFactoryImpl implements QSFactory {
    331. return mOneHandedModeTileProvider.get();
    332. case "color_correction":
    333. return mColorCorrectionTileProvider.get();
    334. + //lyz add Reading mode
    335. + case "xwreader":
    336. + return mXwReaderTileProvider.get();
    337. }
    338. // Custom tiles
    339. diff --git a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/tiles/XwReaderTile.java b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/tiles/XwReaderTile.java
    340. new file mode 100755 (executable)
    341. index 0000000..1d8608e
    342. --- /dev/null
    343. +++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/tiles/XwReaderTile.java
    344. @@ -0,0 +1,118 @@
    345. +package com.android.systemui.qs.tiles;\r
    346. +\r
    347. +\r
    348. +import android.content.Intent;\r
    349. +import android.database.ContentObserver;\r
    350. +import android.os.Handler;\r
    351. +import android.provider.Settings;\r
    352. +import android.service.quicksettings.Tile;\r
    353. +\r
    354. +import com.android.internal.logging.nano.MetricsProto;\r
    355. +import com.android.systemui.R;\r
    356. +import com.android.systemui.plugins.qs.QSTile;\r
    357. +import com.android.systemui.qs.QSHost;\r
    358. +import com.android.systemui.qs.tileimpl.QSTileImpl;\r
    359. +\r
    360. +\r
    361. +\r
    362. +import android.view.View;\r
    363. +import androidx.annotation.Nullable;\r
    364. +import android.os.Handler;\r
    365. +\r
    366. +import android.content.BroadcastReceiver;\r
    367. +import com.android.systemui.qs.logging.QSLogger;\r
    368. +import android.os.Looper;\r
    369. +\r
    370. +import com.android.systemui.plugins.ActivityStarter;\r
    371. +import com.android.systemui.plugins.FalsingManager;\r
    372. +import com.android.internal.logging.MetricsLogger;\r
    373. +import com.android.systemui.plugins.statusbar.StatusBarStateController;\r
    374. +import com.android.systemui.broadcast.BroadcastDispatcher;\r
    375. +import com.android.systemui.dagger.qualifiers.Background;\r
    376. +import com.android.systemui.dagger.qualifiers.Main;\r
    377. +\r
    378. +import dagger.Lazy;\r
    379. +import android.net.ConnectivityManager;\r
    380. +import javax.inject.Inject;\r
    381. +import android.util.Log;\r
    382. +\r
    383. +\r
    384. +public class XwReaderTile extends QSTileImpl<QSTile.BooleanState> {\r
    385. + private static final String TAG = "XwReaderTile";\r
    386. + private static final String NETWORK_SPEED = "xw_show_network_speed";\r
    387. + static final int SETTING_VALUE_OFF = 0;\r
    388. + static final int SETTING_VALUE_ON = 1;\r
    389. + \r
    390. + @Inject\r
    391. + public XwReaderTile(QSHost host,\r
    392. + @Background Looper backgroundLooper,\r
    393. + @Main Handler mainHandler,\r
    394. + FalsingManager falsingManager,\r
    395. + MetricsLogger metricsLogger,\r
    396. + StatusBarStateController statusBarStateController,\r
    397. + ActivityStarter activityStarter,\r
    398. + QSLogger qsLogger,\r
    399. + BroadcastDispatcher broadcastDispatcher,\r
    400. + Lazy<ConnectivityManager> lazyConnectivityManager) {\r
    401. + super(host, backgroundLooper, mainHandler, falsingManager, metricsLogger,\r
    402. + statusBarStateController, activityStarter, qsLogger);\r
    403. + }\r
    404. +\r
    405. + @Override\r
    406. + public Intent getLongClickIntent() {\r
    407. + return new Intent();\r
    408. + }\r
    409. +\r
    410. + @Override\r
    411. + public BooleanState newTileState() {\r
    412. + return new BooleanState();\r
    413. + }\r
    414. +\r
    415. + @Override\r
    416. + public void handleSetListening(boolean listening) {\r
    417. + refreshState();\r
    418. + }\r
    419. +\r
    420. + @Override\r
    421. + public CharSequence getTileLabel() {\r
    422. + return mContext.getString(R.string.xw_reader);\r
    423. + }\r
    424. +\r
    425. + @Override\r
    426. + protected void handleClick(@Nullable View view) {\r
    427. + boolean isOn = Settings.Secure.getInt(\r
    428. + mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, SETTING_VALUE_OFF)\r
    429. + != SETTING_VALUE_OFF;\r
    430. + if (!isOn) {\r
    431. + Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED,\r
    432. + SETTING_VALUE_ON);\r
    433. + Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER, 0);\r
    434. + } else {\r
    435. + Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED,\r
    436. + SETTING_VALUE_OFF);\r
    437. + }\r
    438. + refreshState();\r
    439. + }\r
    440. +\r
    441. + @Override\r
    442. + protected void handleUpdateState(BooleanState state, Object arg) {\r
    443. +\r
    444. + boolean isOn = Settings.Secure.getInt(\r
    445. + mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, SETTING_VALUE_OFF)\r
    446. + != SETTING_VALUE_OFF;\r
    447. + state.value = isOn ? true : false;\r
    448. + state.state = state.value ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE;\r
    449. + if(isOn) {\r
    450. + state.icon = ResourceIcon.get(R.drawable.ic_qs_reader_on);\r
    451. + } else {\r
    452. + state.icon = ResourceIcon.get(R.drawable.ic_qs_reader_off);\r
    453. + }\r
    454. + state.label = mContext.getString(R.string.xw_reader);\r
    455. + }\r
    456. +\r
    457. + @Override\r
    458. + public int getMetricsCategory() {\r
    459. + return MetricsProto.MetricsEvent.QS_PANEL;\r
    460. + }\r
    461. +\r
    462. +}\r

    代码分析

    添加步骤就是客户提供drawable跟strings,我们在​QSFactoryImpl.java​中写好接口,在tiles/XXXXXXXXTile.java中实现具体的功能。

  • 相关阅读:
    Docker镜像解析获取Dockerfile文件
    我是如何写作的?
    英语一和英语二难度差多少?英语二翻译更长为什么说其实更容易?
    计算机网络——wireshark抓包
    2.2 Go语言中的布尔型和整型
    postgresql-数据库与模式
    TCP/IP(十八)TCP 实战抓包分析(二)TCP 三次握手和四次挥手
    【Java综合专栏】「渐入佳境」全链路追踪原理之Java Agent探针的底层运作原理和分析(中篇)
    centos部署tomcat
    2023.10.23
  • 原文地址:https://blog.csdn.net/m0_66587877/article/details/133163651