Merge changes I30a2fa4f,I1abd1561 into rvc-dev am: 5bbeb33ec9

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

Change-Id: I71ea683eb324ee070d6a3025df27a58f23dce28c
This commit is contained in:
TreeHugger Robot
2020-06-23 07:02:01 +00:00
committed by Automerger Merge Worker
4 changed files with 61 additions and 10 deletions

View File

@@ -15,6 +15,7 @@ import com.android.systemui.plugins.FalsingManager
import com.android.systemui.qs.PageIndicator import com.android.systemui.qs.PageIndicator
import com.android.systemui.statusbar.notification.VisualStabilityManager import com.android.systemui.statusbar.notification.VisualStabilityManager
import com.android.systemui.statusbar.policy.ConfigurationController import com.android.systemui.statusbar.policy.ConfigurationController
import com.android.systemui.util.Utils
import com.android.systemui.util.animation.UniqueObjectHostView import com.android.systemui.util.animation.UniqueObjectHostView
import com.android.systemui.util.animation.requiresRemeasuring import com.android.systemui.util.animation.requiresRemeasuring
import com.android.systemui.util.concurrency.DelayableExecutor import com.android.systemui.util.concurrency.DelayableExecutor
@@ -150,8 +151,15 @@ class MediaCarouselController @Inject constructor(
mediaManager.addListener(object : MediaDataManager.Listener { mediaManager.addListener(object : MediaDataManager.Listener {
override fun onMediaDataLoaded(key: String, oldKey: String?, data: MediaData) { override fun onMediaDataLoaded(key: String, oldKey: String?, data: MediaData) {
oldKey?.let { mediaData.remove(it) } oldKey?.let { mediaData.remove(it) }
mediaData.put(key, data) if (!data.active && !Utils.useMediaResumption(context)) {
addOrUpdatePlayer(key, oldKey, data) // This view is inactive, let's remove this! This happens e.g when dismissing /
// timing out a view. We still have the data around because resumption could
// be on, but we should save the resources and release this.
onMediaDataRemoved(key)
} else {
mediaData.put(key, data)
addOrUpdatePlayer(key, oldKey, data)
}
} }
override fun onMediaDataRemoved(key: String) { override fun onMediaDataRemoved(key: String) {

View File

@@ -139,6 +139,18 @@ class MediaHierarchyManager @Inject constructor(
} }
} }
/**
* Is the shade currently collapsing from the expanded qs? If we're on the lockscreen and in qs,
* we wouldn't want to transition in that case.
*/
var collapsingShadeFromQS: Boolean = false
set(value) {
if (field != value) {
field = value
updateDesiredLocation(forceNoAnimation = true)
}
}
/** /**
* Are location changes currently blocked? * Are location changes currently blocked?
*/ */
@@ -160,6 +172,19 @@ class MediaHierarchyManager @Inject constructor(
} }
} }
/**
* Are we currently fullyAwake
*/
private var fullyAwake: Boolean = false
set(value) {
if (field != value) {
field = value
if (value) {
updateDesiredLocation(forceNoAnimation = true)
}
}
}
/** /**
* Is the doze animation currently Running * Is the doze animation currently Running
*/ */
@@ -206,10 +231,12 @@ class MediaHierarchyManager @Inject constructor(
override fun onStartedGoingToSleep() { override fun onStartedGoingToSleep() {
goingToSleep = true goingToSleep = true
fullyAwake = false
} }
override fun onFinishedWakingUp() { override fun onFinishedWakingUp() {
goingToSleep = false goingToSleep = false
fullyAwake = true
} }
override fun onStartedWakingUp() { override fun onStartedWakingUp() {
@@ -531,6 +558,18 @@ class MediaHierarchyManager @Inject constructor(
!statusBarStateController.isDozing) { !statusBarStateController.isDozing) {
return LOCATION_QS return LOCATION_QS
} }
if (location == LOCATION_LOCKSCREEN && desiredLocation == LOCATION_QS &&
collapsingShadeFromQS) {
// When collapsing on the lockscreen, we want to remain in QS
return LOCATION_QS
}
if (location != LOCATION_LOCKSCREEN && desiredLocation == LOCATION_LOCKSCREEN
&& !fullyAwake) {
// When unlocking from dozing / while waking up, the media shouldn't be transitioning
// in an animated way. Let's keep it in the lockscreen until we're fully awake and
// reattach it without an animation
return LOCATION_LOCKSCREEN
}
return location return location
} }

View File

@@ -443,6 +443,7 @@ public class NotificationPanelViewController extends PanelViewController {
*/ */
private boolean mDelayShowingKeyguardStatusBar; private boolean mDelayShowingKeyguardStatusBar;
private boolean mAnimatingQS;
private int mOldLayoutDirection; private int mOldLayoutDirection;
private View.AccessibilityDelegate mAccessibilityDelegate = new View.AccessibilityDelegate() { private View.AccessibilityDelegate mAccessibilityDelegate = new View.AccessibilityDelegate() {
@@ -1860,6 +1861,7 @@ public class NotificationPanelViewController extends PanelViewController {
@Override @Override
public void onAnimationEnd(Animator animation) { public void onAnimationEnd(Animator animation) {
mAnimatingQS = false;
notifyExpandingFinished(); notifyExpandingFinished();
mNotificationStackScroller.resetCheckSnoozeLeavebehind(); mNotificationStackScroller.resetCheckSnoozeLeavebehind();
mQsExpansionAnimator = null; mQsExpansionAnimator = null;
@@ -1868,6 +1870,9 @@ public class NotificationPanelViewController extends PanelViewController {
} }
} }
}); });
// Let's note that we're animating QS. Moving the animator here will cancel it immediately,
// so we need a separate flag.
mAnimatingQS = true;
animator.start(); animator.start();
mQsExpansionAnimator = animator; mQsExpansionAnimator = animator;
mQsAnimatorExpand = expanding; mQsAnimatorExpand = expanding;
@@ -2220,6 +2225,9 @@ public class NotificationPanelViewController extends PanelViewController {
mNotificationStackScroller.onExpansionStarted(); mNotificationStackScroller.onExpansionStarted();
mIsExpanding = true; mIsExpanding = true;
mQsExpandedWhenExpandingStarted = mQsFullyExpanded; mQsExpandedWhenExpandingStarted = mQsFullyExpanded;
mMediaHierarchyManager.setCollapsingShadeFromQS(mQsExpandedWhenExpandingStarted &&
/* We also start expanding when flinging closed Qs. Let's exclude that */
!mAnimatingQS);
if (mQsExpanded) { if (mQsExpanded) {
onQsExpansionStarted(); onQsExpansionStarted();
} }
@@ -2236,6 +2244,7 @@ public class NotificationPanelViewController extends PanelViewController {
mHeadsUpManager.onExpandingFinished(); mHeadsUpManager.onExpandingFinished();
mConversationNotificationManager.onNotificationPanelExpandStateChanged(isFullyCollapsed()); mConversationNotificationManager.onNotificationPanelExpandStateChanged(isFullyCollapsed());
mIsExpanding = false; mIsExpanding = false;
mMediaHierarchyManager.setCollapsingShadeFromQS(false);
if (isFullyCollapsed()) { if (isFullyCollapsed()) {
DejankUtils.postAfterTraversal(new Runnable() { DejankUtils.postAfterTraversal(new Runnable() {
@Override @Override

View File

@@ -150,15 +150,10 @@ class TransitionLayout @JvmOverloads constructor(
} }
override fun dispatchDraw(canvas: Canvas?) { override fun dispatchDraw(canvas: Canvas?) {
val clip = !boundsRect.isEmpty canvas?.save()
if (clip) { canvas?.clipRect(boundsRect)
canvas?.save()
canvas?.clipRect(boundsRect)
}
super.dispatchDraw(canvas) super.dispatchDraw(canvas)
if (clip) { canvas?.restore()
canvas?.restore()
}
} }
private fun updateBounds() { private fun updateBounds() {