Loading core/java/android/inputmethodservice/InputMethodService.java +14 −1 Original line number Original line Diff line number Diff line Loading @@ -94,6 +94,7 @@ import java.io.FileDescriptor; import java.io.PrintWriter; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy; import java.util.Collections; /** /** * InputMethodService provides a standard implementation of an InputMethod, * InputMethodService provides a standard implementation of an InputMethod, Loading Loading @@ -434,6 +435,7 @@ public class InputMethodService extends AbstractInputMethodService { final int[] mTmpLocation = new int[2]; final int[] mTmpLocation = new int[2]; final ViewTreeObserver.OnComputeInternalInsetsListener mInsetsComputer = info -> { final ViewTreeObserver.OnComputeInternalInsetsListener mInsetsComputer = info -> { onComputeInsets(mTmpInsets); if (isExtractViewShown()) { if (isExtractViewShown()) { // In true fullscreen mode, we just say the window isn't covering // In true fullscreen mode, we just say the window isn't covering // any content so we don't impact whatever is behind. // any content so we don't impact whatever is behind. Loading @@ -442,12 +444,15 @@ public class InputMethodService extends AbstractInputMethodService { info.touchableRegion.setEmpty(); info.touchableRegion.setEmpty(); info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME); info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME); } else { } else { onComputeInsets(mTmpInsets); info.contentInsets.top = mTmpInsets.contentTopInsets; info.contentInsets.top = mTmpInsets.contentTopInsets; info.visibleInsets.top = mTmpInsets.visibleTopInsets; info.visibleInsets.top = mTmpInsets.visibleTopInsets; info.touchableRegion.set(mTmpInsets.touchableRegion); info.touchableRegion.set(mTmpInsets.touchableRegion); info.setTouchableInsets(mTmpInsets.touchableInsets); info.setTouchableInsets(mTmpInsets.touchableInsets); } } if (mInputFrame != null) { setImeExclusionRect(mTmpInsets.visibleTopInsets); } }; }; final View.OnClickListener mActionClickListener = v -> { final View.OnClickListener mActionClickListener = v -> { Loading Loading @@ -672,6 +677,14 @@ public class InputMethodService extends AbstractInputMethodService { mPrivOps.setImeWindowStatus(visibilityFlags, backDisposition); 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 * Concrete implementation of * {@link AbstractInputMethodService.AbstractInputMethodSessionImpl} that provides * {@link AbstractInputMethodService.AbstractInputMethodSessionImpl} that provides Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java +0 −21 Original line number Original line Diff line number Diff line Loading @@ -54,9 +54,7 @@ import com.android.systemui.R; import com.android.systemui.bubbles.BubbleController; import com.android.systemui.bubbles.BubbleController; import com.android.systemui.model.SysUiState; import com.android.systemui.model.SysUiState; import com.android.systemui.recents.OverviewProxyService; import com.android.systemui.recents.OverviewProxyService; import com.android.systemui.shared.system.PinnedStackListenerForwarder.PinnedStackListener; import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.shared.system.WindowManagerWrapper; import java.io.PrintWriter; import java.io.PrintWriter; import java.util.concurrent.Executor; import java.util.concurrent.Executor; Loading @@ -70,15 +68,6 @@ public class EdgeBackGestureHandler implements DisplayListener { private static final int MAX_LONG_PRESS_TIMEOUT = SystemProperties.getInt( private static final int MAX_LONG_PRESS_TIMEOUT = SystemProperties.getInt( "gestures.back_timeout", 250); "gestures.back_timeout", 250); private final PinnedStackListener mImeChangedListener = new PinnedStackListener() { @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 } }; private ISystemGestureExclusionListener mGestureExclusionListener = private ISystemGestureExclusionListener mGestureExclusionListener = new ISystemGestureExclusionListener.Stub() { new ISystemGestureExclusionListener.Stub() { @Override @Override Loading Loading @@ -126,8 +115,6 @@ public class EdgeBackGestureHandler implements DisplayListener { private boolean mInRejectedExclusion = false; private boolean mInRejectedExclusion = false; private boolean mIsOnLeftEdge; private boolean mIsOnLeftEdge; private int mImeHeight = 0; private boolean mIsAttached; private boolean mIsAttached; private boolean mIsGesturalModeEnabled; private boolean mIsGesturalModeEnabled; private boolean mIsEnabled; private boolean mIsEnabled; Loading Loading @@ -227,7 +214,6 @@ public class EdgeBackGestureHandler implements DisplayListener { } } if (!mIsEnabled) { if (!mIsEnabled) { WindowManagerWrapper.getInstance().removePinnedStackListener(mImeChangedListener); mContext.getSystemService(DisplayManager.class).unregisterDisplayListener(this); mContext.getSystemService(DisplayManager.class).unregisterDisplayListener(this); try { try { Loading @@ -244,7 +230,6 @@ public class EdgeBackGestureHandler implements DisplayListener { mContext.getMainThreadHandler()); mContext.getMainThreadHandler()); try { try { WindowManagerWrapper.getInstance().addPinnedStackListener(mImeChangedListener); WindowManagerGlobal.getWindowManagerService() WindowManagerGlobal.getWindowManagerService() .registerSystemGestureExclusionListener( .registerSystemGestureExclusionListener( mGestureExclusionListener, mDisplayId); mGestureExclusionListener, mDisplayId); Loading Loading @@ -301,11 +286,6 @@ public class EdgeBackGestureHandler implements DisplayListener { } } private boolean isWithinTouchRegion(int x, int y) { private boolean isWithinTouchRegion(int x, int y) { // Disallow if over the IME if (y > (mDisplaySize.y - Math.max(mImeHeight, mNavBarHeight))) { return false; } // Disallow if too far from the edge // Disallow if too far from the edge if (x > mEdgeWidth + mLeftInset && x < (mDisplaySize.x - mEdgeWidth - mRightInset)) { if (x > mEdgeWidth + mLeftInset && x < (mDisplaySize.x - mEdgeWidth - mRightInset)) { return false; return false; Loading Loading @@ -483,7 +463,6 @@ public class EdgeBackGestureHandler implements DisplayListener { pw.println(" mInRejectedExclusion" + mInRejectedExclusion); pw.println(" mInRejectedExclusion" + mInRejectedExclusion); pw.println(" mExcludeRegion=" + mExcludeRegion); pw.println(" mExcludeRegion=" + mExcludeRegion); pw.println(" mUnrestrictedExcludeRegion=" + mUnrestrictedExcludeRegion); pw.println(" mUnrestrictedExcludeRegion=" + mUnrestrictedExcludeRegion); pw.println(" mImeHeight=" + mImeHeight); pw.println(" mIsAttached=" + mIsAttached); pw.println(" mIsAttached=" + mIsAttached); pw.println(" mEdgeWidth=" + mEdgeWidth); pw.println(" mEdgeWidth=" + mEdgeWidth); } } Loading Loading
core/java/android/inputmethodservice/InputMethodService.java +14 −1 Original line number Original line Diff line number Diff line Loading @@ -94,6 +94,7 @@ import java.io.FileDescriptor; import java.io.PrintWriter; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy; import java.util.Collections; /** /** * InputMethodService provides a standard implementation of an InputMethod, * InputMethodService provides a standard implementation of an InputMethod, Loading Loading @@ -434,6 +435,7 @@ public class InputMethodService extends AbstractInputMethodService { final int[] mTmpLocation = new int[2]; final int[] mTmpLocation = new int[2]; final ViewTreeObserver.OnComputeInternalInsetsListener mInsetsComputer = info -> { final ViewTreeObserver.OnComputeInternalInsetsListener mInsetsComputer = info -> { onComputeInsets(mTmpInsets); if (isExtractViewShown()) { if (isExtractViewShown()) { // In true fullscreen mode, we just say the window isn't covering // In true fullscreen mode, we just say the window isn't covering // any content so we don't impact whatever is behind. // any content so we don't impact whatever is behind. Loading @@ -442,12 +444,15 @@ public class InputMethodService extends AbstractInputMethodService { info.touchableRegion.setEmpty(); info.touchableRegion.setEmpty(); info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME); info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME); } else { } else { onComputeInsets(mTmpInsets); info.contentInsets.top = mTmpInsets.contentTopInsets; info.contentInsets.top = mTmpInsets.contentTopInsets; info.visibleInsets.top = mTmpInsets.visibleTopInsets; info.visibleInsets.top = mTmpInsets.visibleTopInsets; info.touchableRegion.set(mTmpInsets.touchableRegion); info.touchableRegion.set(mTmpInsets.touchableRegion); info.setTouchableInsets(mTmpInsets.touchableInsets); info.setTouchableInsets(mTmpInsets.touchableInsets); } } if (mInputFrame != null) { setImeExclusionRect(mTmpInsets.visibleTopInsets); } }; }; final View.OnClickListener mActionClickListener = v -> { final View.OnClickListener mActionClickListener = v -> { Loading Loading @@ -672,6 +677,14 @@ public class InputMethodService extends AbstractInputMethodService { mPrivOps.setImeWindowStatus(visibilityFlags, backDisposition); 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 * Concrete implementation of * {@link AbstractInputMethodService.AbstractInputMethodSessionImpl} that provides * {@link AbstractInputMethodService.AbstractInputMethodSessionImpl} that provides Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java +0 −21 Original line number Original line Diff line number Diff line Loading @@ -54,9 +54,7 @@ import com.android.systemui.R; import com.android.systemui.bubbles.BubbleController; import com.android.systemui.bubbles.BubbleController; import com.android.systemui.model.SysUiState; import com.android.systemui.model.SysUiState; import com.android.systemui.recents.OverviewProxyService; import com.android.systemui.recents.OverviewProxyService; import com.android.systemui.shared.system.PinnedStackListenerForwarder.PinnedStackListener; import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.shared.system.WindowManagerWrapper; import java.io.PrintWriter; import java.io.PrintWriter; import java.util.concurrent.Executor; import java.util.concurrent.Executor; Loading @@ -70,15 +68,6 @@ public class EdgeBackGestureHandler implements DisplayListener { private static final int MAX_LONG_PRESS_TIMEOUT = SystemProperties.getInt( private static final int MAX_LONG_PRESS_TIMEOUT = SystemProperties.getInt( "gestures.back_timeout", 250); "gestures.back_timeout", 250); private final PinnedStackListener mImeChangedListener = new PinnedStackListener() { @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 } }; private ISystemGestureExclusionListener mGestureExclusionListener = private ISystemGestureExclusionListener mGestureExclusionListener = new ISystemGestureExclusionListener.Stub() { new ISystemGestureExclusionListener.Stub() { @Override @Override Loading Loading @@ -126,8 +115,6 @@ public class EdgeBackGestureHandler implements DisplayListener { private boolean mInRejectedExclusion = false; private boolean mInRejectedExclusion = false; private boolean mIsOnLeftEdge; private boolean mIsOnLeftEdge; private int mImeHeight = 0; private boolean mIsAttached; private boolean mIsAttached; private boolean mIsGesturalModeEnabled; private boolean mIsGesturalModeEnabled; private boolean mIsEnabled; private boolean mIsEnabled; Loading Loading @@ -227,7 +214,6 @@ public class EdgeBackGestureHandler implements DisplayListener { } } if (!mIsEnabled) { if (!mIsEnabled) { WindowManagerWrapper.getInstance().removePinnedStackListener(mImeChangedListener); mContext.getSystemService(DisplayManager.class).unregisterDisplayListener(this); mContext.getSystemService(DisplayManager.class).unregisterDisplayListener(this); try { try { Loading @@ -244,7 +230,6 @@ public class EdgeBackGestureHandler implements DisplayListener { mContext.getMainThreadHandler()); mContext.getMainThreadHandler()); try { try { WindowManagerWrapper.getInstance().addPinnedStackListener(mImeChangedListener); WindowManagerGlobal.getWindowManagerService() WindowManagerGlobal.getWindowManagerService() .registerSystemGestureExclusionListener( .registerSystemGestureExclusionListener( mGestureExclusionListener, mDisplayId); mGestureExclusionListener, mDisplayId); Loading Loading @@ -301,11 +286,6 @@ public class EdgeBackGestureHandler implements DisplayListener { } } private boolean isWithinTouchRegion(int x, int y) { private boolean isWithinTouchRegion(int x, int y) { // Disallow if over the IME if (y > (mDisplaySize.y - Math.max(mImeHeight, mNavBarHeight))) { return false; } // Disallow if too far from the edge // Disallow if too far from the edge if (x > mEdgeWidth + mLeftInset && x < (mDisplaySize.x - mEdgeWidth - mRightInset)) { if (x > mEdgeWidth + mLeftInset && x < (mDisplaySize.x - mEdgeWidth - mRightInset)) { return false; return false; Loading Loading @@ -483,7 +463,6 @@ public class EdgeBackGestureHandler implements DisplayListener { pw.println(" mInRejectedExclusion" + mInRejectedExclusion); pw.println(" mInRejectedExclusion" + mInRejectedExclusion); pw.println(" mExcludeRegion=" + mExcludeRegion); pw.println(" mExcludeRegion=" + mExcludeRegion); pw.println(" mUnrestrictedExcludeRegion=" + mUnrestrictedExcludeRegion); pw.println(" mUnrestrictedExcludeRegion=" + mUnrestrictedExcludeRegion); pw.println(" mImeHeight=" + mImeHeight); pw.println(" mIsAttached=" + mIsAttached); pw.println(" mIsAttached=" + mIsAttached); pw.println(" mEdgeWidth=" + mEdgeWidth); pw.println(" mEdgeWidth=" + mEdgeWidth); } } Loading