Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0632b35b authored by Jeff Brown's avatar Jeff Brown Committed by Android (Google) Code Review
Browse files

Merge "Improve handling of built-in keyboard." into jb-dev

parents 5a00661b daa3753a
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
@@ -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()}.
@@ -442,6 +446,18 @@ public final class InputDevice implements Parcelable {
        return mId < 0;
    }

    /**
     * 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) {
+11 −1
Original line number Diff line number Diff line
@@ -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
+2 −2
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ jobject android_view_InputDevice_create(JNIEnv* env, const InputDeviceInfo& devi

    ScopedLocalRef<jobject> inputDeviceObj(env, env->NewObject(gInputDeviceClassInfo.clazz,
            gInputDeviceClassInfo.ctor, deviceInfo.getId(), deviceInfo.getGeneration(),
            nameObj.get(), descriptorObj.get(),
            nameObj.get(), descriptorObj.get(), deviceInfo.isExternal(),
            deviceInfo.getSources(), deviceInfo.getKeyboardType(),
            kcmObj.get(), deviceInfo.hasVibrator()));

@@ -87,7 +87,7 @@ int register_android_view_InputDevice(JNIEnv* env)
    gInputDeviceClassInfo.clazz = jclass(env->NewGlobalRef(gInputDeviceClassInfo.clazz));

    GET_METHOD_ID(gInputDeviceClassInfo.ctor, gInputDeviceClassInfo.clazz,
            "<init>", "(IILjava/lang/String;Ljava/lang/String;IILandroid/view/KeyCharacterMap;Z)V");
            "<init>", "(IILjava/lang/String;Ljava/lang/String;ZIILandroid/view/KeyCharacterMap;Z)V");

    GET_METHOD_ID(gInputDeviceClassInfo.addMotionRange, gInputDeviceClassInfo.clazz,
            "addMotionRange", "(IIFFFF)V");
+0 −31
Original line number Diff line number Diff line
@@ -156,37 +156,6 @@ enum {
    POLICY_FLAG_PASS_TO_USER = 0x40000000,
};

/*
 * Describes the basic configuration of input devices that are present.
 */
struct InputConfiguration {
    enum {
        TOUCHSCREEN_UNDEFINED = 0,
        TOUCHSCREEN_NOTOUCH = 1,
        TOUCHSCREEN_STYLUS = 2,
        TOUCHSCREEN_FINGER = 3
    };

    enum {
        KEYBOARD_UNDEFINED = 0,
        KEYBOARD_NOKEYS = 1,
        KEYBOARD_QWERTY = 2,
        KEYBOARD_12KEY = 3
    };

    enum {
        NAVIGATION_UNDEFINED = 0,
        NAVIGATION_NONAV = 1,
        NAVIGATION_DPAD = 2,
        NAVIGATION_TRACKBALL = 3,
        NAVIGATION_WHEEL = 4
    };

    int32_t touchScreen;
    int32_t keyboard;
    int32_t navigation;
};

/*
 * Pointer coordinate data.
 */
+3 −1
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ public:
    };

    void initialize(int32_t id, int32_t generation, const InputDeviceIdentifier& identifier,
            const String8& alias);
            const String8& alias, bool isExternal);

    inline int32_t getId() const { return mId; }
    inline int32_t getGeneration() const { return mGeneration; }
@@ -76,6 +76,7 @@ public:
    inline const String8& getDisplayName() const {
        return mAlias.isEmpty() ? mIdentifier.name : mAlias;
    }
    inline bool isExternal() const { return mIsExternal; }
    inline uint32_t getSources() const { return mSources; }

    const MotionRange* getMotionRange(int32_t axis, uint32_t source) const;
@@ -108,6 +109,7 @@ private:
    int32_t mGeneration;
    InputDeviceIdentifier mIdentifier;
    String8 mAlias;
    bool mIsExternal;
    uint32_t mSources;
    int32_t mKeyboardType;
    sp<KeyCharacterMap> mKeyCharacterMap;
Loading