Merge "Making ScreenOnUnblocked and ScreenOffUnblocked public"
This commit is contained in:
committed by
Android (Google) Code Review
commit
03882bc8bd
@@ -267,12 +267,10 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
|
||||
// Must only be accessed on the handler thread.
|
||||
private DisplayPowerState mPowerState;
|
||||
|
||||
|
||||
|
||||
// The currently active screen on unblocker. This field is non-null whenever
|
||||
// we are waiting for a callback to release it and unblock the screen.
|
||||
private ScreenOnUnblocker mPendingScreenOnUnblocker;
|
||||
private ScreenOffUnblocker mPendingScreenOffUnblocker;
|
||||
private WindowManagerPolicy.ScreenOnListener mPendingScreenOnUnblocker;
|
||||
private WindowManagerPolicy.ScreenOffListener mPendingScreenOffUnblocker;
|
||||
|
||||
// True if we were in the process of turning off the screen.
|
||||
// This allows us to recover more gracefully from situations where we abort
|
||||
@@ -1758,7 +1756,9 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
|
||||
private void blockScreenOn() {
|
||||
if (mPendingScreenOnUnblocker == null) {
|
||||
Trace.asyncTraceBegin(Trace.TRACE_TAG_POWER, SCREEN_ON_BLOCKED_TRACE_NAME, 0);
|
||||
mPendingScreenOnUnblocker = new ScreenOnUnblocker();
|
||||
mPendingScreenOnUnblocker = () -> {
|
||||
mHandler.obtainMessage(MSG_SCREEN_ON_UNBLOCKED, this).sendToTarget();
|
||||
};
|
||||
mScreenOnBlockStartRealTime = SystemClock.elapsedRealtime();
|
||||
Slog.i(mTag, "Blocking screen on until initial contents have been drawn.");
|
||||
}
|
||||
@@ -1776,7 +1776,9 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
|
||||
private void blockScreenOff() {
|
||||
if (mPendingScreenOffUnblocker == null) {
|
||||
Trace.asyncTraceBegin(Trace.TRACE_TAG_POWER, SCREEN_OFF_BLOCKED_TRACE_NAME, 0);
|
||||
mPendingScreenOffUnblocker = new ScreenOffUnblocker();
|
||||
mPendingScreenOffUnblocker = () -> {
|
||||
mHandler.obtainMessage(MSG_SCREEN_ON_UNBLOCKED, this).sendToTarget();
|
||||
};
|
||||
mScreenOffBlockStartRealTime = SystemClock.elapsedRealtime();
|
||||
Slog.i(mTag, "Blocking screen off");
|
||||
}
|
||||
@@ -2560,22 +2562,6 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
|
||||
}
|
||||
}
|
||||
|
||||
private final class ScreenOnUnblocker implements WindowManagerPolicy.ScreenOnListener {
|
||||
@Override
|
||||
public void onScreenOn() {
|
||||
Message msg = mHandler.obtainMessage(MSG_SCREEN_ON_UNBLOCKED, this);
|
||||
mHandler.sendMessage(msg);
|
||||
}
|
||||
}
|
||||
|
||||
private final class ScreenOffUnblocker implements WindowManagerPolicy.ScreenOffListener {
|
||||
@Override
|
||||
public void onScreenOff() {
|
||||
Message msg = mHandler.obtainMessage(MSG_SCREEN_OFF_UNBLOCKED, this);
|
||||
mHandler.sendMessage(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAutoBrightnessLoggingEnabled(boolean enabled) {
|
||||
if (mAutomaticBrightnessController != null) {
|
||||
|
||||
@@ -16,12 +16,11 @@
|
||||
|
||||
package com.android.server.display;
|
||||
|
||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.isA;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
@@ -16,13 +16,11 @@
|
||||
|
||||
package com.android.server.display;
|
||||
|
||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;
|
||||
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.isA;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
Reference in New Issue
Block a user