Android属性:所设属性值为何在重起后被清除

在Android系统中,使用adb shell setProp设置的属性值在重启后通常会被清除。要实现属性的永久保存,需以`persist.`开头的属性名。具有root权限时,可直接编辑`/system/build.prop`添加属性。系统初始化时,由`init`守护进程启动PropertyService,管理属性的读写。`persist.`前缀的属性会写入`/data/property`目录的对应文件中,从而在重启后保留。
摘要由CSDN通过智能技术生成

问题:发现adb sehll setProp所设属性值在下次重起后被清除

adb shell setprop testing.mediascanner.skiplist /storage/sdcard1/test


结论:1.必须采用persist.开头的属性名才能永久保存。

2.如果具有root权限,可以直接编辑/system/build.prop并加入需要永久保存的属性


On system initialization, Android will allocates a block of shared memory for storing the properties. This is done in “init” daemon whose sourcecode is at: device/system/init. The “init” daemon will start a PropertyService.

The Property Service is running in the process of “init”daemon. Every client that wants to SET property needs to connect to theProperty Service and send message to Property Service. Property Servicewill update/create the property in shared memory. Any client that wants to GET property can read the property from the shared memory directly.This promotes the read performance.

Java API:

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值