Merge "Added logging for shade top padding and clipping" into tm-qpr-dev
This commit is contained in:
@@ -25,6 +25,7 @@ import static com.android.systemui.shade.NotificationPanelViewController.FLING_E
|
|||||||
import static com.android.systemui.shade.NotificationPanelViewController.FLING_HIDE;
|
import static com.android.systemui.shade.NotificationPanelViewController.FLING_HIDE;
|
||||||
import static com.android.systemui.shade.NotificationPanelViewController.QS_PARALLAX_AMOUNT;
|
import static com.android.systemui.shade.NotificationPanelViewController.QS_PARALLAX_AMOUNT;
|
||||||
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 android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
@@ -246,6 +247,12 @@ public class QuickSettingsController {
|
|||||||
/** The duration of the notification bounds animation. */
|
/** The duration of the notification bounds animation. */
|
||||||
private long mNotificationBoundsAnimationDuration;
|
private long mNotificationBoundsAnimationDuration;
|
||||||
|
|
||||||
|
/** TODO(b/273591201): remove after bug resolved */
|
||||||
|
private int mLastClippingTopBound;
|
||||||
|
private int mLastNotificationsTopPadding;
|
||||||
|
private int mLastNotificationsClippingTopBound;
|
||||||
|
private int mLastNotificationsClippingTopBoundNssl;
|
||||||
|
|
||||||
private final Region mInterceptRegion = new Region();
|
private final Region mInterceptRegion = new Region();
|
||||||
/** The end bounds of a clipping animation. */
|
/** The end bounds of a clipping animation. */
|
||||||
private final Rect mClippingAnimationEndBounds = new Rect();
|
private final Rect mClippingAnimationEndBounds = new Rect();
|
||||||
@@ -610,7 +617,7 @@ public class QuickSettingsController {
|
|||||||
float appearAmount = mNotificationStackScrollLayoutController
|
float appearAmount = mNotificationStackScrollLayoutController
|
||||||
.calculateAppearFraction(mShadeExpandedHeight);
|
.calculateAppearFraction(mShadeExpandedHeight);
|
||||||
float startHeight = -getExpansionHeight();
|
float startHeight = -getExpansionHeight();
|
||||||
if (mBarState == StatusBarState.SHADE) {
|
if (mBarState == SHADE) {
|
||||||
// Small parallax as we pull down and clip QS
|
// Small parallax as we pull down and clip QS
|
||||||
startHeight = -getExpansionHeight() * QS_PARALLAX_AMOUNT;
|
startHeight = -getExpansionHeight() * QS_PARALLAX_AMOUNT;
|
||||||
}
|
}
|
||||||
@@ -1086,6 +1093,7 @@ public class QuickSettingsController {
|
|||||||
mClippingAnimationEndBounds.left, fraction);
|
mClippingAnimationEndBounds.left, fraction);
|
||||||
int animTop = (int) MathUtils.lerp(startTop,
|
int animTop = (int) MathUtils.lerp(startTop,
|
||||||
mClippingAnimationEndBounds.top, fraction);
|
mClippingAnimationEndBounds.top, fraction);
|
||||||
|
logClippingTopBound("interpolated top bound", top);
|
||||||
int animRight = (int) MathUtils.lerp(startRight,
|
int animRight = (int) MathUtils.lerp(startRight,
|
||||||
mClippingAnimationEndBounds.right, fraction);
|
mClippingAnimationEndBounds.right, fraction);
|
||||||
int animBottom = (int) MathUtils.lerp(startBottom,
|
int animBottom = (int) MathUtils.lerp(startBottom,
|
||||||
@@ -1205,6 +1213,8 @@ public class QuickSettingsController {
|
|||||||
// the screen without clipping.
|
// the screen without clipping.
|
||||||
return -mAmbientState.getStackTopMargin();
|
return -mAmbientState.getStackTopMargin();
|
||||||
} else {
|
} else {
|
||||||
|
logNotificationsClippingTopBound(qsTop,
|
||||||
|
mNotificationStackScrollLayoutController.getTop());
|
||||||
return qsTop - mNotificationStackScrollLayoutController.getTop();
|
return qsTop - mNotificationStackScrollLayoutController.getTop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1227,6 +1237,7 @@ public class QuickSettingsController {
|
|||||||
/** Calculate top padding for notifications */
|
/** Calculate top padding for notifications */
|
||||||
public float calculateNotificationsTopPadding(boolean isShadeExpanding,
|
public float calculateNotificationsTopPadding(boolean isShadeExpanding,
|
||||||
int keyguardNotificationStaticPadding, float expandedFraction) {
|
int keyguardNotificationStaticPadding, float expandedFraction) {
|
||||||
|
float topPadding;
|
||||||
boolean keyguardShowing = mBarState == KEYGUARD;
|
boolean keyguardShowing = mBarState == KEYGUARD;
|
||||||
if (mSplitShadeEnabled) {
|
if (mSplitShadeEnabled) {
|
||||||
return keyguardShowing
|
return keyguardShowing
|
||||||
@@ -1243,19 +1254,27 @@ public class QuickSettingsController {
|
|||||||
int maxQsPadding = getMaxExpansionHeight();
|
int maxQsPadding = getMaxExpansionHeight();
|
||||||
int max = keyguardShowing ? Math.max(
|
int max = keyguardShowing ? Math.max(
|
||||||
keyguardNotificationStaticPadding, maxQsPadding) : maxQsPadding;
|
keyguardNotificationStaticPadding, maxQsPadding) : maxQsPadding;
|
||||||
return (int) MathUtils.lerp((float) getMinExpansionHeight(),
|
topPadding = (int) MathUtils.lerp((float) getMinExpansionHeight(),
|
||||||
(float) max, expandedFraction);
|
(float) max, expandedFraction);
|
||||||
|
logNotificationsTopPadding("keyguard and expandImmediate", topPadding);
|
||||||
|
return topPadding;
|
||||||
} else if (isSizeChangeAnimationRunning()) {
|
} else if (isSizeChangeAnimationRunning()) {
|
||||||
return Math.max((int) mSizeChangeAnimator.getAnimatedValue(),
|
topPadding = Math.max((int) mSizeChangeAnimator.getAnimatedValue(),
|
||||||
keyguardNotificationStaticPadding);
|
keyguardNotificationStaticPadding);
|
||||||
|
logNotificationsTopPadding("size change animation running", topPadding);
|
||||||
|
return topPadding;
|
||||||
} else if (keyguardShowing) {
|
} else if (keyguardShowing) {
|
||||||
// We can only do the smoother transition on Keyguard when we also are not collapsing
|
// We can only do the smoother transition on Keyguard when we also are not collapsing
|
||||||
// from a scrolled quick settings.
|
// from a scrolled quick settings.
|
||||||
return MathUtils.lerp((float) keyguardNotificationStaticPadding,
|
topPadding = MathUtils.lerp((float) keyguardNotificationStaticPadding,
|
||||||
(float) (getMaxExpansionHeight()), computeExpansionFraction());
|
(float) (getMaxExpansionHeight()), computeExpansionFraction());
|
||||||
|
logNotificationsTopPadding("keyguard", topPadding);
|
||||||
|
return topPadding;
|
||||||
} else {
|
} else {
|
||||||
return mQsFrameTranslateController.getNotificationsTopPadding(
|
topPadding = mQsFrameTranslateController.getNotificationsTopPadding(
|
||||||
mExpansionHeight, mNotificationStackScrollLayoutController);
|
mExpansionHeight, mNotificationStackScrollLayoutController);
|
||||||
|
logNotificationsTopPadding("default case", topPadding);
|
||||||
|
return topPadding;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1302,6 +1321,38 @@ public class QuickSettingsController {
|
|||||||
- mAmbientState.getScrollY());
|
- mAmbientState.getScrollY());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** TODO(b/273591201): remove after bug resolved */
|
||||||
|
private void logNotificationsTopPadding(String message, float rawPadding) {
|
||||||
|
int padding = ((int) rawPadding / 10) * 10;
|
||||||
|
if (mBarState != KEYGUARD && padding != mLastNotificationsTopPadding && !mExpanded) {
|
||||||
|
mLastNotificationsTopPadding = padding;
|
||||||
|
mShadeLog.logNotificationsTopPadding(message, padding);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** TODO(b/273591201): remove after bug resolved */
|
||||||
|
private void logClippingTopBound(String message, int top) {
|
||||||
|
top = (top / 10) * 10;
|
||||||
|
if (mBarState != KEYGUARD && mShadeExpandedFraction == 1
|
||||||
|
&& top != mLastClippingTopBound && !mExpanded) {
|
||||||
|
mLastClippingTopBound = top;
|
||||||
|
mShadeLog.logClippingTopBound(message, top);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** TODO(b/273591201): remove after bug resolved */
|
||||||
|
private void logNotificationsClippingTopBound(int top, int nsslTop) {
|
||||||
|
top = (top / 10) * 10;
|
||||||
|
nsslTop = (nsslTop / 10) * 10;
|
||||||
|
if (mBarState == SHADE && mShadeExpandedFraction == 1
|
||||||
|
&& (top != mLastNotificationsClippingTopBound
|
||||||
|
|| nsslTop != mLastNotificationsClippingTopBoundNssl) && !mExpanded) {
|
||||||
|
mLastNotificationsClippingTopBound = top;
|
||||||
|
mLastNotificationsClippingTopBoundNssl = nsslTop;
|
||||||
|
mShadeLog.logNotificationsClippingTopBound(top, nsslTop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private int calculateTopClippingBound(int qsPanelBottomY) {
|
private int calculateTopClippingBound(int qsPanelBottomY) {
|
||||||
int top;
|
int top;
|
||||||
if (mSplitShadeEnabled) {
|
if (mSplitShadeEnabled) {
|
||||||
@@ -1311,6 +1362,7 @@ public class QuickSettingsController {
|
|||||||
// If we're transitioning, let's use the actual value. The else case
|
// If we're transitioning, let's use the actual value. The else case
|
||||||
// can be wrong during transitions when waiting for the keyguard to unlock
|
// can be wrong during transitions when waiting for the keyguard to unlock
|
||||||
top = mTransitionToFullShadePosition;
|
top = mTransitionToFullShadePosition;
|
||||||
|
logClippingTopBound("set while transitioning to full shade", top);
|
||||||
} else {
|
} else {
|
||||||
final float notificationTop = getEdgePosition();
|
final float notificationTop = getEdgePosition();
|
||||||
if (mBarState == KEYGUARD) {
|
if (mBarState == KEYGUARD) {
|
||||||
@@ -1319,8 +1371,10 @@ public class QuickSettingsController {
|
|||||||
// this should go away once we unify the stackY position and don't have
|
// this should go away once we unify the stackY position and don't have
|
||||||
// to do this min anymore below.
|
// to do this min anymore below.
|
||||||
top = qsPanelBottomY;
|
top = qsPanelBottomY;
|
||||||
|
logClippingTopBound("bypassing keyguard", top);
|
||||||
} else {
|
} else {
|
||||||
top = (int) Math.min(qsPanelBottomY, notificationTop);
|
top = (int) Math.min(qsPanelBottomY, notificationTop);
|
||||||
|
logClippingTopBound("keyguard default case", top);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
top = (int) notificationTop;
|
top = (int) notificationTop;
|
||||||
@@ -1328,12 +1382,14 @@ public class QuickSettingsController {
|
|||||||
}
|
}
|
||||||
// TODO (b/265193930): remove dependency on NPVC
|
// TODO (b/265193930): remove dependency on NPVC
|
||||||
top += mPanelViewControllerLazy.get().getOverStretchAmount();
|
top += mPanelViewControllerLazy.get().getOverStretchAmount();
|
||||||
|
logClippingTopBound("including overstretch", top);
|
||||||
// Correction for instant expansion caused by HUN pull down/
|
// Correction for instant expansion caused by HUN pull down/
|
||||||
float minFraction = mPanelViewControllerLazy.get().getMinFraction();
|
float minFraction = mPanelViewControllerLazy.get().getMinFraction();
|
||||||
if (minFraction > 0f && minFraction < 1f) {
|
if (minFraction > 0f && minFraction < 1f) {
|
||||||
float realFraction = (mShadeExpandedFraction
|
float realFraction = (mShadeExpandedFraction
|
||||||
- minFraction) / (1f - minFraction);
|
- minFraction) / (1f - minFraction);
|
||||||
top *= MathUtils.saturate(realFraction / minFraction);
|
top *= MathUtils.saturate(realFraction / minFraction);
|
||||||
|
logClippingTopBound("after adjusted fraction", top);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return top;
|
return top;
|
||||||
|
|||||||
@@ -280,4 +280,40 @@ class ShadeLogger @Inject constructor(@ShadeLog private val buffer: LogBuffer) {
|
|||||||
{ "Split shade state changed: split shade ${if (bool1) "enabled" else "disabled"}" }
|
{ "Split shade state changed: split shade ${if (bool1) "enabled" else "disabled"}" }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun logNotificationsTopPadding(message: String, padding: Int) {
|
||||||
|
buffer.log(
|
||||||
|
TAG,
|
||||||
|
LogLevel.VERBOSE,
|
||||||
|
{
|
||||||
|
str1 = message
|
||||||
|
int1 = padding
|
||||||
|
},
|
||||||
|
{ "QSC NotificationsTopPadding $str1: $int1"}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun logClippingTopBound(message: String, top: Int) {
|
||||||
|
buffer.log(
|
||||||
|
TAG,
|
||||||
|
LogLevel.VERBOSE,
|
||||||
|
{
|
||||||
|
str1 = message
|
||||||
|
int1 = top
|
||||||
|
},
|
||||||
|
{ "QSC ClippingTopBound $str1: $int1" }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun logNotificationsClippingTopBound(top: Int, nsslTop: Int) {
|
||||||
|
buffer.log(
|
||||||
|
TAG,
|
||||||
|
LogLevel.VERBOSE,
|
||||||
|
{
|
||||||
|
int1 = top
|
||||||
|
int2 = nsslTop
|
||||||
|
},
|
||||||
|
{ "QSC NotificationsClippingTopBound set to $int1 - $int2" }
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user