想问下 为什么我在typeface.cpp里 用property_set然后再property_get获取 不成功呢? 代码如下
property_set("runtime.default.font","fat2");
property_set("runtime.default.xmlpath","/data/vendor_fonts.xml");
gFontStyle = (char*)malloc(30*sizeof(char));
xmlPath2 = (char*)malloc(30*sizeof(char));
property_get("runtime.default.font",gFontStyle,"");
property_get("runtime.default.xmlpath",xmlPath2,"");
property的设置是需要权限的,你在哪个进程里面做的?
runtime开头的prop需要system权限,下面是部分权限的要求。
/* White list of permissions for setting property services. */
struct {
const char *prefix;
unsigned int uid;
unsigned int gid;
} property_perms[] = {
{ "net.rmnet0.", AID_RADIO, 0 },
{ "net.gprs.", AID_RADIO, 0 },
{ "net.ppp", AID_RADIO, 0 },
{ "net.qmi", AID_RADIO, 0 },
{ "net.lte", AID_RADIO, 0 },
{ "net.cdma", AID_RADIO, 0 },
{ "ril.", AID_RADIO, 0 },
{ "gsm.", AID_RADIO, 0 },
{ "persist.radio", AID_RADIO, 0 },
{ "net.dns", AID_RADIO, 0 },
{ "sys.usb.config", AID_RADIO, 0 },
{ "net.", AID_SYSTEM, 0 },
{ "dev.", AID_SYSTEM, 0 },
{ "runtime.", AID_SYSTEM, 0 },
{ "hw.", AID_SYSTEM, 0 },
...