Merge "Don't use SysUI ScrimController for bubbles" into sc-v2-dev

This commit is contained in:
Mady Mellor
2021-07-29 22:36:54 +00:00
committed by Android (Google) Code Review
8 changed files with 58 additions and 212 deletions

View File

@@ -56,7 +56,6 @@ import android.graphics.Rect;
import android.os.Binder; import android.os.Binder;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper;
import android.os.RemoteException; import android.os.RemoteException;
import android.os.ServiceManager; import android.os.ServiceManager;
import android.os.UserHandle; import android.os.UserHandle;
@@ -98,7 +97,6 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.function.BiConsumer;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.IntConsumer; import java.util.function.IntConsumer;
@@ -581,7 +579,7 @@ public class BubbleController {
/** /**
* BubbleStackView is lazily created by this method the first time a Bubble is added. This * BubbleStackView is lazily created by this method the first time a Bubble is added. This
* method initializes the stack view and adds it to the StatusBar just above the scrim. * method initializes the stack view and adds it to window manager.
*/ */
private void ensureStackViewCreated() { private void ensureStackViewCreated() {
if (mStackView == null) { if (mStackView == null) {
@@ -629,7 +627,6 @@ public class BubbleController {
try { try {
mAddedToWindowManager = true; mAddedToWindowManager = true;
mBubbleData.getOverflow().initialize(this); mBubbleData.getOverflow().initialize(this);
mStackView.addView(mBubbleScrim);
mWindowManager.addView(mStackView, mWmLayoutParams); mWindowManager.addView(mStackView, mWmLayoutParams);
// Position info is dependent on us being attached to a window // Position info is dependent on us being attached to a window
mBubblePositioner.update(); mBubblePositioner.update();
@@ -661,7 +658,6 @@ public class BubbleController {
mAddedToWindowManager = false; mAddedToWindowManager = false;
if (mStackView != null) { if (mStackView != null) {
mWindowManager.removeView(mStackView); mWindowManager.removeView(mStackView);
mStackView.removeView(mBubbleScrim);
mBubbleData.getOverflow().cleanUpExpandedState(); mBubbleData.getOverflow().cleanUpExpandedState();
} else { } else {
Log.w(TAG, "StackView added to WindowManager, but was null when removing!"); Log.w(TAG, "StackView added to WindowManager, but was null when removing!");
@@ -763,13 +759,6 @@ public class BubbleController {
} }
} }
private void setBubbleScrim(View view, BiConsumer<Executor, Looper> callback) {
mBubbleScrim = view;
callback.accept(mMainExecutor, mMainExecutor.executeBlockingForResult(() -> {
return Looper.myLooper();
}, Looper.class));
}
private void setSysuiProxy(Bubbles.SysuiProxy proxy) { private void setSysuiProxy(Bubbles.SysuiProxy proxy) {
mSysuiProxy = proxy; mSysuiProxy = proxy;
} }
@@ -1573,13 +1562,6 @@ public class BubbleController {
}); });
} }
@Override
public void setBubbleScrim(View view, BiConsumer<Executor, Looper> callback) {
mMainExecutor.execute(() -> {
BubbleController.this.setBubbleScrim(view, callback);
});
}
@Override @Override
public void setExpandListener(BubbleExpandListener listener) { public void setExpandListener(BubbleExpandListener listener) {
mMainExecutor.execute(() -> { mMainExecutor.execute(() -> {

View File

@@ -19,6 +19,8 @@ package com.android.wm.shell.bubbles;
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
import static com.android.wm.shell.animation.Interpolators.ALPHA_IN;
import static com.android.wm.shell.animation.Interpolators.ALPHA_OUT;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_STACK_VIEW; import static com.android.wm.shell.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_STACK_VIEW;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_BUBBLES; import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_BUBBLES;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME;
@@ -33,11 +35,11 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.Resources; import android.content.res.Resources;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.Outline; import android.graphics.Outline;
import android.graphics.PointF; import android.graphics.PointF;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.RectF; import android.graphics.RectF;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.provider.Settings; import android.provider.Settings;
import android.util.Log; import android.util.Log;
@@ -122,6 +124,8 @@ public class BubbleStackView extends FrameLayout
private static final int EXPANDED_VIEW_ALPHA_ANIMATION_DURATION = 150; private static final int EXPANDED_VIEW_ALPHA_ANIMATION_DURATION = 150;
private static final float SCRIM_ALPHA = 0.6f;
/** /**
* How long to wait to animate the stack temporarily invisible after a drag/flyout hide * How long to wait to animate the stack temporarily invisible after a drag/flyout hide
* animation ends, if we are in fact temporarily invisible. * animation ends, if we are in fact temporarily invisible.
@@ -195,7 +199,7 @@ public class BubbleStackView extends FrameLayout
private StackAnimationController mStackAnimationController; private StackAnimationController mStackAnimationController;
private ExpandedAnimationController mExpandedAnimationController; private ExpandedAnimationController mExpandedAnimationController;
private View mTaskbarScrim; private View mScrim;
private FrameLayout mExpandedViewContainer; private FrameLayout mExpandedViewContainer;
/** Matrix used to scale the expanded view container with a given pivot point. */ /** Matrix used to scale the expanded view container with a given pivot point. */
@@ -858,11 +862,12 @@ public class BubbleStackView extends FrameLayout
mBubbleData.setExpanded(true); mBubbleData.setExpanded(true);
}); });
mTaskbarScrim = new View(getContext()); mScrim = new View(getContext());
mTaskbarScrim.setBackgroundColor(Color.BLACK); mScrim.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
addView(mTaskbarScrim); mScrim.setBackgroundDrawable(new ColorDrawable(
mTaskbarScrim.setAlpha(0f); getResources().getColor(android.R.color.system_neutral1_1000)));
mTaskbarScrim.setVisibility(GONE); addView(mScrim);
mScrim.setAlpha(0f);
mOrientationChangedListener = mOrientationChangedListener =
(v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> { (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
@@ -1220,6 +1225,8 @@ public class BubbleStackView extends FrameLayout
updateOverflow(); updateOverflow();
updateUserEdu(); updateUserEdu();
updateExpandedViewTheme(); updateExpandedViewTheme();
mScrim.setBackgroundDrawable(new ColorDrawable(
getResources().getColor(android.R.color.system_neutral1_1000)));
} }
/** /**
@@ -1799,6 +1806,20 @@ public class BubbleStackView extends FrameLayout
mExpandedViewAlphaAnimator.start(); mExpandedViewAlphaAnimator.start();
} }
private void showScrim(boolean show) {
if (show) {
mScrim.animate()
.setInterpolator(ALPHA_IN)
.alpha(SCRIM_ALPHA)
.start();
} else {
mScrim.animate()
.alpha(0f)
.setInterpolator(ALPHA_OUT)
.start();
}
}
private void animateExpansion() { private void animateExpansion() {
cancelDelayedExpandCollapseSwitchAnimations(); cancelDelayedExpandCollapseSwitchAnimations();
final boolean showVertically = mPositioner.showBubblesVertically(); final boolean showVertically = mPositioner.showBubblesVertically();
@@ -1808,6 +1829,7 @@ public class BubbleStackView extends FrameLayout
} }
beforeExpandedViewAnimation(); beforeExpandedViewAnimation();
showScrim(true);
updateZOrder(); updateZOrder();
updateBadges(false /* setBadgeForCollapsedStack */); updateBadges(false /* setBadgeForCollapsedStack */);
mBubbleContainer.setActiveController(mExpandedAnimationController); mBubbleContainer.setActiveController(mExpandedAnimationController);
@@ -1819,16 +1841,6 @@ public class BubbleStackView extends FrameLayout
} }
} /* after */); } /* after */);
if (mPositioner.showingInTaskbar()
// Don't need the scrim when the bar is at the bottom
&& mPositioner.getTaskbarPosition() != BubblePositioner.TASKBAR_POSITION_BOTTOM) {
mTaskbarScrim.getLayoutParams().width = mPositioner.getTaskbarSize();
mTaskbarScrim.setTranslationX(mStackOnLeftOrWillBe
? 0f
: mPositioner.getAvailableRect().right - mPositioner.getTaskbarSize());
mTaskbarScrim.setVisibility(VISIBLE);
mTaskbarScrim.animate().alpha(1f).start();
}
final float translationY = mPositioner.getExpandedViewY(mExpandedBubble, final float translationY = mPositioner.getExpandedViewY(mExpandedBubble,
getBubbleIndex(mExpandedBubble)); getBubbleIndex(mExpandedBubble));
mExpandedViewContainer.setTranslationX(0f); mExpandedViewContainer.setTranslationX(0f);
@@ -1939,6 +1951,8 @@ public class BubbleStackView extends FrameLayout
mIsExpanded = false; mIsExpanded = false;
mIsExpansionAnimating = true; mIsExpansionAnimating = true;
showScrim(false);
mBubbleContainer.cancelAllAnimations(); mBubbleContainer.cancelAllAnimations();
// If we were in the middle of swapping, the animating-out surface would have been scaling // If we were in the middle of swapping, the animating-out surface would have been scaling
@@ -1956,10 +1970,6 @@ public class BubbleStackView extends FrameLayout
/* collapseTo */, /* collapseTo */,
() -> mBubbleContainer.setActiveController(mStackAnimationController)); () -> mBubbleContainer.setActiveController(mStackAnimationController));
if (mTaskbarScrim.getVisibility() == VISIBLE) {
mTaskbarScrim.animate().alpha(0f).start();
}
int index; int index;
if (mExpandedBubble != null && BubbleOverflow.KEY.equals(mExpandedBubble.getKey())) { if (mExpandedBubble != null && BubbleOverflow.KEY.equals(mExpandedBubble.getKey())) {
index = mBubbleData.getBubbles().size(); index = mBubbleData.getBubbles().size();
@@ -2027,10 +2037,6 @@ public class BubbleStackView extends FrameLayout
if (previouslySelected != null) { if (previouslySelected != null) {
previouslySelected.setTaskViewVisibility(false); previouslySelected.setTaskViewVisibility(false);
} }
if (mPositioner.showingInTaskbar()) {
mTaskbarScrim.setVisibility(GONE);
}
}) })
.start(); .start();
} }

View File

@@ -24,12 +24,10 @@ import static java.lang.annotation.RetentionPolicy.SOURCE;
import android.content.pm.UserInfo; import android.content.pm.UserInfo;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.Bundle; import android.os.Bundle;
import android.os.Looper;
import android.service.notification.NotificationListenerService.RankingMap; import android.service.notification.NotificationListenerService.RankingMap;
import android.util.ArraySet; import android.util.ArraySet;
import android.util.Pair; import android.util.Pair;
import android.util.SparseArray; import android.util.SparseArray;
import android.view.View;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@@ -43,7 +41,6 @@ import java.lang.annotation.Target;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.function.BiConsumer;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.IntConsumer; import java.util.function.IntConsumer;
@@ -160,14 +157,6 @@ public interface Bubbles {
/** Set the proxy to commnuicate with SysUi side components. */ /** Set the proxy to commnuicate with SysUi side components. */
void setSysuiProxy(SysuiProxy proxy); void setSysuiProxy(SysuiProxy proxy);
/**
* Set the scrim view for bubbles.
*
* @param callback The callback made with the executor and the executor's looper that the view
* will be running on.
**/
void setBubbleScrim(View view, BiConsumer<Executor, Looper> callback);
/** Set a listener to be notified of bubble expand events. */ /** Set a listener to be notified of bubble expand events. */
void setExpandListener(BubbleExpandListener listener); void setExpandListener(BubbleExpandListener listener);

View File

@@ -135,12 +135,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
*/ */
public static final float BUSY_SCRIM_ALPHA = 1f; public static final float BUSY_SCRIM_ALPHA = 1f;
/**
* The default scrim under the expanded bubble stack.
* This should not be lower than 0.54, otherwise we won't pass GAR.
*/
public static final float BUBBLE_SCRIM_ALPHA = 0.6f;
/** /**
* Scrim opacity that can have text on top. * Scrim opacity that can have text on top.
*/ */
@@ -156,8 +150,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
private ScrimView mScrimInFront; private ScrimView mScrimInFront;
private ScrimView mNotificationsScrim; private ScrimView mNotificationsScrim;
private ScrimView mScrimBehind; private ScrimView mScrimBehind;
@Nullable
private ScrimView mScrimForBubble;
private Runnable mScrimBehindChangeRunnable; private Runnable mScrimBehindChangeRunnable;
@@ -195,12 +187,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
private float mInFrontAlpha = NOT_INITIALIZED; private float mInFrontAlpha = NOT_INITIALIZED;
private float mBehindAlpha = NOT_INITIALIZED; private float mBehindAlpha = NOT_INITIALIZED;
private float mNotificationsAlpha = NOT_INITIALIZED; private float mNotificationsAlpha = NOT_INITIALIZED;
private float mBubbleAlpha = NOT_INITIALIZED;
private int mInFrontTint; private int mInFrontTint;
private int mBehindTint; private int mBehindTint;
private int mNotificationsTint; private int mNotificationsTint;
private int mBubbleTint;
private boolean mWallpaperVisibilityTimedOut; private boolean mWallpaperVisibilityTimedOut;
private int mScrimsVisibility; private int mScrimsVisibility;
@@ -229,7 +219,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
UnlockedScreenOffAnimationController unlockedScreenOffAnimationController) { UnlockedScreenOffAnimationController unlockedScreenOffAnimationController) {
mScrimStateListener = lightBarController::setScrimState; mScrimStateListener = lightBarController::setScrimState;
mDefaultScrimAlpha = BUSY_SCRIM_ALPHA; mDefaultScrimAlpha = BUSY_SCRIM_ALPHA;
ScrimState.BUBBLE_EXPANDED.setBubbleAlpha(BUBBLE_SCRIM_ALPHA);
mKeyguardStateController = keyguardStateController; mKeyguardStateController = keyguardStateController;
mDarkenWhileDragging = !mKeyguardStateController.canDismissLockScreen(); mDarkenWhileDragging = !mKeyguardStateController.canDismissLockScreen();
@@ -276,11 +265,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
* Attach the controller to the supplied views. * Attach the controller to the supplied views.
*/ */
public void attachViews(ScrimView behindScrim, ScrimView notificationsScrim, public void attachViews(ScrimView behindScrim, ScrimView notificationsScrim,
ScrimView scrimInFront, @Nullable ScrimView scrimForBubble) { ScrimView scrimInFront) {
mNotificationsScrim = notificationsScrim; mNotificationsScrim = notificationsScrim;
mScrimBehind = behindScrim; mScrimBehind = behindScrim;
mScrimInFront = scrimInFront; mScrimInFront = scrimInFront;
mScrimForBubble = scrimForBubble;
updateThemeColors(); updateThemeColors();
behindScrim.enableBottomEdgeConcave(mClipsQsScrim); behindScrim.enableBottomEdgeConcave(mClipsQsScrim);
@@ -293,8 +281,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
final ScrimState[] states = ScrimState.values(); final ScrimState[] states = ScrimState.values();
for (int i = 0; i < states.length; i++) { for (int i = 0; i < states.length; i++) {
states[i].init(mScrimInFront, mScrimBehind, mScrimForBubble, mDozeParameters, states[i].init(mScrimInFront, mScrimBehind, mDozeParameters, mDockManager);
mDockManager);
states[i].setScrimBehindAlphaKeyguard(mScrimBehindAlphaKeyguard); states[i].setScrimBehindAlphaKeyguard(mScrimBehindAlphaKeyguard);
states[i].setDefaultScrimAlpha(mDefaultScrimAlpha); states[i].setDefaultScrimAlpha(mDefaultScrimAlpha);
} }
@@ -302,9 +289,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
mScrimBehind.setDefaultFocusHighlightEnabled(false); mScrimBehind.setDefaultFocusHighlightEnabled(false);
mNotificationsScrim.setDefaultFocusHighlightEnabled(false); mNotificationsScrim.setDefaultFocusHighlightEnabled(false);
mScrimInFront.setDefaultFocusHighlightEnabled(false); mScrimInFront.setDefaultFocusHighlightEnabled(false);
if (mScrimForBubble != null) {
mScrimForBubble.setDefaultFocusHighlightEnabled(false);
}
updateScrims(); updateScrims();
mKeyguardUpdateMonitor.registerCallback(mKeyguardVisibilityCallback); mKeyguardUpdateMonitor.registerCallback(mKeyguardVisibilityCallback);
} }
@@ -627,11 +611,9 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
mInFrontTint = mState.getFrontTint(); mInFrontTint = mState.getFrontTint();
mBehindTint = mState.getBehindTint(); mBehindTint = mState.getBehindTint();
mNotificationsTint = mState.getNotifTint(); mNotificationsTint = mState.getNotifTint();
mBubbleTint = mState.getBubbleTint();
mInFrontAlpha = mState.getFrontAlpha(); mInFrontAlpha = mState.getFrontAlpha();
mBehindAlpha = mState.getBehindAlpha(); mBehindAlpha = mState.getBehindAlpha();
mBubbleAlpha = mState.getBubbleAlpha();
mNotificationsAlpha = mState.getNotifAlpha(); mNotificationsAlpha = mState.getNotifAlpha();
assertAlphasValid(); assertAlphasValid();
@@ -744,7 +726,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
setOrAdaptCurrentAnimation(mScrimBehind); setOrAdaptCurrentAnimation(mScrimBehind);
setOrAdaptCurrentAnimation(mNotificationsScrim); setOrAdaptCurrentAnimation(mNotificationsScrim);
setOrAdaptCurrentAnimation(mScrimInFront); setOrAdaptCurrentAnimation(mScrimInFront);
setOrAdaptCurrentAnimation(mScrimForBubble);
dispatchBackScrimState(mScrimBehind.getViewAlpha()); dispatchBackScrimState(mScrimBehind.getViewAlpha());
// Reset wallpaper timeout if it's already timeout like expanding panel while PULSING // Reset wallpaper timeout if it's already timeout like expanding panel while PULSING
@@ -852,11 +833,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
setScrimAlpha(mScrimBehind, mBehindAlpha); setScrimAlpha(mScrimBehind, mBehindAlpha);
setScrimAlpha(mNotificationsScrim, mNotificationsAlpha); setScrimAlpha(mNotificationsScrim, mNotificationsAlpha);
if (mScrimForBubble != null) {
boolean animateScrimForBubble = mScrimForBubble.getViewAlpha() != 0 && !mBlankScreen;
mScrimForBubble.setColors(mColors, animateScrimForBubble);
setScrimAlpha(mScrimForBubble, mBubbleAlpha);
}
// The animation could have all already finished, let's call onFinished just in case // The animation could have all already finished, let's call onFinished just in case
onFinished(mState); onFinished(mState);
dispatchScrimsVisible(); dispatchScrimsVisible();
@@ -909,8 +885,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
return "behind_scrim"; return "behind_scrim";
} else if (scrim == mNotificationsScrim) { } else if (scrim == mNotificationsScrim) {
return "notifications_scrim"; return "notifications_scrim";
} else if (scrim == mScrimForBubble) {
return "bubble_scrim";
} }
return "unknown_scrim"; return "unknown_scrim";
} }
@@ -983,8 +957,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
return mBehindAlpha; return mBehindAlpha;
} else if (scrim == mNotificationsScrim) { } else if (scrim == mNotificationsScrim) {
return mNotificationsAlpha; return mNotificationsAlpha;
} else if (scrim == mScrimForBubble) {
return mBubbleAlpha;
} else { } else {
throw new IllegalArgumentException("Unknown scrim view"); throw new IllegalArgumentException("Unknown scrim view");
} }
@@ -997,8 +969,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
return mBehindTint; return mBehindTint;
} else if (scrim == mNotificationsScrim) { } else if (scrim == mNotificationsScrim) {
return mNotificationsTint; return mNotificationsTint;
} else if (scrim == mScrimForBubble) {
return mBubbleTint;
} else { } else {
throw new IllegalArgumentException("Unknown scrim view"); throw new IllegalArgumentException("Unknown scrim view");
} }
@@ -1030,8 +1000,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
} }
if (isAnimating(mScrimBehind) if (isAnimating(mScrimBehind)
|| isAnimating(mNotificationsScrim) || isAnimating(mNotificationsScrim)
|| isAnimating(mScrimInFront) || isAnimating(mScrimInFront)) {
|| isAnimating(mScrimForBubble)) {
if (callback != null && callback != mCallback) { if (callback != null && callback != mCallback) {
// Since we only notify the callback that we're finished once everything has // Since we only notify the callback that we're finished once everything has
// finished, we need to make sure that any changing callbacks are also invoked // finished, we need to make sure that any changing callbacks are also invoked
@@ -1058,13 +1027,9 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
mInFrontTint = Color.TRANSPARENT; mInFrontTint = Color.TRANSPARENT;
mBehindTint = mState.getBehindTint(); mBehindTint = mState.getBehindTint();
mNotificationsTint = mState.getNotifTint(); mNotificationsTint = mState.getNotifTint();
mBubbleTint = Color.TRANSPARENT;
updateScrimColor(mScrimInFront, mInFrontAlpha, mInFrontTint); updateScrimColor(mScrimInFront, mInFrontAlpha, mInFrontTint);
updateScrimColor(mScrimBehind, mBehindAlpha, mBehindTint); updateScrimColor(mScrimBehind, mBehindAlpha, mBehindTint);
updateScrimColor(mNotificationsScrim, mNotificationsAlpha, mNotificationsTint); updateScrimColor(mNotificationsScrim, mNotificationsAlpha, mNotificationsTint);
if (mScrimForBubble != null) {
updateScrimColor(mScrimForBubble, mBubbleAlpha, mBubbleTint);
}
} }
} }
@@ -1232,14 +1197,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
pw.print(" tint=0x"); pw.print(" tint=0x");
pw.println(Integer.toHexString(mNotificationsScrim.getTint())); pw.println(Integer.toHexString(mNotificationsScrim.getTint()));
pw.print(" bubbleScrim:");
pw.print(" viewAlpha=");
pw.print(mScrimForBubble.getViewAlpha());
pw.print(" alpha=");
pw.print(mBubbleAlpha);
pw.print(" tint=0x");
pw.println(Integer.toHexString(mScrimForBubble.getTint()));
pw.print(" mTracking="); pw.print(" mTracking=");
pw.println(mTracking); pw.println(mTracking);
pw.print(" mDefaultScrimAlpha="); pw.print(" mDefaultScrimAlpha=");

View File

@@ -19,8 +19,6 @@ package com.android.systemui.statusbar.phone;
import android.graphics.Color; import android.graphics.Color;
import android.os.Trace; import android.os.Trace;
import androidx.annotation.Nullable;
import com.android.systemui.dock.DockManager; import com.android.systemui.dock.DockManager;
import com.android.systemui.scrim.ScrimView; import com.android.systemui.scrim.ScrimView;
import com.android.systemui.statusbar.notification.stack.StackStateAnimator; import com.android.systemui.statusbar.notification.stack.StackStateAnimator;
@@ -43,11 +41,9 @@ public enum ScrimState {
public void prepare(ScrimState previousState) { public void prepare(ScrimState previousState) {
mFrontTint = Color.BLACK; mFrontTint = Color.BLACK;
mBehindTint = Color.BLACK; mBehindTint = Color.BLACK;
mBubbleTint = previousState.mBubbleTint;
mFrontAlpha = 1f; mFrontAlpha = 1f;
mBehindAlpha = 1f; mBehindAlpha = 1f;
mBubbleAlpha = previousState.mBubbleAlpha;
mAnimationDuration = ScrimController.ANIMATION_DURATION_LONG; mAnimationDuration = ScrimController.ANIMATION_DURATION_LONG;
} }
@@ -81,12 +77,10 @@ public enum ScrimState {
mFrontTint = Color.BLACK; mFrontTint = Color.BLACK;
mBehindTint = Color.BLACK; mBehindTint = Color.BLACK;
mNotifTint = mClipQsScrim ? Color.BLACK : Color.TRANSPARENT; mNotifTint = mClipQsScrim ? Color.BLACK : Color.TRANSPARENT;
mBubbleTint = Color.TRANSPARENT;
mFrontAlpha = 0; mFrontAlpha = 0;
mBehindAlpha = mClipQsScrim ? 1 : mScrimBehindAlphaKeyguard; mBehindAlpha = mClipQsScrim ? 1 : mScrimBehindAlphaKeyguard;
mNotifAlpha = mClipQsScrim ? mScrimBehindAlphaKeyguard : 0; mNotifAlpha = mClipQsScrim ? mScrimBehindAlphaKeyguard : 0;
mBubbleAlpha = 0;
if (mClipQsScrim) { if (mClipQsScrim) {
updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK); updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK);
} }
@@ -118,7 +112,6 @@ public enum ScrimState {
mNotifAlpha = mClipQsScrim ? mDefaultScrimAlpha : 0; mNotifAlpha = mClipQsScrim ? mDefaultScrimAlpha : 0;
mNotifTint = Color.TRANSPARENT; mNotifTint = Color.TRANSPARENT;
mFrontAlpha = 0f; mFrontAlpha = 0f;
mBubbleAlpha = 0f;
} }
}, },
@@ -129,7 +122,6 @@ public enum ScrimState {
@Override @Override
public void prepare(ScrimState previousState) { public void prepare(ScrimState previousState) {
mBehindAlpha = 0; mBehindAlpha = 0;
mBubbleAlpha = 0f;
mFrontAlpha = mDefaultScrimAlpha; mFrontAlpha = mDefaultScrimAlpha;
} }
}, },
@@ -139,7 +131,6 @@ public enum ScrimState {
public void prepare(ScrimState previousState) { public void prepare(ScrimState previousState) {
mBehindAlpha = mClipQsScrim ? 1 : mDefaultScrimAlpha; mBehindAlpha = mClipQsScrim ? 1 : mDefaultScrimAlpha;
mNotifAlpha = 1f; mNotifAlpha = 1f;
mBubbleAlpha = 0f;
mFrontAlpha = 0f; mFrontAlpha = 0f;
mBehindTint = Color.BLACK; mBehindTint = Color.BLACK;
@@ -163,7 +154,6 @@ public enum ScrimState {
public void prepare(ScrimState previousState) { public void prepare(ScrimState previousState) {
mBehindAlpha = 0; mBehindAlpha = 0;
mFrontAlpha = 0; mFrontAlpha = 0;
mBubbleAlpha = 0;
} }
}, },
@@ -185,9 +175,6 @@ public enum ScrimState {
mBehindTint = Color.BLACK; mBehindTint = Color.BLACK;
mBehindAlpha = ScrimController.TRANSPARENT; mBehindAlpha = ScrimController.TRANSPARENT;
mBubbleTint = Color.TRANSPARENT;
mBubbleAlpha = ScrimController.TRANSPARENT;
mAnimationDuration = ScrimController.ANIMATION_DURATION_LONG; mAnimationDuration = ScrimController.ANIMATION_DURATION_LONG;
// DisplayPowerManager may blank the screen for us, or we might blank it for ourselves // DisplayPowerManager may blank the screen for us, or we might blank it for ourselves
// by animating the screen off via the LightRevelScrim. In either case we just need to // by animating the screen off via the LightRevelScrim. In either case we just need to
@@ -214,7 +201,6 @@ public enum ScrimState {
@Override @Override
public void prepare(ScrimState previousState) { public void prepare(ScrimState previousState) {
mFrontAlpha = mAodFrontScrimAlpha; mFrontAlpha = mAodFrontScrimAlpha;
mBubbleAlpha = 0f;
mBehindTint = Color.BLACK; mBehindTint = Color.BLACK;
mFrontTint = Color.BLACK; mFrontTint = Color.BLACK;
mBlankScreen = mDisplayRequiresBlanking; mBlankScreen = mDisplayRequiresBlanking;
@@ -238,7 +224,6 @@ public enum ScrimState {
mBehindAlpha = mClipQsScrim ? 1 : 0; mBehindAlpha = mClipQsScrim ? 1 : 0;
mNotifAlpha = 0; mNotifAlpha = 0;
mFrontAlpha = 0; mFrontAlpha = 0;
mBubbleAlpha = 0;
mAnimationDuration = mKeyguardFadingAway mAnimationDuration = mKeyguardFadingAway
? mKeyguardFadingAwayDuration ? mKeyguardFadingAwayDuration
@@ -248,21 +233,16 @@ public enum ScrimState {
mFrontTint = Color.TRANSPARENT; mFrontTint = Color.TRANSPARENT;
mBehindTint = Color.BLACK; mBehindTint = Color.BLACK;
mBubbleTint = Color.TRANSPARENT;
mBlankScreen = false; mBlankScreen = false;
if (previousState == ScrimState.AOD) { if (previousState == ScrimState.AOD) {
// Set all scrims black, before they fade transparent. // Set all scrims black, before they fade transparent.
updateScrimColor(mScrimInFront, 1f /* alpha */, Color.BLACK /* tint */); updateScrimColor(mScrimInFront, 1f /* alpha */, Color.BLACK /* tint */);
updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK /* tint */); updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK /* tint */);
if (mScrimForBubble != null) {
updateScrimColor(mScrimForBubble, 1f /* alpha */, Color.BLACK /* tint */);
}
// Scrims should still be black at the end of the transition. // Scrims should still be black at the end of the transition.
mFrontTint = Color.BLACK; mFrontTint = Color.BLACK;
mBehindTint = Color.BLACK; mBehindTint = Color.BLACK;
mBubbleTint = Color.BLACK;
mBlankScreen = true; mBlankScreen = true;
} }
@@ -280,7 +260,6 @@ public enum ScrimState {
public void prepare(ScrimState previousState) { public void prepare(ScrimState previousState) {
mFrontTint = Color.TRANSPARENT; mFrontTint = Color.TRANSPARENT;
mBehindTint = Color.TRANSPARENT; mBehindTint = Color.TRANSPARENT;
mBubbleTint = Color.BLACK;
mFrontAlpha = 0f; mFrontAlpha = 0f;
mBehindAlpha = mDefaultScrimAlpha; mBehindAlpha = mDefaultScrimAlpha;
@@ -294,21 +273,18 @@ public enum ScrimState {
long mAnimationDuration = ScrimController.ANIMATION_DURATION; long mAnimationDuration = ScrimController.ANIMATION_DURATION;
int mFrontTint = Color.TRANSPARENT; int mFrontTint = Color.TRANSPARENT;
int mBehindTint = Color.TRANSPARENT; int mBehindTint = Color.TRANSPARENT;
int mBubbleTint = Color.TRANSPARENT;
int mNotifTint = Color.TRANSPARENT; int mNotifTint = Color.TRANSPARENT;
boolean mAnimateChange = true; boolean mAnimateChange = true;
float mAodFrontScrimAlpha; float mAodFrontScrimAlpha;
float mFrontAlpha; float mFrontAlpha;
float mBehindAlpha; float mBehindAlpha;
float mBubbleAlpha;
float mNotifAlpha; float mNotifAlpha;
float mScrimBehindAlphaKeyguard; float mScrimBehindAlphaKeyguard;
float mDefaultScrimAlpha; float mDefaultScrimAlpha;
ScrimView mScrimInFront; ScrimView mScrimInFront;
ScrimView mScrimBehind; ScrimView mScrimBehind;
@Nullable ScrimView mScrimForBubble;
DozeParameters mDozeParameters; DozeParameters mDozeParameters;
DockManager mDockManager; DockManager mDockManager;
@@ -321,11 +297,10 @@ public enum ScrimState {
long mKeyguardFadingAwayDuration; long mKeyguardFadingAwayDuration;
boolean mClipQsScrim; boolean mClipQsScrim;
public void init(ScrimView scrimInFront, ScrimView scrimBehind, ScrimView scrimForBubble, public void init(ScrimView scrimInFront, ScrimView scrimBehind, DozeParameters dozeParameters,
DozeParameters dozeParameters, DockManager dockManager) { DockManager dockManager) {
mScrimInFront = scrimInFront; mScrimInFront = scrimInFront;
mScrimBehind = scrimBehind; mScrimBehind = scrimBehind;
mScrimForBubble = scrimForBubble;
mDozeParameters = dozeParameters; mDozeParameters = dozeParameters;
mDockManager = dockManager; mDockManager = dockManager;
@@ -352,10 +327,6 @@ public enum ScrimState {
return mNotifAlpha; return mNotifAlpha;
} }
public float getBubbleAlpha() {
return mBubbleAlpha;
}
public int getFrontTint() { public int getFrontTint() {
return mFrontTint; return mFrontTint;
} }
@@ -368,10 +339,6 @@ public enum ScrimState {
return mNotifTint; return mNotifTint;
} }
public int getBubbleTint() {
return mBubbleTint;
}
public long getAnimationDuration() { public long getAnimationDuration() {
return mAnimationDuration; return mAnimationDuration;
} }
@@ -409,10 +376,6 @@ public enum ScrimState {
mDefaultScrimAlpha = defaultScrimAlpha; mDefaultScrimAlpha = defaultScrimAlpha;
} }
public void setBubbleAlpha(float alpha) {
mBubbleAlpha = alpha;
}
public void setWallpaperSupportsAmbientMode(boolean wallpaperSupportsAmbientMode) { public void setWallpaperSupportsAmbientMode(boolean wallpaperSupportsAmbientMode) {
mWallpaperSupportsAmbientMode = wallpaperSupportsAmbientMode; mWallpaperSupportsAmbientMode = wallpaperSupportsAmbientMode;
} }

View File

@@ -1262,13 +1262,11 @@ public class StatusBar extends SystemUI implements
ScrimView notificationsScrim = mNotificationShadeWindowView ScrimView notificationsScrim = mNotificationShadeWindowView
.findViewById(R.id.scrim_notifications); .findViewById(R.id.scrim_notifications);
ScrimView scrimInFront = mNotificationShadeWindowView.findViewById(R.id.scrim_in_front); ScrimView scrimInFront = mNotificationShadeWindowView.findViewById(R.id.scrim_in_front);
ScrimView scrimForBubble = mBubblesManagerOptional.isPresent()
? mBubblesManagerOptional.get().getScrimForBubble() : null;
mScrimController.setScrimVisibleListener(scrimsVisible -> { mScrimController.setScrimVisibleListener(scrimsVisible -> {
mNotificationShadeWindowController.setScrimsVisibility(scrimsVisible); mNotificationShadeWindowController.setScrimsVisibility(scrimsVisible);
}); });
mScrimController.attachViews(scrimBehind, notificationsScrim, scrimInFront, scrimForBubble); mScrimController.attachViews(scrimBehind, notificationsScrim, scrimInFront);
mLightRevealScrim = mNotificationShadeWindowView.findViewById(R.id.light_reveal_scrim); mLightRevealScrim = mNotificationShadeWindowView.findViewById(R.id.light_reveal_scrim);
mLightRevealScrim.setRevealAmountListener( mLightRevealScrim.setRevealAmountListener(

View File

@@ -50,7 +50,6 @@ import android.util.ArraySet;
import android.util.Log; import android.util.Log;
import android.util.Pair; import android.util.Pair;
import android.util.SparseArray; import android.util.SparseArray;
import android.view.View;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@@ -63,7 +62,6 @@ import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dump.DumpManager; import com.android.systemui.dump.DumpManager;
import com.android.systemui.model.SysUiState; import com.android.systemui.model.SysUiState;
import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.scrim.ScrimView;
import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.statusbar.FeatureFlags; import com.android.systemui.statusbar.FeatureFlags;
import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationLockscreenUserManager;
@@ -80,7 +78,6 @@ import com.android.systemui.statusbar.notification.collection.notifcollection.Di
import com.android.systemui.statusbar.notification.collection.notifcollection.NotifCollectionListener; import com.android.systemui.statusbar.notification.collection.notifcollection.NotifCollectionListener;
import com.android.systemui.statusbar.notification.interruption.NotificationInterruptStateProvider; import com.android.systemui.statusbar.notification.interruption.NotificationInterruptStateProvider;
import com.android.systemui.statusbar.notification.logging.NotificationLogger; import com.android.systemui.statusbar.notification.logging.NotificationLogger;
import com.android.systemui.statusbar.phone.ScrimController;
import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.statusbar.policy.ZenModeController;
@@ -118,7 +115,6 @@ public class BubblesManager implements Dumpable {
private final NotifPipeline mNotifPipeline; private final NotifPipeline mNotifPipeline;
private final Executor mSysuiMainExecutor; private final Executor mSysuiMainExecutor;
private ScrimView mBubbleScrim;
private final Bubbles.SysuiProxy mSysuiProxy; private final Bubbles.SysuiProxy mSysuiProxy;
// TODO (b/145659174): allow for multiple callbacks to support the "shadow" new notif pipeline // TODO (b/145659174): allow for multiple callbacks to support the "shadow" new notif pipeline
private final List<NotifCallback> mCallbacks = new ArrayList<>(); private final List<NotifCallback> mCallbacks = new ArrayList<>();
@@ -193,12 +189,6 @@ public class BubblesManager implements Dumpable {
ServiceManager.getService(Context.STATUS_BAR_SERVICE)) ServiceManager.getService(Context.STATUS_BAR_SERVICE))
: statusBarService; : statusBarService;
mBubbleScrim = new ScrimView(mContext);
mBubbleScrim.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
mBubbles.setBubbleScrim(mBubbleScrim, (executor, looper) -> {
mBubbleScrim.setExecutor(executor, looper);
});
if (featureFlags.isNewNotifPipelineRenderingEnabled()) { if (featureFlags.isNewNotifPipelineRenderingEnabled()) {
setupNotifPipeline(); setupNotifPipeline();
} else { } else {
@@ -602,15 +592,6 @@ public class BubblesManager implements Dumpable {
NotificationLogger.getNotificationLocation(entry))); NotificationLogger.getNotificationLocation(entry)));
} }
/**
* Returns the scrim drawn behind the bubble stack. This is managed by {@link ScrimController}
* since we want the scrim's appearance and behavior to be identical to that of the notification
* shade scrim.
*/
public ScrimView getScrimForBubble() {
return mBubbleScrim;
}
/** /**
* We intercept notification entries (including group summaries) dismissed by the user when * We intercept notification entries (including group summaries) dismissed by the user when
* there is an active bubble associated with it. We do this so that developers can still * there is an active bubble associated with it. We do this so that developers can still

View File

@@ -83,7 +83,6 @@ public class ScrimControllerTest extends SysuiTestCase {
private ScrimView mScrimBehind; private ScrimView mScrimBehind;
private ScrimView mNotificationsScrim; private ScrimView mNotificationsScrim;
private ScrimView mScrimInFront; private ScrimView mScrimInFront;
private ScrimView mScrimForBubble;
private ScrimState mScrimState; private ScrimState mScrimState;
private float mScrimBehindAlpha; private float mScrimBehindAlpha;
private GradientColors mScrimInFrontColor; private GradientColors mScrimInFrontColor;
@@ -167,7 +166,6 @@ public class ScrimControllerTest extends SysuiTestCase {
endAnimation(mNotificationsScrim); endAnimation(mNotificationsScrim);
endAnimation(mScrimBehind); endAnimation(mScrimBehind);
endAnimation(mScrimInFront); endAnimation(mScrimInFront);
endAnimation(mScrimForBubble);
assertEquals("Animators did not finish", assertEquals("Animators did not finish",
mAnimatorListener.getNumStarts(), mAnimatorListener.getNumEnds()); mAnimatorListener.getNumStarts(), mAnimatorListener.getNumEnds());
@@ -190,7 +188,6 @@ public class ScrimControllerTest extends SysuiTestCase {
mScrimBehind = spy(new ScrimView(getContext())); mScrimBehind = spy(new ScrimView(getContext()));
mScrimInFront = new ScrimView(getContext()); mScrimInFront = new ScrimView(getContext());
mScrimForBubble = new ScrimView(getContext());
mNotificationsScrim = new ScrimView(getContext()); mNotificationsScrim = new ScrimView(getContext());
mAlwaysOnEnabled = true; mAlwaysOnEnabled = true;
mLooper = TestableLooper.get(this); mLooper = TestableLooper.get(this);
@@ -226,8 +223,7 @@ public class ScrimControllerTest extends SysuiTestCase {
mDockManager, mConfigurationController, new FakeExecutor(new FakeSystemClock()), mDockManager, mConfigurationController, new FakeExecutor(new FakeSystemClock()),
mUnlockedScreenOffAnimationController); mUnlockedScreenOffAnimationController);
mScrimController.setScrimVisibleListener(visible -> mScrimVisibility = visible); mScrimController.setScrimVisibleListener(visible -> mScrimVisibility = visible);
mScrimController.attachViews(mScrimBehind, mNotificationsScrim, mScrimInFront, mScrimController.attachViews(mScrimBehind, mNotificationsScrim, mScrimInFront);
mScrimForBubble);
mScrimController.setAnimatorListener(mAnimatorListener); mScrimController.setAnimatorListener(mAnimatorListener);
mScrimController.setHasBackdrop(false); mScrimController.setHasBackdrop(false);
@@ -257,8 +253,8 @@ public class ScrimControllerTest extends SysuiTestCase {
assertScrimTinted(Map.of( assertScrimTinted(Map.of(
mScrimInFront, true, mScrimInFront, true,
mScrimBehind, true, mScrimBehind, true
mScrimForBubble, false)); ));
} }
@Test @Test
@@ -274,8 +270,7 @@ public class ScrimControllerTest extends SysuiTestCase {
assertScrimTinted(Map.of( assertScrimTinted(Map.of(
mScrimInFront, false, mScrimInFront, false,
mScrimBehind, true, mScrimBehind, true
mScrimForBubble, false
)); ));
} }
@@ -293,8 +288,7 @@ public class ScrimControllerTest extends SysuiTestCase {
assertScrimTinted(Map.of( assertScrimTinted(Map.of(
mScrimInFront, false, mScrimInFront, false,
mScrimBehind, true, mScrimBehind, true
mScrimForBubble, false
)); ));
} }
@@ -309,8 +303,7 @@ public class ScrimControllerTest extends SysuiTestCase {
assertScrimTinted(Map.of( assertScrimTinted(Map.of(
mScrimInFront, true, mScrimInFront, true,
mScrimBehind, true, mScrimBehind, true
mScrimForBubble, false
)); ));
assertEquals(1f, mScrimController.getState().getMaxLightRevealScrimAlpha(), 0f); assertEquals(1f, mScrimController.getState().getMaxLightRevealScrimAlpha(), 0f);
@@ -329,8 +322,7 @@ public class ScrimControllerTest extends SysuiTestCase {
assertScrimTinted(Map.of( assertScrimTinted(Map.of(
mScrimInFront, true, mScrimInFront, true,
mScrimBehind, true, mScrimBehind, true
mScrimForBubble, false
)); ));
} }
@@ -369,8 +361,7 @@ public class ScrimControllerTest extends SysuiTestCase {
assertScrimTinted(Map.of( assertScrimTinted(Map.of(
mScrimInFront, true, mScrimInFront, true,
mScrimBehind, true, mScrimBehind, true
mScrimForBubble, false
)); ));
} }
@@ -389,8 +380,7 @@ public class ScrimControllerTest extends SysuiTestCase {
assertScrimTinted(Map.of( assertScrimTinted(Map.of(
mScrimInFront, true, mScrimInFront, true,
mScrimBehind, true, mScrimBehind, true
mScrimForBubble, false
)); ));
} }
@@ -510,8 +500,7 @@ public class ScrimControllerTest extends SysuiTestCase {
assertScrimTinted(Map.of( assertScrimTinted(Map.of(
mScrimInFront, true, mScrimInFront, true,
mScrimBehind, true, mScrimBehind, true
mScrimForBubble, false
)); ));
// ... and when ambient goes dark, front scrim should be semi-transparent // ... and when ambient goes dark, front scrim should be semi-transparent
@@ -549,8 +538,7 @@ public class ScrimControllerTest extends SysuiTestCase {
assertScrimTinted(Map.of( assertScrimTinted(Map.of(
mScrimInFront, false, mScrimInFront, false,
mScrimBehind, false, mScrimBehind, false,
mNotificationsScrim, false, mNotificationsScrim, false
mScrimForBubble, false
)); ));
} }
@@ -570,8 +558,7 @@ public class ScrimControllerTest extends SysuiTestCase {
assertScrimTinted(Map.of( assertScrimTinted(Map.of(
mScrimInFront, false, mScrimInFront, false,
mScrimBehind, true, mScrimBehind, true,
mNotificationsScrim, false, mNotificationsScrim, false
mScrimForBubble, false
)); ));
} }
@@ -627,8 +614,7 @@ public class ScrimControllerTest extends SysuiTestCase {
mScrimBehind, TRANSPARENT)); mScrimBehind, TRANSPARENT));
assertScrimTinted(Map.of( assertScrimTinted(Map.of(
mScrimInFront, false, mScrimInFront, false,
mScrimBehind, false, mScrimBehind, false
mScrimForBubble, false
)); ));
} }
@@ -645,8 +631,7 @@ public class ScrimControllerTest extends SysuiTestCase {
assertScrimTinted(Map.of( assertScrimTinted(Map.of(
mNotificationsScrim, false, mNotificationsScrim, false,
mScrimInFront, false, mScrimInFront, false,
mScrimBehind, true, mScrimBehind, true
mScrimForBubble, false
)); ));
// Back scrim should be visible after start dragging // Back scrim should be visible after start dragging
@@ -664,8 +649,7 @@ public class ScrimControllerTest extends SysuiTestCase {
assertScrimTinted(Map.of( assertScrimTinted(Map.of(
mScrimInFront, false, mScrimInFront, false,
mScrimBehind, false, mScrimBehind, false
mScrimForBubble, true
)); ));
// Front scrim should be transparent // Front scrim should be transparent
@@ -674,9 +658,6 @@ public class ScrimControllerTest extends SysuiTestCase {
// Back scrim should be visible // Back scrim should be visible
assertEquals(ScrimController.BUSY_SCRIM_ALPHA, assertEquals(ScrimController.BUSY_SCRIM_ALPHA,
mScrimBehind.getViewAlpha(), 0.0f); mScrimBehind.getViewAlpha(), 0.0f);
// Bubble scrim should be visible
assertEquals(ScrimController.BUBBLE_SCRIM_ALPHA,
mScrimForBubble.getViewAlpha(), 0.0f);
} }
@Test @Test
@@ -787,8 +768,7 @@ public class ScrimControllerTest extends SysuiTestCase {
// Immediately tinted black after the transition starts // Immediately tinted black after the transition starts
assertScrimTinted(Map.of( assertScrimTinted(Map.of(
mScrimInFront, true, mScrimInFront, true,
mScrimBehind, true, mScrimBehind, true
mScrimForBubble, true
)); ));
finishAnimationsImmediately(); finishAnimationsImmediately();
@@ -796,14 +776,12 @@ public class ScrimControllerTest extends SysuiTestCase {
// All scrims should be transparent at the end of fade transition. // All scrims should be transparent at the end of fade transition.
assertScrimAlpha(Map.of( assertScrimAlpha(Map.of(
mScrimInFront, TRANSPARENT, mScrimInFront, TRANSPARENT,
mScrimBehind, TRANSPARENT, mScrimBehind, TRANSPARENT));
mScrimForBubble, TRANSPARENT));
// Make sure at the very end of the animation, we're reset to transparent // Make sure at the very end of the animation, we're reset to transparent
assertScrimTinted(Map.of( assertScrimTinted(Map.of(
mScrimInFront, false, mScrimInFront, false,
mScrimBehind, true, mScrimBehind, true
mScrimForBubble, false
)); ));
} }
@@ -821,8 +799,7 @@ public class ScrimControllerTest extends SysuiTestCase {
+ mScrimInFront.getViewAlpha(), mScrimInFront.getViewAlpha() > 0); + mScrimInFront.getViewAlpha(), mScrimInFront.getViewAlpha() > 0);
assertScrimTinted(Map.of( assertScrimTinted(Map.of(
mScrimInFront, true, mScrimInFront, true,
mScrimBehind, true, mScrimBehind, true
mScrimForBubble, true
)); ));
Assert.assertSame("Scrim should be visible during transition.", Assert.assertSame("Scrim should be visible during transition.",
mScrimVisibility, OPAQUE); mScrimVisibility, OPAQUE);
@@ -1075,8 +1052,6 @@ public class ScrimControllerTest extends SysuiTestCase {
mScrimInFront.getDefaultFocusHighlightEnabled()); mScrimInFront.getDefaultFocusHighlightEnabled());
Assert.assertFalse("Scrim shouldn't have focus highlight", Assert.assertFalse("Scrim shouldn't have focus highlight",
mScrimBehind.getDefaultFocusHighlightEnabled()); mScrimBehind.getDefaultFocusHighlightEnabled());
Assert.assertFalse("Scrim shouldn't have focus highlight",
mScrimForBubble.getDefaultFocusHighlightEnabled());
} }
@Test @Test
@@ -1239,21 +1214,16 @@ public class ScrimControllerTest extends SysuiTestCase {
return "behind"; return "behind";
} else if (scrim == mNotificationsScrim) { } else if (scrim == mNotificationsScrim) {
return "notifications"; return "notifications";
} else if (scrim == mScrimForBubble) {
return "bubble";
} }
return "unknown_scrim"; return "unknown_scrim";
} }
/** /**
* If {@link #mScrimForBubble} or {@link #mNotificationsScrim} is not passed in the map * If {@link #mNotificationsScrim} is not passed in the map
* we assume it must be transparent * we assume it must be transparent
*/ */
private void assertScrimAlpha(Map<ScrimView, Integer> scrimToAlpha) { private void assertScrimAlpha(Map<ScrimView, Integer> scrimToAlpha) {
// Check single scrim visibility. // Check single scrim visibility.
if (!scrimToAlpha.containsKey(mScrimForBubble)) {
assertScrimAlpha(mScrimForBubble, TRANSPARENT);
}
if (!scrimToAlpha.containsKey(mNotificationsScrim)) { if (!scrimToAlpha.containsKey(mNotificationsScrim)) {
assertScrimAlpha(mNotificationsScrim, TRANSPARENT); assertScrimAlpha(mNotificationsScrim, TRANSPARENT);
} }