diff options
| author | 2018-01-23 04:14:01 +0000 | |
|---|---|---|
| committer | 2018-01-23 04:14:01 +0000 | |
| commit | 03e7ec201bf69cf250b5fab922403b43e93b6141 (patch) | |
| tree | bf5a075b2b033bd6bf2016d8aa8a2512118636fc | |
| parent | cd99c3a17ac98b3a28facf4e5ae85a0e95a04333 (diff) | |
| parent | 5e05a9ae1c04f141f66ca4f420e314f625eec8c3 (diff) | |
Merge "Add SystemApi in SystemProperties for vendor apks"
| -rw-r--r-- | api/system-current.txt | 8 | ||||
| -rw-r--r-- | core/java/android/os/SystemProperties.java | 22 |
2 files changed, 29 insertions, 1 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index ba9f2ac0983e..2af165e06d41 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -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); diff --git a/core/java/android/os/SystemProperties.java b/core/java/android/os/SystemProperties.java index 4f6d322ba871..a9b86752ee54 100644 --- a/core/java/android/os/SystemProperties.java +++ b/core/java/android/os/SystemProperties.java @@ -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; @@ -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; @@ -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") @@ -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); @@ -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); @@ -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); @@ -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); @@ -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); @@ -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) { @@ -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) { @@ -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() { + } } |