From 7ceae6d54ba21d8e7177c19642c3fac6e7abc873 Mon Sep 17 00:00:00 2001 From: Justin Weir Date: Wed, 5 Apr 2023 11:05:27 -0400 Subject: Only disallow QS expansion while keyboard is visible Currently, a bug makes isRemoteInput sometimes returns true when there is no remote input. In order to reduce the impact of the bug, we will also require the keyboard to be visible to block QS expansion. This will allow users to dismiss the keyboard then expand QS while the input has the focus, but this is an acceptable tradeoff while the root cause is being addressed. Bug: 276357074 Test: manually checked go/shade-cujs and ran atest Change-Id: I291ea25c45297820032dec10d81fe88e4159bea6 --- .../com/android/systemui/shade/QuickSettingsController.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsController.java b/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsController.java index 2efc23b87da4..19d83340dc28 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsController.java @@ -17,6 +17,8 @@ package com.android.systemui.shade; +import static android.view.WindowInsets.Type.ime; + import static com.android.internal.jank.InteractionJankMonitor.CUJ_NOTIFICATION_SHADE_QS_EXPAND_COLLAPSE; import static com.android.systemui.classifier.Classifier.QS_COLLAPSE; import static com.android.systemui.shade.NotificationPanelViewController.COUNTER_PANEL_OPEN_QS; @@ -450,9 +452,17 @@ public class QuickSettingsController { return (mQs != null ? mQs.getHeader().getHeight() : 0) + mPeekHeight; } + private boolean isRemoteInputActiveWithKeyboardUp() { + //TODO(b/227115380) remove the isVisible(ime()) check once isRemoteInputActive is fixed. + // The check for keyboard visibility is a temporary workaround that allows QS to expand + // even when isRemoteInputActive is mistakenly returning true. + return mRemoteInputManager.isRemoteInputActive() + && mPanelView.getRootWindowInsets().isVisible(ime()); + } + public boolean isExpansionEnabled() { return mExpansionEnabledPolicy && mExpansionEnabledAmbient - && !mRemoteInputManager.isRemoteInputActive(); + && !isRemoteInputActiveWithKeyboardUp(); } public float getTransitioningToFullShadeProgress() { -- cgit v1.2.3-59-g8ed1b