Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +26 −2 Original line number Diff line number Diff line Loading @@ -640,6 +640,14 @@ public class BubbleController implements ConfigurationChangeListener, mOnImeHidden = onImeHidden; mBubblePositioner.setImeVisible(false /* visible */, 0 /* height */); int displayId = mWindowManager.getDefaultDisplay().getDisplayId(); // if the device is locked we can't use the status bar service to hide the IME because // the IME state is frozen and it will lead to internal IME state going out of sync. This // will make the IME visible when the device is unlocked. Instead we use // DisplayImeController directly to make sure the state is correct when the device unlocks. if (isDeviceLocked()) { mDisplayImeController.hideImeForBubblesWhenLocked(displayId); return; } try { mBarService.hideCurrentInputMethodForBubbles(displayId); } catch (RemoteException e) { Loading Loading @@ -679,9 +687,21 @@ public class BubbleController implements ConfigurationChangeListener, ? mNotifEntryToExpandOnShadeUnlock.getKey() : "null")); mIsStatusBarShade = isShade; if (!mIsStatusBarShade && didChange) { // Only collapse stack on change if (mBubbleData.isExpanded()) { // If the IME is visible, hide it first and then collapse. if (mBubblePositioner.isImeVisible()) { hideCurrentInputMethod(this::collapseStack); } else { collapseStack(); } } else if (mOnImeHidden != null) { // a request to collapse started before we're notified that the device is locking. // we're currently waiting for the IME to collapse, before mOnImeHidden can be // executed, which may not happen since the screen may already be off. hide the IME // immediately now that we're locked and pass the same runnable so it can complete. hideCurrentInputMethod(mOnImeHidden); } } if (mNotifEntryToExpandOnShadeUnlock != null) { expandStackAndSelectBubble(mNotifEntryToExpandOnShadeUnlock); Loading Loading @@ -2483,6 +2503,10 @@ public class BubbleController implements ConfigurationChangeListener, mBubbleData.setSelectedBubbleAndExpandStack(bubbleToSelect); } private boolean isDeviceLocked() { return !mIsStatusBarShade; } /** * Description of current bubble state. */ Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java +6 −0 Original line number Diff line number Diff line Loading @@ -224,6 +224,12 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged } } /** Hides the IME for Bubbles when the device is locked. */ public void hideImeForBubblesWhenLocked(int displayId) { PerDisplay pd = mImePerDisplay.get(displayId); pd.setImeInputTargetRequestedVisibility(false, pd.getImeSourceControl().getImeStatsToken()); } /** An implementation of {@link IDisplayWindowInsetsController} for a given display id. */ public class PerDisplay implements DisplayInsetsController.OnInsetsChangedListener { final int mDisplayId; Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +26 −2 Original line number Diff line number Diff line Loading @@ -640,6 +640,14 @@ public class BubbleController implements ConfigurationChangeListener, mOnImeHidden = onImeHidden; mBubblePositioner.setImeVisible(false /* visible */, 0 /* height */); int displayId = mWindowManager.getDefaultDisplay().getDisplayId(); // if the device is locked we can't use the status bar service to hide the IME because // the IME state is frozen and it will lead to internal IME state going out of sync. This // will make the IME visible when the device is unlocked. Instead we use // DisplayImeController directly to make sure the state is correct when the device unlocks. if (isDeviceLocked()) { mDisplayImeController.hideImeForBubblesWhenLocked(displayId); return; } try { mBarService.hideCurrentInputMethodForBubbles(displayId); } catch (RemoteException e) { Loading Loading @@ -679,9 +687,21 @@ public class BubbleController implements ConfigurationChangeListener, ? mNotifEntryToExpandOnShadeUnlock.getKey() : "null")); mIsStatusBarShade = isShade; if (!mIsStatusBarShade && didChange) { // Only collapse stack on change if (mBubbleData.isExpanded()) { // If the IME is visible, hide it first and then collapse. if (mBubblePositioner.isImeVisible()) { hideCurrentInputMethod(this::collapseStack); } else { collapseStack(); } } else if (mOnImeHidden != null) { // a request to collapse started before we're notified that the device is locking. // we're currently waiting for the IME to collapse, before mOnImeHidden can be // executed, which may not happen since the screen may already be off. hide the IME // immediately now that we're locked and pass the same runnable so it can complete. hideCurrentInputMethod(mOnImeHidden); } } if (mNotifEntryToExpandOnShadeUnlock != null) { expandStackAndSelectBubble(mNotifEntryToExpandOnShadeUnlock); Loading Loading @@ -2483,6 +2503,10 @@ public class BubbleController implements ConfigurationChangeListener, mBubbleData.setSelectedBubbleAndExpandStack(bubbleToSelect); } private boolean isDeviceLocked() { return !mIsStatusBarShade; } /** * Description of current bubble state. */ Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java +6 −0 Original line number Diff line number Diff line Loading @@ -224,6 +224,12 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged } } /** Hides the IME for Bubbles when the device is locked. */ public void hideImeForBubblesWhenLocked(int displayId) { PerDisplay pd = mImePerDisplay.get(displayId); pd.setImeInputTargetRequestedVisibility(false, pd.getImeSourceControl().getImeStatsToken()); } /** An implementation of {@link IDisplayWindowInsetsController} for a given display id. */ public class PerDisplay implements DisplayInsetsController.OnInsetsChangedListener { final int mDisplayId; Loading