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

Commit ee8d4056 authored by wilsonshih's avatar wilsonshih
Browse files

Remove unused injectBackGesture

Clean up some dead code since back gesture key is register in Shell.

Bug: 394599430
Flag: EXEMPT remove dead code
Test: presubmit
Change-Id: Iff2d696ddbf1dfb3edeb457ce95559f6c812cbf8
parent db3e0319
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.