FileDocCategorySizeDatePackage
SystemProperties.javaAPI DocAndroid 5.1 API1884Thu Mar 12 22:22:48 GMT 2015com.android.ex.camera2.portability.util

SystemProperties

public final class SystemProperties extends Object
Mirrors hidden class {@link android.os.SystemProperties} (available since API Level 1).

Fields Summary
private static final Log.Tag
TAG
Constructors Summary
private SystemProperties()

    
Methods Summary
public static java.lang.Stringget(java.lang.String key, java.lang.String defaultValue)
Gets system properties set by adb shell setprop key value

param
key the property key.
param
defaultValue the value to return if the property is undefined or empty (this parameter may be {@code null}).
return
the system property value or the default value.


                                                               
           
        try {
            final Class<?> systemProperties = Class.forName("android.os.SystemProperties");
            final Method get = systemProperties.getMethod("get", String.class, String.class);
            return (String) get.invoke(null, key, defaultValue);
        } catch (Exception e) {
            // This should never happen
            Log.e(TAG, "Exception while getting system property: ", e);
            return defaultValue;
        }