* commit '7b7a2100e292b0678c5e622702ae43ec2a8d74fe': Don't wait for brightness changes
This commit is contained in:
@@ -341,7 +341,8 @@ final class DisplayPowerState {
|
||||
private int mPendingBacklight = INITIAL_BACKLIGHT;
|
||||
private int mActualState = INITIAL_SCREEN_STATE;
|
||||
private int mActualBacklight = INITIAL_BACKLIGHT;
|
||||
private boolean mChangeInProgress;
|
||||
private boolean mStateChangeInProgress;
|
||||
private boolean mBacklightChangeInProgress;
|
||||
|
||||
public PhotonicModulator() {
|
||||
super("PhotonicModulator");
|
||||
@@ -349,7 +350,9 @@ final class DisplayPowerState {
|
||||
|
||||
public boolean setState(int state, int backlight) {
|
||||
synchronized (mLock) {
|
||||
if (state != mPendingState || backlight != mPendingBacklight) {
|
||||
boolean stateChanged = state != mPendingState;
|
||||
boolean backlightChanged = backlight != mPendingBacklight;
|
||||
if (stateChanged || backlightChanged) {
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "Requesting new screen state: state="
|
||||
+ Display.stateToString(state) + ", backlight=" + backlight);
|
||||
@@ -358,12 +361,15 @@ final class DisplayPowerState {
|
||||
mPendingState = state;
|
||||
mPendingBacklight = backlight;
|
||||
|
||||
if (!mChangeInProgress) {
|
||||
mChangeInProgress = true;
|
||||
boolean changeInProgress = mStateChangeInProgress || mBacklightChangeInProgress;
|
||||
mStateChangeInProgress = stateChanged;
|
||||
mBacklightChangeInProgress = backlightChanged;
|
||||
|
||||
if (!changeInProgress) {
|
||||
mLock.notifyAll();
|
||||
}
|
||||
}
|
||||
return !mChangeInProgress;
|
||||
return !mStateChangeInProgress;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,7 +381,8 @@ final class DisplayPowerState {
|
||||
pw.println(" mPendingBacklight=" + mPendingBacklight);
|
||||
pw.println(" mActualState=" + Display.stateToString(mActualState));
|
||||
pw.println(" mActualBacklight=" + mActualBacklight);
|
||||
pw.println(" mChangeInProgress=" + mChangeInProgress);
|
||||
pw.println(" mStateChangeInProgress=" + mStateChangeInProgress);
|
||||
pw.println(" mBacklightChangeInProgress=" + mBacklightChangeInProgress);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,10 +399,15 @@ final class DisplayPowerState {
|
||||
stateChanged = (state != mActualState);
|
||||
backlight = mPendingBacklight;
|
||||
backlightChanged = (backlight != mActualBacklight);
|
||||
if (!stateChanged && !backlightChanged) {
|
||||
// All changed applied, notify outer class and wait for more.
|
||||
mChangeInProgress = false;
|
||||
if (!stateChanged) {
|
||||
// State changed applied, notify outer class.
|
||||
postScreenUpdateThreadSafe();
|
||||
mStateChangeInProgress = false;
|
||||
}
|
||||
if (!backlightChanged) {
|
||||
mBacklightChangeInProgress = false;
|
||||
}
|
||||
if (!stateChanged && !backlightChanged) {
|
||||
try {
|
||||
mLock.wait();
|
||||
} catch (InterruptedException ex) { }
|
||||
|
||||
Reference in New Issue
Block a user