Merge "Updating QS state to default when going from or to split shade" into tm-dev am: 9568bd96c1 am: 021d602bc5

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

Change-Id: Ic4b15223dbff6c8c9b6986888d5553fa1b2599f6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Michał Brzeziński
2022-05-16 10:15:34 +00:00
committed by Automerger Merge Worker
2 changed files with 63 additions and 48 deletions

View File

@@ -322,7 +322,7 @@ public class NotificationPanelViewController extends PanelViewController {
private final LargeScreenShadeHeaderController mLargeScreenShadeHeaderController; private final LargeScreenShadeHeaderController mLargeScreenShadeHeaderController;
private final RecordingController mRecordingController; private final RecordingController mRecordingController;
private final PanelEventsEmitter mPanelEventsEmitter; private final PanelEventsEmitter mPanelEventsEmitter;
private boolean mShouldUseSplitNotificationShade; private boolean mSplitShadeEnabled;
// The bottom padding reserved for elements of the keyguard measuring notifications // The bottom padding reserved for elements of the keyguard measuring notifications
private float mKeyguardNotificationBottomPadding; private float mKeyguardNotificationBottomPadding;
/** /**
@@ -813,7 +813,7 @@ public class NotificationPanelViewController extends PanelViewController {
mKeyguardUserSwitcherComponentFactory = keyguardUserSwitcherComponentFactory; mKeyguardUserSwitcherComponentFactory = keyguardUserSwitcherComponentFactory;
mFragmentService = fragmentService; mFragmentService = fragmentService;
mSettingsChangeObserver = new SettingsChangeObserver(handler); mSettingsChangeObserver = new SettingsChangeObserver(handler);
mShouldUseSplitNotificationShade = mSplitShadeEnabled =
LargeScreenUtils.shouldUseSplitNotificationShade(mResources); LargeScreenUtils.shouldUseSplitNotificationShade(mResources);
mView.setWillNotDraw(!DEBUG); mView.setWillNotDraw(!DEBUG);
mLargeScreenShadeHeaderController = largeScreenShadeHeaderController; mLargeScreenShadeHeaderController = largeScreenShadeHeaderController;
@@ -1028,7 +1028,7 @@ public class NotificationPanelViewController extends PanelViewController {
}); });
mView.setAccessibilityDelegate(mAccessibilityDelegate); mView.setAccessibilityDelegate(mAccessibilityDelegate);
if (mShouldUseSplitNotificationShade) { if (mSplitShadeEnabled) {
updateResources(); updateResources();
} }
@@ -1125,20 +1125,18 @@ public class NotificationPanelViewController extends PanelViewController {
mSplitShadeNotificationsScrimMarginBottom = mSplitShadeNotificationsScrimMarginBottom =
mResources.getDimensionPixelSize( mResources.getDimensionPixelSize(
R.dimen.split_shade_notifications_scrim_margin_bottom); R.dimen.split_shade_notifications_scrim_margin_bottom);
mShelfAndLockIconOverlap = mShelfAndLockIconOverlap =
mResources.getDimensionPixelSize(R.dimen.shelf_and_lock_icon_overlap); mResources.getDimensionPixelSize(R.dimen.shelf_and_lock_icon_overlap);
final boolean newShouldUseSplitNotificationShade = final boolean newSplitShadeEnabled =
LargeScreenUtils.shouldUseSplitNotificationShade(mResources); LargeScreenUtils.shouldUseSplitNotificationShade(mResources);
final boolean splitNotificationShadeChanged = final boolean splitShadeChanged = mSplitShadeEnabled != newSplitShadeEnabled;
mShouldUseSplitNotificationShade != newShouldUseSplitNotificationShade; mSplitShadeEnabled = newSplitShadeEnabled;
mShouldUseSplitNotificationShade = newShouldUseSplitNotificationShade;
boolean useLargeScreenShadeHeader = boolean useLargeScreenShadeHeader =
LargeScreenUtils.shouldUseLargeScreenShadeHeader(mView.getResources()); LargeScreenUtils.shouldUseLargeScreenShadeHeader(mView.getResources());
if (mQs != null) { if (mQs != null) {
mQs.setInSplitShade(mShouldUseSplitNotificationShade); mQs.setInSplitShade(mSplitShadeEnabled);
} }
mLargeScreenShadeHeaderHeight = mLargeScreenShadeHeaderHeight =
mResources.getDimensionPixelSize(R.dimen.large_screen_shade_header_height); mResources.getDimensionPixelSize(R.dimen.large_screen_shade_header_height);
@@ -1154,7 +1152,12 @@ public class NotificationPanelViewController extends PanelViewController {
mKeyguardMediaController.refreshMediaPosition(); mKeyguardMediaController.refreshMediaPosition();
if (splitNotificationShadeChanged) { if (splitShadeChanged) {
// when we switch from split shade to regular shade we want to enforce setting qs to
// the default state: expanded for split shade and collapsed otherwise
if (!isOnKeyguard() && mPanelExpanded) {
setQsExpanded(mSplitShadeEnabled);
}
updateClockAppearance(); updateClockAppearance();
updateQsState(); updateQsState();
mNotificationStackScrollLayoutController.updateFooter(); mNotificationStackScrollLayoutController.updateFooter();
@@ -1383,7 +1386,7 @@ public class NotificationPanelViewController extends PanelViewController {
updateClockAppearance(); updateClockAppearance();
} }
if (!onKeyguard) { if (!onKeyguard) {
if (mShouldUseSplitNotificationShade) { if (mSplitShadeEnabled) {
// Quick settings are not on the top of the notifications // Quick settings are not on the top of the notifications
// when in split shade mode (they are on the left side), // when in split shade mode (they are on the left side),
// so we should not add a padding for them // so we should not add a padding for them
@@ -1411,10 +1414,9 @@ public class NotificationPanelViewController extends PanelViewController {
.getVisibleNotificationCount() != 0 .getVisibleNotificationCount() != 0
|| mMediaDataManager.hasActiveMediaOrRecommendation(); || mMediaDataManager.hasActiveMediaOrRecommendation();
boolean splitShadeWithActiveMedia = boolean splitShadeWithActiveMedia =
mShouldUseSplitNotificationShade mSplitShadeEnabled && mMediaDataManager.hasActiveMediaOrRecommendation();
&& mMediaDataManager.hasActiveMediaOrRecommendation();
boolean shouldAnimateClockChange = mScreenOffAnimationController.shouldAnimateClockChange(); boolean shouldAnimateClockChange = mScreenOffAnimationController.shouldAnimateClockChange();
if ((hasVisibleNotifications && !mShouldUseSplitNotificationShade) if ((hasVisibleNotifications && !mSplitShadeEnabled)
|| (splitShadeWithActiveMedia && !mDozing)) { || (splitShadeWithActiveMedia && !mDozing)) {
mKeyguardStatusViewController.displayClock(SMALL, shouldAnimateClockChange); mKeyguardStatusViewController.displayClock(SMALL, shouldAnimateClockChange);
} else { } else {
@@ -1451,7 +1453,7 @@ public class NotificationPanelViewController extends PanelViewController {
bypassEnabled, getUnlockedStackScrollerPadding(), bypassEnabled, getUnlockedStackScrollerPadding(),
computeQsExpansionFraction(), computeQsExpansionFraction(),
mDisplayTopInset, mDisplayTopInset,
mShouldUseSplitNotificationShade, mSplitShadeEnabled,
udfpsAodTopLocation, udfpsAodTopLocation,
mKeyguardStatusViewController.getClockBottom(mStatusBarHeaderHeightKeyguard), mKeyguardStatusViewController.getClockBottom(mStatusBarHeaderHeightKeyguard),
mKeyguardStatusViewController.isClockTopAligned()); mKeyguardStatusViewController.isClockTopAligned());
@@ -1481,8 +1483,7 @@ public class NotificationPanelViewController extends PanelViewController {
boolean hasVisibleNotifications = mNotificationStackScrollLayoutController boolean hasVisibleNotifications = mNotificationStackScrollLayoutController
.getVisibleNotificationCount() != 0 .getVisibleNotificationCount() != 0
|| mMediaDataManager.hasActiveMediaOrRecommendation(); || mMediaDataManager.hasActiveMediaOrRecommendation();
boolean shouldBeCentered = !mShouldUseSplitNotificationShade || !hasVisibleNotifications boolean shouldBeCentered = !mSplitShadeEnabled || !hasVisibleNotifications || mDozing;
|| mDozing;
if (mStatusViewCentered != shouldBeCentered) { if (mStatusViewCentered != shouldBeCentered) {
mStatusViewCentered = shouldBeCentered; mStatusViewCentered = shouldBeCentered;
ConstraintSet constraintSet = new ConstraintSet(); ConstraintSet constraintSet = new ConstraintSet();
@@ -1491,7 +1492,7 @@ public class NotificationPanelViewController extends PanelViewController {
constraintSet.connect(R.id.keyguard_status_view, END, statusConstraint, END); constraintSet.connect(R.id.keyguard_status_view, END, statusConstraint, END);
if (animate) { if (animate) {
ChangeBounds transition = new ChangeBounds(); ChangeBounds transition = new ChangeBounds();
if (mShouldUseSplitNotificationShade) { if (mSplitShadeEnabled) {
// Excluding media from the transition on split-shade, as it doesn't transition // Excluding media from the transition on split-shade, as it doesn't transition
// horizontally properly. // horizontally properly.
transition.excludeTarget(R.id.status_view_media_container, true); transition.excludeTarget(R.id.status_view_media_container, true);
@@ -1648,7 +1649,7 @@ public class NotificationPanelViewController extends PanelViewController {
private void setShowShelfOnly(boolean shelfOnly) { private void setShowShelfOnly(boolean shelfOnly) {
mNotificationStackScrollLayoutController.setShouldShowShelfOnly( mNotificationStackScrollLayoutController.setShouldShowShelfOnly(
shelfOnly && !mShouldUseSplitNotificationShade); shelfOnly && !mSplitShadeEnabled);
} }
public void closeQs() { public void closeQs() {
@@ -1689,7 +1690,7 @@ public class NotificationPanelViewController extends PanelViewController {
mQsExpandImmediate = true; mQsExpandImmediate = true;
setShowShelfOnly(true); setShowShelfOnly(true);
} }
if (mShouldUseSplitNotificationShade && isOnKeyguard()) { if (mSplitShadeEnabled && isOnKeyguard()) {
// It's a special case as this method is likely to not be initiated by finger movement // It's a special case as this method is likely to not be initiated by finger movement
// but rather called from adb shell or accessibility service. // but rather called from adb shell or accessibility service.
// We're using LockscreenShadeTransitionController because on lockscreen that's the // We're using LockscreenShadeTransitionController because on lockscreen that's the
@@ -1919,7 +1920,7 @@ public class NotificationPanelViewController extends PanelViewController {
int flingType; int flingType;
if (expandsQs && !isCancelMotionEvent) { if (expandsQs && !isCancelMotionEvent) {
flingType = FLING_EXPAND; flingType = FLING_EXPAND;
} else if (mShouldUseSplitNotificationShade) { } else if (mSplitShadeEnabled) {
flingType = FLING_HIDE; flingType = FLING_HIDE;
} else { } else {
flingType = FLING_COLLAPSE; flingType = FLING_COLLAPSE;
@@ -1985,11 +1986,11 @@ public class NotificationPanelViewController extends PanelViewController {
private boolean handleQsTouch(MotionEvent event) { private boolean handleQsTouch(MotionEvent event) {
if (mShouldUseSplitNotificationShade && touchXOutsideOfQs(event.getX())) { if (mSplitShadeEnabled && touchXOutsideOfQs(event.getX())) {
return false; return false;
} }
final int action = event.getActionMasked(); final int action = event.getActionMasked();
boolean collapsedQs = !mQsExpanded && !mShouldUseSplitNotificationShade; boolean collapsedQs = !mQsExpanded && !mSplitShadeEnabled;
boolean expandedShadeCollapsedQs = getExpandedFraction() == 1f && mBarState != KEYGUARD boolean expandedShadeCollapsedQs = getExpandedFraction() == 1f && mBarState != KEYGUARD
&& collapsedQs && isQsExpansionEnabled(); && collapsedQs && isQsExpansionEnabled();
if (action == MotionEvent.ACTION_DOWN && expandedShadeCollapsedQs) { if (action == MotionEvent.ACTION_DOWN && expandedShadeCollapsedQs) {
@@ -2007,7 +2008,7 @@ public class NotificationPanelViewController extends PanelViewController {
} }
if (!mQsExpandImmediate && mQsTracking) { if (!mQsExpandImmediate && mQsTracking) {
onQsTouch(event); onQsTouch(event);
if (!mConflictingQsExpansionGesture && !mShouldUseSplitNotificationShade) { if (!mConflictingQsExpansionGesture && !mSplitShadeEnabled) {
return true; return true;
} }
} }
@@ -2298,7 +2299,7 @@ public class NotificationPanelViewController extends PanelViewController {
} }
private void updateQsState() { private void updateQsState() {
boolean qsFullScreen = mQsExpanded && !mShouldUseSplitNotificationShade; boolean qsFullScreen = mQsExpanded && !mSplitShadeEnabled;
mNotificationStackScrollLayoutController.setQsFullScreen(qsFullScreen); mNotificationStackScrollLayoutController.setQsFullScreen(qsFullScreen);
mNotificationStackScrollLayoutController.setScrollingEnabled( mNotificationStackScrollLayoutController.setScrollingEnabled(
mBarState != KEYGUARD && (!qsFullScreen || mQsExpansionFromOverscroll)); mBarState != KEYGUARD && (!qsFullScreen || mQsExpansionFromOverscroll));
@@ -2346,7 +2347,7 @@ public class NotificationPanelViewController extends PanelViewController {
private void updateQsExpansion() { private void updateQsExpansion() {
if (mQs == null) return; if (mQs == null) return;
final float squishiness; final float squishiness;
if ((mQsExpandImmediate || mQsExpanded) && !mShouldUseSplitNotificationShade) { if ((mQsExpandImmediate || mQsExpanded) && !mSplitShadeEnabled) {
squishiness = 1; squishiness = 1;
} else if (mLockscreenShadeTransitionController.getQSDragProgress() > 0) { } else if (mLockscreenShadeTransitionController.getQSDragProgress() > 0) {
squishiness = mLockscreenShadeTransitionController.getQSDragProgress(); squishiness = mLockscreenShadeTransitionController.getQSDragProgress();
@@ -2355,7 +2356,7 @@ public class NotificationPanelViewController extends PanelViewController {
.getNotificationSquishinessFraction(); .getNotificationSquishinessFraction();
} }
final float qsExpansionFraction = computeQsExpansionFraction(); final float qsExpansionFraction = computeQsExpansionFraction();
final float adjustedExpansionFraction = mShouldUseSplitNotificationShade final float adjustedExpansionFraction = mSplitShadeEnabled
? 1f : computeQsExpansionFraction(); ? 1f : computeQsExpansionFraction();
mQs.setQsExpansion(adjustedExpansionFraction, getExpandedFraction(), getHeaderTranslation(), mQs.setQsExpansion(adjustedExpansionFraction, getExpandedFraction(), getHeaderTranslation(),
squishiness); squishiness);
@@ -2364,7 +2365,7 @@ public class NotificationPanelViewController extends PanelViewController {
mScrimController.setQsPosition(qsExpansionFraction, qsPanelBottomY); mScrimController.setQsPosition(qsExpansionFraction, qsPanelBottomY);
setQSClippingBounds(); setQSClippingBounds();
if (mShouldUseSplitNotificationShade) { if (mSplitShadeEnabled) {
// In split shade we want to pretend that QS are always collapsed so their behaviour and // In split shade we want to pretend that QS are always collapsed so their behaviour and
// interactions don't influence notifications as they do in portrait. But we want to set // interactions don't influence notifications as they do in portrait. But we want to set
// 0 explicitly in case we're rotating from non-split shade with QS expansion of 1. // 0 explicitly in case we're rotating from non-split shade with QS expansion of 1.
@@ -2404,7 +2405,7 @@ public class NotificationPanelViewController extends PanelViewController {
private void updateQSExpansionEnabledAmbient() { private void updateQSExpansionEnabledAmbient() {
final float scrollRangeToTop = mAmbientState.getTopPadding() - mQuickQsHeaderHeight; final float scrollRangeToTop = mAmbientState.getTopPadding() - mQuickQsHeaderHeight;
mQsExpansionEnabledAmbient = mShouldUseSplitNotificationShade mQsExpansionEnabledAmbient = mSplitShadeEnabled
|| (mAmbientState.getScrollY() <= scrollRangeToTop); || (mAmbientState.getScrollY() <= scrollRangeToTop);
setQsExpansionEnabled(); setQsExpansionEnabled();
} }
@@ -2428,7 +2429,7 @@ public class NotificationPanelViewController extends PanelViewController {
private int calculateTopQsClippingBound(int qsPanelBottomY) { private int calculateTopQsClippingBound(int qsPanelBottomY) {
int top; int top;
if (mShouldUseSplitNotificationShade) { if (mSplitShadeEnabled) {
top = Math.min(qsPanelBottomY, mLargeScreenShadeHeaderHeight); top = Math.min(qsPanelBottomY, mLargeScreenShadeHeaderHeight);
} else { } else {
if (mTransitioningToFullShadeProgress > 0.0f) { if (mTransitioningToFullShadeProgress > 0.0f) {
@@ -2462,7 +2463,7 @@ public class NotificationPanelViewController extends PanelViewController {
} }
private int calculateBottomQsClippingBound(int top) { private int calculateBottomQsClippingBound(int top) {
if (mShouldUseSplitNotificationShade) { if (mSplitShadeEnabled) {
return top + mNotificationStackScrollLayoutController.getHeight() return top + mNotificationStackScrollLayoutController.getHeight()
+ mSplitShadeNotificationsScrimMarginBottom; + mSplitShadeNotificationsScrimMarginBottom;
} else { } else {
@@ -2559,7 +2560,7 @@ public class NotificationPanelViewController extends PanelViewController {
// qsTranslation should only be positive during pulse expansion because it's // qsTranslation should only be positive during pulse expansion because it's
// already translating in from the top // already translating in from the top
qsTranslation = Math.max(0, (top - mQs.getHeader().getHeight()) / 2.0f); qsTranslation = Math.max(0, (top - mQs.getHeader().getHeight()) / 2.0f);
} else if (!mShouldUseSplitNotificationShade) { } else if (!mSplitShadeEnabled) {
qsTranslation = (top - mQs.getHeader().getHeight()) * QS_PARALLAX_AMOUNT; qsTranslation = (top - mQs.getHeader().getHeight()) * QS_PARALLAX_AMOUNT;
} }
} }
@@ -2573,11 +2574,11 @@ public class NotificationPanelViewController extends PanelViewController {
mQsClipTop, mQsClipTop,
mQsClipBottom, mQsClipBottom,
radius, qsVisible radius, qsVisible
&& !mShouldUseSplitNotificationShade); && !mSplitShadeEnabled);
} }
mKeyguardStatusViewController.setClipBounds( mKeyguardStatusViewController.setClipBounds(
clipStatusView ? mKeyguardStatusAreaClipBounds : null); clipStatusView ? mKeyguardStatusAreaClipBounds : null);
if (!qsVisible && mShouldUseSplitNotificationShade) { if (!qsVisible && mSplitShadeEnabled) {
// On the lockscreen when qs isn't visible, we don't want the bounds of the shade to // On the lockscreen when qs isn't visible, we don't want the bounds of the shade to
// be visible, otherwise you can see the bounds once swiping up to see bouncer // be visible, otherwise you can see the bounds once swiping up to see bouncer
mScrimController.setNotificationsBounds(0, 0, 0, 0); mScrimController.setNotificationsBounds(0, 0, 0, 0);
@@ -2585,12 +2586,11 @@ public class NotificationPanelViewController extends PanelViewController {
// Increase the height of the notifications scrim when not in split shade // Increase the height of the notifications scrim when not in split shade
// (e.g. portrait tablet) so the rounded corners are not visible at the bottom, // (e.g. portrait tablet) so the rounded corners are not visible at the bottom,
// in this case they are rendered off-screen // in this case they are rendered off-screen
final int notificationsScrimBottom = final int notificationsScrimBottom = mSplitShadeEnabled ? bottom : bottom + radius;
mShouldUseSplitNotificationShade ? bottom : bottom + radius;
mScrimController.setNotificationsBounds(left, top, right, notificationsScrimBottom); mScrimController.setNotificationsBounds(left, top, right, notificationsScrimBottom);
} }
if (mShouldUseSplitNotificationShade) { if (mSplitShadeEnabled) {
mKeyguardStatusBarViewController.setNoTopClipping(); mKeyguardStatusBarViewController.setNoTopClipping();
} else { } else {
mKeyguardStatusBarViewController.updateTopClipping(top); mKeyguardStatusBarViewController.updateTopClipping(top);
@@ -2604,7 +2604,7 @@ public class NotificationPanelViewController extends PanelViewController {
int nsslRight = right - mNotificationStackScrollLayoutController.getLeft(); int nsslRight = right - mNotificationStackScrollLayoutController.getLeft();
int nsslTop = top - mNotificationStackScrollLayoutController.getTop(); int nsslTop = top - mNotificationStackScrollLayoutController.getTop();
int nsslBottom = bottom - mNotificationStackScrollLayoutController.getTop(); int nsslBottom = bottom - mNotificationStackScrollLayoutController.getTop();
int bottomRadius = mShouldUseSplitNotificationShade ? radius : 0; int bottomRadius = mSplitShadeEnabled ? radius : 0;
mNotificationStackScrollLayoutController.setRoundedClippingBounds( mNotificationStackScrollLayoutController.setRoundedClippingBounds(
nsslLeft, nsslTop, nsslRight, nsslBottom, radius, bottomRadius); nsslLeft, nsslTop, nsslRight, nsslBottom, radius, bottomRadius);
} }
@@ -2646,7 +2646,7 @@ public class NotificationPanelViewController extends PanelViewController {
} }
private float calculateNotificationsTopPadding() { private float calculateNotificationsTopPadding() {
if (mShouldUseSplitNotificationShade && !mKeyguardShowing) { if (mSplitShadeEnabled && !mKeyguardShowing) {
return 0; return 0;
} }
if (mKeyguardShowing && (mQsExpandImmediate if (mKeyguardShowing && (mQsExpandImmediate
@@ -2919,7 +2919,7 @@ public class NotificationPanelViewController extends PanelViewController {
private boolean shouldQuickSettingsIntercept(float x, float y, float yDiff) { private boolean shouldQuickSettingsIntercept(float x, float y, float yDiff) {
if (!isQsExpansionEnabled() || mCollapsedOnDown if (!isQsExpansionEnabled() || mCollapsedOnDown
|| (mKeyguardShowing && mKeyguardBypassController.getBypassEnabled()) || (mKeyguardShowing && mKeyguardBypassController.getBypassEnabled())
|| mShouldUseSplitNotificationShade) { || mSplitShadeEnabled) {
return false; return false;
} }
View header = mKeyguardShowing || mQs == null ? mKeyguardStatusBar : mQs.getHeader(); View header = mKeyguardShowing || mQs == null ? mKeyguardStatusBar : mQs.getHeader();
@@ -2950,7 +2950,7 @@ public class NotificationPanelViewController extends PanelViewController {
return true; return true;
} }
return !mShouldUseSplitNotificationShade && (isInSettings() || mIsPanelCollapseOnQQS); return !mSplitShadeEnabled && (isInSettings() || mIsPanelCollapseOnQQS);
} }
@Override @Override
@@ -3134,7 +3134,7 @@ public class NotificationPanelViewController extends PanelViewController {
float appearAmount = mNotificationStackScrollLayoutController float appearAmount = mNotificationStackScrollLayoutController
.calculateAppearFraction(mExpandedHeight); .calculateAppearFraction(mExpandedHeight);
float startHeight = -mQsExpansionHeight; float startHeight = -mQsExpansionHeight;
if (!mShouldUseSplitNotificationShade && mBarState == StatusBarState.SHADE) { if (!mSplitShadeEnabled && mBarState == StatusBarState.SHADE) {
// Small parallax as we pull down and clip QS // Small parallax as we pull down and clip QS
startHeight = -mQsExpansionHeight * QS_PARALLAX_AMOUNT; startHeight = -mQsExpansionHeight * QS_PARALLAX_AMOUNT;
} }
@@ -3682,7 +3682,7 @@ public class NotificationPanelViewController extends PanelViewController {
mQs.setCollapseExpandAction(mCollapseExpandAction); mQs.setCollapseExpandAction(mCollapseExpandAction);
mQs.setHeaderClickable(isQsExpansionEnabled()); mQs.setHeaderClickable(isQsExpansionEnabled());
mQs.setOverscrolling(mStackScrollerOverscrolling); mQs.setOverscrolling(mStackScrollerOverscrolling);
mQs.setInSplitShade(mShouldUseSplitNotificationShade); mQs.setInSplitShade(mSplitShadeEnabled);
// recompute internal state when qspanel height changes // recompute internal state when qspanel height changes
mQs.getView().addOnLayoutChangeListener( mQs.getView().addOnLayoutChangeListener(
@@ -4353,7 +4353,7 @@ public class NotificationPanelViewController extends PanelViewController {
@Override @Override
public void onOverscrollTopChanged(float amount, boolean isRubberbanded) { public void onOverscrollTopChanged(float amount, boolean isRubberbanded) {
// When in split shade, overscroll shouldn't carry through to QS // When in split shade, overscroll shouldn't carry through to QS
if (mShouldUseSplitNotificationShade) { if (mSplitShadeEnabled) {
return; return;
} }
cancelQsAnimation(); cancelQsAnimation();
@@ -4371,7 +4371,7 @@ public class NotificationPanelViewController extends PanelViewController {
@Override @Override
public void flingTopOverscroll(float velocity, boolean open) { public void flingTopOverscroll(float velocity, boolean open) {
// in split shade mode we want to expand/collapse QS only when touch happens within QS // in split shade mode we want to expand/collapse QS only when touch happens within QS
if (mShouldUseSplitNotificationShade && touchXOutsideOfQs(mInitialTouchX)) { if (mSplitShadeEnabled && touchXOutsideOfQs(mInitialTouchX)) {
return; return;
} }
mLastOverscroll = 0f; mLastOverscroll = 0f;
@@ -4711,7 +4711,7 @@ public class NotificationPanelViewController extends PanelViewController {
// the top of QS // the top of QS
if (!mQsExpanded) { if (!mQsExpanded) {
// TODO(b/185683835) Nicer clipping when using new spacial model // TODO(b/185683835) Nicer clipping when using new spacial model
if (mShouldUseSplitNotificationShade) { if (mSplitShadeEnabled) {
mQs.animateHeaderSlidingOut(); mQs.animateHeaderSlidingOut();
} }
} }
@@ -4908,7 +4908,7 @@ public class NotificationPanelViewController extends PanelViewController {
private void updateQSMinHeight() { private void updateQSMinHeight() {
float previousMin = mQsMinExpansionHeight; float previousMin = mQsMinExpansionHeight;
if (mKeyguardShowing || mShouldUseSplitNotificationShade) { if (mKeyguardShowing || mSplitShadeEnabled) {
mQsMinExpansionHeight = 0; mQsMinExpansionHeight = 0;
} else { } else {
mQsMinExpansionHeight = mQs.getQsMinExpansionHeight(); mQsMinExpansionHeight = mQs.getQsMinExpansionHeight();
@@ -5042,7 +5042,7 @@ public class NotificationPanelViewController extends PanelViewController {
// we need to ignore it on keyguard as this is a false alarm - transition from unlocked // we need to ignore it on keyguard as this is a false alarm - transition from unlocked
// to locked will trigger this event and we're not actually in the process of opening // to locked will trigger this event and we're not actually in the process of opening
// the shade, lockscreen is just always expanded // the shade, lockscreen is just always expanded
if (mShouldUseSplitNotificationShade && !isOnKeyguard()) { if (mSplitShadeEnabled && !isOnKeyguard()) {
mQsExpandImmediate = true; mQsExpandImmediate = true;
} }
mCentralSurfaces.makeExpandedVisible(false); mCentralSurfaces.makeExpandedVisible(false);

View File

@@ -1089,6 +1089,21 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
assertThat(mNotificationPanelViewController.mQsExpandImmediate).isFalse(); assertThat(mNotificationPanelViewController.mQsExpandImmediate).isFalse();
} }
@Test
public void testQsExpansionChangedToDefaultWhenRotatingFromOrToSplitShade() {
// to make sure shade is in expanded state
mNotificationPanelViewController.startWaitingForOpenPanelGesture();
assertThat(mNotificationPanelViewController.isQsExpanded()).isFalse();
// switch to split shade from portrait (default state)
enableSplitShade(/* enabled= */ true);
assertThat(mNotificationPanelViewController.isQsExpanded()).isTrue();
// switch to portrait from split shade
enableSplitShade(/* enabled= */ false);
assertThat(mNotificationPanelViewController.isQsExpanded()).isFalse();
}
@Test @Test
public void interceptTouchEvent_withinQs_shadeExpanded_startsQsTracking() { public void interceptTouchEvent_withinQs_shadeExpanded_startsQsTracking() {
mNotificationPanelViewController.mQs = mQs; mNotificationPanelViewController.mQs = mQs;