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

Commit 1abda4f2 authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Android (Google) Code Review
Browse files

Merge "Remove unused injectBackGesture" into main

parents 9c30befc ee8d4056
Loading
Loading
Loading
Loading
+0 −22
Original line number Diff line number Diff line
@@ -202,7 +202,6 @@ import android.view.Display;
import android.view.HapticFeedbackConstants;
import android.view.IDisplayFoldListener;
import android.view.InputDevice;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.KeyboardShortcutGroup;
import android.view.MotionEvent;
@@ -3739,27 +3738,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        msg.sendToTarget();
    }

    @SuppressLint("MissingPermission")
    private void injectBackGesture(long downtime, int displayId) {
        // Create and inject down event
        KeyEvent downEvent = new KeyEvent(downtime, downtime, KeyEvent.ACTION_DOWN,
                KeyEvent.KEYCODE_BACK, 0 /* repeat */, 0 /* metaState */,
                KeyCharacterMap.VIRTUAL_KEYBOARD, 0 /* scancode */,
                KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY,
                InputDevice.SOURCE_KEYBOARD);
        downEvent.setDisplayId(displayId);
        mInputManager.injectInputEvent(downEvent, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC);


        // Create and inject up event
        KeyEvent upEvent = KeyEvent.changeAction(downEvent, KeyEvent.ACTION_UP);
        upEvent.setDisplayId(displayId);
        mInputManager.injectInputEvent(upEvent, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC);

        downEvent.recycle();
        upEvent.recycle();
    }

    private boolean handleHomeShortcuts(IBinder focusedToken, KeyEvent event) {
        // First we always handle the home key here, so applications
        // can never break it, although if keyguard is on, we do let
+0 −33
Original line number Diff line number Diff line
@@ -91,8 +91,6 @@ class BackNavigationController {
    private boolean mShowWallpaper;
    private Runnable mPendingAnimation;
    private final NavigationMonitor mNavigationMonitor = new NavigationMonitor();
    private RemoteCallback mGestureRequest;

    private AnimationHandler mAnimationHandler;

    private final ArrayList<WindowContainer> mTmpOpenApps = new ArrayList<>();
@@ -120,37 +118,6 @@ class BackNavigationController {
        mNavigationMonitor.onEmbeddedWindowGestureTransferred(host);
    }

    void registerBackGestureDelegate(@NonNull RemoteCallback requestObserver) {
        if (!sPredictBackEnable) {
            return;
        }
        synchronized (mWindowManagerService.mGlobalLock) {
            mGestureRequest = requestObserver;
            try {
                requestObserver.getInterface().asBinder().linkToDeath(() -> {
                    synchronized (mWindowManagerService.mGlobalLock) {
                        mGestureRequest = null;
                    }
                }, 0 /* flags */);
            } catch (RemoteException r) {
                Slog.e(TAG, "Failed to link to death");
                mGestureRequest = null;
            }
        }
    }

    boolean requestBackGesture(int displayId) {
        synchronized (mWindowManagerService.mGlobalLock) {
            if (mGestureRequest == null) {
                return false;
            }
            final Bundle result = new Bundle();
            result.putInt(BackNavigationInfo.KEY_DISPLAY_ID, displayId);
            mGestureRequest.sendResult(result);
            return true;
        }
    }

    /**
     * Set up the necessary leashes and build a {@link BackNavigationInfo} instance for an upcoming
     * back gesture animation.