[Android] CodeSnippet
2019-11-22 本文已影响0人
PPPaix
获取系统属性
public static String getSystemProperties(String key,String defaultValue) {
try {
final Class<?> systemProperties = Class.forName("android.os.SystemProperties");
final Method get = systemProperties.getMethod("get", String.class, String.class);
String result = (String) get.invoke(null, key, defaultValue);
return TextUtils.isEmpty(result) ? defaultValue : result;
} catch (Exception e) {
return defaultValue;
}
}
运行adb
try
{
Runtime.getRuntime().exec(this.cmd + " " + i);
} catch (IOException e) {
Log.e("ConfigResetModeClass", "config: " + e.getMessage());
}