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

Commit ee1ebfe5 authored by Prabir Pradhan's avatar Prabir Pradhan
Browse files

Add InputManager as a member in ViewRootImpl

Bug: 266013036
Test: presubmit
Change-Id: I15ad50827e4f727f3c2fc4251be2465d6f9df15b
parent 132ce52f
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -75,7 +75,6 @@ import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
import static android.view.WindowManager.LayoutParams.TYPE_NOTIFICATION_SHADE;
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_ADDITIONAL;
import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
import static android.view.WindowManager.LayoutParams.TYPE_TOAST;
@@ -440,6 +439,7 @@ public final class ViewRootImpl implements ViewParent,
    @NonNull Display mDisplay;
    final DisplayManager mDisplayManager;
    final String mBasePackageName;
    final InputManager mInputManager;

    final int[] mTmpLocation = new int[2];

@@ -967,6 +967,7 @@ public final class ViewRootImpl implements ViewParent,
        // TODO(b/222696368): remove getSfInstance usage and use vsyncId for transactions
        mChoreographer = Choreographer.getInstance();
        mDisplayManager = (DisplayManager)context.getSystemService(Context.DISPLAY_SERVICE);
        mInputManager = context.getSystemService(InputManager.class);
        mInsetsController = new InsetsController(new ViewRootInsetsControllerHost(this));
        mHandwritingInitiator = new HandwritingInitiator(
                mViewConfiguration,
@@ -5336,7 +5337,7 @@ public final class ViewRootImpl implements ViewParent,
            Log.e(mTag, "No input channel to request Pointer Capture.");
            return;
        }
        InputManager.getInstance().requestPointerCapture(inputToken, enabled);
        mInputManager.requestPointerCapture(inputToken, enabled);
    }

    private void handlePointerCaptureChanged(boolean hasCapture) {
@@ -6859,9 +6860,8 @@ public final class ViewRootImpl implements ViewParent,
            if (event.getPointerCount() != 1) {
                return;
            }
            final boolean needsStylusPointerIcon =
                    InputManager.getInstance().isStylusPointerIconEnabled()
                            && event.isStylusPointer();
            final boolean needsStylusPointerIcon = event.isStylusPointer()
                    && mInputManager.isStylusPointerIconEnabled();
            if (needsStylusPointerIcon || event.isFromSource(InputDevice.SOURCE_MOUSE)) {
                if (event.getActionMasked() == MotionEvent.ACTION_HOVER_ENTER
                        || event.getActionMasked() == MotionEvent.ACTION_HOVER_EXIT) {
@@ -6933,7 +6933,7 @@ public final class ViewRootImpl implements ViewParent,

        PointerIcon pointerIcon = null;

        if (event.isStylusPointer() && InputManager.getInstance().isStylusPointerIconEnabled()) {
        if (event.isStylusPointer() && mInputManager.isStylusPointerIconEnabled()) {
            pointerIcon = mHandwritingInitiator.onResolvePointerIcon(mContext, event);
        }

@@ -6948,14 +6948,14 @@ public final class ViewRootImpl implements ViewParent,
            mPointerIconType = pointerType;
            mCustomPointerIcon = null;
            if (mPointerIconType != PointerIcon.TYPE_CUSTOM) {
                InputManager.getInstance().setPointerIconType(pointerType);
                mInputManager.setPointerIconType(pointerType);
                return true;
            }
        }
        if (mPointerIconType == PointerIcon.TYPE_CUSTOM &&
                !pointerIcon.equals(mCustomPointerIcon)) {
            mCustomPointerIcon = pointerIcon;
            InputManager.getInstance().setCustomPointerIcon(mCustomPointerIcon);
            mInputManager.setCustomPointerIcon(mCustomPointerIcon);
        }
        return true;
    }