Merge "Synchronize and slow down fade in" into qt-r1-dev

This commit is contained in:
Lucas Dupin
2019-07-17 07:25:31 +00:00
committed by Android (Google) Code Review
7 changed files with 41 additions and 4 deletions

View File

@@ -50,9 +50,23 @@ public interface DozeHost {
*/
void onSlpiTap(float x, float y);
/**
* Artificially dim down the the display by changing scrim opacities.
* @param scrimOpacity opacity from 0 to 1.
*/
default void setAodDimmingScrim(float scrimOpacity) {}
/**
* Sets the actual display brightness.
* @param value from 0 to 255.
*/
void setDozeScreenBrightness(int value);
/**
* Makes scrims black and changes animation durations.
*/
default void prepareForGentleWakeUp() {}
void onIgnoreTouchWhilePulsing(boolean ignore);
/**

View File

@@ -82,7 +82,10 @@ public class DozeScreenState implements DozeMachine.Part {
boolean messagePending = mHandler.hasCallbacks(mApplyPendingScreenState);
boolean pulseEnding = oldState == DozeMachine.State.DOZE_PULSE_DONE
&& newState == DozeMachine.State.DOZE_AOD;
if (messagePending || oldState == DozeMachine.State.INITIALIZED || pulseEnding) {
boolean turningOn = (oldState == DozeMachine.State.DOZE_AOD_PAUSED
|| oldState == DozeMachine.State.DOZE) && newState == DozeMachine.State.DOZE_AOD;
boolean justInitialized = oldState == DozeMachine.State.INITIALIZED;
if (messagePending || justInitialized || pulseEnding || turningOn) {
// During initialization, we hide the navigation bar. That is however only applied after
// a traversal; setting the screen state here is immediate however, so it can happen
// that the screen turns on again before the navigation bar is hidden. To work around
@@ -91,7 +94,7 @@ public class DozeScreenState implements DozeMachine.Part {
// Delay screen state transitions even longer while animations are running.
boolean shouldDelayTransition = newState == DozeMachine.State.DOZE_AOD
&& mParameters.shouldControlScreenOff();
&& mParameters.shouldControlScreenOff() && !turningOn;
if (shouldDelayTransition) {
mWakeLock.setAcquired(true);

View File

@@ -201,7 +201,7 @@ public class DozeTriggers implements DozeMachine.Part {
// Let's prepare the display to wake-up by drawing black.
// This will cover the hardware wake-up sequence, where the display
// becomes black for a few frames.
mDozeHost.setAodDimmingScrim(255f);
mDozeHost.setAodDimmingScrim(1f);
}
mMachine.wakeUp();
}

View File

@@ -130,6 +130,7 @@ public class DozeUi implements DozeMachine.Part {
break;
case DOZE:
case DOZE_AOD_PAUSED:
mHost.prepareForGentleWakeUp();
unscheduleTimeTick();
break;
case DOZE_REQUEST_PULSE:

View File

@@ -486,6 +486,20 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
mState.AOD.setAodFrontScrimAlpha(alpha);
}
/**
* Set front scrim to black, cancelling animations, in order to prepare to fade them
* away once the display turns on.
*/
public void prepareForGentleWakeUp() {
if (mState == ScrimState.AOD && mDozeParameters.getAlwaysOn()) {
mCurrentInFrontAlpha = 1f;
mAnimateChange = false;
updateScrims();
mAnimateChange = true;
mAnimationDuration = ANIMATION_DURATION_LONG;
}
}
/**
* If the lock screen sensor is active.
*/

View File

@@ -4119,6 +4119,11 @@ public class StatusBar extends SystemUI implements DemoMode,
mScrimController.setAodFrontScrimAlpha(scrimOpacity);
}
@Override
public void prepareForGentleWakeUp() {
mScrimController.prepareForGentleWakeUp();
}
private void dispatchTap(View view, float x, float y) {
long now = SystemClock.elapsedRealtime();
dispatchTouchEvent(view, x, y, now, MotionEvent.ACTION_DOWN);

View File

@@ -155,7 +155,7 @@ public class DozeTriggersTest extends SysuiTestCase {
false /* sensorPerformedProxCheck */, 50 /* screenX */, 50 /* screenY */,
null /* rawValues */);
verify(mHost).setAodDimmingScrim(eq(255f));
verify(mHost).setAodDimmingScrim(eq(1f));
verify(mMachine).wakeUp();
}
}