Loading core/java/android/app/ActivityManager.java +2 −1 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.os.IBinder; import android.os.ParcelFileDescriptor; import com.android.internal.app.procstats.ProcessStats; import com.android.internal.os.RoSystemProperties; import com.android.internal.os.TransferPipe; import com.android.internal.util.FastPrintWriter; Loading Loading @@ -900,7 +901,7 @@ public class ActivityManager { /** @hide */ public static boolean isLowRamDeviceStatic() { return "true".equals(SystemProperties.get("ro.config.low_ram", "false")); return RoSystemProperties.CONFIG_LOW_RAM; } /** Loading core/java/android/net/SSLCertificateSocketFactory.java +4 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package android.net; import android.os.SystemProperties; import android.util.Log; import com.android.internal.os.RoSystemProperties; import com.android.org.conscrypt.OpenSSLContextImpl; import com.android.org.conscrypt.OpenSSLSocketImpl; import com.android.org.conscrypt.SSLClientSessionCache; Loading Loading @@ -221,8 +223,8 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { } private static boolean isSslCheckRelaxed() { return "1".equals(SystemProperties.get("ro.debuggable")) && "yes".equals(SystemProperties.get("socket.relaxsslcheck")); return RoSystemProperties.DEBUGGABLE && SystemProperties.getBoolean("socket.relaxsslcheck", false); } private synchronized SSLSocketFactory getDelegate() { Loading core/java/android/os/FactoryTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.os; import com.android.internal.os.RoSystemProperties; /** * Provides support for in-place factory test functions. * Loading @@ -36,7 +38,7 @@ public final class FactoryTest { * or {@link #FACTORY_TEST_HIGH_LEVEL}. */ public static int getMode() { return SystemProperties.getInt("ro.factorytest", FACTORY_TEST_OFF); return RoSystemProperties.FACTORYTEST; } /** Loading core/java/android/os/SystemProperties.java +46 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,13 @@ package android.os; import android.util.Log; import android.util.MutableInt; import com.android.internal.annotations.GuardedBy; import java.util.ArrayList; import java.util.HashMap; /** Loading @@ -25,13 +31,45 @@ import java.util.ArrayList; * * {@hide} */ public class SystemProperties { public class SystemProperties { private static final String TAG = "SystemProperties"; private static final boolean TRACK_KEY_ACCESS = false; public static final int PROP_NAME_MAX = 31; public static final int PROP_VALUE_MAX = 91; private static final ArrayList<Runnable> sChangeCallbacks = new ArrayList<Runnable>(); @GuardedBy("sRoReads") private static final HashMap<String, MutableInt> sRoReads; static { if (TRACK_KEY_ACCESS) { sRoReads = new HashMap<>(); } else { sRoReads = null; } } private static void onKeyAccess(String key) { if (!TRACK_KEY_ACCESS) return; if (key != null && key.startsWith("ro.")) { synchronized (sRoReads) { MutableInt numReads = sRoReads.getOrDefault(key, null); if (numReads == null) { numReads = new MutableInt(0); sRoReads.put(key, numReads); } numReads.value++; if (numReads.value > 3) { Log.d(TAG, "Repeated read (count=" + numReads.value + ") of a read-only system property '" + key + "'", new Exception()); } } } } private static native String native_get(String key); private static native String native_get(String key, String def); private static native int native_get_int(String key, int def); Loading @@ -49,6 +87,7 @@ public class SystemProperties if (key.length() > PROP_NAME_MAX) { throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX); } if (TRACK_KEY_ACCESS) onKeyAccess(key); return native_get(key); } Loading @@ -61,6 +100,7 @@ public class SystemProperties if (key.length() > PROP_NAME_MAX) { throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX); } if (TRACK_KEY_ACCESS) onKeyAccess(key); return native_get(key, def); } Loading @@ -76,6 +116,7 @@ public class SystemProperties if (key.length() > PROP_NAME_MAX) { throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX); } if (TRACK_KEY_ACCESS) onKeyAccess(key); return native_get_int(key, def); } Loading @@ -91,6 +132,7 @@ public class SystemProperties if (key.length() > PROP_NAME_MAX) { throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX); } if (TRACK_KEY_ACCESS) onKeyAccess(key); return native_get_long(key, def); } Loading @@ -111,6 +153,7 @@ public class SystemProperties if (key.length() > PROP_NAME_MAX) { throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX); } if (TRACK_KEY_ACCESS) onKeyAccess(key); return native_get_boolean(key, def); } Loading @@ -127,6 +170,7 @@ public class SystemProperties throw new IllegalArgumentException("val.length > " + PROP_VALUE_MAX); } if (TRACK_KEY_ACCESS) onKeyAccess(key); native_set(key, val); } Loading core/java/android/os/UserManager.java +2 −1 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.telephony.TelephonyManager; import android.view.WindowManager.LayoutParams; import com.android.internal.R; import com.android.internal.os.RoSystemProperties; import java.io.IOException; import java.lang.annotation.Retention; Loading Loading @@ -746,7 +747,7 @@ public class UserManager { * a single owner user. see @link {android.os.UserHandle#USER_OWNER} */ public static boolean isSplitSystemUser() { return SystemProperties.getBoolean("ro.fw.system_user_split", false); return RoSystemProperties.FW_SYSTEM_USER_SPLIT; } /** Loading Loading
core/java/android/app/ActivityManager.java +2 −1 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.os.IBinder; import android.os.ParcelFileDescriptor; import com.android.internal.app.procstats.ProcessStats; import com.android.internal.os.RoSystemProperties; import com.android.internal.os.TransferPipe; import com.android.internal.util.FastPrintWriter; Loading Loading @@ -900,7 +901,7 @@ public class ActivityManager { /** @hide */ public static boolean isLowRamDeviceStatic() { return "true".equals(SystemProperties.get("ro.config.low_ram", "false")); return RoSystemProperties.CONFIG_LOW_RAM; } /** Loading
core/java/android/net/SSLCertificateSocketFactory.java +4 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package android.net; import android.os.SystemProperties; import android.util.Log; import com.android.internal.os.RoSystemProperties; import com.android.org.conscrypt.OpenSSLContextImpl; import com.android.org.conscrypt.OpenSSLSocketImpl; import com.android.org.conscrypt.SSLClientSessionCache; Loading Loading @@ -221,8 +223,8 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { } private static boolean isSslCheckRelaxed() { return "1".equals(SystemProperties.get("ro.debuggable")) && "yes".equals(SystemProperties.get("socket.relaxsslcheck")); return RoSystemProperties.DEBUGGABLE && SystemProperties.getBoolean("socket.relaxsslcheck", false); } private synchronized SSLSocketFactory getDelegate() { Loading
core/java/android/os/FactoryTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.os; import com.android.internal.os.RoSystemProperties; /** * Provides support for in-place factory test functions. * Loading @@ -36,7 +38,7 @@ public final class FactoryTest { * or {@link #FACTORY_TEST_HIGH_LEVEL}. */ public static int getMode() { return SystemProperties.getInt("ro.factorytest", FACTORY_TEST_OFF); return RoSystemProperties.FACTORYTEST; } /** Loading
core/java/android/os/SystemProperties.java +46 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,13 @@ package android.os; import android.util.Log; import android.util.MutableInt; import com.android.internal.annotations.GuardedBy; import java.util.ArrayList; import java.util.HashMap; /** Loading @@ -25,13 +31,45 @@ import java.util.ArrayList; * * {@hide} */ public class SystemProperties { public class SystemProperties { private static final String TAG = "SystemProperties"; private static final boolean TRACK_KEY_ACCESS = false; public static final int PROP_NAME_MAX = 31; public static final int PROP_VALUE_MAX = 91; private static final ArrayList<Runnable> sChangeCallbacks = new ArrayList<Runnable>(); @GuardedBy("sRoReads") private static final HashMap<String, MutableInt> sRoReads; static { if (TRACK_KEY_ACCESS) { sRoReads = new HashMap<>(); } else { sRoReads = null; } } private static void onKeyAccess(String key) { if (!TRACK_KEY_ACCESS) return; if (key != null && key.startsWith("ro.")) { synchronized (sRoReads) { MutableInt numReads = sRoReads.getOrDefault(key, null); if (numReads == null) { numReads = new MutableInt(0); sRoReads.put(key, numReads); } numReads.value++; if (numReads.value > 3) { Log.d(TAG, "Repeated read (count=" + numReads.value + ") of a read-only system property '" + key + "'", new Exception()); } } } } private static native String native_get(String key); private static native String native_get(String key, String def); private static native int native_get_int(String key, int def); Loading @@ -49,6 +87,7 @@ public class SystemProperties if (key.length() > PROP_NAME_MAX) { throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX); } if (TRACK_KEY_ACCESS) onKeyAccess(key); return native_get(key); } Loading @@ -61,6 +100,7 @@ public class SystemProperties if (key.length() > PROP_NAME_MAX) { throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX); } if (TRACK_KEY_ACCESS) onKeyAccess(key); return native_get(key, def); } Loading @@ -76,6 +116,7 @@ public class SystemProperties if (key.length() > PROP_NAME_MAX) { throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX); } if (TRACK_KEY_ACCESS) onKeyAccess(key); return native_get_int(key, def); } Loading @@ -91,6 +132,7 @@ public class SystemProperties if (key.length() > PROP_NAME_MAX) { throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX); } if (TRACK_KEY_ACCESS) onKeyAccess(key); return native_get_long(key, def); } Loading @@ -111,6 +153,7 @@ public class SystemProperties if (key.length() > PROP_NAME_MAX) { throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX); } if (TRACK_KEY_ACCESS) onKeyAccess(key); return native_get_boolean(key, def); } Loading @@ -127,6 +170,7 @@ public class SystemProperties throw new IllegalArgumentException("val.length > " + PROP_VALUE_MAX); } if (TRACK_KEY_ACCESS) onKeyAccess(key); native_set(key, val); } Loading
core/java/android/os/UserManager.java +2 −1 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.telephony.TelephonyManager; import android.view.WindowManager.LayoutParams; import com.android.internal.R; import com.android.internal.os.RoSystemProperties; import java.io.IOException; import java.lang.annotation.Retention; Loading Loading @@ -746,7 +747,7 @@ public class UserManager { * a single owner user. see @link {android.os.UserHandle#USER_OWNER} */ public static boolean isSplitSystemUser() { return SystemProperties.getBoolean("ro.fw.system_user_split", false); return RoSystemProperties.FW_SYSTEM_USER_SPLIT; } /** Loading