若要在java代码里读取里面的属性值,则需用到android.os.SystemProperties这个类,此类未开放(未提供给SDK API),
此类具体位置:frameworks\base\core\java\android\os\SystemProperties.java
能够在frameworks里面使用,
比如在所有文件policies\base\phone\com\android\internal\policy\impl\LockScreen.java
final boolean isMonkey = SystemProperties.getBoolean("ro.monkey", false);
也能够在android自带的APP 里使用,比如在Settings app里使用
packages\apps\Settings\src\com\android\settings\deviceinfo\Status.java
//leo added for KYLIN-529
if(SystemProperties.get("ro.product.name").equals("surfone_citic"))
在android应用中使用
try {
Class<?> classType = Class.forName("android.os.SystemProperties");
//Method[] method = classType.getDeclaredMethods();
//for(int i = 0 ;i<method.length;i++){
// Log.i(TAG, "method="+method[i].getName());
//}
Method getMethod = classType.getDeclaredMethod("get", new Class<?>[]{String.class});
String value = (String) getMethod.invoke(classType, new Object[]{"ro.build.version.incremental"});
Log.i(TAG, value);
} catch (Exception e) {
Log.e(TAG, e.getMessage(),e);
}