summaryrefslogtreecommitdiffstats
path: root/tools/layoutlib
diff options
context:
space:
mode:
authorDeepanshu Gupta <deepanshu@google.com>2014-08-02 13:31:30 -0700
committerDeepanshu Gupta <deepanshu@google.com>2014-08-05 21:13:00 +0000
commit0c5cd96522bae516a43d79d9014e93bca4727785 (patch)
tree6dc87e871b3f57425db547c94dae529899a2df9b /tools/layoutlib
parent45aab0eb8f479b9967e7c3c43d0342412fb49b57 (diff)
downloadframeworks_base-0c5cd96522bae516a43d79d9014e93bca4727785.zip
frameworks_base-0c5cd96522bae516a43d79d9014e93bca4727785.tar.gz
frameworks_base-0c5cd96522bae516a43d79d9014e93bca4727785.tar.bz2
Add SystemProperties native method implementations.
Bug: http://b.android.com/73046 Change-Id: Ia695e7beb81f426509b646cfd929201f7e0a4ade
Diffstat (limited to 'tools/layoutlib')
-rw-r--r--tools/layoutlib/bridge/src/android/os/SystemProperties_Delegate.java54
-rw-r--r--tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java2
2 files changed, 55 insertions, 1 deletions
diff --git a/tools/layoutlib/bridge/src/android/os/SystemProperties_Delegate.java b/tools/layoutlib/bridge/src/android/os/SystemProperties_Delegate.java
index 1e7564e..af0c456 100644
--- a/tools/layoutlib/bridge/src/android/os/SystemProperties_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/os/SystemProperties_Delegate.java
@@ -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.
+ }
}
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
index a315916..89cbaeb 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
@@ -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",