Android 属性: persist
来源:互联网 发布:局域网办公聊天软件 编辑:程序博客网 时间:2024/04/26 13:33
转自:http://blog.csdn.net/cloudwu007/article/details/7850496
问题:发现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:
import android.os.SystemProperties;
The Native API:
bionic/libc/include/sys/system_properties.h
bionic/libc/include/sys/_system_properties.h
属性服务启动后会从系统文件中读取默认的属性,并写入共享内存中,以下4个文件为按顺序读取:
/default.prop
/system/build.prop
/system/default.prop
/data/local.prop
后读入的属性将覆盖前面读取的相同的属性。
system/core/init/property_service.c
设置属性,ro.开头的属性将不能被更改属性值,persist.开头的属性会被永久纪录,其他属性值在重新开机后均将被丢弃:
当用户设置属性时,如果以属性名字以persist.开头,则会同时在/data/property目录下创建以该属性名字命名的文件,并写入属性值。
加载永久属性时,会读入在目录/data/property下所有名字以persist.开头的文件内容,作为该名字对应的属性值。
ref:
1.Android Property Systemhttp://blog.csdn.net/magod/article/details/7255217
- Android 属性: persist
- Android系统属性分析ro.persist.
- Android应用具有persist属性时如何自升级
- Tapestry属性生命周期(关于persist)
- 添加persist.sys属性写权限方法
- Android: persist instance state across multiple sessions
- persist: usb persist config
- Using the Android Application class to persist data
- Android App 设置persist 类型系统变量异常分析
- Persist.NET
- persist应用
- Android恢复出厂设置保存文件标志位到 persist 分区
- android 属性
- android属性
- android属性
- android属性
- android 属性
- Android 属性
- mysql数据库FULLTEXT索引的用法和作用
- Java:使用synchronized和Lock对象获取对象锁
- 使用Python抓取网页信息
- 命令行运行hadoop实例wordcount程序
- php学习笔记(二十四)php使用memcache扩展库的使用和安装
- Android 属性: persist
- shell FAQ
- android的基本面试题
- 在Qt中使部分组件透明化
- Visual Geometry Group 资源(vgg)
- 解决不能在 Chromium 上播放mp3的问题
- AES加密时抛出java.security.InvalidKeyException: Illegal key size or default parameters .
- android面试题2
- linux内核(kernel)版本号的意义