diff options
Diffstat (limited to 'core/java')
| -rwxr-xr-x | core/java/android/view/InputDevice.java | 22 | ||||
| -rw-r--r-- | core/java/android/view/WindowManagerPolicy.java | 12 |
2 files changed, 31 insertions, 3 deletions
diff --git a/core/java/android/view/InputDevice.java b/core/java/android/view/InputDevice.java index 85f435c76116..2ea03604315d 100755 --- a/core/java/android/view/InputDevice.java +++ b/core/java/android/view/InputDevice.java @@ -46,6 +46,7 @@ public final class InputDevice implements Parcelable { private final int mGeneration; private final String mName; private final String mDescriptor; + private final boolean mIsExternal; private final int mSources; private final int mKeyboardType; private final KeyCharacterMap mKeyCharacterMap; @@ -322,12 +323,14 @@ public final class InputDevice implements Parcelable { }; // Called by native code. - private InputDevice(int id, int generation, String name, String descriptor, int sources, + private InputDevice(int id, int generation, String name, String descriptor, + boolean isExternal, int sources, int keyboardType, KeyCharacterMap keyCharacterMap, boolean hasVibrator) { mId = id; mGeneration = generation; mName = name; mDescriptor = descriptor; + mIsExternal = isExternal; mSources = sources; mKeyboardType = keyboardType; mKeyCharacterMap = keyCharacterMap; @@ -339,6 +342,7 @@ public final class InputDevice implements Parcelable { mGeneration = in.readInt(); mName = in.readString(); mDescriptor = in.readString(); + mIsExternal = in.readInt() != 0; mSources = in.readInt(); mKeyboardType = in.readInt(); mKeyCharacterMap = KeyCharacterMap.CREATOR.createFromParcel(in); @@ -414,7 +418,7 @@ public final class InputDevice implements Parcelable { * has a trackpad. Alternately, it may be that the input devices are simply * indistinguishable, such as two keyboards made by the same manufacturer. * </p><p> - * The input device descriptor returned by {@link #getDescriptor} should only bt + * The input device descriptor returned by {@link #getDescriptor} should only be * used when an application needs to remember settings associated with a particular * input device. For all other purposes when referring to a logical * {@link InputDevice} instance at runtime use the id returned by {@link #getId()}. @@ -443,6 +447,18 @@ public final class InputDevice implements Parcelable { } /** + * Returns true if the device is external (connected to USB or Bluetooth or some other + * peripheral bus), otherwise it is built-in. + * + * @return True if the device is external. + * + * @hide + */ + public boolean isExternal() { + return mIsExternal; + } + + /** * Gets the name of this input device. * @return The input device name. */ @@ -660,6 +676,7 @@ public final class InputDevice implements Parcelable { out.writeInt(mGeneration); out.writeString(mName); out.writeString(mDescriptor); + out.writeInt(mIsExternal ? 1 : 0); out.writeInt(mSources); out.writeInt(mKeyboardType); mKeyCharacterMap.writeToParcel(out, flags); @@ -689,6 +706,7 @@ public final class InputDevice implements Parcelable { description.append("Input Device ").append(mId).append(": ").append(mName).append("\n"); description.append(" Descriptor: ").append(mDescriptor).append("\n"); description.append(" Generation: ").append(mGeneration).append("\n"); + description.append(" Location: ").append(mIsExternal ? "external" : "built-in").append("\n"); description.append(" Keyboard Type: "); switch (mKeyboardType) { diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java index 94762b903e08..5025a29cdcaf 100644 --- a/core/java/android/view/WindowManagerPolicy.java +++ b/core/java/android/view/WindowManagerPolicy.java @@ -91,6 +91,11 @@ public interface WindowManagerPolicy { public final static int FLAG_BRIGHT_HERE = 0x20000000; public final static int FLAG_PASS_TO_USER = 0x40000000; + // Flags used for indicating whether the internal and/or external input devices + // of some type are available. + public final static int PRESENCE_INTERNAL = 1 << 0; + public final static int PRESENCE_EXTERNAL = 1 << 1; + public final static boolean WATCH_POINTER = false; /** @@ -516,8 +521,13 @@ public interface WindowManagerPolicy { * * @param config The Configuration being computed, for you to change as * desired. + * @param keyboardPresence Flags that indicate whether internal or external + * keyboards are present. + * @param navigationPresence Flags that indicate whether internal or external + * navigation devices are present. */ - public void adjustConfigurationLw(Configuration config); + public void adjustConfigurationLw(Configuration config, int keyboardPresence, + int navigationPresence); /** * Assign a window type to a layer. Allows you to control how different |
