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

Commit 4f7b4bb4 authored by Steve Elliott's avatar Steve Elliott Committed by Automerger Merge Worker
Browse files

Merge "Prevent QS expansion while remote input active" into sc-dev am: 89bc0823 am: 8f08e5c9

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15129147

Change-Id: Ic488c14757b2904c3150ae7bc0bd0cfe8396c392
parents 34ad7af3 8f08e5c9
Loading
Loading
Loading
Loading
+22 −13
Original line number Diff line number Diff line
@@ -123,6 +123,7 @@ import com.android.systemui.statusbar.KeyguardAffordanceView;
import com.android.systemui.statusbar.KeyguardIndicationController;
import com.android.systemui.statusbar.LockscreenShadeTransitionController;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.NotificationShadeDepthController;
import com.android.systemui.statusbar.NotificationShelfController;
import com.android.systemui.statusbar.PulseExpansionHandler;
@@ -316,6 +317,7 @@ public class NotificationPanelViewController extends PanelViewController {
    private final ScrimController mScrimController;
    private final PrivacyDotViewController mPrivacyDotViewController;
    private final QuickAccessWalletController mQuickAccessWalletController;
    private final NotificationRemoteInputManager mRemoteInputManager;

    // Maximum # notifications to show on Keyguard; extras will be collapsed in an overflow card.
    // If there are exactly 1 + mMaxKeyguardNotifications, then still shows all notifications
@@ -374,7 +376,6 @@ public class NotificationPanelViewController extends PanelViewController {
    private float mLastOverscroll;
    private boolean mQsExpansionEnabledPolicy = true;
    private boolean mQsExpansionEnabledAmbient = true;
    private boolean mQsExpansionEnabled = mQsExpansionEnabledPolicy && mQsExpansionEnabledAmbient;
    private ValueAnimator mQsExpansionAnimator;
    private FlingAnimationUtils mFlingAnimationUtils;
    private int mStatusBarMinHeight;
@@ -698,7 +699,8 @@ public class NotificationPanelViewController extends PanelViewController {
            QuickAccessWalletController quickAccessWalletController,
            @Main Executor uiExecutor,
            SecureSettings secureSettings,
            UnlockedScreenOffAnimationController unlockedScreenOffAnimationController) {
            UnlockedScreenOffAnimationController unlockedScreenOffAnimationController,
            NotificationRemoteInputManager remoteInputManager) {
        super(view, falsingManager, dozeLog, keyguardStateController,
                (SysuiStatusBarStateController) statusBarStateController, vibratorHelper,
                statusBarKeyguardViewManager, latencyTracker, flingAnimationUtilsBuilder.get(),
@@ -791,6 +793,8 @@ public class NotificationPanelViewController extends PanelViewController {
        mAuthController = authController;
        mLockIconViewController = lockIconViewController;
        mUnlockedScreenOffAnimationController = unlockedScreenOffAnimationController;
        mRemoteInputManager = remoteInputManager;

        int currentMode = navigationModeController.addListener(
                mode -> mIsGestureNavigation = QuickStepContract.isGesturalMode(mode));
        mIsGestureNavigation = QuickStepContract.isGesturalMode(currentMode);
@@ -1473,9 +1477,8 @@ public class NotificationPanelViewController extends PanelViewController {
    }

    private void setQsExpansionEnabled() {
        mQsExpansionEnabled = mQsExpansionEnabledPolicy && mQsExpansionEnabledAmbient;
        if (mQs == null) return;
        mQs.setHeaderClickable(mQsExpansionEnabled);
        mQs.setHeaderClickable(isQsExpansionEnabled());
    }

    public void setQsExpansionEnabledPolicy(boolean qsExpansionEnabledPolicy) {
@@ -1544,8 +1547,13 @@ public class NotificationPanelViewController extends PanelViewController {
        flingSettings(0 /* vel */, animateAway ? FLING_HIDE : FLING_COLLAPSE);
    }

    private boolean isQsExpansionEnabled() {
        return mQsExpansionEnabledPolicy && mQsExpansionEnabledAmbient
                && !mRemoteInputManager.getController().isRemoteInputActive();
    }

    public void expandWithQs() {
        if (mQsExpansionEnabled) {
        if (isQsExpansionEnabled()) {
            mQsExpandImmediate = true;
            mNotificationStackScrollLayoutController.setShouldShowShelfOnly(true);
        }
@@ -1810,7 +1818,7 @@ public class NotificationPanelViewController extends PanelViewController {
    private boolean handleQsTouch(MotionEvent event) {
        final int action = event.getActionMasked();
        if (action == MotionEvent.ACTION_DOWN && getExpandedFraction() == 1f
                && mBarState != KEYGUARD && !mQsExpanded && mQsExpansionEnabled) {
                && mBarState != KEYGUARD && !mQsExpanded && isQsExpansionEnabled()) {
            // Down in the empty area while fully expanded - go to QS.
            mQsTracking = true;
            traceQsJank(true /* startTracing */, false /* wasCancelled */);
@@ -1832,7 +1840,7 @@ public class NotificationPanelViewController extends PanelViewController {
        if (action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP) {
            mConflictingQsExpansionGesture = false;
        }
        if (action == MotionEvent.ACTION_DOWN && isFullyCollapsed() && mQsExpansionEnabled) {
        if (action == MotionEvent.ACTION_DOWN && isFullyCollapsed() && isQsExpansionEnabled()) {
            mTwoFingerQsExpandPossible = true;
        }
        if (mTwoFingerQsExpandPossible && isOpenQsEvent(event) && event.getY(event.getActionIndex())
@@ -2671,7 +2679,7 @@ public class NotificationPanelViewController extends PanelViewController {
     * @return Whether we should intercept a gesture to open Quick Settings.
     */
    private boolean shouldQuickSettingsIntercept(float x, float y, float yDiff) {
        if (!mQsExpansionEnabled || mCollapsedOnDown || (mKeyguardShowing
        if (!isQsExpansionEnabled() || mCollapsedOnDown || (mKeyguardShowing
                && mKeyguardBypassController.getBypassEnabled())) {
            return false;
        }
@@ -3490,7 +3498,7 @@ public class NotificationPanelViewController extends PanelViewController {
            mQs = (QS) fragment;
            mQs.setPanelView(mHeightListener);
            mQs.setExpandClickListener(mOnClickListener);
            mQs.setHeaderClickable(mQsExpansionEnabled);
            mQs.setHeaderClickable(isQsExpansionEnabled());
            updateQSPulseExpansion();
            mQs.setOverscrolling(mStackScrollerOverscrolling);
            mQs.setTranslateWhileExpanding(mShouldUseSplitNotificationShade);
@@ -3981,7 +3989,7 @@ public class NotificationPanelViewController extends PanelViewController {
            if (mQsExpanded) {
                flingSettings(0 /* vel */, FLING_COLLAPSE, null /* onFinishRunnable */,
                        true /* isClick */);
            } else if (mQsExpansionEnabled) {
            } else if (isQsExpansionEnabled()) {
                mLockscreenGestureLogger.write(MetricsEvent.ACTION_SHADE_QS_TAP, 0, 0);
                flingSettings(0 /* vel */, FLING_EXPAND, null /* onFinishRunnable */,
                        true /* isClick */);
@@ -3998,7 +4006,7 @@ public class NotificationPanelViewController extends PanelViewController {
                return;
            }
            cancelQsAnimation();
            if (!mQsExpansionEnabled) {
            if (!isQsExpansionEnabled()) {
                amount = 0f;
            }
            float rounded = amount >= 1f ? amount : 0f;
@@ -4026,8 +4034,9 @@ public class NotificationPanelViewController extends PanelViewController {
                setOverScrolling(false);
            }
            setQsExpansion(mQsExpansionHeight);
            flingSettings(!mQsExpansionEnabled && open ? 0f : velocity,
                    open && mQsExpansionEnabled ? FLING_EXPAND : FLING_COLLAPSE, () -> {
            boolean canExpand = isQsExpansionEnabled();
            flingSettings(!canExpand && open ? 0f : velocity,
                    open && canExpand ? FLING_EXPAND : FLING_COLLAPSE, () -> {
                        setOverScrolling(false);
                        updateQsState();
                    }, false /* isClick */);
+10 −1
Original line number Diff line number Diff line
@@ -103,9 +103,11 @@ import com.android.systemui.statusbar.KeyguardAffordanceView;
import com.android.systemui.statusbar.KeyguardIndicationController;
import com.android.systemui.statusbar.LockscreenShadeTransitionController;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.NotificationShadeDepthController;
import com.android.systemui.statusbar.NotificationShelfController;
import com.android.systemui.statusbar.PulseExpansionHandler;
import com.android.systemui.statusbar.RemoteInputController;
import com.android.systemui.statusbar.StatusBarStateControllerImpl;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.VibratorHelper;
@@ -292,6 +294,10 @@ public class NotificationPanelViewTest extends SysuiTestCase {
    private FragmentHostManager mFragmentHostManager;
    @Mock
    private QuickAccessWalletController mQuickAccessWalletController;
    @Mock
    private NotificationRemoteInputManager mNotificationRemoteInputManager;
    @Mock
    private RemoteInputController mRemoteInputController;

    private SysuiStatusBarStateController mStatusBarStateController;
    private NotificationPanelViewController mNotificationPanelViewController;
@@ -387,6 +393,8 @@ public class NotificationPanelViewTest extends SysuiTestCase {
                .thenReturn(mKeyguardStatusView);
        when(mLayoutInflater.inflate(eq(R.layout.keyguard_bottom_area), any(), anyBoolean()))
                .thenReturn(mKeyguardBottomArea);
        when(mNotificationRemoteInputManager.getController()).thenReturn(mRemoteInputController);
        when(mRemoteInputController.isRemoteInputActive()).thenReturn(false);

        reset(mView);

@@ -430,7 +438,8 @@ public class NotificationPanelViewTest extends SysuiTestCase {
                mQuickAccessWalletController,
                new FakeExecutor(new FakeSystemClock()),
                mSecureSettings,
                mUnlockedScreenOffAnimationController);
                mUnlockedScreenOffAnimationController,
                mNotificationRemoteInputManager);
        mNotificationPanelViewController.initDependencies(
                mStatusBar,
                mNotificationShelfController);