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