aboutsummaryrefslogtreecommitdiffstats
path: root/apps/DeviceConfig/src/com/example
diff options
context:
space:
mode:
authorMichael Wright <michaelwr@google.com>2012-07-10 22:33:32 -0700
committerMichael Wright <michaelwr@google.com>2012-07-23 16:08:04 -0700
commit825ea51673fc78aae6ed349ad0be9e7162f50850 (patch)
tree882dc0f9a75b47e0e99aa94463929fcdf693e228 /apps/DeviceConfig/src/com/example
parent03cf005d411fd240a84eaafff514807c4851d85c (diff)
downloadsdk-825ea51673fc78aae6ed349ad0be9e7162f50850.zip
sdk-825ea51673fc78aae6ed349ad0be9e7162f50850.tar.gz
sdk-825ea51673fc78aae6ed349ad0be9e7162f50850.tar.bz2
Updated DeviceConfig to generate button information
Change-Id: I7c7536ad871135dd39672dc4164a4f5970028f38 Conflicts: apps/DeviceConfig/src/com/example/android/deviceconfig/ConfigGenerator.java
Diffstat (limited to 'apps/DeviceConfig/src/com/example')
-rw-r--r--apps/DeviceConfig/src/com/example/android/deviceconfig/ConfigGenerator.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/apps/DeviceConfig/src/com/example/android/deviceconfig/ConfigGenerator.java b/apps/DeviceConfig/src/com/example/android/deviceconfig/ConfigGenerator.java
index e8d6333..bc2ca7f 100644
--- a/apps/DeviceConfig/src/com/example/android/deviceconfig/ConfigGenerator.java
+++ b/apps/DeviceConfig/src/com/example/android/deviceconfig/ConfigGenerator.java
@@ -488,10 +488,15 @@ public class ConfigGenerator {
ram.setAttribute(ATTR_UNIT, unit);
ram.appendChild(doc.createTextNode(Long.toString(ramAmount)));
- // Can't actually get whether we're using software buttons
Element buttons = doc.createElement(PREFIX + NODE_BUTTONS);
hardware.appendChild(buttons);
- buttons.appendChild(doc.createTextNode(" "));
+ Text buttonsText;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+ buttonsText = doc.createTextNode(getButtonsType());
+ } else {
+ buttonsText = doc.createTextNode("hard");
+ }
+ buttons.appendChild(buttonsText);
Element internalStorage = doc.createElement(PREFIX + NODE_INTERNAL_STORAGE);
hardware.appendChild(internalStorage);
@@ -647,6 +652,17 @@ public class ConfigGenerator {
return cList;
}
+ @TargetApi(14)
+ private String getButtonsType() {
+ ViewConfiguration vConfig = ViewConfiguration.get(mCtx);
+
+ if (vConfig.hasPermanentMenuKey()) {
+ return "hard";
+ } else {
+ return "soft";
+ }
+ }
+
private void error(String err, Throwable e) {
Toast.makeText(mCtx, "Error Generating Configuration", Toast.LENGTH_SHORT).show();
Log.e(TAG, err);