Loading packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/OverlayShade.kt +3 −3 Original line number Diff line number Diff line Loading @@ -44,8 +44,8 @@ import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalLayoutDirection import androidx.compose.ui.platform.LocalResources import androidx.compose.ui.res.dimensionResource import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp Loading Loading @@ -195,12 +195,12 @@ object OverlayShade { val ScrimBackground: Color @Composable @ReadOnlyComposable get() = Color(LocalResources.current.notificationScrim(Flags.notificationShadeBlur())) get() = Color(notificationScrim(LocalContext.current, Flags.notificationShadeBlur())) val PanelBackground: Color @Composable @ReadOnlyComposable get() = Color(LocalResources.current.shadePanel(Flags.notificationShadeBlur())) get() = Color(shadePanel(LocalContext.current, Flags.notificationShadeBlur())) } object Dimensions { Loading packages/SystemUI/src/com/android/systemui/shade/ui/ShadeColors.kt +15 −15 Original line number Diff line number Diff line Loading @@ -16,34 +16,34 @@ package com.android.systemui.shade.ui import android.content.res.Resources import android.content.Context import android.graphics.Color import com.android.internal.graphics.ColorUtils import com.android.systemui.res.R object ShadeColors { @JvmStatic fun Resources.shadePanel(blurSupported: Boolean): Int { fun shadePanel(context: Context, blurSupported: Boolean): Int { return if (blurSupported) { shadePanelStandard() shadePanelStandard(context) } else { shadePanelFallback() shadePanelFallback(context) } } @JvmStatic fun Resources.notificationScrim(blurSupported: Boolean): Int { fun notificationScrim(context: Context, blurSupported: Boolean): Int { return if (blurSupported) { notificationScrimStandard() notificationScrimStandard(context) } else { notificationScrimFallback() notificationScrimFallback(context) } } @JvmStatic private fun Resources.shadePanelStandard(): Int { private fun shadePanelStandard(context: Context): Int { val layerAbove = ColorUtils.setAlphaComponent( getColor(R.color.shade_panel_base, null), context.getColor(R.color.shade_panel_base), (0.4f * 255).toInt() ) val layerBelow = ColorUtils.setAlphaComponent(Color.WHITE, (0.1f * 255).toInt()) Loading @@ -51,20 +51,20 @@ object ShadeColors { } @JvmStatic private fun Resources.shadePanelFallback(): Int { return getColor(R.color.shade_panel_fallback, null) private fun shadePanelFallback(context: Context): Int { return context.getColor(R.color.shade_panel_fallback) } @JvmStatic private fun Resources.notificationScrimStandard(): Int { private fun notificationScrimStandard(context: Context): Int { return ColorUtils.setAlphaComponent( getColor(R.color.notification_scrim_base, null), context.getColor(R.color.notification_scrim_base), (0.5f * 255).toInt(), ) } @JvmStatic private fun Resources.notificationScrimFallback(): Int { return getColor(R.color.notification_scrim_fallback, null) private fun notificationScrimFallback(context: Context): Int { return context.getColor(R.color.notification_scrim_fallback) } } packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +16 −3 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ import com.android.systemui.scene.shared.model.Scenes; import com.android.systemui.scrim.ScrimView; import com.android.systemui.shade.ShadeViewController; import com.android.systemui.shade.transition.LargeScreenShadeInterpolator; import com.android.systemui.shade.ui.ShadeColors; import com.android.systemui.statusbar.notification.stack.ViewState; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.KeyguardStateController; Loading Loading @@ -433,8 +434,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, mDozeParameters, mDockManager, this::isBlurCurrentlySupported); states[i].init(mScrimInFront, mScrimBehind, mDozeParameters, mDockManager); states[i].setScrimBehindAlphaKeyguard(mScrimBehindAlphaKeyguard); states[i].setDefaultScrimAlpha(getDefaultScrimAlpha()); } Loading Loading @@ -540,7 +540,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump } } if (Flags.notificationShadeBlur()) { mState.prepare(mState); for (ScrimState state : ScrimState.values()) { state.setNotificationScrimColor(getNotificationsScrimColor()); state.setShadePanelColor(getShadePanelColor()); } } applyAndDispatchState(); } Loading Loading @@ -1639,11 +1642,21 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump com.android.internal.R.color.materialColorSurface); for (ScrimState state : ScrimState.values()) { state.setSurfaceColor(surface); state.setShadePanelColor(getShadePanelColor()); state.setNotificationScrimColor(getNotificationsScrimColor()); } mNeedsDrawableColorUpdate = true; } private int getNotificationsScrimColor() { return ShadeColors.notificationScrim(mContext, isBlurCurrentlySupported()); } private int getShadePanelColor() { return ShadeColors.shadePanel(mContext, isBlurCurrentlySupported()); } private void onThemeChanged() { updateThemeColors(); scheduleUpdate(); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java +123 −32 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import com.android.systemui.Flags; import com.android.systemui.dock.DockManager; import com.android.systemui.res.R; import com.android.systemui.scrim.ScrimView; import com.android.systemui.shade.ui.ShadeColors; import com.android.systemui.statusbar.notification.stack.StackStateAnimator; import kotlinx.coroutines.ExperimentalCoroutinesApi; Loading Loading @@ -90,8 +89,7 @@ public enum ScrimState { } if (Flags.notificationShadeBlur()) { mBehindTint = Color.TRANSPARENT; mNotifTint = ShadeColors.notificationScrim(mScrimBehind.getResources(), mIsBlurSupported.get()); mNotifTint = mNotificationScrimColor; mBehindAlpha = 0.0f; mNotifAlpha = 0.0f; mFrontAlpha = 0.0f; Loading @@ -106,7 +104,16 @@ public enum ScrimState { updateScrimColor(mScrimBehind, 1f /* alpha */, mBackgroundColor); } } } @Override public void setNotificationScrimColor(int notificationScrimColor) { super.setNotificationScrimColor(notificationScrimColor); if (Flags.notificationShadeBlur()) { // TODO(b/406208846): the keyguard scrims alpha need to be greater than 0.2. // They should be updated here as well. mNotifTint = mNotificationScrimColor; } } }, Loading Loading @@ -189,12 +196,10 @@ public enum ScrimState { @Override public void prepare(ScrimState previousState) { if (Flags.notificationShadeBlur()) { mBehindTint = ShadeColors.shadePanel(mScrimBehind.getResources(), mIsBlurSupported.get()); mBehindAlpha = Color.alpha(mBehindTint) / 255.0f; mNotifTint = ShadeColors.notificationScrim(mScrimBehind.getResources(), mIsBlurSupported.get()); mNotifAlpha = Color.alpha(mNotifTint) / 255.0f; mBehindTint = mShadePanelColor; mBehindAlpha = getColorAlpha(mBehindTint); mNotifTint = mNotificationScrimColor; mNotifAlpha = getColorAlpha(mNotifTint); mFrontAlpha = 0.0f; } else { if (Flags.bouncerUiRevamp()) { Loading @@ -216,6 +221,24 @@ public enum ScrimState { } } } @Override public void setShadePanelColor(int shadePanelColor) { super.setShadePanelColor(shadePanelColor); if (Flags.notificationShadeBlur()) { mBehindTint = mShadePanelColor; mBehindAlpha = getColorAlpha(mBehindTint); } } @Override public void setNotificationScrimColor(int notificationScrimColor) { super.setNotificationScrimColor(notificationScrimColor); if (Flags.notificationShadeBlur()) { mNotifTint = mNotificationScrimColor; mNotifAlpha = getColorAlpha(mNotifTint); } } }, /** Loading Loading @@ -321,12 +344,10 @@ public enum ScrimState { mBehindTint = mBackgroundColor; mBlankScreen = true; } else if (Flags.notificationShadeBlur()) { mBehindTint = ShadeColors.shadePanel(mScrimBehind.getResources(), mIsBlurSupported.get()); mBehindAlpha = Color.alpha(mBehindTint) / 255.0f; mNotifTint = ShadeColors.notificationScrim(mScrimBehind.getResources(), mIsBlurSupported.get()); mNotifAlpha = Color.alpha(mNotifTint) / 255.0f; mBehindTint = mShadePanelColor; mBehindAlpha = getColorAlpha(mBehindTint); mNotifTint = mNotificationScrimColor; mNotifAlpha = getColorAlpha(mNotifTint); mFrontAlpha = 0.0f; return; } Loading @@ -335,6 +356,24 @@ public enum ScrimState { updateScrimColor(mScrimBehind, 1f /* alpha */, mBackgroundColor); } } @Override public void setShadePanelColor(int shadePanelColor) { super.setShadePanelColor(shadePanelColor); if (Flags.notificationShadeBlur()) { mBehindTint = mShadePanelColor; mBehindAlpha = getColorAlpha(mBehindTint); } } @Override public void setNotificationScrimColor(int notificationScrimColor) { super.setNotificationScrimColor(notificationScrimColor); if (Flags.notificationShadeBlur()) { mNotifTint = mNotificationScrimColor; mNotifAlpha = getColorAlpha(mNotifTint); } } }, DREAMING { Loading @@ -343,12 +382,10 @@ public enum ScrimState { if (Flags.notificationShadeBlur()) { // Scrim parameters should match SHADE_LOCKED like other activities occluding // keyguard. mBehindTint = ShadeColors.shadePanel(mScrimBehind.getResources(), mIsBlurSupported.get()); mBehindAlpha = Color.alpha(mBehindTint) / 255.0f; mNotifTint = ShadeColors.notificationScrim(mScrimBehind.getResources(), mIsBlurSupported.get()); mNotifAlpha = Color.alpha(mNotifTint) / 255.0f; mBehindTint = mShadePanelColor; mBehindAlpha = getColorAlpha(mBehindTint); mNotifTint = mNotificationScrimColor; mNotifAlpha = getColorAlpha(mNotifTint); mFrontAlpha = 0.0f; } else { mFrontTint = Color.TRANSPARENT; Loading @@ -366,6 +403,24 @@ public enum ScrimState { } } } @Override public void setShadePanelColor(int shadePanelColor) { super.setShadePanelColor(shadePanelColor); if (Flags.notificationShadeBlur()) { mBehindTint = mShadePanelColor; mBehindAlpha = getColorAlpha(mBehindTint); } } @Override public void setNotificationScrimColor(int notificationScrimColor) { super.setNotificationScrimColor(notificationScrimColor); if (Flags.notificationShadeBlur()) { mNotifTint = mNotificationScrimColor; mNotifAlpha = getColorAlpha(mNotifTint); } } }, /** Loading @@ -379,8 +434,7 @@ public enum ScrimState { if (Flags.notificationShadeBlur()) { // Scrim parameters should match KEYGUARD as we're showing on top of keyguard. mBehindTint = Color.TRANSPARENT; mNotifTint = ShadeColors.notificationScrim(mScrimBehind.getResources(), mIsBlurSupported.get()); mNotifTint = mNotificationScrimColor; mBehindAlpha = 0.0f; mNotifAlpha = 0.0f; mFrontAlpha = 0.0f; Loading @@ -395,6 +449,14 @@ public enum ScrimState { mNotifTint = mClipQsScrim ? mBackgroundColor : Color.TRANSPARENT; } } @Override public void setNotificationScrimColor(int notificationScrimColor) { super.setNotificationScrimColor(notificationScrimColor); if (Flags.notificationShadeBlur()) { mNotifTint = mNotificationScrimColor; } } }, /** Loading @@ -410,12 +472,10 @@ public enum ScrimState { public void prepare(ScrimState previousState) { if (Flags.notificationShadeBlur()) { // Scrim parameters should match DREAM as hub is showing while on top of the dream. mBehindTint = ShadeColors.shadePanel(mScrimBehind.getResources(), mIsBlurSupported.get()); mBehindAlpha = Color.alpha(mBehindTint) / 255.0f; mNotifTint = ShadeColors.notificationScrim(mScrimBehind.getResources(), mIsBlurSupported.get()); mNotifAlpha = Color.alpha(mNotifTint) / 255.0f; mBehindTint = mShadePanelColor; mBehindAlpha = getColorAlpha(mBehindTint); mNotifTint = mNotificationScrimColor; mNotifAlpha = getColorAlpha(mNotifTint); mFrontAlpha = 0.0f; } else { // No scrims should be visible by default in this state. Loading @@ -428,6 +488,24 @@ public enum ScrimState { mNotifTint = mClipQsScrim ? mBackgroundColor : Color.TRANSPARENT; } } @Override public void setShadePanelColor(int shadePanelColor) { super.setShadePanelColor(shadePanelColor); if (Flags.notificationShadeBlur()) { mBehindTint = mShadePanelColor; mBehindAlpha = getColorAlpha(mBehindTint); } } @Override public void setNotificationScrimColor(int notificationScrimColor) { super.setNotificationScrimColor(notificationScrimColor); if (Flags.notificationShadeBlur()) { mNotifTint = mNotificationScrimColor; mNotifAlpha = getColorAlpha(mNotifTint); } } }; boolean mBlankScreen = false; Loading @@ -437,6 +515,9 @@ public enum ScrimState { int mNotifTint = Color.TRANSPARENT; int mSurfaceColor = Color.TRANSPARENT; int mShadePanelColor = Color.TRANSPARENT; int mNotificationScrimColor = Color.TRANSPARENT; boolean mAnimateChange = true; float mAodFrontScrimAlpha; float mFrontAlpha; Loading @@ -451,7 +532,6 @@ public enum ScrimState { DozeParameters mDozeParameters; DockManager mDockManager; boolean mDisplayRequiresBlanking; protected Supplier<Boolean> mIsBlurSupported; boolean mLaunchingAffordanceWithPreview; boolean mOccludeAnimationPlaying; boolean mWakeLockScreenSensorActive; Loading @@ -465,7 +545,7 @@ public enum ScrimState { protected float mNotifBlurRadius = 0.0f; public void init(ScrimView scrimInFront, ScrimView scrimBehind, DozeParameters dozeParameters, DockManager dockManager, Supplier<Boolean> isBlurSupported) { DockManager dockManager) { mBackgroundColor = scrimBehind.getContext().getColor(R.color.shade_scrim_background_dark); mScrimInFront = scrimInFront; mScrimBehind = scrimBehind; Loading @@ -473,7 +553,6 @@ public enum ScrimState { mDozeParameters = dozeParameters; mDockManager = dockManager; mDisplayRequiresBlanking = dozeParameters.getDisplayNeedsBlanking(); mIsBlurSupported = isBlurSupported; } /** Prepare state for transition. */ Loading Loading @@ -556,6 +635,14 @@ public enum ScrimState { mSurfaceColor = surfaceColor; } public void setShadePanelColor(int shadePanelColor) { mShadePanelColor = shadePanelColor; } public void setNotificationScrimColor(int notificationScrimColor) { mNotificationScrimColor = notificationScrimColor; } public void setLaunchingAffordanceWithPreview(boolean launchingAffordanceWithPreview) { mLaunchingAffordanceWithPreview = launchingAffordanceWithPreview; } Loading Loading @@ -588,4 +675,8 @@ public enum ScrimState { public void setNotifBlurRadius(float value) { mNotifBlurRadius = value; } private static float getColorAlpha(int color) { return Color.alpha(color) / 255.0f; } } Loading
packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/OverlayShade.kt +3 −3 Original line number Diff line number Diff line Loading @@ -44,8 +44,8 @@ import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalLayoutDirection import androidx.compose.ui.platform.LocalResources import androidx.compose.ui.res.dimensionResource import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp Loading Loading @@ -195,12 +195,12 @@ object OverlayShade { val ScrimBackground: Color @Composable @ReadOnlyComposable get() = Color(LocalResources.current.notificationScrim(Flags.notificationShadeBlur())) get() = Color(notificationScrim(LocalContext.current, Flags.notificationShadeBlur())) val PanelBackground: Color @Composable @ReadOnlyComposable get() = Color(LocalResources.current.shadePanel(Flags.notificationShadeBlur())) get() = Color(shadePanel(LocalContext.current, Flags.notificationShadeBlur())) } object Dimensions { Loading
packages/SystemUI/src/com/android/systemui/shade/ui/ShadeColors.kt +15 −15 Original line number Diff line number Diff line Loading @@ -16,34 +16,34 @@ package com.android.systemui.shade.ui import android.content.res.Resources import android.content.Context import android.graphics.Color import com.android.internal.graphics.ColorUtils import com.android.systemui.res.R object ShadeColors { @JvmStatic fun Resources.shadePanel(blurSupported: Boolean): Int { fun shadePanel(context: Context, blurSupported: Boolean): Int { return if (blurSupported) { shadePanelStandard() shadePanelStandard(context) } else { shadePanelFallback() shadePanelFallback(context) } } @JvmStatic fun Resources.notificationScrim(blurSupported: Boolean): Int { fun notificationScrim(context: Context, blurSupported: Boolean): Int { return if (blurSupported) { notificationScrimStandard() notificationScrimStandard(context) } else { notificationScrimFallback() notificationScrimFallback(context) } } @JvmStatic private fun Resources.shadePanelStandard(): Int { private fun shadePanelStandard(context: Context): Int { val layerAbove = ColorUtils.setAlphaComponent( getColor(R.color.shade_panel_base, null), context.getColor(R.color.shade_panel_base), (0.4f * 255).toInt() ) val layerBelow = ColorUtils.setAlphaComponent(Color.WHITE, (0.1f * 255).toInt()) Loading @@ -51,20 +51,20 @@ object ShadeColors { } @JvmStatic private fun Resources.shadePanelFallback(): Int { return getColor(R.color.shade_panel_fallback, null) private fun shadePanelFallback(context: Context): Int { return context.getColor(R.color.shade_panel_fallback) } @JvmStatic private fun Resources.notificationScrimStandard(): Int { private fun notificationScrimStandard(context: Context): Int { return ColorUtils.setAlphaComponent( getColor(R.color.notification_scrim_base, null), context.getColor(R.color.notification_scrim_base), (0.5f * 255).toInt(), ) } @JvmStatic private fun Resources.notificationScrimFallback(): Int { return getColor(R.color.notification_scrim_fallback, null) private fun notificationScrimFallback(context: Context): Int { return context.getColor(R.color.notification_scrim_fallback) } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +16 −3 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ import com.android.systemui.scene.shared.model.Scenes; import com.android.systemui.scrim.ScrimView; import com.android.systemui.shade.ShadeViewController; import com.android.systemui.shade.transition.LargeScreenShadeInterpolator; import com.android.systemui.shade.ui.ShadeColors; import com.android.systemui.statusbar.notification.stack.ViewState; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.KeyguardStateController; Loading Loading @@ -433,8 +434,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, mDozeParameters, mDockManager, this::isBlurCurrentlySupported); states[i].init(mScrimInFront, mScrimBehind, mDozeParameters, mDockManager); states[i].setScrimBehindAlphaKeyguard(mScrimBehindAlphaKeyguard); states[i].setDefaultScrimAlpha(getDefaultScrimAlpha()); } Loading Loading @@ -540,7 +540,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump } } if (Flags.notificationShadeBlur()) { mState.prepare(mState); for (ScrimState state : ScrimState.values()) { state.setNotificationScrimColor(getNotificationsScrimColor()); state.setShadePanelColor(getShadePanelColor()); } } applyAndDispatchState(); } Loading Loading @@ -1639,11 +1642,21 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump com.android.internal.R.color.materialColorSurface); for (ScrimState state : ScrimState.values()) { state.setSurfaceColor(surface); state.setShadePanelColor(getShadePanelColor()); state.setNotificationScrimColor(getNotificationsScrimColor()); } mNeedsDrawableColorUpdate = true; } private int getNotificationsScrimColor() { return ShadeColors.notificationScrim(mContext, isBlurCurrentlySupported()); } private int getShadePanelColor() { return ShadeColors.shadePanel(mContext, isBlurCurrentlySupported()); } private void onThemeChanged() { updateThemeColors(); scheduleUpdate(); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java +123 −32 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import com.android.systemui.Flags; import com.android.systemui.dock.DockManager; import com.android.systemui.res.R; import com.android.systemui.scrim.ScrimView; import com.android.systemui.shade.ui.ShadeColors; import com.android.systemui.statusbar.notification.stack.StackStateAnimator; import kotlinx.coroutines.ExperimentalCoroutinesApi; Loading Loading @@ -90,8 +89,7 @@ public enum ScrimState { } if (Flags.notificationShadeBlur()) { mBehindTint = Color.TRANSPARENT; mNotifTint = ShadeColors.notificationScrim(mScrimBehind.getResources(), mIsBlurSupported.get()); mNotifTint = mNotificationScrimColor; mBehindAlpha = 0.0f; mNotifAlpha = 0.0f; mFrontAlpha = 0.0f; Loading @@ -106,7 +104,16 @@ public enum ScrimState { updateScrimColor(mScrimBehind, 1f /* alpha */, mBackgroundColor); } } } @Override public void setNotificationScrimColor(int notificationScrimColor) { super.setNotificationScrimColor(notificationScrimColor); if (Flags.notificationShadeBlur()) { // TODO(b/406208846): the keyguard scrims alpha need to be greater than 0.2. // They should be updated here as well. mNotifTint = mNotificationScrimColor; } } }, Loading Loading @@ -189,12 +196,10 @@ public enum ScrimState { @Override public void prepare(ScrimState previousState) { if (Flags.notificationShadeBlur()) { mBehindTint = ShadeColors.shadePanel(mScrimBehind.getResources(), mIsBlurSupported.get()); mBehindAlpha = Color.alpha(mBehindTint) / 255.0f; mNotifTint = ShadeColors.notificationScrim(mScrimBehind.getResources(), mIsBlurSupported.get()); mNotifAlpha = Color.alpha(mNotifTint) / 255.0f; mBehindTint = mShadePanelColor; mBehindAlpha = getColorAlpha(mBehindTint); mNotifTint = mNotificationScrimColor; mNotifAlpha = getColorAlpha(mNotifTint); mFrontAlpha = 0.0f; } else { if (Flags.bouncerUiRevamp()) { Loading @@ -216,6 +221,24 @@ public enum ScrimState { } } } @Override public void setShadePanelColor(int shadePanelColor) { super.setShadePanelColor(shadePanelColor); if (Flags.notificationShadeBlur()) { mBehindTint = mShadePanelColor; mBehindAlpha = getColorAlpha(mBehindTint); } } @Override public void setNotificationScrimColor(int notificationScrimColor) { super.setNotificationScrimColor(notificationScrimColor); if (Flags.notificationShadeBlur()) { mNotifTint = mNotificationScrimColor; mNotifAlpha = getColorAlpha(mNotifTint); } } }, /** Loading Loading @@ -321,12 +344,10 @@ public enum ScrimState { mBehindTint = mBackgroundColor; mBlankScreen = true; } else if (Flags.notificationShadeBlur()) { mBehindTint = ShadeColors.shadePanel(mScrimBehind.getResources(), mIsBlurSupported.get()); mBehindAlpha = Color.alpha(mBehindTint) / 255.0f; mNotifTint = ShadeColors.notificationScrim(mScrimBehind.getResources(), mIsBlurSupported.get()); mNotifAlpha = Color.alpha(mNotifTint) / 255.0f; mBehindTint = mShadePanelColor; mBehindAlpha = getColorAlpha(mBehindTint); mNotifTint = mNotificationScrimColor; mNotifAlpha = getColorAlpha(mNotifTint); mFrontAlpha = 0.0f; return; } Loading @@ -335,6 +356,24 @@ public enum ScrimState { updateScrimColor(mScrimBehind, 1f /* alpha */, mBackgroundColor); } } @Override public void setShadePanelColor(int shadePanelColor) { super.setShadePanelColor(shadePanelColor); if (Flags.notificationShadeBlur()) { mBehindTint = mShadePanelColor; mBehindAlpha = getColorAlpha(mBehindTint); } } @Override public void setNotificationScrimColor(int notificationScrimColor) { super.setNotificationScrimColor(notificationScrimColor); if (Flags.notificationShadeBlur()) { mNotifTint = mNotificationScrimColor; mNotifAlpha = getColorAlpha(mNotifTint); } } }, DREAMING { Loading @@ -343,12 +382,10 @@ public enum ScrimState { if (Flags.notificationShadeBlur()) { // Scrim parameters should match SHADE_LOCKED like other activities occluding // keyguard. mBehindTint = ShadeColors.shadePanel(mScrimBehind.getResources(), mIsBlurSupported.get()); mBehindAlpha = Color.alpha(mBehindTint) / 255.0f; mNotifTint = ShadeColors.notificationScrim(mScrimBehind.getResources(), mIsBlurSupported.get()); mNotifAlpha = Color.alpha(mNotifTint) / 255.0f; mBehindTint = mShadePanelColor; mBehindAlpha = getColorAlpha(mBehindTint); mNotifTint = mNotificationScrimColor; mNotifAlpha = getColorAlpha(mNotifTint); mFrontAlpha = 0.0f; } else { mFrontTint = Color.TRANSPARENT; Loading @@ -366,6 +403,24 @@ public enum ScrimState { } } } @Override public void setShadePanelColor(int shadePanelColor) { super.setShadePanelColor(shadePanelColor); if (Flags.notificationShadeBlur()) { mBehindTint = mShadePanelColor; mBehindAlpha = getColorAlpha(mBehindTint); } } @Override public void setNotificationScrimColor(int notificationScrimColor) { super.setNotificationScrimColor(notificationScrimColor); if (Flags.notificationShadeBlur()) { mNotifTint = mNotificationScrimColor; mNotifAlpha = getColorAlpha(mNotifTint); } } }, /** Loading @@ -379,8 +434,7 @@ public enum ScrimState { if (Flags.notificationShadeBlur()) { // Scrim parameters should match KEYGUARD as we're showing on top of keyguard. mBehindTint = Color.TRANSPARENT; mNotifTint = ShadeColors.notificationScrim(mScrimBehind.getResources(), mIsBlurSupported.get()); mNotifTint = mNotificationScrimColor; mBehindAlpha = 0.0f; mNotifAlpha = 0.0f; mFrontAlpha = 0.0f; Loading @@ -395,6 +449,14 @@ public enum ScrimState { mNotifTint = mClipQsScrim ? mBackgroundColor : Color.TRANSPARENT; } } @Override public void setNotificationScrimColor(int notificationScrimColor) { super.setNotificationScrimColor(notificationScrimColor); if (Flags.notificationShadeBlur()) { mNotifTint = mNotificationScrimColor; } } }, /** Loading @@ -410,12 +472,10 @@ public enum ScrimState { public void prepare(ScrimState previousState) { if (Flags.notificationShadeBlur()) { // Scrim parameters should match DREAM as hub is showing while on top of the dream. mBehindTint = ShadeColors.shadePanel(mScrimBehind.getResources(), mIsBlurSupported.get()); mBehindAlpha = Color.alpha(mBehindTint) / 255.0f; mNotifTint = ShadeColors.notificationScrim(mScrimBehind.getResources(), mIsBlurSupported.get()); mNotifAlpha = Color.alpha(mNotifTint) / 255.0f; mBehindTint = mShadePanelColor; mBehindAlpha = getColorAlpha(mBehindTint); mNotifTint = mNotificationScrimColor; mNotifAlpha = getColorAlpha(mNotifTint); mFrontAlpha = 0.0f; } else { // No scrims should be visible by default in this state. Loading @@ -428,6 +488,24 @@ public enum ScrimState { mNotifTint = mClipQsScrim ? mBackgroundColor : Color.TRANSPARENT; } } @Override public void setShadePanelColor(int shadePanelColor) { super.setShadePanelColor(shadePanelColor); if (Flags.notificationShadeBlur()) { mBehindTint = mShadePanelColor; mBehindAlpha = getColorAlpha(mBehindTint); } } @Override public void setNotificationScrimColor(int notificationScrimColor) { super.setNotificationScrimColor(notificationScrimColor); if (Flags.notificationShadeBlur()) { mNotifTint = mNotificationScrimColor; mNotifAlpha = getColorAlpha(mNotifTint); } } }; boolean mBlankScreen = false; Loading @@ -437,6 +515,9 @@ public enum ScrimState { int mNotifTint = Color.TRANSPARENT; int mSurfaceColor = Color.TRANSPARENT; int mShadePanelColor = Color.TRANSPARENT; int mNotificationScrimColor = Color.TRANSPARENT; boolean mAnimateChange = true; float mAodFrontScrimAlpha; float mFrontAlpha; Loading @@ -451,7 +532,6 @@ public enum ScrimState { DozeParameters mDozeParameters; DockManager mDockManager; boolean mDisplayRequiresBlanking; protected Supplier<Boolean> mIsBlurSupported; boolean mLaunchingAffordanceWithPreview; boolean mOccludeAnimationPlaying; boolean mWakeLockScreenSensorActive; Loading @@ -465,7 +545,7 @@ public enum ScrimState { protected float mNotifBlurRadius = 0.0f; public void init(ScrimView scrimInFront, ScrimView scrimBehind, DozeParameters dozeParameters, DockManager dockManager, Supplier<Boolean> isBlurSupported) { DockManager dockManager) { mBackgroundColor = scrimBehind.getContext().getColor(R.color.shade_scrim_background_dark); mScrimInFront = scrimInFront; mScrimBehind = scrimBehind; Loading @@ -473,7 +553,6 @@ public enum ScrimState { mDozeParameters = dozeParameters; mDockManager = dockManager; mDisplayRequiresBlanking = dozeParameters.getDisplayNeedsBlanking(); mIsBlurSupported = isBlurSupported; } /** Prepare state for transition. */ Loading Loading @@ -556,6 +635,14 @@ public enum ScrimState { mSurfaceColor = surfaceColor; } public void setShadePanelColor(int shadePanelColor) { mShadePanelColor = shadePanelColor; } public void setNotificationScrimColor(int notificationScrimColor) { mNotificationScrimColor = notificationScrimColor; } public void setLaunchingAffordanceWithPreview(boolean launchingAffordanceWithPreview) { mLaunchingAffordanceWithPreview = launchingAffordanceWithPreview; } Loading Loading @@ -588,4 +675,8 @@ public enum ScrimState { public void setNotifBlurRadius(float value) { mNotifBlurRadius = value; } private static float getColorAlpha(int color) { return Color.alpha(color) / 255.0f; } }