关于SystemProperies的注意事项
在使用SystemProperties时出现了开机后不断重启的问题,看log 筛选system android 找到
E/AndroidRuntime(14952): at android.os.SystemProperties.get(SystemProperties.java:64)
然后查看Framework源码SystemProperties.java:64,定位到如下位置:
/**
* Get the value for the given key.
* @return if the key isn't found, return def if it isn't null, or an empty string otherwise
* @throws IllegalArgumentException if the key exceeds 32 characters
*/
public static String get(String key, String def) {
if (key.length() > PROP_NAME_MAX) {
throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX);
}
return native_get(key, def);
}
原来SystemProperties的key长度不能超过30字节。自此问题解决
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。