Loading core/java/android/inputmethodservice/InputMethodService.java +14 −1 Original line number Diff line number Diff line Loading @@ -92,6 +92,7 @@ import java.io.FileDescriptor; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Collections; /** * InputMethodService provides a standard implementation of an InputMethod, Loading Loading @@ -437,6 +438,7 @@ public class InputMethodService extends AbstractInputMethodService { private static final int VOLUME_CURSOR_ON_REVERSE = 2; final ViewTreeObserver.OnComputeInternalInsetsListener mInsetsComputer = info -> { onComputeInsets(mTmpInsets); if (isExtractViewShown()) { // In true fullscreen mode, we just say the window isn't covering // any content so we don't impact whatever is behind. Loading @@ -445,12 +447,15 @@ public class InputMethodService extends AbstractInputMethodService { info.touchableRegion.setEmpty(); info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME); } else { onComputeInsets(mTmpInsets); info.contentInsets.top = mTmpInsets.contentTopInsets; info.visibleInsets.top = mTmpInsets.visibleTopInsets; info.touchableRegion.set(mTmpInsets.touchableRegion); info.setTouchableInsets(mTmpInsets.touchableInsets); } if (mInputFrame != null) { setImeExclusionRect(mTmpInsets.visibleTopInsets); } }; final View.OnClickListener mActionClickListener = v -> { Loading Loading @@ -675,6 +680,14 @@ public class InputMethodService extends AbstractInputMethodService { mPrivOps.setImeWindowStatus(visibilityFlags, backDisposition); } /** Set region of the keyboard to be avoided from back gesture */ private void setImeExclusionRect(int visibleTopInsets) { View inputFrameRootView = mInputFrame.getRootView(); Rect r = new Rect(0, visibleTopInsets, inputFrameRootView.getWidth(), inputFrameRootView.getHeight()); inputFrameRootView.setSystemGestureExclusionRects(Collections.singletonList(r)); } /** * Concrete implementation of * {@link AbstractInputMethodService.AbstractInputMethodSessionImpl} that provides Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java +11 −47 Original line number Diff line number Diff line Loading @@ -61,7 +61,6 @@ import com.android.systemui.R; import com.android.systemui.bubbles.BubbleController; import com.android.systemui.recents.OverviewProxyService; import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.shared.system.WindowManagerWrapper; import com.android.systemui.tuner.TunerService; import lineageos.providers.LineageSettings; Loading @@ -84,37 +83,6 @@ public class EdgeBackGestureHandler implements DisplayListener, TunerService.Tun private static final String KEY_GESTURE_BACK_EXCLUDE_TOP = "lineagesecure:" + LineageSettings.Secure.GESTURE_BACK_EXCLUDE_TOP; private final IPinnedStackListener.Stub mImeChangedListener = new IPinnedStackListener.Stub() { @Override public void onListenerRegistered(IPinnedStackController controller) { } @Override public void onImeVisibilityChanged(boolean imeVisible, int imeHeight) { // No need to thread jump, assignments are atomic mImeHeight = imeVisible ? imeHeight : 0; // TODO: Probably cancel any existing gesture } @Override public void onShelfVisibilityChanged(boolean shelfVisible, int shelfHeight) { } @Override public void onMinimizedStateChanged(boolean isMinimized) { } @Override public void onMovementBoundsChanged(Rect insetBounds, Rect normalBounds, Rect animatingBounds, boolean fromImeAdjustment, boolean fromShelfAdjustment, int displayRotation) { } @Override public void onActionsChanged(ParceledListSlice actions) { } }; private ISystemGestureExclusionListener mGestureExclusionListener = new ISystemGestureExclusionListener.Stub() { @Override Loading Loading @@ -143,6 +111,8 @@ public class EdgeBackGestureHandler implements DisplayListener, TunerService.Tun // The edge width where touch down is allowed private int mEdgeWidth; // The bottom gesture area height private int mBottomGestureHeight; // The slop to distinguish between horizontal and vertical motion private final float mTouchSlop; // Duration after which we consider the event as longpress. Loading @@ -164,8 +134,6 @@ public class EdgeBackGestureHandler implements DisplayListener, TunerService.Tun private boolean mInRejectedExclusion = false; private boolean mIsOnLeftEdge; private int mImeHeight = 0; private boolean mIsAttached; private boolean mIsGesturalModeEnabled; private boolean mIsEnabled; Loading Loading @@ -213,6 +181,8 @@ public class EdgeBackGestureHandler implements DisplayListener, TunerService.Tun public void updateCurrentUserResources(Resources res) { mEdgeWidth = res.getDimensionPixelSize( com.android.internal.R.dimen.config_backGestureInset); mBottomGestureHeight = res.getDimensionPixelSize( com.android.internal.R.dimen.navigation_bar_gesture_height); } /** Loading Loading @@ -270,7 +240,6 @@ public class EdgeBackGestureHandler implements DisplayListener, TunerService.Tun } if (!mIsEnabled) { WindowManagerWrapper.getInstance().removePinnedStackListener(mImeChangedListener); mContext.getSystemService(DisplayManager.class).unregisterDisplayListener(this); try { Loading @@ -287,7 +256,6 @@ public class EdgeBackGestureHandler implements DisplayListener, TunerService.Tun mContext.getMainThreadHandler()); try { WindowManagerWrapper.getInstance().addPinnedStackListener(mImeChangedListener); WindowManagerGlobal.getWindowManagerService() .registerSystemGestureExclusionListener( mGestureExclusionListener, mDisplayId); Loading Loading @@ -344,14 +312,8 @@ public class EdgeBackGestureHandler implements DisplayListener, TunerService.Tun } private boolean isWithinTouchRegion(int x, int y) { final int baseY = mDisplaySize.y - Math.max(mImeHeight, mNavBarHeight); // Disallow if over the IME if (y > baseY) { return false; } // Disallow if over user exclusion area if (mUserExclude > 0 && y < baseY - mUserExclude) { if (mUserExclude > 0 && y < mDisplaySize.y - mNavBarHeight - mUserExclude) { return false; } Loading @@ -360,6 +322,11 @@ public class EdgeBackGestureHandler implements DisplayListener, TunerService.Tun return false; } // Disallow if we are in the bottom gesture area if (y >= (mDisplaySize.y - mBottomGestureHeight)) { return false; } // Always allow if the user is in a transient sticky immersive state if (mIsInTransientImmersiveStickyState) { return true; Loading Loading @@ -519,9 +486,7 @@ public class EdgeBackGestureHandler implements DisplayListener, TunerService.Tun } private void updateDisplaySize() { mContext.getSystemService(DisplayManager.class) .getDisplay(mDisplayId) .getRealSize(mDisplaySize); mContext.getDisplay().getRealSize(mDisplaySize); updateLongSwipeWidth(); loadUserExclusion(); } Loading Loading @@ -582,7 +547,6 @@ public class EdgeBackGestureHandler implements DisplayListener, TunerService.Tun pw.println(" mInRejectedExclusion" + mInRejectedExclusion); pw.println(" mExcludeRegion=" + mExcludeRegion); pw.println(" mUnrestrictedExcludeRegion=" + mUnrestrictedExcludeRegion); pw.println(" mImeHeight=" + mImeHeight); pw.println(" mIsAttached=" + mIsAttached); pw.println(" mEdgeWidth=" + mEdgeWidth); } Loading Loading
core/java/android/inputmethodservice/InputMethodService.java +14 −1 Original line number Diff line number Diff line Loading @@ -92,6 +92,7 @@ import java.io.FileDescriptor; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Collections; /** * InputMethodService provides a standard implementation of an InputMethod, Loading Loading @@ -437,6 +438,7 @@ public class InputMethodService extends AbstractInputMethodService { private static final int VOLUME_CURSOR_ON_REVERSE = 2; final ViewTreeObserver.OnComputeInternalInsetsListener mInsetsComputer = info -> { onComputeInsets(mTmpInsets); if (isExtractViewShown()) { // In true fullscreen mode, we just say the window isn't covering // any content so we don't impact whatever is behind. Loading @@ -445,12 +447,15 @@ public class InputMethodService extends AbstractInputMethodService { info.touchableRegion.setEmpty(); info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME); } else { onComputeInsets(mTmpInsets); info.contentInsets.top = mTmpInsets.contentTopInsets; info.visibleInsets.top = mTmpInsets.visibleTopInsets; info.touchableRegion.set(mTmpInsets.touchableRegion); info.setTouchableInsets(mTmpInsets.touchableInsets); } if (mInputFrame != null) { setImeExclusionRect(mTmpInsets.visibleTopInsets); } }; final View.OnClickListener mActionClickListener = v -> { Loading Loading @@ -675,6 +680,14 @@ public class InputMethodService extends AbstractInputMethodService { mPrivOps.setImeWindowStatus(visibilityFlags, backDisposition); } /** Set region of the keyboard to be avoided from back gesture */ private void setImeExclusionRect(int visibleTopInsets) { View inputFrameRootView = mInputFrame.getRootView(); Rect r = new Rect(0, visibleTopInsets, inputFrameRootView.getWidth(), inputFrameRootView.getHeight()); inputFrameRootView.setSystemGestureExclusionRects(Collections.singletonList(r)); } /** * Concrete implementation of * {@link AbstractInputMethodService.AbstractInputMethodSessionImpl} that provides Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java +11 −47 Original line number Diff line number Diff line Loading @@ -61,7 +61,6 @@ import com.android.systemui.R; import com.android.systemui.bubbles.BubbleController; import com.android.systemui.recents.OverviewProxyService; import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.shared.system.WindowManagerWrapper; import com.android.systemui.tuner.TunerService; import lineageos.providers.LineageSettings; Loading @@ -84,37 +83,6 @@ public class EdgeBackGestureHandler implements DisplayListener, TunerService.Tun private static final String KEY_GESTURE_BACK_EXCLUDE_TOP = "lineagesecure:" + LineageSettings.Secure.GESTURE_BACK_EXCLUDE_TOP; private final IPinnedStackListener.Stub mImeChangedListener = new IPinnedStackListener.Stub() { @Override public void onListenerRegistered(IPinnedStackController controller) { } @Override public void onImeVisibilityChanged(boolean imeVisible, int imeHeight) { // No need to thread jump, assignments are atomic mImeHeight = imeVisible ? imeHeight : 0; // TODO: Probably cancel any existing gesture } @Override public void onShelfVisibilityChanged(boolean shelfVisible, int shelfHeight) { } @Override public void onMinimizedStateChanged(boolean isMinimized) { } @Override public void onMovementBoundsChanged(Rect insetBounds, Rect normalBounds, Rect animatingBounds, boolean fromImeAdjustment, boolean fromShelfAdjustment, int displayRotation) { } @Override public void onActionsChanged(ParceledListSlice actions) { } }; private ISystemGestureExclusionListener mGestureExclusionListener = new ISystemGestureExclusionListener.Stub() { @Override Loading Loading @@ -143,6 +111,8 @@ public class EdgeBackGestureHandler implements DisplayListener, TunerService.Tun // The edge width where touch down is allowed private int mEdgeWidth; // The bottom gesture area height private int mBottomGestureHeight; // The slop to distinguish between horizontal and vertical motion private final float mTouchSlop; // Duration after which we consider the event as longpress. Loading @@ -164,8 +134,6 @@ public class EdgeBackGestureHandler implements DisplayListener, TunerService.Tun private boolean mInRejectedExclusion = false; private boolean mIsOnLeftEdge; private int mImeHeight = 0; private boolean mIsAttached; private boolean mIsGesturalModeEnabled; private boolean mIsEnabled; Loading Loading @@ -213,6 +181,8 @@ public class EdgeBackGestureHandler implements DisplayListener, TunerService.Tun public void updateCurrentUserResources(Resources res) { mEdgeWidth = res.getDimensionPixelSize( com.android.internal.R.dimen.config_backGestureInset); mBottomGestureHeight = res.getDimensionPixelSize( com.android.internal.R.dimen.navigation_bar_gesture_height); } /** Loading Loading @@ -270,7 +240,6 @@ public class EdgeBackGestureHandler implements DisplayListener, TunerService.Tun } if (!mIsEnabled) { WindowManagerWrapper.getInstance().removePinnedStackListener(mImeChangedListener); mContext.getSystemService(DisplayManager.class).unregisterDisplayListener(this); try { Loading @@ -287,7 +256,6 @@ public class EdgeBackGestureHandler implements DisplayListener, TunerService.Tun mContext.getMainThreadHandler()); try { WindowManagerWrapper.getInstance().addPinnedStackListener(mImeChangedListener); WindowManagerGlobal.getWindowManagerService() .registerSystemGestureExclusionListener( mGestureExclusionListener, mDisplayId); Loading Loading @@ -344,14 +312,8 @@ public class EdgeBackGestureHandler implements DisplayListener, TunerService.Tun } private boolean isWithinTouchRegion(int x, int y) { final int baseY = mDisplaySize.y - Math.max(mImeHeight, mNavBarHeight); // Disallow if over the IME if (y > baseY) { return false; } // Disallow if over user exclusion area if (mUserExclude > 0 && y < baseY - mUserExclude) { if (mUserExclude > 0 && y < mDisplaySize.y - mNavBarHeight - mUserExclude) { return false; } Loading @@ -360,6 +322,11 @@ public class EdgeBackGestureHandler implements DisplayListener, TunerService.Tun return false; } // Disallow if we are in the bottom gesture area if (y >= (mDisplaySize.y - mBottomGestureHeight)) { return false; } // Always allow if the user is in a transient sticky immersive state if (mIsInTransientImmersiveStickyState) { return true; Loading Loading @@ -519,9 +486,7 @@ public class EdgeBackGestureHandler implements DisplayListener, TunerService.Tun } private void updateDisplaySize() { mContext.getSystemService(DisplayManager.class) .getDisplay(mDisplayId) .getRealSize(mDisplaySize); mContext.getDisplay().getRealSize(mDisplaySize); updateLongSwipeWidth(); loadUserExclusion(); } Loading Loading @@ -582,7 +547,6 @@ public class EdgeBackGestureHandler implements DisplayListener, TunerService.Tun pw.println(" mInRejectedExclusion" + mInRejectedExclusion); pw.println(" mExcludeRegion=" + mExcludeRegion); pw.println(" mUnrestrictedExcludeRegion=" + mUnrestrictedExcludeRegion); pw.println(" mImeHeight=" + mImeHeight); pw.println(" mIsAttached=" + mIsAttached); pw.println(" mEdgeWidth=" + mEdgeWidth); } Loading