Add SystemProperties native method implementations.

Bug: http://b.android.com/73046
Change-Id: Ia695e7beb81f426509b646cfd929201f7e0a4ade
This commit is contained in:
Deepanshu Gupta
2014-08-02 13:31:30 -07:00
parent 45aab0eb8f
commit 0c5cd96522
2 changed files with 55 additions and 1 deletions

View File

@@ -48,4 +48,58 @@ public class SystemProperties_Delegate {
return def;
}
@LayoutlibDelegate
/*package*/ static int native_get_int(String key, int def) {
Map<String, String> properties = Bridge.getPlatformProperties();
String value = properties.get(key);
if (value != null) {
return Integer.decode(value);
}
return def;
}
@LayoutlibDelegate
/*package*/ static long native_get_long(String key, long def) {
Map<String, String> properties = Bridge.getPlatformProperties();
String value = properties.get(key);
if (value != null) {
return Long.decode(value);
}
return def;
}
/**
* Values 'n', 'no', '0', 'false' or 'off' are considered false.
* Values 'y', 'yes', '1', 'true' or 'on' are considered true.
*/
@LayoutlibDelegate
/*package*/ static boolean native_get_boolean(String key, boolean def) {
Map<String, String> properties = Bridge.getPlatformProperties();
String value = properties.get(key);
if ("n".equals(value) || "no".equals(value) || "0".equals(value) || "false".equals(value)
|| "off".equals(value)) {
return false;
}
//noinspection SimplifiableIfStatement
if ("y".equals(value) || "yes".equals(value) || "1".equals(value) || "true".equals(value)
|| "on".equals(value)) {
return true;
}
return def;
}
@LayoutlibDelegate
/*package*/ static void native_set(String key, String def) {
Map<String, String> properties = Bridge.getPlatformProperties();
properties.put(key, def);
}
@LayoutlibDelegate
/*package*/ static void native_add_change_callback() {
// pass.
}
}

View File

@@ -150,7 +150,6 @@ public final class CreateInfo implements ICreateInfo {
"com.android.internal.view.menu.MenuBuilder#createNewMenuItem",
"com.android.internal.util.XmlUtils#convertValueToInt",
"com.android.internal.textservice.ITextServicesManager$Stub#asInterface",
"android.os.SystemProperties#native_get",
"dalvik.system.VMRuntime#newUnpaddedArray"
};
@@ -198,6 +197,7 @@ public final class CreateInfo implements ICreateInfo {
"android.graphics.Typeface",
"android.graphics.Xfermode",
"android.os.SystemClock",
"android.os.SystemProperties",
"android.text.AndroidBidi",
"android.text.StaticLayout",
"android.text.format.Time",