一,背景介绍
Android 系统属性主要有两种:SettingsProvider 和 SystemProperties 。
二,SettingsProvider详解
2.1 关于Android"设置"里的一些属性可以直接通过settings命令直接查看或者设置adb shell 下 settings指令可以分别查看系统、全局、安全设置属性。
2.1.1 settings查看方法
adb shell settings list system
adb shell settings list global
adb shell settings list secure
2.1.2 属性的存储位置
/data/system/users/0/
下的对应xml文件:
settings_global.xml
settings_secure.xml
settings_system.xml
2.1.3 settings方法
# get方法
adb shell settings get global bluetooth_on
# set方法
adb shell settings put global bluetooth_on 1
C:\Users\Administrator>adb shell
abc:/ $ su
abc:/ # settings list global | grep device
device_name=Android abc
device_provisioned=1
abc:/ #
2.1.4 源码相关
状态值进行存储:frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
设置的成员定义:frameworks/base/core/java/android/provider/Settings.java
部分的默认值来源于:frameworks/base/packages/SettingsProvider/res/values/defaults.xml
settings代码位置在:frameworks/base/cmds/settings/settings
2.1.5 settings实例
#获取自动锁屏时间
adb shell settings list system | grep timeout
screen_off_timeout=300000
#设置自动锁屏时间
adb shell settings put system screen_off_timeout 2147483647
#全屏沉浸模式(包括状态栏和虚拟按键):
adb shell settings put global policy_control immersive.full=*
#沉浸状态栏:
adb shell settings put global policy_control immersive.status=*
#沉浸虚拟按键(隐藏后底部上划可以呼出):
adb shell settings put global policy_control immersive.navigation=*
#恢复正常模式(如果隐藏了状态栏或者虚拟按键但是又不想用了):
adb shell settings put global policy_control null
三,系统属性读取
3.1 在adb中进行属性读取和设置
3.1.1 Settings Provider设置和读取
//查看screen_off_timeout的值,可以使用下面的命令
$ adb shell settings get system screen_off_timeout
$ 60000
这里属性值是严格区分大小写的(全部都是小写),不存在的值或者写错就获取到null。
//修改休眠时间
$ adb shell settings put system screen_off_timeout 120000 //120秒,2分钟
3.1.2、SystemProperties属性读取和设置
C:\Users\Administrator>adb shell getprop
[apexd.status]: [ready]
[bootreceiver.enable]: [1]
[bpf.progs_loaded]: [1]
[build.version.extensions.r]: [1]
[build.version.extensions.s]: [1]
[cache_key.bluetooth.get_adapter_connection_state]: [7470926241194665063]
[cache_key.bluetooth.get_bond_state]: [7470926241194665059]
[cache_key.bluetooth.get_profile_connection_state]: [7470926241194665064]
[cache_key.bluetooth.get_state]: [7470926241194665065]
[cache_key.bluetooth.is_offloaded_filtering_supported]: [7470926241194665060]
[cache_key.display_info]: [6176213068958815969]
[cache_key.get_packages_for_uid]: [6176213068958816006]
[cache_key.has_system_feature]: [6176213068958815942]
[cache_key.is_compat_change_enabled]: [6176213068958816008]
[cache_key.is_interactive]: [6176213068958815922]
[cache_key.is_power_save_mode]: [6176213068958815957]
[cache_key.is_user_unlocked]: [6176213068958815983]
[cache_key.location_enabled]: [6176213068958815956]
[cache_key.package_info]: [6176213068958816009]
[cache_key.system_server.accounts_data]: [6176213068958815987]
[dalvik.vm.appimageformat]: [lz4]
[dalvik.vm.boot-dex2oat-threads]: [8]
[dalvik.vm.dex2oat-Xms]: [64m]
[dalvik.vm.dex2oat-Xmx]: [512m]
[dalvik.vm.dex2oat-max-image-block-size]: [524288]
[dalvik.vm.dex2oat-minidebuginfo]: [true]
[dalvik.vm.dex2oat-resolve-startup-strings]: [true]
[dalvik.vm.dex2oat-threads]: [8]
[dalvik.vm.dex2oat-updatable-bcp-packages-file]: [/system/etc/updatable-bcp-packages.txt]
[dalvik.vm.dexopt.secondary]: [true]
[dalvik.vm.dexopt.thermal-cutoff]: [2]
[dalvik.vm.heapgrowthlimit]: [192m]
[dalvik.vm.heapmaxfree]: [8m]
[dalvik.vm.heapminfree]: [512k]
[dalvik.vm.heapsize]: [512m]
[dalvik.vm.heapstartsize]: [16m]
[dalvik.vm.heaptargetutilization]: [0.75]
[dalvik.vm.image-dex2oat-Xms]: [64m]
[dalvik.vm.image-dex2oat-Xmx]: [64m]
[dalvik.vm.isa.arm.features]: [default]
[dalvik.vm.isa.arm.variant]: [cortex-a76]
[dalvik.vm.isa.arm64.features]: [default]
[dalvik.vm.isa.arm64.variant]: [cortex-a76]
[dalvik.vm.lockprof.threshold]: [500]
[dalvik.vm.madvise.artfile.size]: [4294967295]
[dalvik.vm.madvise.odexfile.size]: [104857600]
[dalvik.vm.madvise.vdexfile.size]: [104857600]
[dalvik.vm.minidebuginfo]: [true]
[dalvik.vm.usejit]: [true]
[dalvik.vm.usejitprofiles]: [true]
[debug.atrace.tags.enableflags]: [0]
[debug.force_rtl]: [false]
[debug.hwui.use_partial_updates]: [false]
[debug.nfc.fw_download]: [false]
[debug.nfc.se]: [false]
[debug.tracing.screen_brightness]: [0.5]
[dev.bootcomplete]: [1]
[dev.mnt.blk.odm]: [dm-4]
[dev.mnt.blk.odm_dlkm]: [dm-5]
[dev.mnt.blk.product]: [dm-6]
[dev.mnt.blk.root]: [dm-0]
[dev.mnt.blk.system_ext]: [dm-1]
[dev.mnt.blk.vendor]: [dm-2]
[dev.mnt.blk.vendor_dlkm]: [dm-3]
[drm.service.enabled]: [true]
[dumpstate.completed]: [1]
[dumpstate.last_id]: [2]
[external_storage.casefold.enabled]: [1]
[external_storage.projid.enabled]: [1]
[external_storage.sdcardfs.enabled]: [0]
[graphics.gpu.profiler.support]: [true]
[gsid.image_installed]: [0]
[gsm.ignore-nitz]: [yes]
[hwservicemanager.ready]: [true]
[init.svc.adbd]: [running]
[init.svc.akmd]: [stopped]
[init.svc.android-hardware-media-c2-hal-1-1]: [running]
[init.svc.apexd]: [stopped]
[init.svc.apexd-bootstrap]: [stopped]
[init.svc.apexd-snapshotde]: [stopped]
[init.svc.audioserver]: [running]
[init.svc.bootanim]: [stopped]
[init.svc.boringssl_self_test32]: [stopped]
[init.svc.boringssl_self_test32_vendor]: [stopped]
[init.svc.boringssl_self_test64]: [stopped]
[init.svc.boringssl_self_test64_vendor]: [stopped]
[init.svc.boringssl_self_test_apex32]: [stopped]
[init.svc.boringssl_self_test_apex64]: [stopped]
[init.svc.bpfloader]: [stopped]
[init.svc.cameraserver]: [running]
[init.svc.console]: [running]
[init.svc.credstore]: [running]
[init.svc.derive_classpath]: [stopped]
[init.svc.derive_sdk]: [stopped]
[init.svc.drm]: [running]
[init.svc.dump_kernel_panic]: [stopped]
[init.svc.eGTouchD]: [running]
[init.svc.gatekeeperd]: [running]
[init.svc.gpu]: [running]
[init.svc.hdcp2_hdmi]: [stopped]
[init.svc.hdmi_server]: [running]
[init.svc.health-hal-2-1]: [running]
[init.svc.heapprofd]: [stopped]
[init.svc.hidl_memory]: [running]
[init.svc.hwservicemanager]: [running]
[init.svc.idmap2d]: [stopped]
[init.svc.incidentd]: [running]
[init.svc.installd]: [running]
[init.svc.keystore2]: [running]
[init.svc.lcdparamservice]: [running]
[init.svc.lmkd]: [running]
[init.svc.logd]: [running]
[init.svc.logd-auditctl]: [stopped]
[init.svc.logd-reinit]: [stopped]
[init.svc.media]: [running]
[init.svc.media.swcodec]: [running]
[init.svc.media.tuner]: [running]
[init.svc.mediadrm]: [running]
[init.svc.mediaextractor]: [running]
[init.svc.mediametrics]: [running]
[init.svc.netd]: [running]
[init.svc.network_coexist]: [stopped]
[init.svc.odsign]: [stopped]
[init.svc.oemscript]: [stopped]
[init.svc.ril-daemon]: [running]
[init.svc.rknn_server]: [running]
[init.svc.rockchip.drmservice]: [stopped]
[init.svc.rockchip_udc_detector]: [stopped]
[init.svc.servicemanager]: [running]
[init.svc.simple_bugreportd]: [stopped]
[init.svc.statsd]: [running]
[init.svc.storaged]: [running]
[init.svc.surfaceflinger]: [running]
[init.svc.system_suspend]: [running]
[init.svc.tee-supplicant]: [running]
[init.svc.tombstoned]: [running]
[init.svc.traced]: [running]
[init.svc.traced_perf]: [stopped]
[init.svc.traced_probes]: [running]
[init.svc.ueventd]: [running]
[init.svc.usbd]: [stopped]
[init.svc.vendor.audio-hal]: [running]
[init.svc.vendor.bluetooth-1-0]: [running]
[init.svc.vendor.camera-provider-2-4]: [running]
[init.svc.vendor.camera-provider-2-4-ext]: [running]
[init.svc.vendor.cas-hal-1-2]: [running]
[init.svc.vendor.drm-clearkey-hal-1-4]: [running]
[init.svc.vendor.drm-widevine-hal-1-4]: [running]
[init.svc.vendor.gatekeeper-1-0]: [running]
[init.svc.vendor.gnss-2-0]: [running]
[init.svc.vendor.gralloc-4-0]: [running]
[init.svc.vendor.hwcomposer-2-1]: [running]
[init.svc.vendor.insmod_sh]: [stopped]
[init.svc.vendor.keymint-default]: [running]
[init.svc.vendor.light-rockchip]: [running]
[init.svc.vendor.media.omx]: [running]
[init.svc.vendor.move_data_sh]: [stopped]
[init.svc.vendor.outputmanager-1-0]: [running]
[init.svc.vendor.power-aidl-rockchip]: [running]
[init.svc.vendor.radio-1-2]: [running]
[init.svc.vendor.radio-config-hal-1-0]: [running]
[init.svc.vendor.rknn-1-0]: [running]
[init.svc.vendor.rockit-hal-1-0]: [running]
[init.svc.vendor.sensors-hal-1-0]: [running]
[init.svc.vendor.tv-input-1-0]: [running]
[init.svc.vendor.weaver-hal-1-0]: [running]
[init.svc.vendor.wifi_hal_legacy]: [running]
[init.svc.vndservicemanager]: [running]
[init.svc.vold]: [running]
[init.svc.wificond]: [running]
[init.svc.zygote]: [running]
[init.svc.zygote_secondary]: [running]
[init.svc_debug_pid.adbd]: [720]
[init.svc_debug_pid.akmd]: []
[init.svc_debug_pid.android-hardware-media-c2-hal-1-1]: [380]
[init.svc_debug_pid.apexd]: []
[init.svc_debug_pid.apexd-bootstrap]: []
[init.svc_debug_pid.apexd-snapshotde]: []
[init.svc_debug_pid.audioserver]: [393]
[init.svc_debug_pid.bootanim]: []
[init.svc_debug_pid.boringssl_self_test32]: []
[init.svc_debug_pid.boringssl_self_test32_vendor]: []
[init.svc_debug_pid.boringssl_self_test64]: []
[init.svc_debug_pid.boringssl_self_test64_vendor]: []
[init.svc_debug_pid.boringssl_self_test_apex32]: []
[init.svc_debug_pid.boringssl_self_test_apex64]: []
[init.svc_debug_pid.bpfloader]: []
[init.svc_debug_pid.cameraserver]: [439]
[init.svc_debug_pid.console]: [287]
[init.svc_debug_pid.credstore]: [394]
[init.svc_debug_pid.derive_classpath]: []
[init.svc_debug_pid.derive_sdk]: []
[init.svc_debug_pid.drm]: [429]
[init.svc_debug_pid.dump_kernel_panic]: []
[init.svc_debug_pid.eGTouchD]: [433]
[init.svc_debug_pid.gatekeeperd]: [514]
[init.svc_debug_pid.gpu]: [395]
[init.svc_debug_pid.hdcp2_hdmi]: []
[init.svc_debug_pid.hdmi_server]: [388]
[init.svc_debug_pid.health-hal-2-1]: [379]
[init.svc_debug_pid.heapprofd]: []
[init.svc_debug_pid.hidl_memory]: [367]
[init.svc_debug_pid.hwservicemanager]: [285]
[init.svc_debug_pid.idmap2d]: []
[init.svc_debug_pid.incidentd]: [441]
[init.svc_debug_pid.installd]: [442]
[init.svc_debug_pid.keystore2]: [322]
[init.svc_debug_pid.lcdparamservice]: [438]
[init.svc_debug_pid.lmkd]: [283]
[init.svc_debug_pid.logd]: [282]
[init.svc_debug_pid.logd-auditctl]: []
[init.svc_debug_pid.logd-reinit]: []
[init.svc_debug_pid.media]: [445]
[init.svc_debug_pid.media.swcodec]: [457]
[init.svc_debug_pid.media.tuner]: [446]
[init.svc_debug_pid.mediaextractor]: [443]
[init.svc_debug_pid.mediametrics]: [444]
[init.svc_debug_pid.netd]: [361]
[init.svc_debug_pid.network_coexist]: []
[init.svc_debug_pid.odsign]: []
[init.svc_debug_pid.oemscript]: []
[init.svc_debug_pid.ril-daemon]: [452]
[init.svc_debug_pid.rknn_server]: [289]
[init.svc_debug_pid.rockchip.drmservice]: []
[init.svc_debug_pid.rockchip_udc_detector]: []
[init.svc_debug_pid.servicemanager]: [284]
[init.svc_debug_pid.simple_bugreportd]: []
[init.svc_debug_pid.statsd]: [360]
[init.svc_debug_pid.storaged]: [447]
[init.svc_debug_pid.surfaceflinger]: [396]
[init.svc_debug_pid.system_suspend]: [321]
[init.svc_debug_pid.tee-supplicant]: [320]
[init.svc_debug_pid.tombstoned]: [340]
[init.svc_debug_pid.traced]: [432]
[init.svc_debug_pid.traced_perf]: []
[init.svc_debug_pid.traced_probes]: [430]
[init.svc_debug_pid.ueventd]: [262]
[init.svc_debug_pid.usbd]: []
[init.svc_debug_pid.vendor.audio-hal]: [368]
[init.svc_debug_pid.vendor.bluetooth-1-0]: [369]
[init.svc_debug_pid.vendor.camera-provider-2-4]: [371]
[init.svc_debug_pid.vendor.camera-provider-2-4-ext]: [370]
[init.svc_debug_pid.vendor.cas-hal-1-2]: [372]
[init.svc_debug_pid.vendor.drm-clearkey-hal-1-4]: [373]
[init.svc_debug_pid.vendor.drm-widevine-hal-1-4]: [374]
[init.svc_debug_pid.vendor.gatekeeper-1-0]: [375]
[init.svc_debug_pid.vendor.gnss-2-0]: [376]
[init.svc_debug_pid.vendor.gralloc-4-0]: [377]
[init.svc_debug_pid.vendor.hwcomposer-2-1]: [378]
[init.svc_debug_pid.vendor.insmod_sh]: []
[init.svc_debug_pid.vendor.keymint-default]: [288]
[init.svc_debug_pid.vendor.light-rockchip]: [386]
[init.svc_debug_pid.vendor.media.omx]: [449]
[init.svc_debug_pid.vendor.move_data_sh]: []
[init.svc_debug_pid.vendor.outputmanager-1-0]: [390]
[init.svc_debug_pid.vendor.power-aidl-rockchip]: [387]
[init.svc_debug_pid.vendor.radio-1-2]: [382]
[init.svc_debug_pid.vendor.radio-config-hal-1-0]: [381]
[init.svc_debug_pid.vendor.rknn-1-0]: [389]
[init.svc_debug_pid.vendor.rockit-hal-1-0]: [391]
[init.svc_debug_pid.vendor.sensors-hal-1-0]: [383]
[init.svc_debug_pid.vendor.tv-input-1-0]: [392]
[init.svc_debug_pid.vendor.weaver-hal-1-0]: [384]
[init.svc_debug_pid.vendor.wifi_hal_legacy]: [385]
[init.svc_debug_pid.vndservicemanager]: [286]
[init.svc_debug_pid.vold]: [291]
[init.svc_debug_pid.wificond]: [448]
[init.svc_debug_pid.zygote]: [362]
[init.svc_debug_pid.zygote_secondary]: [363]
[keyguard.no_require_sim]: [true]
[keystore.boot_level]: [1000000000]
[keystore.crash_count]: [0]
[khungtask.enable]: [false]
[llk.enable]: [false]
[log.tag.APM_AudioPolicyManager]: [D]
[log.tag.stats_log]: [I]
[logd.logpersistd.enable]: [true]
[media.sink.audio]: [LPCM,
]
[net.bt.name]: [Android]
[net.qtaguid_enabled]: [1]
[net.tcp_def_init_rwnd]: [60]
[odsign.key.done]: [1]
[odsign.verification.done]: [1]
[odsign.verification.success]: [0]
[persist.bluetooth.btsnoopdefaultmode]: []
[persist.bluetooth.btsnooplogmode]: [disable]
[persist.bluetooth.btsnooppath]: [/data/misc/bluedroid/btsnoop_hci.cfa]
[persist.bluetooth.btsnoopsize]: [0xffff]
[persist.bluetooth.showdeviceswithoutnames]: [false]
[persist.bt.power.down]: [true]
[persist.dbg.keep_debugfs_mounted]: [1]
[persist.debug.dalvik.vm.core_platform_api_policy]: [just-warn]
[persist.device_config.attempted_boot_count]: [0]
[persist.enable_task_snapshots]: [false]
[persist.net.data.score]: [100]
[persist.net.eth0.score]: [400]
[persist.net.eth1.score]: [300]
[persist.net.network_coexist]: [false]
[persist.net.network_priority]: [0]
[persist.net.wifi.score]: [200]
[persist.netd.stable_secret]: [49fd:3efd:7045:d23:203d:1ad:28e4:fa68]
[persist.service.bdroid.bdaddr]: [22:22:69:0d:0c:00]
[persist.sys.audio_gain_level]: [1]
[persist.sys.boot.reason]: []
[persist.sys.boot.reason.history]: [reboot,1520046188
reboot,loader,1690445810
reboot,userrequested,1690409354]
[persist.sys.carkey.mode]: [0]
[persist.sys.dalvik.vm.lib.2]: [libart.so]
[persist.sys.device_provisioned]: [1]
[persist.sys.displayinset.top]: [0]
[persist.sys.dpi]: [1]
[persist.sys.enable_ethernet_tethering]: [0]
[persist.sys.fuse]: [true]
[persist.sys.fuse.passthrough.enable]: [true]
[persist.sys.hdmi_audio_mode]: [1]
[persist.sys.hdmiinmode]: [2]
[persist.sys.hidnotify.enable]: [false]
[persist.sys.ison]: [false]
[persist.sys.lmk.reportkills]: [true]
[persist.sys.mipicam_mirror]: [1]
[persist.sys.mipicam_orientation]: [0]
[persist.sys.provider.uid]: [10082]
[persist.sys.repeat.shundown]: [1]
[persist.sys.rotation.efull-1]: [true]
[persist.sys.rotation.einit-1]: [0]
[persist.sys.strictmode.visual]: [false]
[persist.sys.theme]: [1]
[persist.sys.timezone]: [Asia/Shanghai]
[persist.sys.ts.disable]: [0]
[persist.sys.usb.config]: [adb]
[persist.sys.usbcam_mirror]: [1]
[persist.sys.usbcam_orientation]: [0]
[persist.sys.usbmode]: [0]
[persist.sys.zram_enabled]: [1]
[persist.traced.enable]: [1]
[persist.usb.mode]: [0]
[persist.vendor.bluetooth.prefferedrole]: [master]
[persist.vendor.bluetooth.rtkcoex]: [true]
[persist.vendor.camera.debug.logfile]: [0]
[persist.vendor.primary_display_orientation]: [0]
[persist.vendor.rtkbt.bdaddr_path]: [none]
[persist.vendor.rtkbtadvdisable]: [false]
[persist.vendor.sys.hid]: []
[persist.wifi.sleep.delay.ms]: [0]
[pm.dexopt.ab-ota]: [speed-profile]
[pm.dexopt.bg-dexopt]: [speed-profile]
[pm.dexopt.boot-after-ota]: [verify]
[pm.dexopt.cmdline]: [verify]
[pm.dexopt.first-boot]: [verify]
[pm.dexopt.inactive]: [verify]
[pm.dexopt.install]: [speed-profile]
[pm.dexopt.install-bulk]: [speed-profile]
[pm.dexopt.install-bulk-downgraded]: [verify]
[pm.dexopt.install-bulk-secondary]: [verify]
[pm.dexopt.install-bulk-secondary-downgraded]: [extract]
[pm.dexopt.install-fast]: [skip]
[pm.dexopt.post-boot]: [extract]
[pm.dexopt.shared]: [speed]
[ril.function.dataonly]: [1]
[rild.libargs]: [-d]
[rild.simcom.gps]: [1]
[rild.simcom.iprulemain]: [1]
[ro.actionable_compatible_property.enabled]: [true]
[ro.allow.mock.location]: [0]
[ro.audio.monitorOrientation]: [true]
[ro.baseband]: [unknown]
[ro.bionic.2nd_arch]: [arm]
[ro.bionic.2nd_cpu_variant]: [cortex-a76]
[ro.bionic.arch]: [arm64]
[ro.bionic.cpu_variant]: [cortex-a76]
[ro.board.platform]: [rk3588]
[ro.boot.boot_devices]: [fe2e0000.mmc]
[ro.boot.bootreason]: [reboot]
[ro.boot.console]: [ttyFIQ0]
[ro.boot.dtb_idx]: [0]
[ro.boot.dtbo_idx]: [0]
[ro.boot.dynamic_partitions]: [true]
[ro.boot.flash.locked]: [0]
[ro.boot.hardware]: [rk30board]
[ro.boot.mode]: [normal]
[ro.boot.noril]: [false]
[ro.boot.selinux]: [permissive]
[ro.boot.serialno]: [93c3e5cef612a187]
[ro.boot.storagemedia]: [emmc]
[ro.boot.verifiedbootstate]: [orange]
[ro.boot.vr]: [0]
[ro.boot.wificountrycode]: [CN]
[ro.bootimage.build.date]: [Wed Jul 26 20:04:46 CST 2023]
[ro.bootimage.build.date.utc]: [1690373086]
[ro.bootimage.build.fingerprint]: [rockchip/rk3588_s/rk3588_s:12/SQ3A.220705.003.A1/tcz07262004:userdebug/release-keys]
[ro.bootimage.build.id]: [SQ3A.220705.003.A1]
[ro.bootimage.build.tags]: [release-keys]
[ro.bootimage.build.type]: [userdebug]
[ro.bootimage.build.version.incremental]: [eng.tcz.20230726.200723]
[ro.bootimage.build.version.release]: [12]
[ro.bootimage.build.version.release_or_codename]: [12]
[ro.bootimage.build.version.sdk]: [32]
[ro.bootloader]: [unknown]
[ro.bootmode]: [normal]
[ro.boottime.adbd]: [5755736558]
[ro.boottime.akmd]: [5808724230]
[ro.boottime.android-hardware-media-c2-hal-1-1]: [5450743611]
[ro.boottime.apexd]: [5108350826]
[ro.boottime.apexd-bootstrap]: [3995707964]
[ro.boottime.apexd-snapshotde]: [5261461842]
[ro.boottime.audioserver]: [5465636112]
[ro.boottime.bootanim]: [6715681363]
[ro.boottime.boringssl_self_test32]: [4096751558]
[ro.boottime.boringssl_self_test32_vendor]: [4393044088]
[ro.boottime.boringssl_self_test64]: [4200329693]
[ro.boottime.boringssl_self_test64_vendor]: [4420574507]
[ro.boottime.boringssl_self_test_apex32]: [5528551827]
[ro.boottime.boringssl_self_test_apex64]: [5610308918]
[ro.boottime.bpfloader]: [5327454348]
[ro.boottime.cameraserver]: [5792170687]
[ro.boottime.console]: [4707804953]
[ro.boottime.credstore]: [5466815904]
[ro.boottime.derive_classpath]: [5204571961]
[ro.boottime.derive_sdk]: [5154745081]
[ro.boottime.drm]: [5758183350]
[ro.boottime.dump_kernel_panic]: [5292751845]
[ro.boottime.eGTouchD]: [5786481436]
[ro.boottime.gatekeeperd]: [6059992172]
[ro.boottime.gpu]: [5468116154]
[ro.boottime.hdcp2_hdmi]: [4875124219]
[ro.boottime.hdmi_server]: [5460099987]
[ro.boottime.health-hal-2-1]: [5449549235]
[ro.boottime.hidl_memory]: [5431910109]
[ro.boottime.hwservicemanager]: [4705865952]
[ro.boottime.idmap2d]: [5795267312]
[ro.boottime.incidentd]: [5796649520]
[ro.boottime.init]: [3322159730]
[ro.boottime.init.cold_boot_wait]: [0]
[ro.boottime.init.first_stage]: [394436915]
[ro.boottime.init.fsck.cache]: [99]
[ro.boottime.init.fsck.data]: [92]
[ro.boottime.init.mount.cache]: [2]
[ro.boottime.init.mount.data]: [66]
[ro.boottime.init.mount_all.early]: [117]
[ro.boottime.init.mount_all.late]: [173]
[ro.boottime.init.selinux]: [171717434]
[ro.boottime.installd]: [5798364812]
[ro.boottime.keystore2]: [4878466720]
[ro.boottime.lcdparamservice]: [5789146978]
[ro.boottime.lmkd]: [4700267994]
[ro.boottime.logd]: [4696165993]
[ro.boottime.logd-auditctl]: [15895179243]
[ro.boottime.logd-reinit]: [5308621430]
[ro.boottime.media]: [5802367938]
[ro.boottime.media.swcodec]: [5833961274]
[ro.boottime.media.tuner]: [5803619479]
[ro.boottime.mediaextractor]: [5799662437]
[ro.boottime.mediametrics]: [5801173854]
[ro.boottime.netd]: [5400661231]
[ro.boottime.network_coexist]: [15848173947]
[ro.boottime.odsign]: [5224108671]
[ro.boottime.oemscript]: [15852774405]
[ro.boottime.ril-daemon]: [5811292938]
[ro.boottime.rknn_server]: [4713129036]
[ro.boottime.rockchip.drmservice]: [5809932605]
[ro.boottime.rockchip_udc_detector]: [4718313995]
[ro.boottime.servicemanager]: [4703571994]
[ro.boottime.simple_bugreportd]: [24003761516]
[ro.boottime.statsd]: [5396390355]
[ro.boottime.storaged]: [5804840980]
[ro.boottime.surfaceflinger]: [5469737238]
[ro.boottime.system_suspend]: [4877601053]
[ro.boottime.tee-supplicant]: [4876150595]
[ro.boottime.tombstoned]: [5075254240]
[ro.boottime.traced]: [5784456102]
[ro.boottime.traced_probes]: [5760556058]
[ro.boottime.ueventd]: [3993362673]
[ro.boottime.usbd]: [6061482297]
[ro.boottime.vendor.audio-hal]: [5433301067]
[ro.boottime.vendor.bluetooth-1-0]: [5434767567]
[ro.boottime.vendor.camera-provider-2-4]: [5437404234]
[ro.boottime.vendor.camera-provider-2-4-ext]: [5435982359]
[ro.boottime.vendor.cas-hal-1-2]: [5438733943]
[ro.boottime.vendor.drm-clearkey-hal-1-4]: [5440109443]
[ro.boottime.vendor.drm-widevine-hal-1-4]: [5441371193]
[ro.boottime.vendor.gatekeeper-1-0]: [5442681943]
[ro.boottime.vendor.gnss-2-0]: [5443755860]
[ro.boottime.vendor.gralloc-4-0]: [5444740527]
[ro.boottime.vendor.hwcomposer-2-1]: [5445901652]
[ro.boottime.vendor.insmod_sh]: [4259938783]
[ro.boottime.vendor.keymint-default]: [4710823120]
[ro.boottime.vendor.light-rockchip]: [5458051903]
[ro.boottime.vendor.media.omx]: [5807424563]
[ro.boottime.vendor.move_data_sh]: [6132944429]
[ro.boottime.vendor.outputmanager-1-0]: [5462250737]
[ro.boottime.vendor.power-aidl-rockchip]: [5459065153]
[ro.boottime.vendor.radio-1-2]: [5453405069]
[ro.boottime.vendor.radio-config-hal-1-0]: [5452217694]
[ro.boottime.vendor.rknn-1-0]: [5461229320]
[ro.boottime.vendor.rockit-hal-1-0]: [5463317945]
[ro.boottime.vendor.sensors-hal-1-0]: [5454459153]
[ro.boottime.vendor.tv-input-1-0]: [5464407904]
[ro.boottime.vendor.weaver-hal-1-0]: [5455780986]
[ro.boottime.vendor.wifi_hal_legacy]: [5456826028]
[ro.boottime.vndservicemanager]: [4706799869]
[ro.boottime.vold]: [4716894162]
[ro.boottime.wificond]: [5806032730]
[ro.boottime.zygote]: [5402835022]
[ro.boottime.zygote_secondary]: [5405436981]
[ro.bt.bdaddr_path]: [/data/misc/bluetooth/bdaddr]
[ro.build.characteristics]: [tablet]
[ro.build.date]: [Thu Jul 27 15:20:05 CST 2023]
[ro.build.date.utc]: [1690442405]
[ro.build.description]: [rk3588_s-userdebug 12 SQ3A.220705.003.A1 eng.tcz.20230727.152031 release-keys]
[ro.build.display.id]: [CX3588_android12_20230727152737]
[ro.build.fingerprint]: [rockchip/rk3588_s/rk3588_s:12/SQ3A.220705.003.A1/eng.tcz.20230727.152031:userdebug/release-keys]
[ro.build.flavor]: [rk3588_s-userdebug]
[ro.build.host]: [jawest-rd2]
[ro.build.id]: [SQ3A.220705.003.A1]
[ro.build.product]: [rk3588_s]
[ro.build.shutdown_timeout]: [6]
[ro.build.tags]: [release-keys]
[ro.build.type]: [userdebug]
[ro.build.user]: [tcz]
[ro.build.version.all_codenames]: [REL]
[ro.build.version.base_os]: []
[ro.build.version.codename]: [REL]
[ro.build.version.incremental]: [eng.tcz.20230727.152031]
[ro.build.version.min_supported_target_sdk]: [23]
[ro.build.version.preview_sdk]: [0]
[ro.build.version.preview_sdk_fingerprint]: [REL]
[ro.build.version.release]: [12]
[ro.build.version.release_or_codename]: [12]
[ro.build.version.sdk]: [32]
[ro.build.version.security_patch]: [2022-07-05]
[ro.carrier]: [unknown]
[ro.cold_boot_done]: [true]
[ro.com.android.dataroaming]: [true]
[ro.config.alarm_alert]: [Alarm_Classic.ogg]
[ro.config.enable.remotecontrol]: [false]
[ro.config.notification_sound]: [OnTheHunt.ogg]
[ro.config.ringtone]: [Ring_Synth_04.ogg]
[ro.crypto.state]: [unsupported]
[ro.dalvik.vm.native.bridge]: [0]
[ro.debuggable]: [1]
[ro.default.size]: [100]
[ro.enable_boot_charger_mode]: [0]
[ro.factory.hasGPS]: [true]
[ro.factory.hasUMS]: [false]
[ro.factory.storage_suppexfat]: [true]
[ro.factory.storage_suppntfs]: [true]
[ro.factory.tool]: [0]
[ro.factory.without_battery]: [false]
[ro.flash_img.enable]: [false]
[ro.gsid.image_running]: [0]
[ro.hardware]: [rk30board]
[ro.hardware.egl]: [mali]
[ro.hardware.tv_input]: [rockchip]
[ro.hwui.use_vulkan]: []
[ro.incremental.enable]: [yes]
[ro.iorapd.enable]: [true]
[ro.jws.api]: [v1.1]
[ro.kernel.android.checkjni]: [0]
[ro.kernel.version]: [5.10]
[ro.logd.kernel]: [1]
[ro.logd.size.stats]: [64K]
[ro.minui.default_rotation]: [ROTATION_NONE]
[ro.minui.pixel_format]: [RGBX_8888]
[ro.net.eth_aux]: [eth1]
[ro.net.eth_primary]: [eth0]
[ro.odm.build.date]: [Thu Jul 27 15:20:05 CST 2023]
[ro.odm.build.date.utc]: [1690442405]
[ro.odm.build.fingerprint]: [rockchip/rk3588_s/rk3588_s:12/SQ3A.220705.003.A1/tcz07271520:userdebug/release-keys]
[ro.odm.build.id]: [SQ3A.220705.003.A1]
[ro.odm.build.tags]: [release-keys]
[ro.odm.build.type]: [userdebug]
[ro.odm.build.version.incremental]: [eng.tcz.20230727.152031]
[ro.odm.build.version.release]: [12]
[ro.odm.build.version.release_or_codename]: [12]
[ro.odm.build.version.sdk]: [32]
[ro.odm.product.cpu.abilist]: [arm64-v8a,armeabi-v7a,armeabi]
[ro.odm.product.cpu.abilist32]: [armeabi-v7a,armeabi]
[ro.odm.product.cpu.abilist64]: [arm64-v8a]
[ro.odm_dlkm.build.date]: [Thu Jul 27 15:20:05 CST 2023]
[ro.odm_dlkm.build.date.utc]: [1690442405]
[ro.odm_dlkm.build.fingerprint]: [rockchip/rk3588_s/rk3588_s:12/SQ3A.220705.003.A1/tcz07271520:userdebug/release-keys]
[ro.odm_dlkm.build.id]: [SQ3A.220705.003.A1]
[ro.odm_dlkm.build.tags]: [release-keys]
[ro.odm_dlkm.build.type]: [userdebug]
[ro.odm_dlkm.build.version.incremental]: [eng.tcz.20230727.152031]
[ro.odm_dlkm.build.version.release]: [12]
[ro.odm_dlkm.build.version.release_or_codename]: [12]
[ro.odm_dlkm.build.version.sdk]: [32]
[ro.oem_unlock_supported]: [1]
[ro.opengles.version]: [196610]
[ro.organization_owned]: [false]
[ro.persistent_properties.ready]: [true]
[ro.postinstall.fstab.prefix]: [/system]
[ro.product.board]: [rk30sdk]
[ro.product.bootimage.brand]: [rockchip]
[ro.product.bootimage.device]: [rk3588_s]
[ro.product.bootimage.manufacturer]: [rockchip]
[ro.product.bootimage.model]: [CX3588]
[ro.product.bootimage.name]: [rk3588_s]
[ro.product.brand]: [rockchip]
[ro.product.build.date]: [Thu Jul 27 15:20:05 CST 2023]
[ro.product.build.date.utc]: [1690442405]
[ro.product.build.fingerprint]: [rockchip/rk3588_s/rk3588_s:12/SQ3A.220705.003.A1/tcz07271520:userdebug/release-keys]
[ro.product.build.id]: [SQ3A.220705.003.A1]
[ro.product.build.tags]: [release-keys]
[ro.product.build.type]: [userdebug]
[ro.product.build.version.incremental]: [eng.tcz.20230727.152031]
[ro.product.build.version.release]: [12]
[ro.product.build.version.release_or_codename]: [12]
[ro.product.build.version.sdk]: [32]
[ro.product.cpu.abi]: [arm64-v8a]
[ro.product.cpu.abilist]: [arm64-v8a,armeabi-v7a,armeabi]
[ro.product.cpu.abilist32]: [armeabi-v7a,armeabi]
[ro.product.cpu.abilist64]: [arm64-v8a]
[ro.product.debugfs_restrictions.enabled]: [true]
[ro.product.device]: [rk3588_s]
[ro.product.firmware]: [v2.1]
[ro.product.first_api_level]: [31]
[ro.product.locale]: [zh-CN]
[ro.product.manufacturer]: [rockchip]
[ro.product.model]: [CX3588]
[ro.product.name]: [rk3588_s]
[ro.product.odm.brand]: [rockchip]
[ro.product.odm.device]: [rk3588_s]
[ro.product.odm.manufacturer]: [rockchip]
[ro.product.odm.model]: [CX3588]
[ro.product.odm.name]: [rk3588_s]
[ro.product.odm_dlkm.brand]: [rockchip]
[ro.product.odm_dlkm.device]: [rk3588_s]
[ro.product.odm_dlkm.manufacturer]: [rockchip]
[ro.product.odm_dlkm.model]: [CX3588]
[ro.product.odm_dlkm.name]: [rk3588_s]
[ro.product.ota.host]: [192.168.1.1:8888]
[ro.product.product.brand]: [rockchip]
[ro.product.product.device]: [rk3588_s]
[ro.product.product.manufacturer]: [rockchip]
[ro.product.product.model]: [CX3588]
[ro.product.product.name]: [rk3588_s]
[ro.product.system.brand]: [rockchip]
[ro.product.system.device]: [rk3588_s]
[ro.product.system.manufacturer]: [rockchip]
[ro.product.system.model]: [CX3588]
[ro.product.system.name]: [rk3588_s]
[ro.product.system_ext.brand]: [rockchip]
[ro.product.system_ext.device]: [rk3588_s]
[ro.product.system_ext.manufacturer]: [rockchip]
[ro.product.system_ext.model]: [CX3588]
[ro.product.system_ext.name]: [rk3588_s]
[ro.product.usbfactory]: [rockchip_usb]
[ro.product.vendor.brand]: [rockchip]
[ro.product.vendor.device]: [rk3588_s]
[ro.product.vendor.manufacturer]: [rockchip]
[ro.product.vendor.model]: [CX3588]
[ro.product.vendor.name]: [rk3588_s]
[ro.product.vendor_dlkm.brand]: [rockchip]
[ro.product.vendor_dlkm.device]: [rk3588_s]
[ro.product.vendor_dlkm.manufacturer]: [rockchip]
[ro.product.vendor_dlkm.model]: [CX3588]
[ro.product.vendor_dlkm.name]: [rk3588_s]
[ro.product.vndk.version]: [32]
[ro.property_service.version]: [2]
[ro.revision]: [0]
[ro.ril.ecclist]: [112,911]
[ro.rk.bt_enable]: [true]
[ro.rk.ethernet_settings]: [true]
[ro.rk.flash_enable]: [true]
[ro.rk.hdmi_enable]: [true]
[ro.rk.screenoff_time]: [60000]
[ro.rk.screenshot_enable]: [true]
[ro.rksdk.version]: [ANDROID12_RKR14]
[ro.runtime.firstboot]: [1690442965150]
[ro.safemode.disabled]: [true]
[ro.secure]: [1]
[ro.serialno]: [93c3e5cef612a187]
[ro.sf.fakerotation]: [false]
[ro.sf.lcd_density]: [160]
[ro.soc.manufacturer]: [Rockchip]
[ro.soc.model]: [RK3588]
[ro.sys.host_unhide_charge_notify]: [true]
[ro.system.build.date]: [Thu Jul 27 15:20:05 CST 2023]
[ro.system.build.date.utc]: [1690442405]
[ro.system.build.fingerprint]: [rockchip/rk3588_s/rk3588_s:12/SQ3A.220705.003.A1/tcz07271520:userdebug/release-keys]
[ro.system.build.id]: [SQ3A.220705.003.A1]
[ro.system.build.tags]: [release-keys]
[ro.system.build.type]: [userdebug]
[ro.system.build.version.incremental]: [eng.tcz.20230727.152031]
[ro.system.build.version.release]: [12]
[ro.system.build.version.release_or_codename]: [12]
[ro.system.build.version.sdk]: [32]
[ro.system.product.cpu.abilist]: [arm64-v8a,armeabi-v7a,armeabi]
[ro.system.product.cpu.abilist32]: [armeabi-v7a,armeabi]
[ro.system.product.cpu.abilist64]: [arm64-v8a]
[ro.system_ext.build.date]: [Thu Jul 27 15:20:05 CST 2023]
[ro.system_ext.build.date.utc]: [1690442405]
[ro.system_ext.build.fingerprint]: [rockchip/rk3588_s/rk3588_s:12/SQ3A.220705.003.A1/tcz07271520:userdebug/release-keys][ro.system_ext.build.id]: [SQ3A.220705.003.A1]
[ro.system_ext.build.tags]: [release-keys]
[ro.system_ext.build.type]: [userdebug]
[ro.system_ext.build.version.incremental]: [eng.tcz.20230727.152031]
[ro.system_ext.build.version.release]: [12]
[ro.system_ext.build.version.release_or_codename]: [12]
[ro.system_ext.build.version.sdk]: [32]
[ro.target.product]: [tablet]
[ro.telephony.default_network]: [26]
[ro.tether.denied]: [false]
[ro.treble.enabled]: [true]
[ro.vendor.build.date]: [Thu Jul 27 15:20:05 CST 2023]
[ro.vendor.build.date.utc]: [1690442405]
[ro.vendor.build.fingerprint]: [rockchip/rk3588_s/rk3588_s:12/SQ3A.220705.003.A1/tcz07271520:userdebug/release-keys]
[ro.vendor.build.id]: [SQ3A.220705.003.A1]
[ro.vendor.build.security_patch]: [2022-07-05]
[ro.vendor.build.tags]: [release-keys]
[ro.vendor.build.type]: [userdebug]
[ro.vendor.build.version.incremental]: [eng.tcz.20230727.152031]
[ro.vendor.build.version.release]: [12]
[ro.vendor.build.version.release_or_codename]: [12]
[ro.vendor.build.version.sdk]: [32]
[ro.vendor.frameratelock]: [true]
[ro.vendor.hdmi_settings]: [true]
[ro.vendor.mpp_buf_type]: [1]
[ro.vendor.product.cpu.abilist]: [arm64-v8a,armeabi-v7a,armeabi]
[ro.vendor.product.cpu.abilist32]: [armeabi-v7a,armeabi]
[ro.vendor.product.cpu.abilist64]: [arm64-v8a]
[ro.vendor.rk_sdk]: [1]
[ro.vendor.sdkversion]: [rk3588_ANDROID12.0_MID_V1.0]
[ro.vendor.udisk.visible]: [true]
[ro.vendor_dlkm.build.date]: [Thu Jul 27 15:20:05 CST 2023]
[ro.vendor_dlkm.build.date.utc]: [1690442405]
[ro.vendor_dlkm.build.fingerprint]: [rockchip/rk3588_s/rk3588_s:12/SQ3A.220705.003.A1/tcz07271520:userdebug/release-keys]
[ro.vendor_dlkm.build.id]: [SQ3A.220705.003.A1]
[ro.vendor_dlkm.build.tags]: [release-keys]
[ro.vendor_dlkm.build.type]: [userdebug]
[ro.vendor_dlkm.build.version.incremental]: [eng.tcz.20230727.152031]
[ro.vendor_dlkm.build.version.release]: [12]
[ro.vendor_dlkm.build.version.release_or_codename]: [12]
[ro.vendor_dlkm.build.version.sdk]: [32]
[ro.vndk.version]: [32]
[ro.wifi.channels]: []
[ro.wifi.sleep.power.down]: [true]
[ro.zygote]: [zygote64_32]
[security.perf_harden]: [1]
[selinux.restorecon_recursive]: [/data/misc_ce/0]
[service.bootanim.exit]: [1]
[service.bootanim.progress]: [0]
[service.sf.present_timestamp]: [1]
[sf.power.control]: [2073600]
[sys.boot.reason]: [reboot]
[sys.boot.reason.last]: [reboot]
[sys.boot_completed]: [1]
[sys.bootstat.first_boot_completed]: [1]
[sys.bugreport_reason]: [SYSTEM_BOOT]
[sys.fuse.transcode_enabled]: [true]
[sys.gmali.version]: [g18p0-01eac0-2]
[sys.init.perf_lsm_hooks]: [1]
[sys.lmk.minfree_levels]: [18432:0,23040:100,27648:200,32256:250,55296:900,80640:950]
[sys.lmk.reportkills]: [1]
[sys.mouse.presentation]: [1]
[sys.rescue_boot_count]: [1]
[sys.resolution.changed]: [false]
[sys.retaildemo.enabled]: [0]
[sys.rkadb.root]: [0]
[sys.rklog.system_boot]: [1]
[sys.status.hidebar_enable]: [false]
[sys.sysctl.extra_free_kbytes]: [9216]
[sys.system_server.start_count]: [1]
[sys.system_server.start_elapsed]: [9829]
[sys.system_server.start_uptime]: [9829]
[sys.usb.config]: [adb]
[sys.usb.configfs]: [1]
[sys.usb.controller]: [fc000000.usb]
[sys.usb.ffs.ready]: [1]
[sys.usb.mtp.device_type]: [3]
[sys.usb.state]: [adb]
[sys.use_memfd]: [false]
[sys.user.0.ce_available]: [true]
[sys.wallpaper.rgb565]: [0]
[sys.wifitracing.started]: [1]
[testing.mediascanner.skiplist]: [/mnt/shell/emulated/Android/]
[tombstoned.max_tombstone_count]: [50]
[vendor.all.modules.ready]: [1]
[vendor.bluetooth.enable_timeout_ms]: [11000]
[vendor.boot_completed]: [1]
[vendor.cam.hal3.ver]: [v3.1.0]
[vendor.cam.librkaiq.ver]: [AIQ v5.0x1.2-rc3]
[vendor.cam.librkaiqAdapter.ver]: [v1.0.3]
[vendor.cam.librkaiqCalib.ver]: [Calib v1.4.8,magicCode:1170944]
[vendor.ghwc.version]: [HWC2-1.5.87]
[vendor.gralloc.disable_afbc]: [0]
[vendor.gralloc.fb_size]: [786432]
[vendor.hwc.compose_policy]: [1]
[vendor.hwc.device.display-0]: [DSI-1:114:connected]
[vendor.hwc.device.display-1]: [HDMI-A-1:70:connected]
[vendor.hwc.device.extend]: [HDMI-A,eDP]
[vendor.hwc.device.primary]: [DSI]
[vendor.hwc.hdr_state]: [NORMAL]
[vendor.realtek.bluetooth.chip_name]: [8821CU or 8821CUH]
[vendor.realtek.bluetooth.en]: [false]
[vendor.rild.libpath]: [/vendor/lib64/hw/libril_ec2x.so]
[vendor.rild.libpath.ec2x]: [/vendor/lib64/hw/libril_ec2x.so]
[vendor.rild.libpath.me3630]: [/vendor/lib64/hw/libril_me3630.so]
[vendor.rild.libpath.n58]: [/vendor/lib64/hw/libril_n58.so]
[vendor.rild.libpath.nl668]: [/vendor/lib64/hw/libril_nl668.so]
[vendor.rild.libpath.rg200]: [/vendor/lib64/hw/libril_rg200.so]
[vendor.rild.libpath.rx500]: [/vendor/lib64/hw/libril_rx500.so]
[vendor.rild.libpath.sim7600]: [/vendor/lib64/hw/libril_sim7600.so]
[vendor.security.tee_supplicant]: [1]
[vendor.serialno]: [93c3e5cef612a187]
[vendor.shutdown_anim.orien]: [0]
[vendor.usb.controller]: [fc000000.usb]
[vold.has_adoptable]: [0]
[vold.has_compress]: [0]
[vold.has_quota]: [1]
[vold.has_reserved]: [1]
[wifi.interface]: [wlan0]
[wifi.supplicant_scan_interval]: [15]
[wlan.driver.status]: [ok]
C:\Users\Administrator>adb shell getprop ro.serialno
93c3e5cef612a187
3.2 Android代码中进行属性读取和设置
3.2.1 Settings Provider设置和读取
Settings Provider是指通过如下方式设置的系统变量数据库:
//读取
Settings.System.getInt(Context.getContentResolver(), "xxx", 1);
Settings.System.getString(Context.getContentResolver(), "xxx", "1");
Settings.System.getLong(Context.getContentResolver(), "xxx", 1);
Settings.System.getFloat(Context.getContentResolver(), "xxx", 1);
//设置
Settings.System.putInt(Context.getContentResolver(), "xxx", 1);
Settings.System.putString(Context.getContentResolver(), "xxx", "1");
Settings.System.putLong(Context.getContentResolver(), "xxx", 1);
Settings.System.putFloat(Context.getContentResolver(), "xxx", 1);
xxx表示属性,比如:screen_off_timeout
3.2.2 SystemProperties设置和读取
/**
* 设置属性值
*
* @param key 长度不能超过31,key.length <= 30
* @param value 长度不能超过91,value.length<=90
*/
public static void set(String key, String value) {
// android.os.SystemProperties
// public static void set(String key, String val)
try {
Class<?> cls = Class.forName("android.os.SystemProperties");
Method method = cls.getMethod("set", String.class, String.class);
method.invoke(null, key, value);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 获取属性值
*
* @param key 长度不能超过31,key.length <= 30
* @param defValue
* @return
*/
public static String get(String key, String defValue) {
// android.os.SystemProperties
// public static String get(String key, String def)
try {
Class<?> cls = Class.forName("android.os.SystemProperties");
Method method = cls.getMethod("get", String.class, String.class);
return (String) method.invoke(null, key, defValue);
} catch (Exception e) {
e.printStackTrace();
}
return defValue;
}
}
但反射对android11及以上,无法使用,android11接口定义如下,
@NonNull
@SystemApi
@TestApi
public static String get(@NonNull String key) {
if (TRACK_KEY_ACCESS) onKeyAccess(key);
return native_get(key);
}
可以看出,@SystemApi描述的为系统api,需要系统权限。解决思路授予应用系统权限。
文章来源:https://uudwc.com/A/AAXbg
文章来源地址https://uudwc.com/A/AAXbg