首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

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

2012-08-27 
Android属性:所设属性值为何在重起后被清除问题:发现adb sehll setProp所设属性在下次重起后被清除adb she

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

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

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


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


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:

static void load_persistent_properties(){    DIR* dir = opendir(PERSISTENT_PROPERTY_DIR);...    if (dir) {        while ((entry = readdir(dir)) != NULL) {            if (strncmp("persist.", entry->d_name, strlen("persist.")))                continue;



ref:

1.Android Property Systemhttp://blog.csdn.net/magod/article/details/7255217

热点排行