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

Commit da108307 authored by Aayush Gupta's avatar Aayush Gupta
Browse files

Merge remote-tracking branch 'origin/lineage-18.1' into v1-r

parents ddd7e44f dda67597
Loading
Loading
Loading
Loading
+0 −18
Original line number Diff line number Diff line
@@ -3167,22 +3167,4 @@ public class KeyEvent extends InputEvent implements Parcelable {
        out.writeLong(mEventTime);
        out.writeString(mCharacters);
    }

    /** @hide */
    public boolean equals(KeyEvent other) {
        return other != null
                && mId == other.mId
                && mDeviceId == other.mDeviceId
                && mSource == other.mSource
                && mDisplayId == other.mDisplayId
                && mAction == other.mAction
                && mKeyCode == other.mKeyCode
                && mRepeatCount == other.mRepeatCount
                && mMetaState == other.mMetaState
                && mScanCode == other.mScanCode
                && mFlags == other.mFlags
                && mDownTime == other.mDownTime
                && mEventTime == other.mEventTime
                && mCharacters == other.mCharacters;
    }
}
+0 −10
Original line number Diff line number Diff line
@@ -1565,8 +1565,6 @@ public final class MotionEvent extends InputEvent implements Parcelable {
    private static native long nativeCopy(long destNativePtr, long sourceNativePtr,
            boolean keepHistory);
    @CriticalNative
    private static native boolean nativeEquals(long nativePtrA, long nativePtrB);
    @CriticalNative
    private static native int nativeGetId(long nativePtr);
    @CriticalNative
    private static native int nativeGetDeviceId(long nativePtr);
@@ -3790,14 +3788,6 @@ public final class MotionEvent extends InputEvent implements Parcelable {
        nativeWriteToParcel(mNativePtr, out);
    }

    /** @hide */
    public boolean equals(MotionEvent other) {
        if (other == null) {
            return false;
        }
        return nativeEquals(mNativePtr, other.mNativePtr);
    }

    /**
     * Transfer object for pointer coordinates.
     *
+0 −1
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@ public interface WindowManagerPolicyConstants {
    int FLAG_TRUSTED = 0x02000000;
    int FLAG_FILTERED = 0x04000000;
    int FLAG_DISABLE_KEY_REPEAT = 0x08000000;
    int FLAG_INJECTED_IS_UNCHANGED = 0x10000000;

    int FLAG_INTERACTIVE = 0x20000000;
    int FLAG_PASS_TO_USER = 0x40000000;
+0 −7
Original line number Diff line number Diff line
@@ -593,12 +593,6 @@ static jlong android_view_MotionEvent_nativeCopy(jlong destNativePtr, jlong sour
    return reinterpret_cast<jlong>(destEvent);
}

static jboolean android_view_MotionEvent_nativeEquals(jlong nativePtrA, jlong nativePtrB) {
    MotionEvent* eventA = reinterpret_cast<MotionEvent*>(nativePtrA);
    MotionEvent* eventB = reinterpret_cast<MotionEvent*>(nativePtrB);
    return eventA->equals(eventB);
}

static jint android_view_MotionEvent_nativeGetId(jlong nativePtr) {
    MotionEvent* event = reinterpret_cast<MotionEvent*>(nativePtr);
    return event->getId();
@@ -802,7 +796,6 @@ static const JNINativeMethod gMotionEventMethods[] = {
        // --------------- @CriticalNative ------------------

        {"nativeCopy", "(JJZ)J", (void*)android_view_MotionEvent_nativeCopy},
        {"nativeEquals", "(JJ)Z", (void*)android_view_MotionEvent_nativeEquals},
        {"nativeGetId", "(J)I", (void*)android_view_MotionEvent_nativeGetId},
        {"nativeGetDeviceId", "(J)I", (void*)android_view_MotionEvent_nativeGetDeviceId},
        {"nativeGetSource", "(J)I", (void*)android_view_MotionEvent_nativeGetSource},
+0 −27
Original line number Diff line number Diff line
@@ -77,7 +77,6 @@ import android.view.InputDevice;
import android.view.InputEvent;
import android.view.InputMonitor;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.PointerIcon;
import android.view.Surface;
import android.view.VerifiedInputEvent;
@@ -1998,7 +1997,6 @@ public class InputManagerService extends IInputManager.Stub
    final boolean filterInputEvent(InputEvent event, int policyFlags) {
        synchronized (mInputFilterLock) {
            if (mInputFilter != null) {
                mInputFilterHost.setPreFilterEventLocked(event);
                try {
                    mInputFilter.filterInputEvent(event, policyFlags);
                } catch (RemoteException e) {
@@ -2345,7 +2343,6 @@ public class InputManagerService extends IInputManager.Stub
     */
    private final class InputFilterHost extends IInputFilterHost.Stub {
        private boolean mDisconnected;
        private InputEvent mPreFilterEvent;

        public void disconnectLocked() {
            mDisconnected = true;
@@ -2359,36 +2356,12 @@ public class InputManagerService extends IInputManager.Stub

            synchronized (mInputFilterLock) {
                if (!mDisconnected) {
                    if (isEventEqual(event, mPreFilterEvent)) {
                        policyFlags |= WindowManagerPolicy.FLAG_INJECTED_IS_UNCHANGED;
                        setPreFilterEventLocked(null);
                    } else {
                        policyFlags &= ~WindowManagerPolicy.FLAG_INJECTED_IS_UNCHANGED;
                    }

                    nativeInjectInputEvent(mPtr, event, 0, 0,
                            InputManager.INJECT_INPUT_EVENT_MODE_ASYNC, 0,
                            policyFlags | WindowManagerPolicy.FLAG_FILTERED);
                }
            }
        }

        private void setPreFilterEventLocked(InputEvent event) {
            if (mPreFilterEvent != null) {
                mPreFilterEvent.recycle();
            }
            mPreFilterEvent = event != null ? event.copy() : null;
        }
    }

    private boolean isEventEqual(InputEvent a, InputEvent b) {
        if (a instanceof KeyEvent && b instanceof KeyEvent) {
            return ((KeyEvent) a).equals((KeyEvent) b);
        }
        if (a instanceof MotionEvent && b instanceof MotionEvent) {
            return ((MotionEvent) a).equals((MotionEvent) b);
        }
        return false;
    }

    /**