Android Property System
来源:互联网 发布:linux虚拟机上网 编辑:程序博客网 时间:2024/05/16 06:21
Everyproperty has a name and value. Both name and value are text strings.Property is heavily used in Android to record system setting orexchange information between processes. The property is globallyvisible in the whole system. Every process can get/set a property. Onsystem initialization, Android will allocates a block of sharedmemory for storing the properties. This is done in “init” daemonwhose source code is at: device/system/init. The “init” daemonwill start a Property Service. The Property Service is running in theprocess of “init” daemon. Every client that wants to SET propertyneeds to connect to the Property Service and send message to PropertyService. Property Service will update/create the property in sharedmemory. Any client that wants to GET property can read the propertyfrom the shared memory directly. This promotes the read performance. Theclient application can invoke the API function exposed from libcutilsto GET/SET a property. The source code of libcutils locatesat: device/libs/cutils. TheAPI function is: intproperty_get(const char *key, char *value, const char*default_value); intproperty_set(const char *key, const char *value); Thelibcutils is in turn calling the __system_property_xxx function inlibc to get a property from the shared memory. The source code oflibc is at: device/system/bionic. TheProperty Service is also in turn calling the __system_property_initfunction in libc to initiate the shared memory for properties. Whenstarting the Property Service will load the default properties frombelow files: /default.prop /system/build.prop /system/default.prop /data/local.prop Theproperties are loaded in the above order. Later loaded propertieswill override the previous values. After those properties are loaded,the last loaded is the persistent properties which is persisted in/data/property. SpecialProperties Ifa property’s name begins with “ro.”, then this property istreated as a read-only property. Once set, the value of the propertycan’t be changed. Ifa property’s name begins with “persist.”, then when settingthis property, the value will be written to /data/property, too. Ifa property’s name begins with “net.”, when when setting thisproperty, the “net.change” property will be set automatically tocontain the name of the last updated property. (It’s tricky. Thenetresolve module uses this property to track if there is any changeon the net.* properties.) Theproperty “ctrl.start” and “ctrl.stop” is used to startand stop a service. Every servicemust be defined in /init.rc. On system startup, the init daemon willparse the init.rc and start the Property Service. Once received arequest to set the property of “ctrl.start”, the Property Servicewill use the property value as the service name to find the serviceand then start the service. The service starting result is then putto the property “init.svc.<service name>”. The clientapplication can poll the value of that property to determine theresult. Androidtoolbox TheAndroid toolbox provides two applets: setprop and getprop to get andset properties. The usage is: getprop<property name> setprop<property name> <property value> Java Thejava application can use the System.getProperty() andSystem.setProperty() function to Get and Set the property. Action Bydefault the set property will only cause "init" daemon towrite to shared memory, it won't execute any script or binary. Butyou can add your actions to correspond to property change in init.rc.For example, in the default init.rc, you can find. #adbd on at boot in emulator onproperty:persist.service.adb.enable=1 onproperty:persist.service.adb.enable=0 Soif you set persist.service.adb.enable to 1, the "init"daemon knows it has actions to do, then it will start adbd service. a
on property:ro.kernel.qemu=1
start adbd
startadbd
stop adbd
- Android: Android Property System
- Android System Property 一 System Property
- Android Property System
- Android Property System
- android property system
- Android Property System
- Android Property System (Forwarding)
- Android Property System
- (转载) Android Property System
- Android Property System
- android property system
- Android Property System
- Android Property System
- Android Property System
- Android Property System
- android property system
- Android Property System
- Android Property System
- 二次开发目录
- 顺序栈
- zoj 2022 Factorial(纠结!)(已理解)
- xml中定位到任一节点
- 累
- Android Property System
- 1.2 ECMS(帝国CMS)二次开发1 – 基本方式概述
- 可伸缩性, 可用性和稳定性模式
- hibernate 关联关系配置
- AIX syslog 日志输出配置 syslogd
- 几个好网站~
- LR 8.1对IBM HTTP SERVER服务的监控环境
- WebApp服务器 禁用/启用 SESSION持久化
- 网站测试基本方法-22. 打印机测试