Loading api/system-current.txt +8 −0 Original line number Diff line number Diff line Loading @@ -3506,6 +3506,14 @@ package android.os { method public abstract void onResult(android.os.Bundle); } public class SystemProperties { method public static java.lang.String get(java.lang.String); method public static java.lang.String get(java.lang.String, java.lang.String); method public static boolean getBoolean(java.lang.String, boolean); method public static int getInt(java.lang.String, int); method public static long getLong(java.lang.String, long); } public class SystemUpdateManager { method public android.os.Bundle retrieveSystemUpdateInfo(); method public void updateSystemUpdateInfo(android.os.PersistableBundle); Loading core/java/android/os/SystemProperties.java +21 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.os; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.util.Log; import android.util.MutableInt; Loading @@ -33,6 +34,7 @@ import java.util.HashMap; * * {@hide} */ @SystemApi public class SystemProperties { private static final String TAG = "SystemProperties"; private static final boolean TRACK_KEY_ACCESS = false; Loading @@ -40,9 +42,11 @@ public class SystemProperties { /** * Android O removed the property name length limit, but com.amazon.kindle 7.8.1.5 * uses reflection to read this whenever text is selected (http://b/36095274). * @hide */ public static final int PROP_NAME_MAX = Integer.MAX_VALUE; /** @hide */ public static final int PROP_VALUE_MAX = 91; @GuardedBy("sChangeCallbacks") Loading Loading @@ -86,8 +90,10 @@ public class SystemProperties { * * @param key the key to lookup * @return an empty string if the {@code key} isn't found * @hide */ @NonNull @SystemApi public static String get(@NonNull String key) { if (TRACK_KEY_ACCESS) onKeyAccess(key); return native_get(key); Loading @@ -100,8 +106,10 @@ public class SystemProperties { * @param def the default value in case the property is not set or empty * @return if the {@code key} isn't found, return {@code def} if it isn't null, or an empty * string otherwise * @hide */ @NonNull @SystemApi public static String get(@NonNull String key, @Nullable String def) { if (TRACK_KEY_ACCESS) onKeyAccess(key); return native_get(key, def); Loading @@ -114,7 +122,9 @@ public class SystemProperties { * @param def a default value to return * @return the key parsed as an integer, or def if the key isn't found or * cannot be parsed * @hide */ @SystemApi public static int getInt(@NonNull String key, int def) { if (TRACK_KEY_ACCESS) onKeyAccess(key); return native_get_int(key, def); Loading @@ -127,7 +137,9 @@ public class SystemProperties { * @param def a default value to return * @return the key parsed as a long, or def if the key isn't found or * cannot be parsed * @hide */ @SystemApi public static long getLong(@NonNull String key, long def) { if (TRACK_KEY_ACCESS) onKeyAccess(key); return native_get_long(key, def); Loading @@ -145,7 +157,9 @@ public class SystemProperties { * @param def a default value to return * @return the key parsed as a boolean, or def if the key isn't found or is * not able to be parsed as a boolean. * @hide */ @SystemApi public static boolean getBoolean(@NonNull String key, boolean def) { if (TRACK_KEY_ACCESS) onKeyAccess(key); return native_get_boolean(key, def); Loading @@ -155,6 +169,7 @@ public class SystemProperties { * Set the value for the given {@code key} to {@code val}. * * @throws IllegalArgumentException if the {@code val} exceeds 91 characters * @hide */ public static void set(@NonNull String key, @Nullable String val) { if (val != null && !val.startsWith("ro.") && val.length() > PROP_VALUE_MAX) { Loading @@ -170,6 +185,7 @@ public class SystemProperties { * * @param callback The {@link Runnable} that should be executed when a system property * changes. * @hide */ public static void addChangeCallback(@NonNull Runnable callback) { synchronized (sChangeCallbacks) { Loading @@ -194,10 +210,14 @@ public class SystemProperties { } } /* /** * Notifies listeners that a system property has changed * @hide */ public static void reportSyspropChanged() { native_report_sysprop_change(); } private SystemProperties() { } } Loading
api/system-current.txt +8 −0 Original line number Diff line number Diff line Loading @@ -3506,6 +3506,14 @@ package android.os { method public abstract void onResult(android.os.Bundle); } public class SystemProperties { method public static java.lang.String get(java.lang.String); method public static java.lang.String get(java.lang.String, java.lang.String); method public static boolean getBoolean(java.lang.String, boolean); method public static int getInt(java.lang.String, int); method public static long getLong(java.lang.String, long); } public class SystemUpdateManager { method public android.os.Bundle retrieveSystemUpdateInfo(); method public void updateSystemUpdateInfo(android.os.PersistableBundle); Loading
core/java/android/os/SystemProperties.java +21 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.os; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.util.Log; import android.util.MutableInt; Loading @@ -33,6 +34,7 @@ import java.util.HashMap; * * {@hide} */ @SystemApi public class SystemProperties { private static final String TAG = "SystemProperties"; private static final boolean TRACK_KEY_ACCESS = false; Loading @@ -40,9 +42,11 @@ public class SystemProperties { /** * Android O removed the property name length limit, but com.amazon.kindle 7.8.1.5 * uses reflection to read this whenever text is selected (http://b/36095274). * @hide */ public static final int PROP_NAME_MAX = Integer.MAX_VALUE; /** @hide */ public static final int PROP_VALUE_MAX = 91; @GuardedBy("sChangeCallbacks") Loading Loading @@ -86,8 +90,10 @@ public class SystemProperties { * * @param key the key to lookup * @return an empty string if the {@code key} isn't found * @hide */ @NonNull @SystemApi public static String get(@NonNull String key) { if (TRACK_KEY_ACCESS) onKeyAccess(key); return native_get(key); Loading @@ -100,8 +106,10 @@ public class SystemProperties { * @param def the default value in case the property is not set or empty * @return if the {@code key} isn't found, return {@code def} if it isn't null, or an empty * string otherwise * @hide */ @NonNull @SystemApi public static String get(@NonNull String key, @Nullable String def) { if (TRACK_KEY_ACCESS) onKeyAccess(key); return native_get(key, def); Loading @@ -114,7 +122,9 @@ public class SystemProperties { * @param def a default value to return * @return the key parsed as an integer, or def if the key isn't found or * cannot be parsed * @hide */ @SystemApi public static int getInt(@NonNull String key, int def) { if (TRACK_KEY_ACCESS) onKeyAccess(key); return native_get_int(key, def); Loading @@ -127,7 +137,9 @@ public class SystemProperties { * @param def a default value to return * @return the key parsed as a long, or def if the key isn't found or * cannot be parsed * @hide */ @SystemApi public static long getLong(@NonNull String key, long def) { if (TRACK_KEY_ACCESS) onKeyAccess(key); return native_get_long(key, def); Loading @@ -145,7 +157,9 @@ public class SystemProperties { * @param def a default value to return * @return the key parsed as a boolean, or def if the key isn't found or is * not able to be parsed as a boolean. * @hide */ @SystemApi public static boolean getBoolean(@NonNull String key, boolean def) { if (TRACK_KEY_ACCESS) onKeyAccess(key); return native_get_boolean(key, def); Loading @@ -155,6 +169,7 @@ public class SystemProperties { * Set the value for the given {@code key} to {@code val}. * * @throws IllegalArgumentException if the {@code val} exceeds 91 characters * @hide */ public static void set(@NonNull String key, @Nullable String val) { if (val != null && !val.startsWith("ro.") && val.length() > PROP_VALUE_MAX) { Loading @@ -170,6 +185,7 @@ public class SystemProperties { * * @param callback The {@link Runnable} that should be executed when a system property * changes. * @hide */ public static void addChangeCallback(@NonNull Runnable callback) { synchronized (sChangeCallbacks) { Loading @@ -194,10 +210,14 @@ public class SystemProperties { } } /* /** * Notifies listeners that a system property has changed * @hide */ public static void reportSyspropChanged() { native_report_sysprop_change(); } private SystemProperties() { } }