Introduce scrim state for bubbles

When bubbles are expanded we'll want to put a scrim behind them, this
is the scrim state we'll use.

Super simple test to check that alpha / visibility state of scrims
are as expected

Test: atest frameworks/base/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
Bug: 111236845
Change-Id: I1ee8ff9e7ce35aae692cf75a912106255e0e9b5a
This commit is contained in:
Mady Mellor
2018-11-06 18:05:54 -08:00
parent 2f01ed9a2c
commit 0c333774c8
2 changed files with 27 additions and 0 deletions

View File

@@ -186,6 +186,20 @@ public enum ScrimState {
mBlankScreen = false;
}
}
},
/**
* Unlocked with a bubble expanded.
*/
BUBBLE_EXPANDED(7) {
@Override
public void prepare(ScrimState previousState) {
mCurrentInFrontTint = Color.TRANSPARENT;
mCurrentBehindTint = Color.TRANSPARENT;
mAnimationDuration = ScrimController.ANIMATION_DURATION;
mCurrentBehindAlpha = ScrimController.GRADIENT_SCRIM_ALPHA_BUSY;
mBlankScreen = false;
}
};
boolean mBlankScreen = false;

View File

@@ -262,6 +262,19 @@ public class ScrimControllerTest extends SysuiTestCase {
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_SEMI_TRANSPARENT);
}
@Test
public void transitionToBubbleExpanded() {
mScrimController.transitionTo(ScrimState.BUBBLE_EXPANDED);
mScrimController.finishAnimationsImmediately();
// Front scrim should be transparent
Assert.assertEquals(ScrimController.VISIBILITY_FULLY_TRANSPARENT,
mScrimInFront.getViewAlpha(), 0.0f);
// Back scrim should be visible
Assert.assertEquals(ScrimController.GRADIENT_SCRIM_ALPHA_BUSY,
mScrimBehind.getViewAlpha(), 0.0f);
}
@Test
public void scrimStateCallback() {
mScrimController.transitionTo(ScrimState.UNLOCKED);