Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +1 −19 Original line number Diff line number Diff line Loading @@ -56,7 +56,6 @@ import android.graphics.Rect; import android.os.Binder; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserHandle; Loading Loading @@ -98,7 +97,6 @@ import java.util.HashSet; import java.util.List; import java.util.Objects; import java.util.concurrent.Executor; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.IntConsumer; Loading Loading @@ -581,7 +579,7 @@ public class BubbleController { /** * 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() { if (mStackView == null) { Loading Loading @@ -629,7 +627,6 @@ public class BubbleController { try { mAddedToWindowManager = true; mBubbleData.getOverflow().initialize(this); mStackView.addView(mBubbleScrim); mWindowManager.addView(mStackView, mWmLayoutParams); // Position info is dependent on us being attached to a window mBubblePositioner.update(); Loading Loading @@ -661,7 +658,6 @@ public class BubbleController { mAddedToWindowManager = false; if (mStackView != null) { mWindowManager.removeView(mStackView); mStackView.removeView(mBubbleScrim); mBubbleData.getOverflow().cleanUpExpandedState(); } else { Log.w(TAG, "StackView added to WindowManager, but was null when removing!"); Loading Loading @@ -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) { mSysuiProxy = proxy; } Loading Loading @@ -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 public void setExpandListener(BubbleExpandListener listener) { mMainExecutor.execute(() -> { Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java +31 −25 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package com.android.wm.shell.bubbles; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; 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.TAG_BUBBLES; import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; Loading @@ -33,11 +35,11 @@ import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Color; import android.graphics.Outline; import android.graphics.PointF; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.provider.Settings; import android.util.Log; Loading Loading @@ -122,6 +124,8 @@ public class BubbleStackView extends FrameLayout 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 * animation ends, if we are in fact temporarily invisible. Loading Loading @@ -195,7 +199,7 @@ public class BubbleStackView extends FrameLayout private StackAnimationController mStackAnimationController; private ExpandedAnimationController mExpandedAnimationController; private View mTaskbarScrim; private View mScrim; private FrameLayout mExpandedViewContainer; /** Matrix used to scale the expanded view container with a given pivot point. */ Loading Loading @@ -858,11 +862,12 @@ public class BubbleStackView extends FrameLayout mBubbleData.setExpanded(true); }); mTaskbarScrim = new View(getContext()); mTaskbarScrim.setBackgroundColor(Color.BLACK); addView(mTaskbarScrim); mTaskbarScrim.setAlpha(0f); mTaskbarScrim.setVisibility(GONE); mScrim = new View(getContext()); mScrim.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); mScrim.setBackgroundDrawable(new ColorDrawable( getResources().getColor(android.R.color.system_neutral1_1000))); addView(mScrim); mScrim.setAlpha(0f); mOrientationChangedListener = (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> { Loading Loading @@ -1220,6 +1225,8 @@ public class BubbleStackView extends FrameLayout updateOverflow(); updateUserEdu(); updateExpandedViewTheme(); mScrim.setBackgroundDrawable(new ColorDrawable( getResources().getColor(android.R.color.system_neutral1_1000))); } /** Loading Loading @@ -1799,6 +1806,20 @@ public class BubbleStackView extends FrameLayout 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() { cancelDelayedExpandCollapseSwitchAnimations(); final boolean showVertically = mPositioner.showBubblesVertically(); Loading @@ -1808,6 +1829,7 @@ public class BubbleStackView extends FrameLayout } beforeExpandedViewAnimation(); showScrim(true); updateZOrder(); updateBadges(false /* setBadgeForCollapsedStack */); mBubbleContainer.setActiveController(mExpandedAnimationController); Loading @@ -1819,16 +1841,6 @@ public class BubbleStackView extends FrameLayout } } /* 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, getBubbleIndex(mExpandedBubble)); mExpandedViewContainer.setTranslationX(0f); Loading Loading @@ -1939,6 +1951,8 @@ public class BubbleStackView extends FrameLayout mIsExpanded = false; mIsExpansionAnimating = true; showScrim(false); mBubbleContainer.cancelAllAnimations(); // If we were in the middle of swapping, the animating-out surface would have been scaling Loading @@ -1956,10 +1970,6 @@ public class BubbleStackView extends FrameLayout /* collapseTo */, () -> mBubbleContainer.setActiveController(mStackAnimationController)); if (mTaskbarScrim.getVisibility() == VISIBLE) { mTaskbarScrim.animate().alpha(0f).start(); } int index; if (mExpandedBubble != null && BubbleOverflow.KEY.equals(mExpandedBubble.getKey())) { index = mBubbleData.getBubbles().size(); Loading Loading @@ -2027,10 +2037,6 @@ public class BubbleStackView extends FrameLayout if (previouslySelected != null) { previouslySelected.setTaskViewVisibility(false); } if (mPositioner.showingInTaskbar()) { mTaskbarScrim.setVisibility(GONE); } }) .start(); } Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubbles.java +0 −11 Original line number Diff line number Diff line Loading @@ -24,12 +24,10 @@ import static java.lang.annotation.RetentionPolicy.SOURCE; import android.content.pm.UserInfo; import android.content.res.Configuration; import android.os.Bundle; import android.os.Looper; import android.service.notification.NotificationListenerService.RankingMap; import android.util.ArraySet; import android.util.Pair; import android.util.SparseArray; import android.view.View; import androidx.annotation.IntDef; import androidx.annotation.Nullable; Loading @@ -43,7 +41,6 @@ import java.lang.annotation.Target; import java.util.HashMap; import java.util.List; import java.util.concurrent.Executor; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.IntConsumer; Loading Loading @@ -160,14 +157,6 @@ public interface Bubbles { /** Set the proxy to commnuicate with SysUi side components. */ 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. */ void setExpandListener(BubbleExpandListener listener); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +3 −46 Original line number Diff line number Diff line Loading @@ -135,12 +135,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump */ 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. */ Loading @@ -156,8 +150,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump private ScrimView mScrimInFront; private ScrimView mNotificationsScrim; private ScrimView mScrimBehind; @Nullable private ScrimView mScrimForBubble; private Runnable mScrimBehindChangeRunnable; Loading Loading @@ -195,12 +187,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump private float mInFrontAlpha = NOT_INITIALIZED; private float mBehindAlpha = NOT_INITIALIZED; private float mNotificationsAlpha = NOT_INITIALIZED; private float mBubbleAlpha = NOT_INITIALIZED; private int mInFrontTint; private int mBehindTint; private int mNotificationsTint; private int mBubbleTint; private boolean mWallpaperVisibilityTimedOut; private int mScrimsVisibility; Loading Loading @@ -229,7 +219,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump UnlockedScreenOffAnimationController unlockedScreenOffAnimationController) { mScrimStateListener = lightBarController::setScrimState; mDefaultScrimAlpha = BUSY_SCRIM_ALPHA; ScrimState.BUBBLE_EXPANDED.setBubbleAlpha(BUBBLE_SCRIM_ALPHA); mKeyguardStateController = keyguardStateController; mDarkenWhileDragging = !mKeyguardStateController.canDismissLockScreen(); Loading Loading @@ -276,11 +265,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump * Attach the controller to the supplied views. */ public void attachViews(ScrimView behindScrim, ScrimView notificationsScrim, ScrimView scrimInFront, @Nullable ScrimView scrimForBubble) { ScrimView scrimInFront) { mNotificationsScrim = notificationsScrim; mScrimBehind = behindScrim; mScrimInFront = scrimInFront; mScrimForBubble = scrimForBubble; updateThemeColors(); behindScrim.enableBottomEdgeConcave(mClipsQsScrim); Loading @@ -293,8 +281,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump final ScrimState[] states = ScrimState.values(); for (int i = 0; i < states.length; i++) { states[i].init(mScrimInFront, mScrimBehind, mScrimForBubble, mDozeParameters, mDockManager); states[i].init(mScrimInFront, mScrimBehind, mDozeParameters, mDockManager); states[i].setScrimBehindAlphaKeyguard(mScrimBehindAlphaKeyguard); states[i].setDefaultScrimAlpha(mDefaultScrimAlpha); } Loading @@ -302,9 +289,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump mScrimBehind.setDefaultFocusHighlightEnabled(false); mNotificationsScrim.setDefaultFocusHighlightEnabled(false); mScrimInFront.setDefaultFocusHighlightEnabled(false); if (mScrimForBubble != null) { mScrimForBubble.setDefaultFocusHighlightEnabled(false); } updateScrims(); mKeyguardUpdateMonitor.registerCallback(mKeyguardVisibilityCallback); } Loading Loading @@ -627,11 +611,9 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump mInFrontTint = mState.getFrontTint(); mBehindTint = mState.getBehindTint(); mNotificationsTint = mState.getNotifTint(); mBubbleTint = mState.getBubbleTint(); mInFrontAlpha = mState.getFrontAlpha(); mBehindAlpha = mState.getBehindAlpha(); mBubbleAlpha = mState.getBubbleAlpha(); mNotificationsAlpha = mState.getNotifAlpha(); assertAlphasValid(); Loading Loading @@ -744,7 +726,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump setOrAdaptCurrentAnimation(mScrimBehind); setOrAdaptCurrentAnimation(mNotificationsScrim); setOrAdaptCurrentAnimation(mScrimInFront); setOrAdaptCurrentAnimation(mScrimForBubble); dispatchBackScrimState(mScrimBehind.getViewAlpha()); // Reset wallpaper timeout if it's already timeout like expanding panel while PULSING Loading Loading @@ -852,11 +833,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump setScrimAlpha(mScrimBehind, mBehindAlpha); 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 onFinished(mState); dispatchScrimsVisible(); Loading Loading @@ -909,8 +885,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump return "behind_scrim"; } else if (scrim == mNotificationsScrim) { return "notifications_scrim"; } else if (scrim == mScrimForBubble) { return "bubble_scrim"; } return "unknown_scrim"; } Loading Loading @@ -983,8 +957,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump return mBehindAlpha; } else if (scrim == mNotificationsScrim) { return mNotificationsAlpha; } else if (scrim == mScrimForBubble) { return mBubbleAlpha; } else { throw new IllegalArgumentException("Unknown scrim view"); } Loading @@ -997,8 +969,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump return mBehindTint; } else if (scrim == mNotificationsScrim) { return mNotificationsTint; } else if (scrim == mScrimForBubble) { return mBubbleTint; } else { throw new IllegalArgumentException("Unknown scrim view"); } Loading Loading @@ -1030,8 +1000,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump } if (isAnimating(mScrimBehind) || isAnimating(mNotificationsScrim) || isAnimating(mScrimInFront) || isAnimating(mScrimForBubble)) { || isAnimating(mScrimInFront)) { if (callback != null && callback != mCallback) { // 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 Loading @@ -1058,13 +1027,9 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump mInFrontTint = Color.TRANSPARENT; mBehindTint = mState.getBehindTint(); mNotificationsTint = mState.getNotifTint(); mBubbleTint = Color.TRANSPARENT; updateScrimColor(mScrimInFront, mInFrontAlpha, mInFrontTint); updateScrimColor(mScrimBehind, mBehindAlpha, mBehindTint); updateScrimColor(mNotificationsScrim, mNotificationsAlpha, mNotificationsTint); if (mScrimForBubble != null) { updateScrimColor(mScrimForBubble, mBubbleAlpha, mBubbleTint); } } } Loading Loading @@ -1232,14 +1197,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump pw.print(" tint=0x"); 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.println(mTracking); pw.print(" mDefaultScrimAlpha="); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java +2 −39 Original line number Diff line number Diff line Loading @@ -19,8 +19,6 @@ package com.android.systemui.statusbar.phone; import android.graphics.Color; import android.os.Trace; import androidx.annotation.Nullable; import com.android.systemui.dock.DockManager; import com.android.systemui.scrim.ScrimView; import com.android.systemui.statusbar.notification.stack.StackStateAnimator; Loading @@ -43,11 +41,9 @@ public enum ScrimState { public void prepare(ScrimState previousState) { mFrontTint = Color.BLACK; mBehindTint = Color.BLACK; mBubbleTint = previousState.mBubbleTint; mFrontAlpha = 1f; mBehindAlpha = 1f; mBubbleAlpha = previousState.mBubbleAlpha; mAnimationDuration = ScrimController.ANIMATION_DURATION_LONG; } Loading Loading @@ -81,12 +77,10 @@ public enum ScrimState { mFrontTint = Color.BLACK; mBehindTint = Color.BLACK; mNotifTint = mClipQsScrim ? Color.BLACK : Color.TRANSPARENT; mBubbleTint = Color.TRANSPARENT; mFrontAlpha = 0; mBehindAlpha = mClipQsScrim ? 1 : mScrimBehindAlphaKeyguard; mNotifAlpha = mClipQsScrim ? mScrimBehindAlphaKeyguard : 0; mBubbleAlpha = 0; if (mClipQsScrim) { updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK); } Loading Loading @@ -118,7 +112,6 @@ public enum ScrimState { mNotifAlpha = mClipQsScrim ? mDefaultScrimAlpha : 0; mNotifTint = Color.TRANSPARENT; mFrontAlpha = 0f; mBubbleAlpha = 0f; } }, Loading @@ -129,7 +122,6 @@ public enum ScrimState { @Override public void prepare(ScrimState previousState) { mBehindAlpha = 0; mBubbleAlpha = 0f; mFrontAlpha = mDefaultScrimAlpha; } }, Loading @@ -139,7 +131,6 @@ public enum ScrimState { public void prepare(ScrimState previousState) { mBehindAlpha = mClipQsScrim ? 1 : mDefaultScrimAlpha; mNotifAlpha = 1f; mBubbleAlpha = 0f; mFrontAlpha = 0f; mBehindTint = Color.BLACK; Loading @@ -163,7 +154,6 @@ public enum ScrimState { public void prepare(ScrimState previousState) { mBehindAlpha = 0; mFrontAlpha = 0; mBubbleAlpha = 0; } }, Loading @@ -185,9 +175,6 @@ public enum ScrimState { mBehindTint = Color.BLACK; mBehindAlpha = ScrimController.TRANSPARENT; mBubbleTint = Color.TRANSPARENT; mBubbleAlpha = ScrimController.TRANSPARENT; mAnimationDuration = ScrimController.ANIMATION_DURATION_LONG; // 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 Loading @@ -214,7 +201,6 @@ public enum ScrimState { @Override public void prepare(ScrimState previousState) { mFrontAlpha = mAodFrontScrimAlpha; mBubbleAlpha = 0f; mBehindTint = Color.BLACK; mFrontTint = Color.BLACK; mBlankScreen = mDisplayRequiresBlanking; Loading @@ -238,7 +224,6 @@ public enum ScrimState { mBehindAlpha = mClipQsScrim ? 1 : 0; mNotifAlpha = 0; mFrontAlpha = 0; mBubbleAlpha = 0; mAnimationDuration = mKeyguardFadingAway ? mKeyguardFadingAwayDuration Loading @@ -248,21 +233,16 @@ public enum ScrimState { mFrontTint = Color.TRANSPARENT; mBehindTint = Color.BLACK; mBubbleTint = Color.TRANSPARENT; mBlankScreen = false; if (previousState == ScrimState.AOD) { // Set all scrims black, before they fade transparent. updateScrimColor(mScrimInFront, 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. mFrontTint = Color.BLACK; mBehindTint = Color.BLACK; mBubbleTint = Color.BLACK; mBlankScreen = true; } Loading @@ -280,7 +260,6 @@ public enum ScrimState { public void prepare(ScrimState previousState) { mFrontTint = Color.TRANSPARENT; mBehindTint = Color.TRANSPARENT; mBubbleTint = Color.BLACK; mFrontAlpha = 0f; mBehindAlpha = mDefaultScrimAlpha; Loading @@ -294,21 +273,18 @@ public enum ScrimState { long mAnimationDuration = ScrimController.ANIMATION_DURATION; int mFrontTint = Color.TRANSPARENT; int mBehindTint = Color.TRANSPARENT; int mBubbleTint = Color.TRANSPARENT; int mNotifTint = Color.TRANSPARENT; boolean mAnimateChange = true; float mAodFrontScrimAlpha; float mFrontAlpha; float mBehindAlpha; float mBubbleAlpha; float mNotifAlpha; float mScrimBehindAlphaKeyguard; float mDefaultScrimAlpha; ScrimView mScrimInFront; ScrimView mScrimBehind; @Nullable ScrimView mScrimForBubble; DozeParameters mDozeParameters; DockManager mDockManager; Loading @@ -321,11 +297,10 @@ public enum ScrimState { long mKeyguardFadingAwayDuration; boolean mClipQsScrim; public void init(ScrimView scrimInFront, ScrimView scrimBehind, ScrimView scrimForBubble, DozeParameters dozeParameters, DockManager dockManager) { public void init(ScrimView scrimInFront, ScrimView scrimBehind, DozeParameters dozeParameters, DockManager dockManager) { mScrimInFront = scrimInFront; mScrimBehind = scrimBehind; mScrimForBubble = scrimForBubble; mDozeParameters = dozeParameters; mDockManager = dockManager; Loading @@ -352,10 +327,6 @@ public enum ScrimState { return mNotifAlpha; } public float getBubbleAlpha() { return mBubbleAlpha; } public int getFrontTint() { return mFrontTint; } Loading @@ -368,10 +339,6 @@ public enum ScrimState { return mNotifTint; } public int getBubbleTint() { return mBubbleTint; } public long getAnimationDuration() { return mAnimationDuration; } Loading Loading @@ -409,10 +376,6 @@ public enum ScrimState { mDefaultScrimAlpha = defaultScrimAlpha; } public void setBubbleAlpha(float alpha) { mBubbleAlpha = alpha; } public void setWallpaperSupportsAmbientMode(boolean wallpaperSupportsAmbientMode) { mWallpaperSupportsAmbientMode = wallpaperSupportsAmbientMode; } Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +1 −19 Original line number Diff line number Diff line Loading @@ -56,7 +56,6 @@ import android.graphics.Rect; import android.os.Binder; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserHandle; Loading Loading @@ -98,7 +97,6 @@ import java.util.HashSet; import java.util.List; import java.util.Objects; import java.util.concurrent.Executor; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.IntConsumer; Loading Loading @@ -581,7 +579,7 @@ public class BubbleController { /** * 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() { if (mStackView == null) { Loading Loading @@ -629,7 +627,6 @@ public class BubbleController { try { mAddedToWindowManager = true; mBubbleData.getOverflow().initialize(this); mStackView.addView(mBubbleScrim); mWindowManager.addView(mStackView, mWmLayoutParams); // Position info is dependent on us being attached to a window mBubblePositioner.update(); Loading Loading @@ -661,7 +658,6 @@ public class BubbleController { mAddedToWindowManager = false; if (mStackView != null) { mWindowManager.removeView(mStackView); mStackView.removeView(mBubbleScrim); mBubbleData.getOverflow().cleanUpExpandedState(); } else { Log.w(TAG, "StackView added to WindowManager, but was null when removing!"); Loading Loading @@ -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) { mSysuiProxy = proxy; } Loading Loading @@ -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 public void setExpandListener(BubbleExpandListener listener) { mMainExecutor.execute(() -> { Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java +31 −25 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package com.android.wm.shell.bubbles; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; 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.TAG_BUBBLES; import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; Loading @@ -33,11 +35,11 @@ import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Color; import android.graphics.Outline; import android.graphics.PointF; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.provider.Settings; import android.util.Log; Loading Loading @@ -122,6 +124,8 @@ public class BubbleStackView extends FrameLayout 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 * animation ends, if we are in fact temporarily invisible. Loading Loading @@ -195,7 +199,7 @@ public class BubbleStackView extends FrameLayout private StackAnimationController mStackAnimationController; private ExpandedAnimationController mExpandedAnimationController; private View mTaskbarScrim; private View mScrim; private FrameLayout mExpandedViewContainer; /** Matrix used to scale the expanded view container with a given pivot point. */ Loading Loading @@ -858,11 +862,12 @@ public class BubbleStackView extends FrameLayout mBubbleData.setExpanded(true); }); mTaskbarScrim = new View(getContext()); mTaskbarScrim.setBackgroundColor(Color.BLACK); addView(mTaskbarScrim); mTaskbarScrim.setAlpha(0f); mTaskbarScrim.setVisibility(GONE); mScrim = new View(getContext()); mScrim.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); mScrim.setBackgroundDrawable(new ColorDrawable( getResources().getColor(android.R.color.system_neutral1_1000))); addView(mScrim); mScrim.setAlpha(0f); mOrientationChangedListener = (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> { Loading Loading @@ -1220,6 +1225,8 @@ public class BubbleStackView extends FrameLayout updateOverflow(); updateUserEdu(); updateExpandedViewTheme(); mScrim.setBackgroundDrawable(new ColorDrawable( getResources().getColor(android.R.color.system_neutral1_1000))); } /** Loading Loading @@ -1799,6 +1806,20 @@ public class BubbleStackView extends FrameLayout 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() { cancelDelayedExpandCollapseSwitchAnimations(); final boolean showVertically = mPositioner.showBubblesVertically(); Loading @@ -1808,6 +1829,7 @@ public class BubbleStackView extends FrameLayout } beforeExpandedViewAnimation(); showScrim(true); updateZOrder(); updateBadges(false /* setBadgeForCollapsedStack */); mBubbleContainer.setActiveController(mExpandedAnimationController); Loading @@ -1819,16 +1841,6 @@ public class BubbleStackView extends FrameLayout } } /* 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, getBubbleIndex(mExpandedBubble)); mExpandedViewContainer.setTranslationX(0f); Loading Loading @@ -1939,6 +1951,8 @@ public class BubbleStackView extends FrameLayout mIsExpanded = false; mIsExpansionAnimating = true; showScrim(false); mBubbleContainer.cancelAllAnimations(); // If we were in the middle of swapping, the animating-out surface would have been scaling Loading @@ -1956,10 +1970,6 @@ public class BubbleStackView extends FrameLayout /* collapseTo */, () -> mBubbleContainer.setActiveController(mStackAnimationController)); if (mTaskbarScrim.getVisibility() == VISIBLE) { mTaskbarScrim.animate().alpha(0f).start(); } int index; if (mExpandedBubble != null && BubbleOverflow.KEY.equals(mExpandedBubble.getKey())) { index = mBubbleData.getBubbles().size(); Loading Loading @@ -2027,10 +2037,6 @@ public class BubbleStackView extends FrameLayout if (previouslySelected != null) { previouslySelected.setTaskViewVisibility(false); } if (mPositioner.showingInTaskbar()) { mTaskbarScrim.setVisibility(GONE); } }) .start(); } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubbles.java +0 −11 Original line number Diff line number Diff line Loading @@ -24,12 +24,10 @@ import static java.lang.annotation.RetentionPolicy.SOURCE; import android.content.pm.UserInfo; import android.content.res.Configuration; import android.os.Bundle; import android.os.Looper; import android.service.notification.NotificationListenerService.RankingMap; import android.util.ArraySet; import android.util.Pair; import android.util.SparseArray; import android.view.View; import androidx.annotation.IntDef; import androidx.annotation.Nullable; Loading @@ -43,7 +41,6 @@ import java.lang.annotation.Target; import java.util.HashMap; import java.util.List; import java.util.concurrent.Executor; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.IntConsumer; Loading Loading @@ -160,14 +157,6 @@ public interface Bubbles { /** Set the proxy to commnuicate with SysUi side components. */ 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. */ void setExpandListener(BubbleExpandListener listener); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +3 −46 Original line number Diff line number Diff line Loading @@ -135,12 +135,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump */ 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. */ Loading @@ -156,8 +150,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump private ScrimView mScrimInFront; private ScrimView mNotificationsScrim; private ScrimView mScrimBehind; @Nullable private ScrimView mScrimForBubble; private Runnable mScrimBehindChangeRunnable; Loading Loading @@ -195,12 +187,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump private float mInFrontAlpha = NOT_INITIALIZED; private float mBehindAlpha = NOT_INITIALIZED; private float mNotificationsAlpha = NOT_INITIALIZED; private float mBubbleAlpha = NOT_INITIALIZED; private int mInFrontTint; private int mBehindTint; private int mNotificationsTint; private int mBubbleTint; private boolean mWallpaperVisibilityTimedOut; private int mScrimsVisibility; Loading Loading @@ -229,7 +219,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump UnlockedScreenOffAnimationController unlockedScreenOffAnimationController) { mScrimStateListener = lightBarController::setScrimState; mDefaultScrimAlpha = BUSY_SCRIM_ALPHA; ScrimState.BUBBLE_EXPANDED.setBubbleAlpha(BUBBLE_SCRIM_ALPHA); mKeyguardStateController = keyguardStateController; mDarkenWhileDragging = !mKeyguardStateController.canDismissLockScreen(); Loading Loading @@ -276,11 +265,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump * Attach the controller to the supplied views. */ public void attachViews(ScrimView behindScrim, ScrimView notificationsScrim, ScrimView scrimInFront, @Nullable ScrimView scrimForBubble) { ScrimView scrimInFront) { mNotificationsScrim = notificationsScrim; mScrimBehind = behindScrim; mScrimInFront = scrimInFront; mScrimForBubble = scrimForBubble; updateThemeColors(); behindScrim.enableBottomEdgeConcave(mClipsQsScrim); Loading @@ -293,8 +281,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump final ScrimState[] states = ScrimState.values(); for (int i = 0; i < states.length; i++) { states[i].init(mScrimInFront, mScrimBehind, mScrimForBubble, mDozeParameters, mDockManager); states[i].init(mScrimInFront, mScrimBehind, mDozeParameters, mDockManager); states[i].setScrimBehindAlphaKeyguard(mScrimBehindAlphaKeyguard); states[i].setDefaultScrimAlpha(mDefaultScrimAlpha); } Loading @@ -302,9 +289,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump mScrimBehind.setDefaultFocusHighlightEnabled(false); mNotificationsScrim.setDefaultFocusHighlightEnabled(false); mScrimInFront.setDefaultFocusHighlightEnabled(false); if (mScrimForBubble != null) { mScrimForBubble.setDefaultFocusHighlightEnabled(false); } updateScrims(); mKeyguardUpdateMonitor.registerCallback(mKeyguardVisibilityCallback); } Loading Loading @@ -627,11 +611,9 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump mInFrontTint = mState.getFrontTint(); mBehindTint = mState.getBehindTint(); mNotificationsTint = mState.getNotifTint(); mBubbleTint = mState.getBubbleTint(); mInFrontAlpha = mState.getFrontAlpha(); mBehindAlpha = mState.getBehindAlpha(); mBubbleAlpha = mState.getBubbleAlpha(); mNotificationsAlpha = mState.getNotifAlpha(); assertAlphasValid(); Loading Loading @@ -744,7 +726,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump setOrAdaptCurrentAnimation(mScrimBehind); setOrAdaptCurrentAnimation(mNotificationsScrim); setOrAdaptCurrentAnimation(mScrimInFront); setOrAdaptCurrentAnimation(mScrimForBubble); dispatchBackScrimState(mScrimBehind.getViewAlpha()); // Reset wallpaper timeout if it's already timeout like expanding panel while PULSING Loading Loading @@ -852,11 +833,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump setScrimAlpha(mScrimBehind, mBehindAlpha); 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 onFinished(mState); dispatchScrimsVisible(); Loading Loading @@ -909,8 +885,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump return "behind_scrim"; } else if (scrim == mNotificationsScrim) { return "notifications_scrim"; } else if (scrim == mScrimForBubble) { return "bubble_scrim"; } return "unknown_scrim"; } Loading Loading @@ -983,8 +957,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump return mBehindAlpha; } else if (scrim == mNotificationsScrim) { return mNotificationsAlpha; } else if (scrim == mScrimForBubble) { return mBubbleAlpha; } else { throw new IllegalArgumentException("Unknown scrim view"); } Loading @@ -997,8 +969,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump return mBehindTint; } else if (scrim == mNotificationsScrim) { return mNotificationsTint; } else if (scrim == mScrimForBubble) { return mBubbleTint; } else { throw new IllegalArgumentException("Unknown scrim view"); } Loading Loading @@ -1030,8 +1000,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump } if (isAnimating(mScrimBehind) || isAnimating(mNotificationsScrim) || isAnimating(mScrimInFront) || isAnimating(mScrimForBubble)) { || isAnimating(mScrimInFront)) { if (callback != null && callback != mCallback) { // 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 Loading @@ -1058,13 +1027,9 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump mInFrontTint = Color.TRANSPARENT; mBehindTint = mState.getBehindTint(); mNotificationsTint = mState.getNotifTint(); mBubbleTint = Color.TRANSPARENT; updateScrimColor(mScrimInFront, mInFrontAlpha, mInFrontTint); updateScrimColor(mScrimBehind, mBehindAlpha, mBehindTint); updateScrimColor(mNotificationsScrim, mNotificationsAlpha, mNotificationsTint); if (mScrimForBubble != null) { updateScrimColor(mScrimForBubble, mBubbleAlpha, mBubbleTint); } } } Loading Loading @@ -1232,14 +1197,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump pw.print(" tint=0x"); 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.println(mTracking); pw.print(" mDefaultScrimAlpha="); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java +2 −39 Original line number Diff line number Diff line Loading @@ -19,8 +19,6 @@ package com.android.systemui.statusbar.phone; import android.graphics.Color; import android.os.Trace; import androidx.annotation.Nullable; import com.android.systemui.dock.DockManager; import com.android.systemui.scrim.ScrimView; import com.android.systemui.statusbar.notification.stack.StackStateAnimator; Loading @@ -43,11 +41,9 @@ public enum ScrimState { public void prepare(ScrimState previousState) { mFrontTint = Color.BLACK; mBehindTint = Color.BLACK; mBubbleTint = previousState.mBubbleTint; mFrontAlpha = 1f; mBehindAlpha = 1f; mBubbleAlpha = previousState.mBubbleAlpha; mAnimationDuration = ScrimController.ANIMATION_DURATION_LONG; } Loading Loading @@ -81,12 +77,10 @@ public enum ScrimState { mFrontTint = Color.BLACK; mBehindTint = Color.BLACK; mNotifTint = mClipQsScrim ? Color.BLACK : Color.TRANSPARENT; mBubbleTint = Color.TRANSPARENT; mFrontAlpha = 0; mBehindAlpha = mClipQsScrim ? 1 : mScrimBehindAlphaKeyguard; mNotifAlpha = mClipQsScrim ? mScrimBehindAlphaKeyguard : 0; mBubbleAlpha = 0; if (mClipQsScrim) { updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK); } Loading Loading @@ -118,7 +112,6 @@ public enum ScrimState { mNotifAlpha = mClipQsScrim ? mDefaultScrimAlpha : 0; mNotifTint = Color.TRANSPARENT; mFrontAlpha = 0f; mBubbleAlpha = 0f; } }, Loading @@ -129,7 +122,6 @@ public enum ScrimState { @Override public void prepare(ScrimState previousState) { mBehindAlpha = 0; mBubbleAlpha = 0f; mFrontAlpha = mDefaultScrimAlpha; } }, Loading @@ -139,7 +131,6 @@ public enum ScrimState { public void prepare(ScrimState previousState) { mBehindAlpha = mClipQsScrim ? 1 : mDefaultScrimAlpha; mNotifAlpha = 1f; mBubbleAlpha = 0f; mFrontAlpha = 0f; mBehindTint = Color.BLACK; Loading @@ -163,7 +154,6 @@ public enum ScrimState { public void prepare(ScrimState previousState) { mBehindAlpha = 0; mFrontAlpha = 0; mBubbleAlpha = 0; } }, Loading @@ -185,9 +175,6 @@ public enum ScrimState { mBehindTint = Color.BLACK; mBehindAlpha = ScrimController.TRANSPARENT; mBubbleTint = Color.TRANSPARENT; mBubbleAlpha = ScrimController.TRANSPARENT; mAnimationDuration = ScrimController.ANIMATION_DURATION_LONG; // 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 Loading @@ -214,7 +201,6 @@ public enum ScrimState { @Override public void prepare(ScrimState previousState) { mFrontAlpha = mAodFrontScrimAlpha; mBubbleAlpha = 0f; mBehindTint = Color.BLACK; mFrontTint = Color.BLACK; mBlankScreen = mDisplayRequiresBlanking; Loading @@ -238,7 +224,6 @@ public enum ScrimState { mBehindAlpha = mClipQsScrim ? 1 : 0; mNotifAlpha = 0; mFrontAlpha = 0; mBubbleAlpha = 0; mAnimationDuration = mKeyguardFadingAway ? mKeyguardFadingAwayDuration Loading @@ -248,21 +233,16 @@ public enum ScrimState { mFrontTint = Color.TRANSPARENT; mBehindTint = Color.BLACK; mBubbleTint = Color.TRANSPARENT; mBlankScreen = false; if (previousState == ScrimState.AOD) { // Set all scrims black, before they fade transparent. updateScrimColor(mScrimInFront, 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. mFrontTint = Color.BLACK; mBehindTint = Color.BLACK; mBubbleTint = Color.BLACK; mBlankScreen = true; } Loading @@ -280,7 +260,6 @@ public enum ScrimState { public void prepare(ScrimState previousState) { mFrontTint = Color.TRANSPARENT; mBehindTint = Color.TRANSPARENT; mBubbleTint = Color.BLACK; mFrontAlpha = 0f; mBehindAlpha = mDefaultScrimAlpha; Loading @@ -294,21 +273,18 @@ public enum ScrimState { long mAnimationDuration = ScrimController.ANIMATION_DURATION; int mFrontTint = Color.TRANSPARENT; int mBehindTint = Color.TRANSPARENT; int mBubbleTint = Color.TRANSPARENT; int mNotifTint = Color.TRANSPARENT; boolean mAnimateChange = true; float mAodFrontScrimAlpha; float mFrontAlpha; float mBehindAlpha; float mBubbleAlpha; float mNotifAlpha; float mScrimBehindAlphaKeyguard; float mDefaultScrimAlpha; ScrimView mScrimInFront; ScrimView mScrimBehind; @Nullable ScrimView mScrimForBubble; DozeParameters mDozeParameters; DockManager mDockManager; Loading @@ -321,11 +297,10 @@ public enum ScrimState { long mKeyguardFadingAwayDuration; boolean mClipQsScrim; public void init(ScrimView scrimInFront, ScrimView scrimBehind, ScrimView scrimForBubble, DozeParameters dozeParameters, DockManager dockManager) { public void init(ScrimView scrimInFront, ScrimView scrimBehind, DozeParameters dozeParameters, DockManager dockManager) { mScrimInFront = scrimInFront; mScrimBehind = scrimBehind; mScrimForBubble = scrimForBubble; mDozeParameters = dozeParameters; mDockManager = dockManager; Loading @@ -352,10 +327,6 @@ public enum ScrimState { return mNotifAlpha; } public float getBubbleAlpha() { return mBubbleAlpha; } public int getFrontTint() { return mFrontTint; } Loading @@ -368,10 +339,6 @@ public enum ScrimState { return mNotifTint; } public int getBubbleTint() { return mBubbleTint; } public long getAnimationDuration() { return mAnimationDuration; } Loading Loading @@ -409,10 +376,6 @@ public enum ScrimState { mDefaultScrimAlpha = defaultScrimAlpha; } public void setBubbleAlpha(float alpha) { mBubbleAlpha = alpha; } public void setWallpaperSupportsAmbientMode(boolean wallpaperSupportsAmbientMode) { mWallpaperSupportsAmbientMode = wallpaperSupportsAmbientMode; } Loading