Add method for initializing unchangeable system properties.
This is useful when the environment needs to change under native bridge
emulation.
Bug: 17713104
Change-Id: I074e45a60e5f2e798d6759a134ad637763d791ca
diff --git a/luni/src/main/java/java/lang/System.java b/luni/src/main/java/java/lang/System.java
index bc45196..ed75534 100644
--- a/luni/src/main/java/java/lang/System.java
+++ b/luni/src/main/java/java/lang/System.java
@@ -763,6 +763,7 @@
}
StructUtsname info = Libcore.os.uname();
+ p.put("os.arch", info.machine);
p.put("os.name", info.sysname);
p.put("os.version", info.release);
@@ -778,12 +779,18 @@
return p;
}
+ /**
+ * Inits an unchangeable system property with the given value.
+ * This is useful when the environment needs to change under native bridge emulation.
+ */
+ private static void initUnchangeableSystemProperty(String name, String value) {
+ checkPropertyName(name);
+ unchangeableSystemProperties.put(name, value);
+ }
+
private static Properties createSystemProperties() {
Properties p = new PropertiesWithNonOverrideableDefaults(unchangeableSystemProperties);
- // "os.arch" is a property that changes under native bridge emulation.
- p.put("os.arch", Libcore.os.uname().machine);
-
// On Android, each app gets its own temporary directory.
// (See android.app.ActivityThread.) This is just a fallback default,
// useful only on the host.