From 825ea51673fc78aae6ed349ad0be9e7162f50850 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Tue, 10 Jul 2012 22:33:32 -0700 Subject: Updated DeviceConfig to generate button information Change-Id: I7c7536ad871135dd39672dc4164a4f5970028f38 Conflicts: apps/DeviceConfig/src/com/example/android/deviceconfig/ConfigGenerator.java --- .../android/deviceconfig/ConfigGenerator.java | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'apps/DeviceConfig/src/com/example') 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); -- cgit v1.1