Merge "Fixing QS not showing up in split shade" into tm-qpr-dev

This commit is contained in:
Michał Brzeziński
2022-11-01 10:55:22 +00:00
committed by Android (Google) Code Review
2 changed files with 19 additions and 31 deletions

View File

@@ -41,7 +41,6 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_N
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
import static com.android.systemui.statusbar.StatusBarState.KEYGUARD; import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
import static com.android.systemui.statusbar.StatusBarState.SHADE; import static com.android.systemui.statusbar.StatusBarState.SHADE;
import static com.android.systemui.statusbar.StatusBarState.SHADE_LOCKED;
import static com.android.systemui.statusbar.VibratorHelper.TOUCH_VIBRATION_ATTRIBUTES; import static com.android.systemui.statusbar.VibratorHelper.TOUCH_VIBRATION_ATTRIBUTES;
import static com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.ROWS_ALL; import static com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.ROWS_ALL;
import static com.android.systemui.statusbar.notification.stack.StackStateAnimator.ANIMATION_DURATION_FOLD_TO_AOD; import static com.android.systemui.statusbar.notification.stack.StackStateAnimator.ANIMATION_DURATION_FOLD_TO_AOD;
@@ -1954,7 +1953,7 @@ public final class NotificationPanelViewController {
public void closeQs() { public void closeQs() {
cancelQsAnimation(); cancelQsAnimation();
setQsExpansion(mQsMinExpansionHeight); setQsExpansionHeight(mQsMinExpansionHeight);
} }
@VisibleForTesting @VisibleForTesting
@@ -1992,7 +1991,7 @@ public final class NotificationPanelViewController {
} }
float height = mQsExpansionHeight; float height = mQsExpansionHeight;
mQsExpansionAnimator.cancel(); mQsExpansionAnimator.cancel();
setQsExpansion(height); setQsExpansionHeight(height);
} }
flingSettings(0 /* vel */, animateAway ? FLING_HIDE : FLING_COLLAPSE); flingSettings(0 /* vel */, animateAway ? FLING_HIDE : FLING_COLLAPSE);
} }
@@ -2205,7 +2204,7 @@ public final class NotificationPanelViewController {
// Already tracking because onOverscrolled was called. We need to update here // Already tracking because onOverscrolled was called. We need to update here
// so we don't stop for a frame until the next touch event gets handled in // so we don't stop for a frame until the next touch event gets handled in
// onTouchEvent. // onTouchEvent.
setQsExpansion(h + mInitialHeightOnTouch); setQsExpansionHeight(h + mInitialHeightOnTouch);
trackMovement(event); trackMovement(event);
return true; return true;
} else { } else {
@@ -2616,7 +2615,7 @@ public final class NotificationPanelViewController {
case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_MOVE:
if (DEBUG_LOGCAT) Log.d(TAG, "onQSTouch move"); if (DEBUG_LOGCAT) Log.d(TAG, "onQSTouch move");
mShadeLog.logMotionEvent(event, "onQsTouch: move action, setting QS expansion"); mShadeLog.logMotionEvent(event, "onQsTouch: move action, setting QS expansion");
setQsExpansion(h + mInitialHeightOnTouch); setQsExpansionHeight(h + mInitialHeightOnTouch);
if (h >= getFalsingThreshold()) { if (h >= getFalsingThreshold()) {
mQsTouchAboveFalsingThreshold = true; mQsTouchAboveFalsingThreshold = true;
} }
@@ -2663,7 +2662,7 @@ public final class NotificationPanelViewController {
// Reset scroll position and apply that position to the expanded height. // Reset scroll position and apply that position to the expanded height.
float height = mQsExpansionHeight; float height = mQsExpansionHeight;
setQsExpansion(height); setQsExpansionHeight(height);
updateExpandedHeightToMaxHeight(); updateExpandedHeightToMaxHeight();
mNotificationStackScrollLayoutController.checkSnoozeLeavebehind(); mNotificationStackScrollLayoutController.checkSnoozeLeavebehind();
@@ -2735,7 +2734,7 @@ public final class NotificationPanelViewController {
mQs.setExpanded(mQsExpanded); mQs.setExpanded(mQsExpanded);
} }
void setQsExpansion(float height) { void setQsExpansionHeight(float height) {
height = Math.min(Math.max(height, mQsMinExpansionHeight), mQsMaxExpansionHeight); height = Math.min(Math.max(height, mQsMinExpansionHeight), mQsMaxExpansionHeight);
mQsFullyExpanded = height == mQsMaxExpansionHeight && mQsMaxExpansionHeight != 0; mQsFullyExpanded = height == mQsMaxExpansionHeight && mQsMaxExpansionHeight != 0;
boolean qsAnimatingAway = !mQsAnimatorExpand && mAnimatingQS; boolean qsAnimatingAway = !mQsAnimatorExpand && mAnimatingQS;
@@ -3157,12 +3156,13 @@ public final class NotificationPanelViewController {
delay); delay);
mIsQsTranslationResetAnimator = mQsTranslationForFullShadeTransition > 0.0f; mIsQsTranslationResetAnimator = mQsTranslationForFullShadeTransition > 0.0f;
} }
if (mSplitShadeEnabled) {
updateQsExpansionForLockscreenToShadeTransition(pxAmount);
}
float endPosition = 0; float endPosition = 0;
if (pxAmount > 0.0f) { if (pxAmount > 0.0f) {
if (mSplitShadeEnabled) {
float qsHeight = MathUtils.lerp(mQsMinExpansionHeight, mQsMaxExpansionHeight,
mLockscreenShadeTransitionController.getQSDragProgress());
setQsExpansionHeight(qsHeight);
}
if (mNotificationStackScrollLayoutController.getVisibleNotificationCount() == 0 if (mNotificationStackScrollLayoutController.getVisibleNotificationCount() == 0
&& !mMediaDataManager.hasActiveMediaOrRecommendation()) { && !mMediaDataManager.hasActiveMediaOrRecommendation()) {
// No notifications are visible, let's animate to the height of qs instead // No notifications are visible, let's animate to the height of qs instead
@@ -3200,18 +3200,6 @@ public final class NotificationPanelViewController {
updateQsExpansion(); updateQsExpansion();
} }
private void updateQsExpansionForLockscreenToShadeTransition(float pxAmount) {
float qsExpansion = 0;
if (pxAmount > 0.0f) {
qsExpansion = MathUtils.lerp(mQsMinExpansionHeight, mQsMaxExpansionHeight,
mLockscreenShadeTransitionController.getQSDragProgress());
}
// SHADE_LOCKED means transition is over and we don't want further updates
if (mBarState != SHADE_LOCKED) {
setQsExpansion(qsExpansion);
}
}
/** /**
* Notify the panel that the pulse expansion has finished and that we're going to the full * Notify the panel that the pulse expansion has finished and that we're going to the full
* shade * shade
@@ -3329,7 +3317,7 @@ public final class NotificationPanelViewController {
animator.setDuration(350); animator.setDuration(350);
} }
animator.addUpdateListener( animator.addUpdateListener(
animation -> setQsExpansion((Float) animation.getAnimatedValue())); animation -> setQsExpansionHeight((Float) animation.getAnimatedValue()));
animator.addListener(new AnimatorListenerAdapter() { animator.addListener(new AnimatorListenerAdapter() {
private boolean mIsCanceled; private boolean mIsCanceled;
@@ -3470,7 +3458,7 @@ public final class NotificationPanelViewController {
} }
float targetHeight = mQsMinExpansionHeight float targetHeight = mQsMinExpansionHeight
+ qsExpansionFraction * (mQsMaxExpansionHeight - mQsMinExpansionHeight); + qsExpansionFraction * (mQsMaxExpansionHeight - mQsMinExpansionHeight);
setQsExpansion(targetHeight); setQsExpansionHeight(targetHeight);
} }
updateExpandedHeight(expandedHeight); updateExpandedHeight(expandedHeight);
updateHeader(); updateHeader();
@@ -5339,7 +5327,7 @@ public final class NotificationPanelViewController {
mQsExpansionFromOverscroll = rounded != 0f; mQsExpansionFromOverscroll = rounded != 0f;
mLastOverscroll = rounded; mLastOverscroll = rounded;
updateQsState(); updateQsState();
setQsExpansion(mQsMinExpansionHeight + rounded); setQsExpansionHeight(mQsMinExpansionHeight + rounded);
} }
@Override @Override
@@ -5356,7 +5344,7 @@ public final class NotificationPanelViewController {
// make sure we can expand // make sure we can expand
setOverScrolling(false); setOverScrolling(false);
} }
setQsExpansion(mQsExpansionHeight); setQsExpansionHeight(mQsExpansionHeight);
boolean canExpand = isQsExpansionEnabled(); boolean canExpand = isQsExpansionEnabled();
flingSettings(!canExpand && open ? 0f : velocity, flingSettings(!canExpand && open ? 0f : velocity,
open && canExpand ? FLING_EXPAND : FLING_COLLAPSE, () -> { open && canExpand ? FLING_EXPAND : FLING_COLLAPSE, () -> {
@@ -5549,7 +5537,7 @@ public final class NotificationPanelViewController {
} }
} else { } else {
// this else branch means we are doing one of: // this else branch means we are doing one of:
// - from KEYGUARD and SHADE (but not expanded shade) // - from KEYGUARD to SHADE (but not fully expanded as when swiping from the top)
// - from SHADE to KEYGUARD // - from SHADE to KEYGUARD
// - from SHADE_LOCKED to SHADE // - from SHADE_LOCKED to SHADE
// - getting notified again about the current SHADE or KEYGUARD state // - getting notified again about the current SHADE or KEYGUARD state
@@ -5718,7 +5706,7 @@ public final class NotificationPanelViewController {
startQsSizeChangeAnimation(oldMaxHeight, mQsMaxExpansionHeight); startQsSizeChangeAnimation(oldMaxHeight, mQsMaxExpansionHeight);
} }
} else if (!mQsExpanded && mQsExpansionAnimator == null) { } else if (!mQsExpanded && mQsExpansionAnimator == null) {
setQsExpansion(mQsMinExpansionHeight + mLastOverscroll); setQsExpansionHeight(mQsMinExpansionHeight + mLastOverscroll);
} else { } else {
mShadeLog.v("onLayoutChange: qs expansion not set"); mShadeLog.v("onLayoutChange: qs expansion not set");
} }

View File

@@ -1552,7 +1552,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
/* delay= */ 0 /* delay= */ 0
); );
mNotificationPanelViewController.setQsExpansion(/* height= */ 123); mNotificationPanelViewController.setQsExpansionHeight(/* height= */ 123);
// First for setTransitionToFullShadeAmount and then setQsExpansion // First for setTransitionToFullShadeAmount and then setQsExpansion
verify(mQs, times(2)).setQsExpansion( verify(mQs, times(2)).setQsExpansion(
@@ -1573,7 +1573,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
when(mNotificationStackScrollLayoutController.getNotificationSquishinessFraction()) when(mNotificationStackScrollLayoutController.getNotificationSquishinessFraction())
.thenReturn(nsslSquishinessFraction); .thenReturn(nsslSquishinessFraction);
mNotificationPanelViewController.setQsExpansion(/* height= */ 123); mNotificationPanelViewController.setQsExpansionHeight(/* height= */ 123);
verify(mQs).setQsExpansion( verify(mQs).setQsExpansion(
/* expansion= */ anyFloat(), /* expansion= */ anyFloat(),