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

Commit ddca3ee3 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Add support for power keys, improve behavior of virtual keys.

The platform now knows how to deal with a platform key, which at this
point is "just like end call, but don't end a call."

Also improve the handling of virtual keys, to allow for canceling when
sliding off into the display and providing haptic feedback.

Finally fixes a bug where the raw x and y in motion event were not
always set which caused the status bar to not work.
parent 8e4ac714
Loading
Loading
Loading
Loading
+44 −0
Original line number Diff line number Diff line
@@ -141896,6 +141896,17 @@
 visibility="public"
>
</field>
<field name="VIRTUAL_KEY"
 type="int"
 transient="false"
 volatile="false"
 value="1"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</class>
<class name="InflateException"
 extends="java.lang.RuntimeException"
@@ -142736,6 +142747,17 @@
 visibility="public"
>
</method>
<method name="isCanceled"
 return="boolean"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="isModifierKey"
 return="boolean"
 abstract="false"
@@ -142851,6 +142873,17 @@
 visibility="public"
>
</field>
<field name="FLAG_CANCELED"
 type="int"
 transient="false"
 volatile="false"
 value="32"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="FLAG_EDITOR_ACTION"
 type="int"
 transient="false"
@@ -142895,6 +142928,17 @@
 visibility="public"
>
</field>
<field name="FLAG_VIRTUAL_HARD_KEY"
 type="int"
 transient="false"
 volatile="false"
 value="64"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="FLAG_WOKE_HERE"
 type="int"
 transient="false"
+9 −0
Original line number Diff line number Diff line
@@ -24,8 +24,17 @@ public class HapticFeedbackConstants {

    private HapticFeedbackConstants() {}

    /**
     * The user has performed a long press on an object that is resulting
     * in an action being performed.
     */
    public static final int LONG_PRESS = 0;
    
    /**
     * The user has pressed on a virtual on-screen key.
     */
    public static final int VIRTUAL_KEY = 1;
    
    /**
     * Flag for {@link View#performHapticFeedback(int, int)
     * View.performHapticFeedback(int, int)}: Ignore the setting in the
+27 −0
Original line number Diff line number Diff line
@@ -257,6 +257,25 @@ public class KeyEvent implements Parcelable {
     */
    public static final int FLAG_EDITOR_ACTION = 0x10;
    
    /**
     * When associated with up key events, this indicates that the key press
     * has been canceled.  Typically this is used with virtual touch screen
     * keys, where the user can slide from the virtual key area on to the
     * display: in that case, the application will receive a canceled up
     * event and should not perform the action normally associated with the
     * key.  Note that for this to work, the application can not perform an
     * action for a key until it receives an up or the long press timeout has
     * expired. 
     */
    public static final int FLAG_CANCELED = 0x20;
    
    /**
     * This key event was generated by a virtual (on-screen) hard key area.
     * Typically this is an area of the touchscreen, outside of the regular
     * display, dedicated to "hardware" buttons.
     */
    public static final int FLAG_VIRTUAL_HARD_KEY = 0x40;
    
    /**
     * Returns the maximum keycode.
     */
@@ -693,6 +712,14 @@ public class KeyEvent implements Parcelable {
        return mAction;
    }

    /**
     * For {@link #ACTION_UP} events, indicates that the event has been
     * canceled as per {@link #FLAG_CANCELED}.
     */
    public final boolean isCanceled() {
        return (mFlags&FLAG_CANCELED) != 0;
    }
    
    /**
     * Retrieve the key code of the key event.  This is the physical key that
     * was pressed, <em>not</em> the Unicode character.
+2 −1
Original line number Diff line number Diff line
@@ -288,9 +288,10 @@ public final class MotionEvent implements Parcelable {
        ev.mEventTimeNano = eventTimeNano;
        ev.mAction = action;
        ev.mMetaState = metaState;
        ev.mRawX = inData[SAMPLE_X];
        ev.mRawY = inData[SAMPLE_Y];
        ev.mXPrecision = xPrecision;
        ev.mYPrecision = yPrecision;
        
        ev.mNumPointers = pointers;
        ev.mNumSamples = 1;
        
+3 −1
Original line number Diff line number Diff line
@@ -1665,7 +1665,9 @@ public final class ViewRoot extends Handler implements ViewParent,
                    if(Config.LOGV) {
                        captureMotionLog("captureDispatchPointer", event);
                    }
                    if (mCurScrollY != 0) {
                        event.offsetLocation(0, mCurScrollY);
                    }
                    if (MEASURE_LATENCY) {
                        lt.sample("A Dispatching TouchEvents", System.nanoTime() - event.getEventTimeNano());
                    }
Loading