Merge "DO NOT MERGE Revert all scrim related changes in qpr" into qt-qpr1-dev
This commit is contained in:
@@ -44,7 +44,7 @@
|
|||||||
</com.android.systemui.statusbar.BackDropView>
|
</com.android.systemui.statusbar.BackDropView>
|
||||||
|
|
||||||
<com.android.systemui.statusbar.ScrimView
|
<com.android.systemui.statusbar.ScrimView
|
||||||
android:id="@+id/scrim_for_bubble"
|
android:id="@+id/scrim_behind"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:importantForAccessibility="no"
|
android:importantForAccessibility="no"
|
||||||
@@ -56,14 +56,6 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<com.android.systemui.statusbar.ScrimView
|
|
||||||
android:id="@+id/scrim_behind"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:importantForAccessibility="no"
|
|
||||||
sysui:ignoreRightInset="true"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<include layout="@layout/status_bar_expanded"
|
<include layout="@layout/status_bar_expanded"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|||||||
@@ -123,12 +123,11 @@ public class SystemUIFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ScrimController createScrimController(ScrimView scrimBehind, ScrimView scrimInFront,
|
public ScrimController createScrimController(ScrimView scrimBehind, ScrimView scrimInFront,
|
||||||
ScrimView scrimForBubble,
|
|
||||||
LockscreenWallpaper lockscreenWallpaper,
|
LockscreenWallpaper lockscreenWallpaper,
|
||||||
TriConsumer<ScrimState, Float, GradientColors> scrimStateListener,
|
TriConsumer<ScrimState, Float, GradientColors> scrimStateListener,
|
||||||
Consumer<Integer> scrimVisibleListener, DozeParameters dozeParameters,
|
Consumer<Integer> scrimVisibleListener, DozeParameters dozeParameters,
|
||||||
AlarmManager alarmManager, KeyguardMonitor keyguardMonitor) {
|
AlarmManager alarmManager, KeyguardMonitor keyguardMonitor) {
|
||||||
return new ScrimController(scrimBehind, scrimInFront, scrimForBubble, scrimStateListener,
|
return new ScrimController(scrimBehind, scrimInFront, scrimStateListener,
|
||||||
scrimVisibleListener, dozeParameters, alarmManager, keyguardMonitor);
|
scrimVisibleListener, dozeParameters, alarmManager, keyguardMonitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -316,9 +316,10 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
|
|||||||
if (mStackView == null) {
|
if (mStackView == null) {
|
||||||
mStackView = new BubbleStackView(mContext, mBubbleData, mSurfaceSynchronizer);
|
mStackView = new BubbleStackView(mContext, mBubbleData, mSurfaceSynchronizer);
|
||||||
ViewGroup sbv = mStatusBarWindowController.getStatusBarView();
|
ViewGroup sbv = mStatusBarWindowController.getStatusBarView();
|
||||||
int bubbleScrimIndex = sbv.indexOfChild(sbv.findViewById(R.id.scrim_for_bubble));
|
// TODO(b/130237686): When you expand the shade on top of expanded bubble, there is no
|
||||||
int stackIndex = bubbleScrimIndex + 1; // Show stack above bubble scrim.
|
// scrim between bubble and the shade
|
||||||
sbv.addView(mStackView, stackIndex,
|
int bubblePosition = sbv.indexOfChild(sbv.findViewById(R.id.scrim_behind)) + 1;
|
||||||
|
sbv.addView(mStackView, bubblePosition,
|
||||||
new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
|
new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
|
||||||
if (mExpandListener != null) {
|
if (mExpandListener != null) {
|
||||||
mStackView.setExpandListener(mExpandListener);
|
mStackView.setExpandListener(mExpandListener);
|
||||||
|
|||||||
@@ -604,7 +604,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
|
|||||||
*/
|
*/
|
||||||
public void onScrimVisibilityChanged(@ScrimVisibility int scrimsVisible) {
|
public void onScrimVisibilityChanged(@ScrimVisibility int scrimsVisible) {
|
||||||
if (mWakeAndUnlockRunning
|
if (mWakeAndUnlockRunning
|
||||||
&& scrimsVisible == ScrimController.TRANSPARENT) {
|
&& scrimsVisible == ScrimController.VISIBILITY_FULLY_TRANSPARENT) {
|
||||||
mWakeAndUnlockRunning = false;
|
mWakeAndUnlockRunning = false;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,24 +79,23 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
/**
|
/**
|
||||||
* When both scrims have 0 alpha.
|
* When both scrims have 0 alpha.
|
||||||
*/
|
*/
|
||||||
public static final int TRANSPARENT = 0;
|
public static final int VISIBILITY_FULLY_TRANSPARENT = 0;
|
||||||
/**
|
/**
|
||||||
* When scrims aren't transparent (alpha 0) but also not opaque (alpha 1.)
|
* When scrims aren't transparent (alpha 0) but also not opaque (alpha 1.)
|
||||||
*/
|
*/
|
||||||
public static final int SEMI_TRANSPARENT = 1;
|
public static final int VISIBILITY_SEMI_TRANSPARENT = 1;
|
||||||
/**
|
/**
|
||||||
* When at least 1 scrim is fully opaque (alpha set to 1.)
|
* When at least 1 scrim is fully opaque (alpha set to 1.)
|
||||||
*/
|
*/
|
||||||
public static final int OPAQUE = 2;
|
public static final int VISIBILITY_FULLY_OPAQUE = 2;
|
||||||
|
|
||||||
@IntDef(prefix = { "VISIBILITY_" }, value = {
|
@IntDef(prefix = { "VISIBILITY_" }, value = {
|
||||||
TRANSPARENT,
|
VISIBILITY_FULLY_TRANSPARENT,
|
||||||
SEMI_TRANSPARENT,
|
VISIBILITY_SEMI_TRANSPARENT,
|
||||||
OPAQUE
|
VISIBILITY_FULLY_OPAQUE
|
||||||
})
|
})
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface ScrimVisibility {
|
public @interface ScrimVisibility {}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default alpha value for most scrims.
|
* Default alpha value for most scrims.
|
||||||
@@ -124,11 +123,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
|
|
||||||
private ScrimState mState = ScrimState.UNINITIALIZED;
|
private ScrimState mState = ScrimState.UNINITIALIZED;
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
|
|
||||||
protected final ScrimView mScrimInFront;
|
|
||||||
protected final ScrimView mScrimBehind;
|
protected final ScrimView mScrimBehind;
|
||||||
protected final ScrimView mScrimForBubble;
|
protected final ScrimView mScrimInFront;
|
||||||
|
|
||||||
private final UnlockMethodCache mUnlockMethodCache;
|
private final UnlockMethodCache mUnlockMethodCache;
|
||||||
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
|
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
|
||||||
private final DozeParameters mDozeParameters;
|
private final DozeParameters mDozeParameters;
|
||||||
@@ -157,15 +153,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
private Runnable mOnAnimationFinished;
|
private Runnable mOnAnimationFinished;
|
||||||
private boolean mDeferFinishedListener;
|
private boolean mDeferFinishedListener;
|
||||||
private final Interpolator mInterpolator = new DecelerateInterpolator();
|
private final Interpolator mInterpolator = new DecelerateInterpolator();
|
||||||
|
private float mCurrentInFrontAlpha = NOT_INITIALIZED;
|
||||||
private float mInFrontAlpha = NOT_INITIALIZED;
|
private float mCurrentBehindAlpha = NOT_INITIALIZED;
|
||||||
private float mBehindAlpha = NOT_INITIALIZED;
|
private int mCurrentInFrontTint;
|
||||||
private float mBubbleAlpha = NOT_INITIALIZED;
|
private int mCurrentBehindTint;
|
||||||
|
|
||||||
private int mInFrontTint;
|
|
||||||
private int mBehindTint;
|
|
||||||
private int mBubbleTint;
|
|
||||||
|
|
||||||
private boolean mWallpaperVisibilityTimedOut;
|
private boolean mWallpaperVisibilityTimedOut;
|
||||||
private int mScrimsVisibility;
|
private int mScrimsVisibility;
|
||||||
private final TriConsumer<ScrimState, Float, GradientColors> mScrimStateListener;
|
private final TriConsumer<ScrimState, Float, GradientColors> mScrimStateListener;
|
||||||
@@ -184,17 +175,14 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
private boolean mWakeLockHeld;
|
private boolean mWakeLockHeld;
|
||||||
private boolean mKeyguardOccluded;
|
private boolean mKeyguardOccluded;
|
||||||
|
|
||||||
public ScrimController(ScrimView scrimBehind, ScrimView scrimInFront, ScrimView scrimForBubble,
|
public ScrimController(ScrimView scrimBehind, ScrimView scrimInFront,
|
||||||
TriConsumer<ScrimState, Float, GradientColors> scrimStateListener,
|
TriConsumer<ScrimState, Float, GradientColors> scrimStateListener,
|
||||||
Consumer<Integer> scrimVisibleListener, DozeParameters dozeParameters,
|
Consumer<Integer> scrimVisibleListener, DozeParameters dozeParameters,
|
||||||
AlarmManager alarmManager, KeyguardMonitor keyguardMonitor) {
|
AlarmManager alarmManager, KeyguardMonitor keyguardMonitor) {
|
||||||
mScrimBehind = scrimBehind;
|
mScrimBehind = scrimBehind;
|
||||||
mScrimInFront = scrimInFront;
|
mScrimInFront = scrimInFront;
|
||||||
mScrimForBubble = scrimForBubble;
|
|
||||||
|
|
||||||
mScrimStateListener = scrimStateListener;
|
mScrimStateListener = scrimStateListener;
|
||||||
mScrimVisibleListener = scrimVisibleListener;
|
mScrimVisibleListener = scrimVisibleListener;
|
||||||
|
|
||||||
mContext = scrimBehind.getContext();
|
mContext = scrimBehind.getContext();
|
||||||
mUnlockMethodCache = UnlockMethodCache.getInstance(mContext);
|
mUnlockMethodCache = UnlockMethodCache.getInstance(mContext);
|
||||||
mDarkenWhileDragging = !mUnlockMethodCache.canSkipBouncer();
|
mDarkenWhileDragging = !mUnlockMethodCache.canSkipBouncer();
|
||||||
@@ -225,13 +213,12 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
|
|
||||||
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);
|
||||||
states[i].setScrimBehindAlphaKeyguard(mScrimBehindAlphaKeyguard);
|
states[i].setScrimBehindAlphaKeyguard(mScrimBehindAlphaKeyguard);
|
||||||
}
|
}
|
||||||
|
|
||||||
mScrimBehind.setDefaultFocusHighlightEnabled(false);
|
mScrimBehind.setDefaultFocusHighlightEnabled(false);
|
||||||
mScrimInFront.setDefaultFocusHighlightEnabled(false);
|
mScrimInFront.setDefaultFocusHighlightEnabled(false);
|
||||||
mScrimForBubble.setDefaultFocusHighlightEnabled(false);
|
|
||||||
|
|
||||||
updateScrims();
|
updateScrims();
|
||||||
}
|
}
|
||||||
@@ -270,14 +257,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
mBlankScreen = state.getBlanksScreen();
|
mBlankScreen = state.getBlanksScreen();
|
||||||
mAnimateChange = state.getAnimateChange();
|
mAnimateChange = state.getAnimateChange();
|
||||||
mAnimationDuration = state.getAnimationDuration();
|
mAnimationDuration = state.getAnimationDuration();
|
||||||
|
mCurrentInFrontTint = state.getFrontTint();
|
||||||
mInFrontTint = state.getFrontTint();
|
mCurrentBehindTint = state.getBehindTint();
|
||||||
mBehindTint = state.getBehindTint();
|
mCurrentInFrontAlpha = state.getFrontAlpha();
|
||||||
mBubbleTint = state.getBubbleTint();
|
mCurrentBehindAlpha = state.getBehindAlpha();
|
||||||
|
|
||||||
mInFrontAlpha = state.getFrontAlpha();
|
|
||||||
mBehindAlpha = state.getBehindAlpha();
|
|
||||||
mBubbleAlpha = state.getBubbleAlpha();
|
|
||||||
applyExpansionToAlpha();
|
applyExpansionToAlpha();
|
||||||
|
|
||||||
// Scrim might acquire focus when user is navigating with a D-pad or a keyboard.
|
// Scrim might acquire focus when user is navigating with a D-pad or a keyboard.
|
||||||
@@ -410,20 +393,21 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
if (mExpansionFraction != fraction) {
|
if (mExpansionFraction != fraction) {
|
||||||
mExpansionFraction = fraction;
|
mExpansionFraction = fraction;
|
||||||
|
|
||||||
boolean relevantState = (mState == ScrimState.UNLOCKED
|
final boolean keyguardOrUnlocked = mState == ScrimState.UNLOCKED
|
||||||
|| mState == ScrimState.KEYGUARD
|
|| mState == ScrimState.KEYGUARD || mState == ScrimState.PULSING;
|
||||||
|| mState == ScrimState.PULSING
|
if (!keyguardOrUnlocked || !mExpansionAffectsAlpha) {
|
||||||
|| mState == ScrimState.BUBBLE_EXPANDED);
|
|
||||||
if (!(relevantState && mExpansionAffectsAlpha)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
applyExpansionToAlpha();
|
applyExpansionToAlpha();
|
||||||
|
|
||||||
if (mUpdatePending) {
|
if (mUpdatePending) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setOrAdaptCurrentAnimation(mScrimBehind);
|
setOrAdaptCurrentAnimation(mScrimBehind);
|
||||||
setOrAdaptCurrentAnimation(mScrimInFront);
|
setOrAdaptCurrentAnimation(mScrimInFront);
|
||||||
setOrAdaptCurrentAnimation(mScrimForBubble);
|
|
||||||
dispatchScrimState(mScrimBehind.getViewAlpha());
|
dispatchScrimState(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
|
||||||
@@ -437,10 +421,11 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setOrAdaptCurrentAnimation(View scrim) {
|
private void setOrAdaptCurrentAnimation(View scrim) {
|
||||||
float alpha = getCurrentScrimAlpha(scrim);
|
if (!isAnimating(scrim)) {
|
||||||
if (isAnimating(scrim)) {
|
updateScrimColor(scrim, getCurrentScrimAlpha(scrim), getCurrentScrimTint(scrim));
|
||||||
// Adapt current animation.
|
} else {
|
||||||
ValueAnimator previousAnimator = (ValueAnimator) scrim.getTag(TAG_KEY_ANIM);
|
ValueAnimator previousAnimator = (ValueAnimator) scrim.getTag(TAG_KEY_ANIM);
|
||||||
|
float alpha = getCurrentScrimAlpha(scrim);
|
||||||
float previousEndValue = (Float) scrim.getTag(TAG_END_ALPHA);
|
float previousEndValue = (Float) scrim.getTag(TAG_END_ALPHA);
|
||||||
float previousStartValue = (Float) scrim.getTag(TAG_START_ALPHA);
|
float previousStartValue = (Float) scrim.getTag(TAG_START_ALPHA);
|
||||||
float relativeDiff = alpha - previousEndValue;
|
float relativeDiff = alpha - previousEndValue;
|
||||||
@@ -448,9 +433,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
scrim.setTag(TAG_START_ALPHA, newStartValue);
|
scrim.setTag(TAG_START_ALPHA, newStartValue);
|
||||||
scrim.setTag(TAG_END_ALPHA, alpha);
|
scrim.setTag(TAG_END_ALPHA, alpha);
|
||||||
previousAnimator.setCurrentPlayTime(previousAnimator.getCurrentPlayTime());
|
previousAnimator.setCurrentPlayTime(previousAnimator.getCurrentPlayTime());
|
||||||
} else {
|
|
||||||
// Set animation.
|
|
||||||
updateScrimColor(scrim, alpha, getCurrentScrimTint(scrim));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,27 +441,27 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mState == ScrimState.UNLOCKED || mState == ScrimState.BUBBLE_EXPANDED) {
|
if (mState == ScrimState.UNLOCKED) {
|
||||||
// Darken scrim as you pull down the shade when unlocked
|
// Darken scrim as you pull down the shade when unlocked
|
||||||
float behindFraction = getInterpolatedFraction();
|
float behindFraction = getInterpolatedFraction();
|
||||||
behindFraction = (float) Math.pow(behindFraction, 0.8f);
|
behindFraction = (float) Math.pow(behindFraction, 0.8f);
|
||||||
mBehindAlpha = behindFraction * GRADIENT_SCRIM_ALPHA_BUSY;
|
mCurrentBehindAlpha = behindFraction * GRADIENT_SCRIM_ALPHA_BUSY;
|
||||||
mInFrontAlpha = 0;
|
mCurrentInFrontAlpha = 0;
|
||||||
} else if (mState == ScrimState.KEYGUARD || mState == ScrimState.PULSING) {
|
} else if (mState == ScrimState.KEYGUARD || mState == ScrimState.PULSING) {
|
||||||
// Either darken of make the scrim transparent when you
|
// Either darken of make the scrim transparent when you
|
||||||
// pull down the shade
|
// pull down the shade
|
||||||
float interpolatedFract = getInterpolatedFraction();
|
float interpolatedFract = getInterpolatedFraction();
|
||||||
float alphaBehind = mState.getBehindAlpha();
|
float alphaBehind = mState.getBehindAlpha();
|
||||||
if (mDarkenWhileDragging) {
|
if (mDarkenWhileDragging) {
|
||||||
mBehindAlpha = MathUtils.lerp(GRADIENT_SCRIM_ALPHA_BUSY, alphaBehind,
|
mCurrentBehindAlpha = MathUtils.lerp(GRADIENT_SCRIM_ALPHA_BUSY, alphaBehind,
|
||||||
interpolatedFract);
|
interpolatedFract);
|
||||||
mInFrontAlpha = mState.getFrontAlpha();
|
mCurrentInFrontAlpha = mState.getFrontAlpha();
|
||||||
} else {
|
} else {
|
||||||
mBehindAlpha = MathUtils.lerp(0 /* start */, alphaBehind,
|
mCurrentBehindAlpha = MathUtils.lerp(0 /* start */, alphaBehind,
|
||||||
interpolatedFract);
|
interpolatedFract);
|
||||||
mInFrontAlpha = mState.getFrontAlpha();
|
mCurrentInFrontAlpha = mState.getFrontAlpha();
|
||||||
}
|
}
|
||||||
mBehindTint = ColorUtils.blendARGB(ScrimState.BOUNCER.getBehindTint(),
|
mCurrentBehindTint = ColorUtils.blendARGB(ScrimState.BOUNCER.getBehindTint(),
|
||||||
mState.getBehindTint(), interpolatedFract);
|
mState.getBehindTint(), interpolatedFract);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -504,8 +486,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
*/
|
*/
|
||||||
public void setAodFrontScrimAlpha(float alpha) {
|
public void setAodFrontScrimAlpha(float alpha) {
|
||||||
if (((mState == ScrimState.AOD && mDozeParameters.getAlwaysOn())
|
if (((mState == ScrimState.AOD && mDozeParameters.getAlwaysOn())
|
||||||
|| mState == ScrimState.PULSING) && mInFrontAlpha != alpha) {
|
|| mState == ScrimState.PULSING) && mCurrentInFrontAlpha != alpha) {
|
||||||
mInFrontAlpha = alpha;
|
mCurrentInFrontAlpha = alpha;
|
||||||
updateScrims();
|
updateScrims();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -519,9 +501,9 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
*/
|
*/
|
||||||
public void prepareForGentleWakeUp() {
|
public void prepareForGentleWakeUp() {
|
||||||
if (mState == ScrimState.AOD && mDozeParameters.getAlwaysOn()) {
|
if (mState == ScrimState.AOD && mDozeParameters.getAlwaysOn()) {
|
||||||
mInFrontAlpha = 1f;
|
mCurrentInFrontAlpha = 1f;
|
||||||
mInFrontTint = Color.BLACK;
|
mCurrentInFrontTint = Color.BLACK;
|
||||||
mBehindTint = Color.BLACK;
|
mCurrentBehindTint = Color.BLACK;
|
||||||
mAnimateChange = false;
|
mAnimateChange = false;
|
||||||
updateScrims();
|
updateScrims();
|
||||||
mAnimateChange = true;
|
mAnimateChange = true;
|
||||||
@@ -539,8 +521,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
|
|
||||||
if (mState == ScrimState.PULSING) {
|
if (mState == ScrimState.PULSING) {
|
||||||
float newBehindAlpha = mState.getBehindAlpha();
|
float newBehindAlpha = mState.getBehindAlpha();
|
||||||
if (mBehindAlpha != newBehindAlpha) {
|
if (mCurrentBehindAlpha != newBehindAlpha) {
|
||||||
mBehindAlpha = newBehindAlpha;
|
mCurrentBehindAlpha = newBehindAlpha;
|
||||||
updateScrims();
|
updateScrims();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -562,11 +544,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
// Only animate scrim color if the scrim view is actually visible
|
// Only animate scrim color if the scrim view is actually visible
|
||||||
boolean animateScrimInFront = mScrimInFront.getViewAlpha() != 0 && !mBlankScreen;
|
boolean animateScrimInFront = mScrimInFront.getViewAlpha() != 0 && !mBlankScreen;
|
||||||
boolean animateScrimBehind = mScrimBehind.getViewAlpha() != 0 && !mBlankScreen;
|
boolean animateScrimBehind = mScrimBehind.getViewAlpha() != 0 && !mBlankScreen;
|
||||||
boolean animateScrimForBubble = mScrimForBubble.getViewAlpha() != 0 && !mBlankScreen;
|
|
||||||
|
|
||||||
mScrimInFront.setColors(mColors, animateScrimInFront);
|
mScrimInFront.setColors(mColors, animateScrimInFront);
|
||||||
mScrimBehind.setColors(mColors, animateScrimBehind);
|
mScrimBehind.setColors(mColors, animateScrimBehind);
|
||||||
mScrimForBubble.setColors(mColors, animateScrimForBubble);
|
|
||||||
|
|
||||||
// Calculate minimum scrim opacity for white or black text.
|
// Calculate minimum scrim opacity for white or black text.
|
||||||
int textColor = mColors.supportsDarkText() ? Color.BLACK : Color.WHITE;
|
int textColor = mColors.supportsDarkText() ? Color.BLACK : Color.WHITE;
|
||||||
@@ -585,13 +564,12 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
boolean occludedKeyguard = (mState == ScrimState.PULSING || mState == ScrimState.AOD)
|
boolean occludedKeyguard = (mState == ScrimState.PULSING || mState == ScrimState.AOD)
|
||||||
&& mKeyguardOccluded;
|
&& mKeyguardOccluded;
|
||||||
if (aodWallpaperTimeout || occludedKeyguard) {
|
if (aodWallpaperTimeout || occludedKeyguard) {
|
||||||
mBehindAlpha = 1;
|
mCurrentBehindAlpha = 1;
|
||||||
}
|
}
|
||||||
setScrimAlpha(mScrimInFront, mInFrontAlpha);
|
|
||||||
setScrimAlpha(mScrimBehind, mBehindAlpha);
|
setScrimInFrontAlpha(mCurrentInFrontAlpha);
|
||||||
setScrimAlpha(mScrimForBubble, mBubbleAlpha);
|
setScrimBehindAlpha(mCurrentBehindAlpha);
|
||||||
// The animation could have all already finished, let's call onFinished just in case
|
|
||||||
onFinished();
|
|
||||||
dispatchScrimsVisible();
|
dispatchScrimsVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -602,11 +580,11 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
private void dispatchScrimsVisible() {
|
private void dispatchScrimsVisible() {
|
||||||
final int currentScrimVisibility;
|
final int currentScrimVisibility;
|
||||||
if (mScrimInFront.getViewAlpha() == 1 || mScrimBehind.getViewAlpha() == 1) {
|
if (mScrimInFront.getViewAlpha() == 1 || mScrimBehind.getViewAlpha() == 1) {
|
||||||
currentScrimVisibility = OPAQUE;
|
currentScrimVisibility = VISIBILITY_FULLY_OPAQUE;
|
||||||
} else if (mScrimInFront.getViewAlpha() == 0 && mScrimBehind.getViewAlpha() == 0) {
|
} else if (mScrimInFront.getViewAlpha() == 0 && mScrimBehind.getViewAlpha() == 0) {
|
||||||
currentScrimVisibility = TRANSPARENT;
|
currentScrimVisibility = VISIBILITY_FULLY_TRANSPARENT;
|
||||||
} else {
|
} else {
|
||||||
currentScrimVisibility = SEMI_TRANSPARENT;
|
currentScrimVisibility = VISIBILITY_SEMI_TRANSPARENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mScrimsVisibility != currentScrimVisibility) {
|
if (mScrimsVisibility != currentScrimVisibility) {
|
||||||
@@ -627,6 +605,14 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setScrimBehindAlpha(float alpha) {
|
||||||
|
setScrimAlpha(mScrimBehind, alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setScrimInFrontAlpha(float alpha) {
|
||||||
|
setScrimAlpha(mScrimInFront, alpha);
|
||||||
|
}
|
||||||
|
|
||||||
private void setScrimAlpha(ScrimView scrim, float alpha) {
|
private void setScrimAlpha(ScrimView scrim, float alpha) {
|
||||||
if (alpha == 0f) {
|
if (alpha == 0f) {
|
||||||
scrim.setClickable(false);
|
scrim.setClickable(false);
|
||||||
@@ -637,26 +623,17 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
updateScrim(scrim, alpha);
|
updateScrim(scrim, alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getScrimName(ScrimView scrim) {
|
|
||||||
if (scrim == mScrimInFront) {
|
|
||||||
return "front_scrim";
|
|
||||||
} else if (scrim == mScrimBehind) {
|
|
||||||
return "back_scrim";
|
|
||||||
} else if (scrim == mScrimForBubble) {
|
|
||||||
return "bubble_scrim";
|
|
||||||
}
|
|
||||||
return "unknown_scrim";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateScrimColor(View scrim, float alpha, int tint) {
|
private void updateScrimColor(View scrim, float alpha, int tint) {
|
||||||
alpha = Math.max(0, Math.min(1.0f, alpha));
|
alpha = Math.max(0, Math.min(1.0f, alpha));
|
||||||
if (scrim instanceof ScrimView) {
|
if (scrim instanceof ScrimView) {
|
||||||
ScrimView scrimView = (ScrimView) scrim;
|
ScrimView scrimView = (ScrimView) scrim;
|
||||||
|
|
||||||
Trace.traceCounter(Trace.TRACE_TAG_APP, getScrimName(scrimView) + "_alpha",
|
Trace.traceCounter(Trace.TRACE_TAG_APP,
|
||||||
|
scrim == mScrimInFront ? "front_scrim_alpha" : "back_scrim_alpha",
|
||||||
(int) (alpha * 255));
|
(int) (alpha * 255));
|
||||||
|
|
||||||
Trace.traceCounter(Trace.TRACE_TAG_APP, getScrimName(scrimView) + "_tint",
|
Trace.traceCounter(Trace.TRACE_TAG_APP,
|
||||||
|
scrim == mScrimInFront ? "front_scrim_tint" : "back_scrim_tint",
|
||||||
Color.alpha(tint));
|
Color.alpha(tint));
|
||||||
|
|
||||||
scrimView.setTint(tint);
|
scrimView.setTint(tint);
|
||||||
@@ -690,9 +667,9 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animator animation) {
|
public void onAnimationEnd(Animator animation) {
|
||||||
scrim.setTag(TAG_KEY_ANIM, null);
|
|
||||||
onFinished(lastCallback);
|
onFinished(lastCallback);
|
||||||
|
|
||||||
|
scrim.setTag(TAG_KEY_ANIM, null);
|
||||||
dispatchScrimsVisible();
|
dispatchScrimsVisible();
|
||||||
|
|
||||||
if (!mDeferFinishedListener && mOnAnimationFinished != null) {
|
if (!mDeferFinishedListener && mOnAnimationFinished != null) {
|
||||||
@@ -713,11 +690,9 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
|
|
||||||
private float getCurrentScrimAlpha(View scrim) {
|
private float getCurrentScrimAlpha(View scrim) {
|
||||||
if (scrim == mScrimInFront) {
|
if (scrim == mScrimInFront) {
|
||||||
return mInFrontAlpha;
|
return mCurrentInFrontAlpha;
|
||||||
} else if (scrim == mScrimBehind) {
|
} else if (scrim == mScrimBehind) {
|
||||||
return mBehindAlpha;
|
return mCurrentBehindAlpha;
|
||||||
} else if (scrim == mScrimForBubble) {
|
|
||||||
return mBubbleAlpha;
|
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Unknown scrim view");
|
throw new IllegalArgumentException("Unknown scrim view");
|
||||||
}
|
}
|
||||||
@@ -725,11 +700,9 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
|
|
||||||
private int getCurrentScrimTint(View scrim) {
|
private int getCurrentScrimTint(View scrim) {
|
||||||
if (scrim == mScrimInFront) {
|
if (scrim == mScrimInFront) {
|
||||||
return mInFrontTint;
|
return mCurrentInFrontTint;
|
||||||
} else if (scrim == mScrimBehind) {
|
} else if (scrim == mScrimBehind) {
|
||||||
return mBehindTint;
|
return mCurrentBehindTint;
|
||||||
} else if (scrim == mScrimForBubble) {
|
|
||||||
return mBubbleTint;
|
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Unknown scrim view");
|
throw new IllegalArgumentException("Unknown scrim view");
|
||||||
}
|
}
|
||||||
@@ -756,16 +729,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onFinished(Callback callback) {
|
private void onFinished(Callback callback) {
|
||||||
if (isAnimating(mScrimBehind)
|
|
||||||
|| isAnimating(mScrimInFront)
|
|
||||||
|| isAnimating(mScrimForBubble)) {
|
|
||||||
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
|
|
||||||
callback.onFinished();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (mWakeLockHeld) {
|
if (mWakeLockHeld) {
|
||||||
mWakeLock.release(TAG);
|
mWakeLock.release(TAG);
|
||||||
mWakeLockHeld = false;
|
mWakeLockHeld = false;
|
||||||
@@ -782,12 +745,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
// When unlocking with fingerprint, we'll fade the scrims from black to transparent.
|
// When unlocking with fingerprint, we'll fade the scrims from black to transparent.
|
||||||
// At the end of the animation we need to remove the tint.
|
// At the end of the animation we need to remove the tint.
|
||||||
if (mState == ScrimState.UNLOCKED) {
|
if (mState == ScrimState.UNLOCKED) {
|
||||||
mInFrontTint = Color.TRANSPARENT;
|
mCurrentInFrontTint = Color.TRANSPARENT;
|
||||||
mBehindTint = Color.TRANSPARENT;
|
mCurrentBehindTint = Color.TRANSPARENT;
|
||||||
mBubbleTint = Color.TRANSPARENT;
|
|
||||||
updateScrimColor(mScrimInFront, mInFrontAlpha, mInFrontTint);
|
|
||||||
updateScrimColor(mScrimBehind, mBehindAlpha, mBehindTint);
|
|
||||||
updateScrimColor(mScrimForBubble, mBubbleAlpha, mBubbleTint);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -846,7 +805,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
} else {
|
} else {
|
||||||
// update the alpha directly
|
// update the alpha directly
|
||||||
updateScrimColor(scrim, alpha, getCurrentScrimTint(scrim));
|
updateScrimColor(scrim, alpha, getCurrentScrimTint(scrim));
|
||||||
|
onFinished();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
onFinished();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -889,7 +851,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes a callback after the frame has hit the display.
|
* Executes a callback after the frame has hit the display.
|
||||||
*
|
|
||||||
* @param callback What to run.
|
* @param callback What to run.
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@@ -933,35 +894,16 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
@Override
|
@Override
|
||||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||||
pw.println(" ScrimController: ");
|
pw.println(" ScrimController: ");
|
||||||
pw.print(" state: ");
|
pw.print(" state: "); pw.println(mState);
|
||||||
pw.println(mState);
|
pw.print(" frontScrim:"); pw.print(" viewAlpha="); pw.print(mScrimInFront.getViewAlpha());
|
||||||
|
pw.print(" alpha="); pw.print(mCurrentInFrontAlpha);
|
||||||
|
pw.print(" tint=0x"); pw.println(Integer.toHexString(mScrimInFront.getTint()));
|
||||||
|
|
||||||
pw.print(" frontScrim:");
|
pw.print(" backScrim:"); pw.print(" viewAlpha="); pw.print(mScrimBehind.getViewAlpha());
|
||||||
pw.print(" viewAlpha=");
|
pw.print(" alpha="); pw.print(mCurrentBehindAlpha);
|
||||||
pw.print(mScrimInFront.getViewAlpha());
|
pw.print(" tint=0x"); pw.println(Integer.toHexString(mScrimBehind.getTint()));
|
||||||
pw.print(" alpha=");
|
|
||||||
pw.print(mInFrontAlpha);
|
|
||||||
pw.print(" tint=0x");
|
|
||||||
pw.println(Integer.toHexString(mScrimInFront.getTint()));
|
|
||||||
|
|
||||||
pw.print(" backScrim:");
|
pw.print(" mTracking="); pw.println(mTracking);
|
||||||
pw.print(" viewAlpha=");
|
|
||||||
pw.print(mScrimBehind.getViewAlpha());
|
|
||||||
pw.print(" alpha=");
|
|
||||||
pw.print(mBehindAlpha);
|
|
||||||
pw.print(" tint=0x");
|
|
||||||
pw.println(Integer.toHexString(mScrimBehind.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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWallpaperSupportsAmbientMode(boolean wallpaperSupportsAmbientMode) {
|
public void setWallpaperSupportsAmbientMode(boolean wallpaperSupportsAmbientMode) {
|
||||||
@@ -1008,8 +950,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
// in this case, back-scrim needs to be re-evaluated
|
// in this case, back-scrim needs to be re-evaluated
|
||||||
if (mState == ScrimState.AOD || mState == ScrimState.PULSING) {
|
if (mState == ScrimState.AOD || mState == ScrimState.PULSING) {
|
||||||
float newBehindAlpha = mState.getBehindAlpha();
|
float newBehindAlpha = mState.getBehindAlpha();
|
||||||
if (mBehindAlpha != newBehindAlpha) {
|
if (mCurrentBehindAlpha != newBehindAlpha) {
|
||||||
mBehindAlpha = newBehindAlpha;
|
mCurrentBehindAlpha = newBehindAlpha;
|
||||||
updateScrims();
|
updateScrims();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1030,13 +972,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
public interface Callback {
|
public interface Callback {
|
||||||
default void onStart() {
|
default void onStart() {
|
||||||
}
|
}
|
||||||
|
|
||||||
default void onDisplayBlanked() {
|
default void onDisplayBlanked() {
|
||||||
}
|
}
|
||||||
|
|
||||||
default void onFinished() {
|
default void onFinished() {
|
||||||
}
|
}
|
||||||
|
|
||||||
default void onCancelled() {
|
default void onCancelled() {
|
||||||
}
|
}
|
||||||
/** Returns whether to timeout wallpaper or not. */
|
/** Returns whether to timeout wallpaper or not. */
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public enum ScrimState {
|
|||||||
* On the lock screen.
|
* On the lock screen.
|
||||||
*/
|
*/
|
||||||
KEYGUARD(0) {
|
KEYGUARD(0) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void prepare(ScrimState previousState) {
|
public void prepare(ScrimState previousState) {
|
||||||
mBlankScreen = false;
|
mBlankScreen = false;
|
||||||
@@ -52,13 +53,10 @@ public enum ScrimState {
|
|||||||
} else {
|
} else {
|
||||||
mAnimationDuration = ScrimController.ANIMATION_DURATION;
|
mAnimationDuration = ScrimController.ANIMATION_DURATION;
|
||||||
}
|
}
|
||||||
mFrontTint = Color.BLACK;
|
mCurrentInFrontTint = Color.BLACK;
|
||||||
mBehindTint = Color.BLACK;
|
mCurrentBehindTint = Color.BLACK;
|
||||||
mBubbleTint = Color.TRANSPARENT;
|
mCurrentBehindAlpha = mScrimBehindAlphaKeyguard;
|
||||||
|
mCurrentInFrontAlpha = 0;
|
||||||
mFrontAlpha = 0;
|
|
||||||
mBehindAlpha = mScrimBehindAlphaKeyguard;
|
|
||||||
mBubbleAlpha = 0;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -68,9 +66,8 @@ public enum ScrimState {
|
|||||||
BOUNCER(1) {
|
BOUNCER(1) {
|
||||||
@Override
|
@Override
|
||||||
public void prepare(ScrimState previousState) {
|
public void prepare(ScrimState previousState) {
|
||||||
mBehindAlpha = ScrimController.GRADIENT_SCRIM_ALPHA_BUSY;
|
mCurrentBehindAlpha = ScrimController.GRADIENT_SCRIM_ALPHA_BUSY;
|
||||||
mFrontAlpha = 0f;
|
mCurrentInFrontAlpha = 0f;
|
||||||
mBubbleAlpha = 0f;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -80,9 +77,8 @@ public enum ScrimState {
|
|||||||
BOUNCER_SCRIMMED(2) {
|
BOUNCER_SCRIMMED(2) {
|
||||||
@Override
|
@Override
|
||||||
public void prepare(ScrimState previousState) {
|
public void prepare(ScrimState previousState) {
|
||||||
mBehindAlpha = 0;
|
mCurrentBehindAlpha = 0;
|
||||||
mBubbleAlpha = 0f;
|
mCurrentInFrontAlpha = ScrimController.GRADIENT_SCRIM_ALPHA_BUSY;
|
||||||
mFrontAlpha = ScrimController.GRADIENT_SCRIM_ALPHA_BUSY;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -92,9 +88,8 @@ public enum ScrimState {
|
|||||||
BRIGHTNESS_MIRROR(3) {
|
BRIGHTNESS_MIRROR(3) {
|
||||||
@Override
|
@Override
|
||||||
public void prepare(ScrimState previousState) {
|
public void prepare(ScrimState previousState) {
|
||||||
mBehindAlpha = 0;
|
mCurrentBehindAlpha = 0;
|
||||||
mFrontAlpha = 0;
|
mCurrentInFrontAlpha = 0;
|
||||||
mBubbleAlpha = 0;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -106,16 +101,9 @@ public enum ScrimState {
|
|||||||
public void prepare(ScrimState previousState) {
|
public void prepare(ScrimState previousState) {
|
||||||
final boolean alwaysOnEnabled = mDozeParameters.getAlwaysOn();
|
final boolean alwaysOnEnabled = mDozeParameters.getAlwaysOn();
|
||||||
mBlankScreen = mDisplayRequiresBlanking;
|
mBlankScreen = mDisplayRequiresBlanking;
|
||||||
|
mCurrentInFrontAlpha = alwaysOnEnabled ? mAodFrontScrimAlpha : 1f;
|
||||||
mFrontTint = Color.BLACK;
|
mCurrentInFrontTint = Color.BLACK;
|
||||||
mFrontAlpha = alwaysOnEnabled ? mAodFrontScrimAlpha : 1f;
|
mCurrentBehindTint = Color.BLACK;
|
||||||
|
|
||||||
mBehindTint = Color.BLACK;
|
|
||||||
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,
|
// DisplayPowerManager may blank the screen for us,
|
||||||
// in this case we just need to set our state.
|
// in this case we just need to set our state.
|
||||||
@@ -139,10 +127,9 @@ public enum ScrimState {
|
|||||||
PULSING(5) {
|
PULSING(5) {
|
||||||
@Override
|
@Override
|
||||||
public void prepare(ScrimState previousState) {
|
public void prepare(ScrimState previousState) {
|
||||||
mFrontAlpha = mAodFrontScrimAlpha;
|
mCurrentInFrontAlpha = mAodFrontScrimAlpha;
|
||||||
mBubbleAlpha = 0f;
|
mCurrentBehindTint = Color.BLACK;
|
||||||
mBehindTint = Color.BLACK;
|
mCurrentInFrontTint = Color.BLACK;
|
||||||
mFrontTint = Color.BLACK;
|
|
||||||
mBlankScreen = mDisplayRequiresBlanking;
|
mBlankScreen = mDisplayRequiresBlanking;
|
||||||
mAnimationDuration = mWakeLockScreenSensorActive
|
mAnimationDuration = mWakeLockScreenSensorActive
|
||||||
? ScrimController.ANIMATION_DURATION_LONG : ScrimController.ANIMATION_DURATION;
|
? ScrimController.ANIMATION_DURATION_LONG : ScrimController.ANIMATION_DURATION;
|
||||||
@@ -167,33 +154,26 @@ public enum ScrimState {
|
|||||||
UNLOCKED(6) {
|
UNLOCKED(6) {
|
||||||
@Override
|
@Override
|
||||||
public void prepare(ScrimState previousState) {
|
public void prepare(ScrimState previousState) {
|
||||||
// State that UI will sync to.
|
mCurrentBehindAlpha = 0;
|
||||||
mBehindAlpha = 0;
|
mCurrentInFrontAlpha = 0;
|
||||||
mFrontAlpha = 0;
|
|
||||||
mBubbleAlpha = 0;
|
|
||||||
|
|
||||||
mAnimationDuration = mKeyguardFadingAway
|
mAnimationDuration = mKeyguardFadingAway
|
||||||
? mKeyguardFadingAwayDuration
|
? mKeyguardFadingAwayDuration
|
||||||
: StatusBar.FADE_KEYGUARD_DURATION;
|
: StatusBar.FADE_KEYGUARD_DURATION;
|
||||||
|
|
||||||
mAnimateChange = !mLaunchingAffordanceWithPreview;
|
mAnimateChange = !mLaunchingAffordanceWithPreview;
|
||||||
|
|
||||||
mFrontTint = Color.TRANSPARENT;
|
|
||||||
mBehindTint = Color.TRANSPARENT;
|
|
||||||
mBubbleTint = Color.TRANSPARENT;
|
|
||||||
mBlankScreen = false;
|
|
||||||
|
|
||||||
if (previousState == ScrimState.AOD) {
|
if (previousState == ScrimState.AOD) {
|
||||||
// Set all scrims black, before they fade transparent.
|
// Fade from black to transparent when coming directly from AOD
|
||||||
updateScrimColor(mScrimInFront, 1f /* alpha */, Color.BLACK /* tint */);
|
updateScrimColor(mScrimInFront, 1, Color.BLACK);
|
||||||
updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK /* tint */);
|
updateScrimColor(mScrimBehind, 1, Color.BLACK);
|
||||||
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;
|
mCurrentInFrontTint = Color.BLACK;
|
||||||
mBehindTint = Color.BLACK;
|
mCurrentBehindTint = Color.BLACK;
|
||||||
mBubbleTint = Color.BLACK;
|
|
||||||
mBlankScreen = true;
|
mBlankScreen = true;
|
||||||
|
} else {
|
||||||
|
mCurrentInFrontTint = Color.TRANSPARENT;
|
||||||
|
mCurrentBehindTint = Color.TRANSPARENT;
|
||||||
|
mBlankScreen = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -204,36 +184,25 @@ public enum ScrimState {
|
|||||||
BUBBLE_EXPANDED(7) {
|
BUBBLE_EXPANDED(7) {
|
||||||
@Override
|
@Override
|
||||||
public void prepare(ScrimState previousState) {
|
public void prepare(ScrimState previousState) {
|
||||||
mFrontTint = Color.TRANSPARENT;
|
mCurrentInFrontTint = Color.TRANSPARENT;
|
||||||
mBehindTint = Color.TRANSPARENT;
|
mCurrentBehindTint = Color.TRANSPARENT;
|
||||||
mBubbleTint = Color.TRANSPARENT;
|
|
||||||
|
|
||||||
mFrontAlpha = ScrimController.TRANSPARENT;
|
|
||||||
mBehindAlpha = ScrimController.GRADIENT_SCRIM_ALPHA_BUSY;
|
|
||||||
mBubbleAlpha = ScrimController.GRADIENT_SCRIM_ALPHA_BUSY;
|
|
||||||
|
|
||||||
mAnimationDuration = ScrimController.ANIMATION_DURATION;
|
mAnimationDuration = ScrimController.ANIMATION_DURATION;
|
||||||
|
mCurrentBehindAlpha = ScrimController.GRADIENT_SCRIM_ALPHA_BUSY;
|
||||||
mBlankScreen = false;
|
mBlankScreen = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
boolean mBlankScreen = false;
|
boolean mBlankScreen = false;
|
||||||
long mAnimationDuration = ScrimController.ANIMATION_DURATION;
|
long mAnimationDuration = ScrimController.ANIMATION_DURATION;
|
||||||
int mFrontTint = Color.TRANSPARENT;
|
int mCurrentInFrontTint = Color.TRANSPARENT;
|
||||||
int mBehindTint = Color.TRANSPARENT;
|
int mCurrentBehindTint = Color.TRANSPARENT;
|
||||||
int mBubbleTint = Color.TRANSPARENT;
|
|
||||||
|
|
||||||
boolean mAnimateChange = true;
|
boolean mAnimateChange = true;
|
||||||
|
float mCurrentInFrontAlpha;
|
||||||
|
float mCurrentBehindAlpha;
|
||||||
float mAodFrontScrimAlpha;
|
float mAodFrontScrimAlpha;
|
||||||
float mFrontAlpha;
|
|
||||||
float mBehindAlpha;
|
|
||||||
float mBubbleAlpha;
|
|
||||||
|
|
||||||
float mScrimBehindAlphaKeyguard;
|
float mScrimBehindAlphaKeyguard;
|
||||||
ScrimView mScrimInFront;
|
ScrimView mScrimInFront;
|
||||||
ScrimView mScrimBehind;
|
ScrimView mScrimBehind;
|
||||||
ScrimView mScrimForBubble;
|
|
||||||
|
|
||||||
DozeParameters mDozeParameters;
|
DozeParameters mDozeParameters;
|
||||||
boolean mDisplayRequiresBlanking;
|
boolean mDisplayRequiresBlanking;
|
||||||
boolean mWallpaperSupportsAmbientMode;
|
boolean mWallpaperSupportsAmbientMode;
|
||||||
@@ -248,17 +217,13 @@ public enum ScrimState {
|
|||||||
mIndex = index;
|
mIndex = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(ScrimView scrimInFront, ScrimView scrimBehind, ScrimView scrimForBubble,
|
public void init(ScrimView scrimInFront, ScrimView scrimBehind, DozeParameters dozeParameters) {
|
||||||
DozeParameters dozeParameters) {
|
|
||||||
mScrimInFront = scrimInFront;
|
mScrimInFront = scrimInFront;
|
||||||
mScrimBehind = scrimBehind;
|
mScrimBehind = scrimBehind;
|
||||||
mScrimForBubble = scrimForBubble;
|
|
||||||
|
|
||||||
mDozeParameters = dozeParameters;
|
mDozeParameters = dozeParameters;
|
||||||
mDisplayRequiresBlanking = dozeParameters.getDisplayNeedsBlanking();
|
mDisplayRequiresBlanking = dozeParameters.getDisplayNeedsBlanking();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Prepare state for transition. */
|
|
||||||
public void prepare(ScrimState previousState) {
|
public void prepare(ScrimState previousState) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,27 +232,19 @@ public enum ScrimState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public float getFrontAlpha() {
|
public float getFrontAlpha() {
|
||||||
return mFrontAlpha;
|
return mCurrentInFrontAlpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getBehindAlpha() {
|
public float getBehindAlpha() {
|
||||||
return mBehindAlpha;
|
return mCurrentBehindAlpha;
|
||||||
}
|
|
||||||
|
|
||||||
public float getBubbleAlpha() {
|
|
||||||
return mBubbleAlpha;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFrontTint() {
|
public int getFrontTint() {
|
||||||
return mFrontTint;
|
return mCurrentInFrontTint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBehindTint() {
|
public int getBehindTint() {
|
||||||
return mBehindTint;
|
return mCurrentBehindTint;
|
||||||
}
|
|
||||||
|
|
||||||
public int getBubbleTint() {
|
|
||||||
return mBubbleTint;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getAnimationDuration() {
|
public long getAnimationDuration() {
|
||||||
|
|||||||
@@ -229,6 +229,7 @@ import com.android.systemui.statusbar.policy.UserInfoController;
|
|||||||
import com.android.systemui.statusbar.policy.UserInfoControllerImpl;
|
import com.android.systemui.statusbar.policy.UserInfoControllerImpl;
|
||||||
import com.android.systemui.statusbar.policy.UserSwitcherController;
|
import com.android.systemui.statusbar.policy.UserSwitcherController;
|
||||||
import com.android.systemui.statusbar.policy.ZenModeController;
|
import com.android.systemui.statusbar.policy.ZenModeController;
|
||||||
|
import com.android.systemui.tuner.TunerService;
|
||||||
import com.android.systemui.util.InjectionInflationController;
|
import com.android.systemui.util.InjectionInflationController;
|
||||||
import com.android.systemui.volume.VolumeComponent;
|
import com.android.systemui.volume.VolumeComponent;
|
||||||
|
|
||||||
@@ -811,7 +812,6 @@ public class StatusBar extends SystemUI implements DemoMode,
|
|||||||
// TODO: Deal with the ugliness that comes from having some of the statusbar broken out
|
// TODO: Deal with the ugliness that comes from having some of the statusbar broken out
|
||||||
// into fragments, but the rest here, it leaves some awkward lifecycle and whatnot.
|
// into fragments, but the rest here, it leaves some awkward lifecycle and whatnot.
|
||||||
mNotificationPanel = mStatusBarWindow.findViewById(R.id.notification_panel);
|
mNotificationPanel = mStatusBarWindow.findViewById(R.id.notification_panel);
|
||||||
|
|
||||||
mStackScroller = mStatusBarWindow.findViewById(R.id.notification_stack_scroller);
|
mStackScroller = mStatusBarWindow.findViewById(R.id.notification_stack_scroller);
|
||||||
mZenController.addCallback(this);
|
mZenController.addCallback(this);
|
||||||
NotificationListContainer notifListContainer = (NotificationListContainer) mStackScroller;
|
NotificationListContainer notifListContainer = (NotificationListContainer) mStackScroller;
|
||||||
@@ -932,10 +932,8 @@ public class StatusBar extends SystemUI implements DemoMode,
|
|||||||
|
|
||||||
ScrimView scrimBehind = mStatusBarWindow.findViewById(R.id.scrim_behind);
|
ScrimView scrimBehind = mStatusBarWindow.findViewById(R.id.scrim_behind);
|
||||||
ScrimView scrimInFront = mStatusBarWindow.findViewById(R.id.scrim_in_front);
|
ScrimView scrimInFront = mStatusBarWindow.findViewById(R.id.scrim_in_front);
|
||||||
ScrimView scrimForBubble = mStatusBarWindow.findViewById(R.id.scrim_for_bubble);
|
|
||||||
|
|
||||||
mScrimController = SystemUIFactory.getInstance().createScrimController(
|
mScrimController = SystemUIFactory.getInstance().createScrimController(
|
||||||
scrimBehind, scrimInFront, scrimForBubble, mLockscreenWallpaper,
|
scrimBehind, scrimInFront, mLockscreenWallpaper,
|
||||||
(state, alpha, color) -> mLightBarController.setScrimState(state, alpha, color),
|
(state, alpha, color) -> mLightBarController.setScrimState(state, alpha, color),
|
||||||
scrimsVisible -> {
|
scrimsVisible -> {
|
||||||
if (mStatusBarWindowController != null) {
|
if (mStatusBarWindowController != null) {
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ public class StatusBarWindowController implements Callback, Dumpable, Configurat
|
|||||||
}
|
}
|
||||||
|
|
||||||
final boolean scrimsOccludingWallpaper =
|
final boolean scrimsOccludingWallpaper =
|
||||||
state.scrimsVisibility == ScrimController.OPAQUE;
|
state.scrimsVisibility == ScrimController.VISIBILITY_FULLY_OPAQUE;
|
||||||
final boolean keyguardOrAod = state.keyguardShowing
|
final boolean keyguardOrAod = state.keyguardShowing
|
||||||
|| (state.dozing && mDozeParameters.getAlwaysOn());
|
|| (state.dozing && mDozeParameters.getAlwaysOn());
|
||||||
if (keyguardOrAod && !state.backdropShowing && !scrimsOccludingWallpaper) {
|
if (keyguardOrAod && !state.backdropShowing && !scrimsOccludingWallpaper) {
|
||||||
@@ -308,7 +308,7 @@ public class StatusBarWindowController implements Callback, Dumpable, Configurat
|
|||||||
return !state.forceCollapsed && (state.isKeyguardShowingAndNotOccluded()
|
return !state.forceCollapsed && (state.isKeyguardShowingAndNotOccluded()
|
||||||
|| state.panelVisible || state.keyguardFadingAway || state.bouncerShowing
|
|| state.panelVisible || state.keyguardFadingAway || state.bouncerShowing
|
||||||
|| state.headsUpShowing || state.bubblesShowing
|
|| state.headsUpShowing || state.bubblesShowing
|
||||||
|| state.scrimsVisibility != ScrimController.TRANSPARENT);
|
|| state.scrimsVisibility != ScrimController.VISIBILITY_FULLY_TRANSPARENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyFitsSystemWindows(State state) {
|
private void applyFitsSystemWindows(State state) {
|
||||||
|
|||||||
@@ -16,9 +16,9 @@
|
|||||||
|
|
||||||
package com.android.systemui.statusbar.phone;
|
package com.android.systemui.statusbar.phone;
|
||||||
|
|
||||||
import static com.android.systemui.statusbar.phone.ScrimController.OPAQUE;
|
import static com.android.systemui.statusbar.phone.ScrimController.VISIBILITY_FULLY_OPAQUE;
|
||||||
import static com.android.systemui.statusbar.phone.ScrimController.SEMI_TRANSPARENT;
|
import static com.android.systemui.statusbar.phone.ScrimController.VISIBILITY_FULLY_TRANSPARENT;
|
||||||
import static com.android.systemui.statusbar.phone.ScrimController.TRANSPARENT;
|
import static com.android.systemui.statusbar.phone.ScrimController.VISIBILITY_SEMI_TRANSPARENT;
|
||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
@@ -69,7 +69,6 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
private SynchronousScrimController mScrimController;
|
private SynchronousScrimController mScrimController;
|
||||||
private ScrimView mScrimBehind;
|
private ScrimView mScrimBehind;
|
||||||
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;
|
||||||
@@ -85,7 +84,6 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
public void setup() {
|
public void setup() {
|
||||||
mScrimBehind = spy(new ScrimView(getContext()));
|
mScrimBehind = spy(new ScrimView(getContext()));
|
||||||
mScrimInFront = new ScrimView(getContext());
|
mScrimInFront = new ScrimView(getContext());
|
||||||
mScrimForBubble = new ScrimView(getContext());
|
|
||||||
mWakeLock = mock(WakeLock.class);
|
mWakeLock = mock(WakeLock.class);
|
||||||
mAlarmManager = mock(AlarmManager.class);
|
mAlarmManager = mock(AlarmManager.class);
|
||||||
mAlwaysOnEnabled = true;
|
mAlwaysOnEnabled = true;
|
||||||
@@ -94,7 +92,6 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
when(mDozeParamenters.getAlwaysOn()).thenAnswer(invocation -> mAlwaysOnEnabled);
|
when(mDozeParamenters.getAlwaysOn()).thenAnswer(invocation -> mAlwaysOnEnabled);
|
||||||
when(mDozeParamenters.getDisplayNeedsBlanking()).thenReturn(true);
|
when(mDozeParamenters.getDisplayNeedsBlanking()).thenReturn(true);
|
||||||
mScrimController = new SynchronousScrimController(mScrimBehind, mScrimInFront,
|
mScrimController = new SynchronousScrimController(mScrimBehind, mScrimInFront,
|
||||||
mScrimForBubble,
|
|
||||||
(scrimState, scrimBehindAlpha, scrimInFrontColor) -> {
|
(scrimState, scrimBehindAlpha, scrimInFrontColor) -> {
|
||||||
mScrimState = scrimState;
|
mScrimState = scrimState;
|
||||||
mScrimBehindAlpha = scrimBehindAlpha;
|
mScrimBehindAlpha = scrimBehindAlpha;
|
||||||
@@ -117,28 +114,21 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
public void transitionToKeyguard() {
|
public void transitionToKeyguard() {
|
||||||
mScrimController.transitionTo(ScrimState.KEYGUARD);
|
mScrimController.transitionTo(ScrimState.KEYGUARD);
|
||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
|
// Front scrim should be transparent
|
||||||
assertScrimAlpha(TRANSPARENT /* front */,
|
// Back scrim should be visible without tint
|
||||||
SEMI_TRANSPARENT /* back */,
|
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_SEMI_TRANSPARENT);
|
||||||
TRANSPARENT /* bubble */);
|
assertScrimTint(mScrimBehind, true /* tinted */);
|
||||||
|
|
||||||
assertScrimTint(true /* front */,
|
|
||||||
true /* behind */,
|
|
||||||
false /* bubble */);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void transitionToAod_withRegularWallpaper() {
|
public void transitionToAod_withRegularWallpaper() {
|
||||||
mScrimController.transitionTo(ScrimState.AOD);
|
mScrimController.transitionTo(ScrimState.AOD);
|
||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
|
// Front scrim should be transparent
|
||||||
assertScrimAlpha(TRANSPARENT /* front */,
|
// Back scrim should be visible with tint
|
||||||
OPAQUE /* back */,
|
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
|
||||||
TRANSPARENT /* bubble */);
|
assertScrimTint(mScrimBehind, true /* tinted */);
|
||||||
|
assertScrimTint(mScrimInFront, true /* tinted */);
|
||||||
assertScrimTint(true /* front */,
|
|
||||||
true /* behind */,
|
|
||||||
false /* bubble */);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -146,18 +136,14 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
mScrimController.setWallpaperSupportsAmbientMode(true);
|
mScrimController.setWallpaperSupportsAmbientMode(true);
|
||||||
mScrimController.transitionTo(ScrimState.AOD);
|
mScrimController.transitionTo(ScrimState.AOD);
|
||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
|
// Front scrim should be transparent
|
||||||
assertScrimAlpha(TRANSPARENT /* front */,
|
// Back scrim should be transparent
|
||||||
TRANSPARENT /* back */,
|
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_TRANSPARENT);
|
||||||
TRANSPARENT /* bubble */);
|
|
||||||
|
|
||||||
// Pulsing notification should conserve AOD wallpaper.
|
// Pulsing notification should conserve AOD wallpaper.
|
||||||
mScrimController.transitionTo(ScrimState.PULSING);
|
mScrimController.transitionTo(ScrimState.PULSING);
|
||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
|
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_TRANSPARENT);
|
||||||
assertScrimAlpha(TRANSPARENT /* front */,
|
|
||||||
TRANSPARENT /* back */,
|
|
||||||
TRANSPARENT /* bubble */);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -166,14 +152,11 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
mScrimController.setWallpaperSupportsAmbientMode(true);
|
mScrimController.setWallpaperSupportsAmbientMode(true);
|
||||||
mScrimController.transitionTo(ScrimState.AOD);
|
mScrimController.transitionTo(ScrimState.AOD);
|
||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
|
// Front scrim should be transparent
|
||||||
assertScrimAlpha(TRANSPARENT /* front */,
|
// Back scrim should be visible with tint
|
||||||
OPAQUE /* back */,
|
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
|
||||||
TRANSPARENT /* bubble */);
|
assertScrimTint(mScrimBehind, true /* tinted */);
|
||||||
|
assertScrimTint(mScrimInFront, true /* tinted */);
|
||||||
assertScrimTint(true /* front */,
|
|
||||||
true /* behind */,
|
|
||||||
false /* bubble */);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -183,14 +166,11 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
mScrimController.setHasBackdrop(true);
|
mScrimController.setHasBackdrop(true);
|
||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
|
// Front scrim should be transparent
|
||||||
assertScrimAlpha(TRANSPARENT /* front */,
|
// Back scrim should be visible with tint
|
||||||
OPAQUE /* back */,
|
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
|
||||||
TRANSPARENT /* bubble */);
|
assertScrimTint(mScrimBehind, true /* tinted */);
|
||||||
|
assertScrimTint(mScrimInFront, true /* tinted */);
|
||||||
assertScrimTint(true /* front */,
|
|
||||||
true /* behind */,
|
|
||||||
false /* bubble */);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -199,32 +179,27 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
mScrimController.transitionTo(ScrimState.KEYGUARD);
|
mScrimController.transitionTo(ScrimState.KEYGUARD);
|
||||||
mScrimController.setAodFrontScrimAlpha(0.5f);
|
mScrimController.setAodFrontScrimAlpha(0.5f);
|
||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
|
// Front scrim should be transparent
|
||||||
assertScrimAlpha(TRANSPARENT /* front */,
|
// Back scrim should be visible without tint
|
||||||
SEMI_TRANSPARENT /* back */,
|
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_SEMI_TRANSPARENT);
|
||||||
TRANSPARENT /* bubble */);
|
|
||||||
|
|
||||||
// ... but that it does take effect once we enter the AOD state.
|
// ... but that it does take effect once we enter the AOD state.
|
||||||
mScrimController.transitionTo(ScrimState.AOD);
|
mScrimController.transitionTo(ScrimState.AOD);
|
||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
assertScrimAlpha(SEMI_TRANSPARENT /* front */,
|
// Front scrim should be semi-transparent
|
||||||
OPAQUE /* back */,
|
// Back scrim should be visible
|
||||||
TRANSPARENT /* bubble */);
|
assertScrimVisibility(VISIBILITY_SEMI_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
|
||||||
|
|
||||||
// ... and that if we set it while we're in AOD, it does take immediate effect.
|
// ... and that if we set it while we're in AOD, it does take immediate effect.
|
||||||
mScrimController.setAodFrontScrimAlpha(1f);
|
mScrimController.setAodFrontScrimAlpha(1f);
|
||||||
assertScrimAlpha(OPAQUE /* front */,
|
assertScrimVisibility(VISIBILITY_FULLY_OPAQUE, VISIBILITY_FULLY_OPAQUE);
|
||||||
OPAQUE /* back */,
|
|
||||||
TRANSPARENT /* bubble */);
|
|
||||||
|
|
||||||
// ... and make sure we recall the previous front scrim alpha even if we transition away
|
// ... and make sure we recall the previous front scrim alpha even if we transition away
|
||||||
// for a bit.
|
// for a bit.
|
||||||
mScrimController.transitionTo(ScrimState.UNLOCKED);
|
mScrimController.transitionTo(ScrimState.UNLOCKED);
|
||||||
mScrimController.transitionTo(ScrimState.AOD);
|
mScrimController.transitionTo(ScrimState.AOD);
|
||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
assertScrimAlpha(OPAQUE /* front */,
|
assertScrimVisibility(VISIBILITY_FULLY_OPAQUE, VISIBILITY_FULLY_OPAQUE);
|
||||||
OPAQUE /* back */,
|
|
||||||
TRANSPARENT /* bubble */);
|
|
||||||
|
|
||||||
// ... and alpha updates should be completely ignored if always_on is off.
|
// ... and alpha updates should be completely ignored if always_on is off.
|
||||||
// Passing it forward would mess up the wake-up transition.
|
// Passing it forward would mess up the wake-up transition.
|
||||||
@@ -248,36 +223,27 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
mScrimController.setWallpaperSupportsAmbientMode(false);
|
mScrimController.setWallpaperSupportsAmbientMode(false);
|
||||||
mScrimController.transitionTo(ScrimState.AOD);
|
mScrimController.transitionTo(ScrimState.AOD);
|
||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
assertScrimAlpha(TRANSPARENT /* front */,
|
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
|
||||||
OPAQUE /* back */,
|
|
||||||
TRANSPARENT /* bubble */);
|
|
||||||
|
|
||||||
mScrimController.transitionTo(ScrimState.PULSING);
|
mScrimController.transitionTo(ScrimState.PULSING);
|
||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
// Front scrim should be transparent, but tinted
|
// Front scrim should be transparent, but tinted
|
||||||
// Back scrim should be semi-transparent so the user can see the wallpaper
|
// Back scrim should be semi-transparent so the user can see the wallpaper
|
||||||
// Pulse callback should have been invoked
|
// Pulse callback should have been invoked
|
||||||
assertScrimAlpha(TRANSPARENT /* front */,
|
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
|
||||||
OPAQUE /* back */,
|
assertScrimTint(mScrimBehind, true /* tinted */);
|
||||||
TRANSPARENT /* bubble */);
|
|
||||||
|
|
||||||
assertScrimTint(true /* front */,
|
|
||||||
true /* behind */,
|
|
||||||
false /* bubble */);
|
|
||||||
|
|
||||||
// ... and when ambient goes dark, front scrim should be semi-transparent
|
// ... and when ambient goes dark, front scrim should be semi-transparent
|
||||||
mScrimController.setAodFrontScrimAlpha(0.5f);
|
mScrimController.setAodFrontScrimAlpha(0.5f);
|
||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
// Front scrim should be semi-transparent
|
// Front scrim should be semi-transparent
|
||||||
assertScrimAlpha(SEMI_TRANSPARENT /* front */,
|
assertScrimVisibility(VISIBILITY_SEMI_TRANSPARENT /* front */,
|
||||||
OPAQUE /* back */,
|
VISIBILITY_FULLY_OPAQUE /* back */);
|
||||||
TRANSPARENT /* bubble */);
|
|
||||||
|
|
||||||
mScrimController.setWakeLockScreenSensorActive(true);
|
mScrimController.setWakeLockScreenSensorActive(true);
|
||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
assertScrimAlpha(SEMI_TRANSPARENT /* front */,
|
assertScrimVisibility(VISIBILITY_SEMI_TRANSPARENT /* front */,
|
||||||
SEMI_TRANSPARENT /* back */,
|
VISIBILITY_SEMI_TRANSPARENT /* back */);
|
||||||
TRANSPARENT /* bubble */);
|
|
||||||
|
|
||||||
// Reset value since enums are static.
|
// Reset value since enums are static.
|
||||||
mScrimController.setAodFrontScrimAlpha(0f);
|
mScrimController.setAodFrontScrimAlpha(0f);
|
||||||
@@ -289,13 +255,8 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
// Front scrim should be transparent
|
// Front scrim should be transparent
|
||||||
// Back scrim should be visible without tint
|
// Back scrim should be visible without tint
|
||||||
assertScrimAlpha(TRANSPARENT /* front */,
|
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_SEMI_TRANSPARENT);
|
||||||
SEMI_TRANSPARENT /* back */,
|
assertScrimTint(mScrimBehind, false /* tinted */);
|
||||||
TRANSPARENT /* bubble */);
|
|
||||||
|
|
||||||
assertScrimTint(false /* front */,
|
|
||||||
false /* behind */,
|
|
||||||
false /* bubble */);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -304,12 +265,8 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
// Front scrim should be transparent
|
// Front scrim should be transparent
|
||||||
// Back scrim should be visible without tint
|
// Back scrim should be visible without tint
|
||||||
assertScrimAlpha(SEMI_TRANSPARENT /* front */,
|
assertScrimVisibility(VISIBILITY_SEMI_TRANSPARENT, VISIBILITY_FULLY_TRANSPARENT);
|
||||||
TRANSPARENT /* back */,
|
assertScrimTint(mScrimBehind, false /* tinted */);
|
||||||
TRANSPARENT /* bubble */);
|
|
||||||
assertScrimTint(false /* front */,
|
|
||||||
false /* behind */,
|
|
||||||
false /* bubble */);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -317,19 +274,15 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
mScrimController.setPanelExpansion(0f);
|
mScrimController.setPanelExpansion(0f);
|
||||||
mScrimController.transitionTo(ScrimState.UNLOCKED);
|
mScrimController.transitionTo(ScrimState.UNLOCKED);
|
||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
assertScrimAlpha(TRANSPARENT /* front */,
|
// Front scrim should be transparent
|
||||||
TRANSPARENT /* back */,
|
// Back scrim should be transparent
|
||||||
TRANSPARENT /* bubble */);
|
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_TRANSPARENT);
|
||||||
|
assertScrimTint(mScrimBehind, false /* tinted */);
|
||||||
assertScrimTint(false /* front */,
|
assertScrimTint(mScrimInFront, false /* tinted */);
|
||||||
false /* behind */,
|
|
||||||
false /* bubble */);
|
|
||||||
|
|
||||||
// Back scrim should be visible after start dragging
|
// Back scrim should be visible after start dragging
|
||||||
mScrimController.setPanelExpansion(0.5f);
|
mScrimController.setPanelExpansion(0.5f);
|
||||||
assertScrimAlpha(TRANSPARENT /* front */,
|
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_SEMI_TRANSPARENT);
|
||||||
SEMI_TRANSPARENT /* back */,
|
|
||||||
TRANSPARENT /* bubble */);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -337,19 +290,12 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
mScrimController.transitionTo(ScrimState.BUBBLE_EXPANDED);
|
mScrimController.transitionTo(ScrimState.BUBBLE_EXPANDED);
|
||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
|
|
||||||
assertScrimTint(false /* front */,
|
|
||||||
false /* behind */,
|
|
||||||
false /* bubble */);
|
|
||||||
|
|
||||||
// Front scrim should be transparent
|
// Front scrim should be transparent
|
||||||
Assert.assertEquals(ScrimController.TRANSPARENT,
|
Assert.assertEquals(ScrimController.VISIBILITY_FULLY_TRANSPARENT,
|
||||||
mScrimInFront.getViewAlpha(), 0.0f);
|
mScrimInFront.getViewAlpha(), 0.0f);
|
||||||
// Back scrim should be visible
|
// Back scrim should be visible
|
||||||
Assert.assertEquals(ScrimController.GRADIENT_SCRIM_ALPHA_BUSY,
|
Assert.assertEquals(ScrimController.GRADIENT_SCRIM_ALPHA_BUSY,
|
||||||
mScrimBehind.getViewAlpha(), 0.0f);
|
mScrimBehind.getViewAlpha(), 0.0f);
|
||||||
// Bubble scrim should be visible
|
|
||||||
Assert.assertEquals(ScrimController.GRADIENT_SCRIM_ALPHA_BUSY,
|
|
||||||
mScrimBehind.getViewAlpha(), 0.0f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -418,23 +364,16 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
mScrimController.setPanelExpansion(0f);
|
mScrimController.setPanelExpansion(0f);
|
||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
mScrimController.transitionTo(ScrimState.UNLOCKED);
|
mScrimController.transitionTo(ScrimState.UNLOCKED);
|
||||||
|
// Immediately tinted after the transition starts
|
||||||
// Immediately tinted black after the transition starts
|
assertScrimTint(mScrimInFront, true /* tinted */);
|
||||||
assertScrimTint(true /* front */,
|
assertScrimTint(mScrimBehind, true /* tinted */);
|
||||||
true /* behind */,
|
|
||||||
true /* bubble */);
|
|
||||||
|
|
||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
|
// Front scrim should be transparent
|
||||||
// All scrims should be transparent at the end of fade transition.
|
// Back scrim should be transparent
|
||||||
assertScrimAlpha(TRANSPARENT /* front */,
|
// Neither scrims should be tinted anymore after the animation.
|
||||||
TRANSPARENT /* behind */,
|
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_TRANSPARENT);
|
||||||
TRANSPARENT /* bubble */);
|
assertScrimTint(mScrimInFront, false /* tinted */);
|
||||||
|
assertScrimTint(mScrimBehind, false /* tinted */);
|
||||||
// Make sure at the very end of the animation, we're reset to transparent
|
|
||||||
assertScrimTint(false /* front */,
|
|
||||||
false /* behind */,
|
|
||||||
false /* bubble */);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -449,11 +388,9 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
// Front scrim should be black in the middle of the transition
|
// Front scrim should be black in the middle of the transition
|
||||||
Assert.assertTrue("Scrim should be visible during transition. Alpha: "
|
Assert.assertTrue("Scrim should be visible during transition. Alpha: "
|
||||||
+ mScrimInFront.getViewAlpha(), mScrimInFront.getViewAlpha() > 0);
|
+ mScrimInFront.getViewAlpha(), mScrimInFront.getViewAlpha() > 0);
|
||||||
assertScrimTint(true /* front */,
|
assertScrimTint(mScrimInFront, true /* tinted */);
|
||||||
true /* behind */,
|
|
||||||
true /* bubble */);
|
|
||||||
Assert.assertSame("Scrim should be visible during transition.",
|
Assert.assertSame("Scrim should be visible during transition.",
|
||||||
mScrimVisibility, OPAQUE);
|
mScrimVisibility, VISIBILITY_FULLY_OPAQUE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
@@ -661,15 +598,11 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
mScrimController.setKeyguardOccluded(true);
|
mScrimController.setKeyguardOccluded(true);
|
||||||
mScrimController.transitionTo(ScrimState.AOD);
|
mScrimController.transitionTo(ScrimState.AOD);
|
||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
assertScrimAlpha(TRANSPARENT /* front */,
|
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
|
||||||
OPAQUE /* behind */,
|
|
||||||
TRANSPARENT /* bubble */);
|
|
||||||
|
|
||||||
mScrimController.transitionTo(ScrimState.PULSING);
|
mScrimController.transitionTo(ScrimState.PULSING);
|
||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
assertScrimAlpha(TRANSPARENT /* front */,
|
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
|
||||||
OPAQUE /* behind */,
|
|
||||||
TRANSPARENT /* bubble */);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -677,15 +610,11 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
mScrimController.setWallpaperSupportsAmbientMode(true);
|
mScrimController.setWallpaperSupportsAmbientMode(true);
|
||||||
mScrimController.transitionTo(ScrimState.AOD);
|
mScrimController.transitionTo(ScrimState.AOD);
|
||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
assertScrimAlpha(TRANSPARENT /* front */,
|
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_TRANSPARENT);
|
||||||
TRANSPARENT /* behind */,
|
|
||||||
TRANSPARENT /* bubble */);
|
|
||||||
|
|
||||||
mScrimController.setKeyguardOccluded(true);
|
mScrimController.setKeyguardOccluded(true);
|
||||||
mScrimController.finishAnimationsImmediately();
|
mScrimController.finishAnimationsImmediately();
|
||||||
assertScrimAlpha(TRANSPARENT /* front */,
|
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
|
||||||
OPAQUE /* behind */,
|
|
||||||
TRANSPARENT /* bubble */);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -724,68 +653,33 @@ 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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertScrimTint(boolean front, boolean behind, boolean bubble) {
|
private void assertScrimTint(ScrimView scrimView, boolean tinted) {
|
||||||
|
final boolean viewIsTinted = scrimView.getTint() != Color.TRANSPARENT;
|
||||||
|
final String name = scrimView == mScrimInFront ? "front" : "back";
|
||||||
Assert.assertEquals("Tint test failed at state " + mScrimController.getState()
|
Assert.assertEquals("Tint test failed at state " + mScrimController.getState()
|
||||||
+ " with scrim: " + getScrimName(mScrimInFront) + " and tint: "
|
+" with scrim: " + name + " and tint: " + Integer.toHexString(scrimView.getTint()),
|
||||||
+ Integer.toHexString(mScrimInFront.getTint()),
|
tinted, viewIsTinted);
|
||||||
front, mScrimInFront.getTint() != Color.TRANSPARENT);
|
|
||||||
|
|
||||||
Assert.assertEquals("Tint test failed at state " + mScrimController.getState()
|
|
||||||
+ " with scrim: " + getScrimName(mScrimBehind) + " and tint: "
|
|
||||||
+ Integer.toHexString(mScrimBehind.getTint()),
|
|
||||||
behind, mScrimBehind.getTint() != Color.TRANSPARENT);
|
|
||||||
|
|
||||||
Assert.assertEquals("Tint test failed at state " + mScrimController.getState()
|
|
||||||
+ " with scrim: " + getScrimName(mScrimForBubble) + " and tint: "
|
|
||||||
+ Integer.toHexString(mScrimForBubble.getTint()),
|
|
||||||
bubble, mScrimForBubble.getTint() != Color.TRANSPARENT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getScrimName(ScrimView scrim) {
|
private void assertScrimVisibility(int inFront, int behind) {
|
||||||
if (scrim == mScrimInFront) {
|
boolean inFrontVisible = inFront != ScrimController.VISIBILITY_FULLY_TRANSPARENT;
|
||||||
return "front";
|
boolean behindVisible = behind != ScrimController.VISIBILITY_FULLY_TRANSPARENT;
|
||||||
} else if (scrim == mScrimBehind) {
|
Assert.assertEquals("Unexpected front scrim visibility. Alpha is "
|
||||||
return "back";
|
+ mScrimInFront.getViewAlpha(), inFrontVisible, mScrimInFront.getViewAlpha() > 0);
|
||||||
} else if (scrim == mScrimForBubble) {
|
Assert.assertEquals("Unexpected back scrim visibility. Alpha is "
|
||||||
return "bubble";
|
+ mScrimBehind.getViewAlpha(), behindVisible, mScrimBehind.getViewAlpha() > 0);
|
||||||
}
|
|
||||||
return "unknown_scrim";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void assertScrimAlpha(int front, int behind, int bubble) {
|
|
||||||
// Check single scrim visibility.
|
|
||||||
Assert.assertEquals("Unexpected front scrim alpha: "
|
|
||||||
+ mScrimInFront.getViewAlpha(),
|
|
||||||
front != TRANSPARENT /* expected */,
|
|
||||||
mScrimInFront.getViewAlpha() > TRANSPARENT /* actual */);
|
|
||||||
|
|
||||||
Assert.assertEquals("Unexpected back scrim alpha: "
|
|
||||||
+ mScrimBehind.getViewAlpha(),
|
|
||||||
behind != TRANSPARENT /* expected */,
|
|
||||||
mScrimBehind.getViewAlpha() > TRANSPARENT /* actual */);
|
|
||||||
|
|
||||||
Assert.assertEquals(
|
|
||||||
"Unexpected bubble scrim alpha: "
|
|
||||||
+ mScrimForBubble.getViewAlpha(), /* message */
|
|
||||||
bubble != TRANSPARENT /* expected */,
|
|
||||||
mScrimForBubble.getViewAlpha() > TRANSPARENT /* actual */);
|
|
||||||
|
|
||||||
// Check combined scrim visibility.
|
|
||||||
final int visibility;
|
final int visibility;
|
||||||
if (front == OPAQUE || behind == OPAQUE || bubble == OPAQUE) {
|
if (inFront == VISIBILITY_FULLY_OPAQUE || behind == VISIBILITY_FULLY_OPAQUE) {
|
||||||
visibility = OPAQUE;
|
visibility = VISIBILITY_FULLY_OPAQUE;
|
||||||
} else if (front > TRANSPARENT || behind > TRANSPARENT || bubble > TRANSPARENT) {
|
} else if (inFront > VISIBILITY_FULLY_TRANSPARENT || behind > VISIBILITY_FULLY_TRANSPARENT) {
|
||||||
visibility = SEMI_TRANSPARENT;
|
visibility = VISIBILITY_SEMI_TRANSPARENT;
|
||||||
} else {
|
} else {
|
||||||
visibility = TRANSPARENT;
|
visibility = VISIBILITY_FULLY_TRANSPARENT;
|
||||||
}
|
}
|
||||||
Assert.assertEquals("Invalid visibility.",
|
Assert.assertEquals("Invalid visibility.", visibility, mScrimVisibility);
|
||||||
visibility /* expected */,
|
|
||||||
mScrimVisibility);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -797,12 +691,11 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
boolean mOnPreDrawCalled;
|
boolean mOnPreDrawCalled;
|
||||||
|
|
||||||
SynchronousScrimController(ScrimView scrimBehind, ScrimView scrimInFront,
|
SynchronousScrimController(ScrimView scrimBehind, ScrimView scrimInFront,
|
||||||
ScrimView scrimForBubble,
|
|
||||||
TriConsumer<ScrimState, Float, GradientColors> scrimStateListener,
|
TriConsumer<ScrimState, Float, GradientColors> scrimStateListener,
|
||||||
Consumer<Integer> scrimVisibleListener, DozeParameters dozeParameters,
|
Consumer<Integer> scrimVisibleListener, DozeParameters dozeParameters,
|
||||||
AlarmManager alarmManager, KeyguardMonitor keyguardMonitor) {
|
AlarmManager alarmManager, KeyguardMonitor keyguardMonitor) {
|
||||||
super(scrimBehind, scrimInFront, scrimForBubble, scrimStateListener,
|
super(scrimBehind, scrimInFront, scrimStateListener, scrimVisibleListener,
|
||||||
scrimVisibleListener, dozeParameters, alarmManager, keyguardMonitor);
|
dozeParameters, alarmManager, keyguardMonitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -820,7 +713,6 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
mLooper.processAllMessages();
|
mLooper.processAllMessages();
|
||||||
endAnimation(mScrimBehind, TAG_KEY_ANIM);
|
endAnimation(mScrimBehind, TAG_KEY_ANIM);
|
||||||
endAnimation(mScrimInFront, TAG_KEY_ANIM);
|
endAnimation(mScrimInFront, TAG_KEY_ANIM);
|
||||||
endAnimation(mScrimForBubble, TAG_KEY_ANIM);
|
|
||||||
|
|
||||||
if (!animationFinished[0]) {
|
if (!animationFinished[0]) {
|
||||||
throw new IllegalStateException("Animation never finished");
|
throw new IllegalStateException("Animation never finished");
|
||||||
@@ -858,7 +750,6 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Do not wait for a frame since we're in a test environment.
|
* Do not wait for a frame since we're in a test environment.
|
||||||
*
|
|
||||||
* @param callback What to execute.
|
* @param callback What to execute.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user