summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMichael Wright <michaelwr@google.com>2015-10-20 15:31:01 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-10-20 15:31:01 +0000
commit57a5cba606e5d58cc4ad1c5c1cf4918dc16fe819 (patch)
tree9b0a8e5225992b4272d3a572a1e1f3a8d74d808d /core
parentad968cf4e55afdd897ea84a44b7450442aea1e1d (diff)
parent9209c9cd9a6f779d0d9d86f9b2e368df564fa6bb (diff)
downloadframeworks_base-57a5cba606e5d58cc4ad1c5c1cf4918dc16fe819.zip
frameworks_base-57a5cba606e5d58cc4ad1c5c1cf4918dc16fe819.tar.gz
frameworks_base-57a5cba606e5d58cc4ad1c5c1cf4918dc16fe819.tar.bz2
Merge "Add SystemUI component to watch for keyboard attachment." into mnc-dr-dev
Diffstat (limited to 'core')
-rw-r--r--core/java/android/hardware/input/IInputManager.aidl2
-rw-r--r--core/java/android/hardware/input/InputManager.java45
-rw-r--r--core/res/AndroidManifest.xml5
-rw-r--r--core/res/res/values/config.xml4
-rw-r--r--core/res/res/values/symbols.xml2
5 files changed, 56 insertions, 2 deletions
diff --git a/core/java/android/hardware/input/IInputManager.aidl b/core/java/android/hardware/input/IInputManager.aidl
index c8b45c7..3601b39 100644
--- a/core/java/android/hardware/input/IInputManager.aidl
+++ b/core/java/android/hardware/input/IInputManager.aidl
@@ -61,6 +61,8 @@ interface IInputManager {
// Registers an input devices changed listener.
void registerInputDevicesChangedListener(IInputDevicesChangedListener listener);
+ // Queries whether the device is currently in tablet mode
+ int isInTabletMode();
// Registers a tablet mode change listener
void registerTabletModeChangedListener(ITabletModeChangedListener listener);
diff --git a/core/java/android/hardware/input/InputManager.java b/core/java/android/hardware/input/InputManager.java
index a754d6b..618864f 100644
--- a/core/java/android/hardware/input/InputManager.java
+++ b/core/java/android/hardware/input/InputManager.java
@@ -19,6 +19,7 @@ package android.hardware.input;
import com.android.internal.os.SomeArgs;
import com.android.internal.util.ArrayUtils;
+import android.annotation.IntDef;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.content.Context;
@@ -39,6 +40,8 @@ import android.util.SparseArray;
import android.view.InputDevice;
import android.view.InputEvent;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.List;
@@ -179,6 +182,31 @@ public final class InputManager {
*/
public static final int INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH = 2; // see InputDispatcher.h
+ /** @hide */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef({SWITCH_STATE_UNKNOWN, SWITCH_STATE_OFF, SWITCH_STATE_ON})
+ public @interface SwitchState {}
+
+ /**
+ * Switch State: Unknown.
+ *
+ * The system has yet to report a valid value for the switch.
+ * @hide
+ */
+ public static final int SWITCH_STATE_UNKNOWN = -1;
+
+ /**
+ * Switch State: Off.
+ * @hide
+ */
+ public static final int SWITCH_STATE_OFF = 0;
+
+ /**
+ * Switch State: On.
+ * @hide
+ */
+ public static final int SWITCH_STATE_ON = 1;
+
private InputManager(IInputManager im) {
mIm = im;
}
@@ -339,6 +367,23 @@ public final class InputManager {
}
/**
+ * Queries whether the device is in tablet mode.
+ *
+ * @return The tablet switch state which is one of {@link #SWITCH_STATE_UNKNOWN},
+ * {@link #SWITCH_STATE_OFF} or {@link #SWITCH_STATE_ON}.
+ * @hide
+ */
+ @SwitchState
+ public int isInTabletMode() {
+ try {
+ return mIm.isInTabletMode();
+ } catch (RemoteException ex) {
+ Log.w(TAG, "Could not get tablet mode state", ex);
+ return SWITCH_STATE_UNKNOWN;
+ }
+ }
+
+ /**
* Register a tablet mode changed listener.
*
* @param listener The listener to register.
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index f13f821..4f71699 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -2059,10 +2059,11 @@
<permission android:name="android.permission.SET_KEYBOARD_LAYOUT"
android:protectionLevel="signature" />
- <!-- Allows an application to monitor changes in tablet mode.
+ <!-- Allows an application to query tablet mode state and monitor changes
+ in it.
<p>Not for use by third-party applications.
@hide -->
- <permission android:name="android.permission.TABLET_MODE_LISTENER"
+ <permission android:name="android.permission.TABLET_MODE"
android:protectionLevel="signature" />
<!-- Allows an application to request installing packages. Apps
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 6e8f81e..6c96f84 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -2322,4 +2322,8 @@
<!-- Allow the gesture to double tap the power button twice to start the camera while the device
is non-interactive. -->
<bool name="config_cameraDoubleTapPowerGestureEnabled">true</bool>
+
+ <!-- The BT name of the keyboard packaged with the device. If this is defined, SystemUI will
+ automatically try to pair with it when the device exits tablet mode. -->
+ <string translatable="false" name="config_packagedKeyboardName"></string>
</resources>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 52892ba..1bfb06c 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2330,4 +2330,6 @@
<java-symbol type="bool" name="config_cameraDoubleTapPowerGestureEnabled" />
<java-symbol type="drawable" name="platlogo_m" />
+
+ <java-symbol type="string" name="config_packagedKeyboardName" />
</resources>