Android系统setting中读取apk的属性

657 阅读1分钟

android系统中有一个命令setting,通过它可以设置com.android.setting中的item开关;

generic_x86:/ # settings                                                                     Settings provider (settings) commands:
  help
      Print this help text.
  get [--user <USER_ID> | current] NAMESPACE KEY
      Retrieve the current value of KEY.
  put [--user <USER_ID> | current] NAMESPACE KEY VALUE [TAG] [default]
      Change the contents of KEY to VALUE.
      TAG to associate with the setting.
      {default} to set as the default, case-insensitive only for global/secure namespace
  delete NAMESPACE KEY
      Delete the entry for KEY.
  reset [--user <USER_ID> | current] NAMESPACE {PACKAGE_NAME | RESET_MODE}
      Reset the global/secure table for a package with mode.
      RESET_MODE is one of {untrusted_defaults, untrusted_clear, trusted_defaults}, case-insensitive
  list NAMESPACE
      Print all defined keys.
      NAMESPACE is one of {system, secure, global}, case-insensitive

看Android 代码

frameworks/base/packages/SettingsLib/res/values-en-rXC/strings.xml

<string name="pointer_location" msgid="7516929526199520173">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‎‏‎‎‎‎‏‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‎‎‏‎‎‏‏‏‏‏‎‎‎‏‎‏‏‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‎‏‎‏‏‎‏‎Pointer location‎‏‎‎‏‎"</string>

通过setting命令设置开关状态,指针位置和点击回馈被显示出来了。

给点个赞,你的👍是我最需要的。把你关心的请留言告诉我。