属性服务接口与使用

本文介绍了如何在Java中使用SystemProperties类来设置和获取系统属性,例如通过`SystemProperties.set("ctl.start","shutdownanim")`来执行特定操作。此外,还提到了类似于`getprop`和`setprop`的命令行工具进行属性服务交互。" 127170581,14949583,分布式架构下Redis与ZK实现的分布式锁详解,"['分布式', '架构', 'Redis', 'Zookeeper', '分布式锁']

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

属性服务

1. java:  SystemProperties.set("ctl.start","shutdownanim");



2. c: 
在/system/core/init中
可#include "property_service.h"
property_set("bootanimation.over","1");


3. 其它的C/C++程序中:
/frameworks/base/cmds/bootanimation/bootanimation_main.cpp
#include <cutils/properties.h>

system/core/include/cutils/properties.h:
/* property_get: returns the length of the value which will never be
** greater than PROPERTY_VALUE_MAX - 1 and will always be zero terminated.
** (the length does not include the terminating zero).
**
** If the property read fails or returns an empty value, the default
** value is used (if nonnull).
*/
int property_get(const char *key, char *value, const char *default_value);


/* property_set: returns 0 on success, < 0 on failure
*/
int property_set(const char *key, const char *value);
    
int property_list(void (*propfn)(const char *key, const char *value, void *cookie), void *cookie);  




4. 命令:

getprop/setprop

(完)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值