Hook up luma sampling state change from CommandQueue

Currently when swiping up from some apps (maps), the stashed task bar color changes. Instead, sampling should be disabled during the transition (with a signal from the frameworks).

Bug: 230395757
Test: Swipe up from maps. Make sure the bar color doesn't change during transition
 to overview
Change-Id: Ifc30f4067a0e4d134b422d152f5b5caee0a77a33
This commit is contained in:
Tracy Zhou
2024-01-09 15:00:36 -08:00
parent 225bf58643
commit cf5407dfc6
5 changed files with 47 additions and 2 deletions
@@ -15,6 +15,8 @@
*/
package com.android.launcher3.taskbar;
import static android.view.Display.DEFAULT_DISPLAY;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NAV_BAR_HIDDEN;
import android.animation.Animator;
@@ -83,6 +85,7 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
// States that affect whether region sampling is enabled or not
private boolean mIsStashed;
private boolean mIsLumaSamplingEnabled;
private boolean mTaskbarHidden;
private float mTranslationYForSwipe;
@@ -234,8 +237,21 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
/** Called when taskbar is stashed or unstashed. */
public void onIsStashedChanged() {
mIsStashed = isStashedHandleVisible();
updateSamplingState();
}
public void onNavigationBarLumaSamplingEnabled(int displayId, boolean enable) {
if (DEFAULT_DISPLAY != displayId) {
return;
}
mIsLumaSamplingEnabled = enable;
updateSamplingState();
}
private void updateSamplingState() {
updateRegionSamplingWindowVisibility();
if (mIsStashed) {
if (shouldSample()) {
mStashedHandleView.updateSampledRegion(mStashedHandleBounds);
mRegionSamplingHelper.start(mStashedHandleView.getSampledRegion());
} else {
@@ -243,6 +259,10 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
}
}
private boolean shouldSample() {
return mIsStashed && mIsLumaSamplingEnabled;
}
protected void updateStashedHandleHintScale() {
mStashedHandleView.setScaleX(mTaskbarStashedHandleHintScale.value);
mStashedHandleView.setScaleY(mTaskbarStashedHandleHintScale.value);
@@ -282,7 +302,7 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
}
private void updateRegionSamplingWindowVisibility() {
mRegionSamplingHelper.setWindowVisible(mIsStashed && !mTaskbarHidden);
mRegionSamplingHelper.setWindowVisible(shouldSample() && !mTaskbarHidden);
}
public boolean isStashedHandleVisible() {