Merge "Don't set screen state until boot is completed" into tm-qpr-dev am: 63d87dcbe9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21264319 Change-Id: I6759dc8660d40a72f29716b51f7db7b737f6b7a2 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -434,6 +434,8 @@ public final class DisplayManagerService extends SystemService {
|
|||||||
private boolean mIsDocked;
|
private boolean mIsDocked;
|
||||||
private boolean mIsDreaming;
|
private boolean mIsDreaming;
|
||||||
|
|
||||||
|
private boolean mBootCompleted = false;
|
||||||
|
|
||||||
private final BroadcastReceiver mIdleModeReceiver = new BroadcastReceiver() {
|
private final BroadcastReceiver mIdleModeReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
@@ -573,6 +575,12 @@ public final class DisplayManagerService extends SystemService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (phase == PHASE_BOOT_COMPLETED) {
|
} else if (phase == PHASE_BOOT_COMPLETED) {
|
||||||
|
synchronized (mSyncRoot) {
|
||||||
|
mBootCompleted = true;
|
||||||
|
for (int i = 0; i < mDisplayPowerControllers.size(); i++) {
|
||||||
|
mDisplayPowerControllers.valueAt(i).onBootCompleted();
|
||||||
|
}
|
||||||
|
}
|
||||||
mDisplayModeDirector.onBootCompleted();
|
mDisplayModeDirector.onBootCompleted();
|
||||||
mLogicalDisplayMapper.onBootCompleted();
|
mLogicalDisplayMapper.onBootCompleted();
|
||||||
}
|
}
|
||||||
@@ -2700,7 +2708,7 @@ public final class DisplayManagerService extends SystemService {
|
|||||||
final DisplayPowerController displayPowerController = new DisplayPowerController(
|
final DisplayPowerController displayPowerController = new DisplayPowerController(
|
||||||
mContext, mDisplayPowerCallbacks, mPowerHandler, mSensorManager,
|
mContext, mDisplayPowerCallbacks, mPowerHandler, mSensorManager,
|
||||||
mDisplayBlanker, display, mBrightnessTracker, brightnessSetting,
|
mDisplayBlanker, display, mBrightnessTracker, brightnessSetting,
|
||||||
() -> handleBrightnessChange(display), hbmMetadata);
|
() -> handleBrightnessChange(display), hbmMetadata, mBootCompleted);
|
||||||
mDisplayPowerControllers.append(display.getDisplayIdLocked(), displayPowerController);
|
mDisplayPowerControllers.append(display.getDisplayIdLocked(), displayPowerController);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
|||||||
private static final int MSG_BRIGHTNESS_RAMP_DONE = 12;
|
private static final int MSG_BRIGHTNESS_RAMP_DONE = 12;
|
||||||
private static final int MSG_STATSD_HBM_BRIGHTNESS = 13;
|
private static final int MSG_STATSD_HBM_BRIGHTNESS = 13;
|
||||||
private static final int MSG_SWITCH_USER = 14;
|
private static final int MSG_SWITCH_USER = 14;
|
||||||
|
private static final int MSG_BOOT_COMPLETED = 15;
|
||||||
|
|
||||||
private static final int PROXIMITY_UNKNOWN = -1;
|
private static final int PROXIMITY_UNKNOWN = -1;
|
||||||
private static final int PROXIMITY_NEGATIVE = 0;
|
private static final int PROXIMITY_NEGATIVE = 0;
|
||||||
@@ -506,6 +507,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
|||||||
private boolean mIsEnabled;
|
private boolean mIsEnabled;
|
||||||
private boolean mIsInTransition;
|
private boolean mIsInTransition;
|
||||||
|
|
||||||
|
private boolean mBootCompleted;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the display power controller.
|
* Creates the display power controller.
|
||||||
*/
|
*/
|
||||||
@@ -513,7 +516,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
|||||||
DisplayPowerCallbacks callbacks, Handler handler,
|
DisplayPowerCallbacks callbacks, Handler handler,
|
||||||
SensorManager sensorManager, DisplayBlanker blanker, LogicalDisplay logicalDisplay,
|
SensorManager sensorManager, DisplayBlanker blanker, LogicalDisplay logicalDisplay,
|
||||||
BrightnessTracker brightnessTracker, BrightnessSetting brightnessSetting,
|
BrightnessTracker brightnessTracker, BrightnessSetting brightnessSetting,
|
||||||
Runnable onBrightnessChangeRunnable, HighBrightnessModeMetadata hbmMetadata) {
|
Runnable onBrightnessChangeRunnable, HighBrightnessModeMetadata hbmMetadata,
|
||||||
|
boolean bootCompleted) {
|
||||||
mLogicalDisplay = logicalDisplay;
|
mLogicalDisplay = logicalDisplay;
|
||||||
mDisplayId = mLogicalDisplay.getDisplayIdLocked();
|
mDisplayId = mLogicalDisplay.getDisplayIdLocked();
|
||||||
final String displayIdStr = "[" + mDisplayId + "]";
|
final String displayIdStr = "[" + mDisplayId + "]";
|
||||||
@@ -655,6 +659,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
|||||||
mTemporaryAutoBrightnessAdjustment = PowerManager.BRIGHTNESS_INVALID_FLOAT;
|
mTemporaryAutoBrightnessAdjustment = PowerManager.BRIGHTNESS_INVALID_FLOAT;
|
||||||
mPendingAutoBrightnessAdjustment = PowerManager.BRIGHTNESS_INVALID_FLOAT;
|
mPendingAutoBrightnessAdjustment = PowerManager.BRIGHTNESS_INVALID_FLOAT;
|
||||||
|
|
||||||
|
mBootCompleted = bootCompleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyReduceBrightColorsSplineAdjustment() {
|
private void applyReduceBrightColorsSplineAdjustment() {
|
||||||
@@ -1370,7 +1375,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
|||||||
|
|
||||||
// Initialize things the first time the power state is changed.
|
// Initialize things the first time the power state is changed.
|
||||||
if (mustInitialize) {
|
if (mustInitialize) {
|
||||||
initialize(state);
|
initialize(readyToUpdateDisplayState() ? state : Display.STATE_UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Animate the screen state change unless already animating.
|
// Animate the screen state change unless already animating.
|
||||||
@@ -2050,7 +2055,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!reportOnly && mPowerState.getScreenState() != state) {
|
if (!reportOnly && mPowerState.getScreenState() != state
|
||||||
|
&& readyToUpdateDisplayState()) {
|
||||||
Trace.traceCounter(Trace.TRACE_TAG_POWER, "ScreenState", state);
|
Trace.traceCounter(Trace.TRACE_TAG_POWER, "ScreenState", state);
|
||||||
// TODO(b/153319140) remove when we can get this from the above trace invocation
|
// TODO(b/153319140) remove when we can get this from the above trace invocation
|
||||||
SystemProperties.set("debug.tracing.screen_state", String.valueOf(state));
|
SystemProperties.set("debug.tracing.screen_state", String.valueOf(state));
|
||||||
@@ -2497,6 +2503,10 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
|||||||
mBrightnessSetting.setBrightness(brightnessValue);
|
mBrightnessSetting.setBrightness(brightnessValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onBootCompleted() {
|
||||||
|
mHandler.obtainMessage(MSG_BOOT_COMPLETED).sendToTarget();
|
||||||
|
}
|
||||||
|
|
||||||
private void updateScreenBrightnessSetting(float brightnessValue) {
|
private void updateScreenBrightnessSetting(float brightnessValue) {
|
||||||
if (!isValidBrightnessValue(brightnessValue)
|
if (!isValidBrightnessValue(brightnessValue)
|
||||||
|| brightnessValue == mCurrentScreenBrightnessSetting) {
|
|| brightnessValue == mCurrentScreenBrightnessSetting) {
|
||||||
@@ -2642,6 +2652,17 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether the display state is ready to update. If this is the default display, we
|
||||||
|
* want to update it right away so that we can draw the boot animation on it. If it is not
|
||||||
|
* the default display, drawing the boot animation on it would look incorrect, so we need
|
||||||
|
* to wait until boot is completed.
|
||||||
|
* @return True if the display state is ready to update
|
||||||
|
*/
|
||||||
|
private boolean readyToUpdateDisplayState() {
|
||||||
|
return mDisplayId == Display.DEFAULT_DISPLAY || mBootCompleted;
|
||||||
|
}
|
||||||
|
|
||||||
public void dump(final PrintWriter pw) {
|
public void dump(final PrintWriter pw) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
pw.println();
|
pw.println();
|
||||||
@@ -3177,6 +3198,11 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
|||||||
case MSG_SWITCH_USER:
|
case MSG_SWITCH_USER:
|
||||||
handleOnSwitchUser(msg.arg1);
|
handleOnSwitchUser(msg.arg1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MSG_BOOT_COMPLETED:
|
||||||
|
mBootCompleted = true;
|
||||||
|
updatePowerState();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user