Merge "DOZE instead of DOZE_AOD when batterySaver=active" into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
edbe5bf307
@@ -319,9 +319,10 @@ public class DozeLog implements Dumpable {
|
||||
/**
|
||||
* Appends the doze state that was suppressed to the doze event log
|
||||
* @param suppressedState The {@link DozeMachine.State} that was suppressed
|
||||
* @param reason what suppressed always on
|
||||
*/
|
||||
public void traceAlwaysOnSuppressed(DozeMachine.State suppressedState) {
|
||||
mLogger.logAlwaysOnSuppressed(suppressedState);
|
||||
public void traceAlwaysOnSuppressed(DozeMachine.State suppressedState, String reason) {
|
||||
mLogger.logAlwaysOnSuppressed(suppressedState, reason);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -267,11 +267,12 @@ class DozeLogger @Inject constructor(
|
||||
})
|
||||
}
|
||||
|
||||
fun logAlwaysOnSuppressed(state: DozeMachine.State) {
|
||||
fun logAlwaysOnSuppressed(state: DozeMachine.State, reason: String) {
|
||||
buffer.log(TAG, INFO, {
|
||||
str1 = state.name
|
||||
str2 = reason
|
||||
}, {
|
||||
"Always-on state suppressed, suppressed state=$str1"
|
||||
"Always-on state suppressed, suppressed state=$str1 reason=$str2"
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -358,8 +358,13 @@ public class DozeMachine {
|
||||
return State.FINISH;
|
||||
}
|
||||
if (mDozeHost.isAlwaysOnSuppressed() && requestedState.isAlwaysOn()) {
|
||||
Log.i(TAG, "Doze is suppressed. Suppressing state: " + requestedState);
|
||||
mDozeLog.traceAlwaysOnSuppressed(requestedState);
|
||||
Log.i(TAG, "Doze is suppressed by an app. Suppressing state: " + requestedState);
|
||||
mDozeLog.traceAlwaysOnSuppressed(requestedState, "app");
|
||||
return State.DOZE;
|
||||
}
|
||||
if (mDozeHost.isPowerSaveActive() && requestedState.isAlwaysOn()) {
|
||||
Log.i(TAG, "Doze is suppressed by battery saver. Suppressing state: " + requestedState);
|
||||
mDozeLog.traceAlwaysOnSuppressed(requestedState, "batterySaver");
|
||||
return State.DOZE;
|
||||
}
|
||||
if ((mState == State.DOZE_AOD_PAUSED || mState == State.DOZE_AOD_PAUSING
|
||||
|
||||
@@ -136,6 +136,8 @@ public class DozeService extends DreamService
|
||||
@Override
|
||||
public void setDozeScreenState(int state) {
|
||||
super.setDozeScreenState(state);
|
||||
mDozeMachine.onScreenState(state);
|
||||
if (mDozeMachine != null) {
|
||||
mDozeMachine.onScreenState(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,6 +166,8 @@ public class DozeSuppressor implements DozeMachine.Part {
|
||||
private DozeHost.Callback mHostCallback = new DozeHost.Callback() {
|
||||
@Override
|
||||
public void onPowerSaveChanged(boolean active) {
|
||||
// handles suppression changes, while DozeMachine#transitionPolicy handles gating
|
||||
// transitions to DOZE_AOD
|
||||
DozeMachine.State nextState = null;
|
||||
if (mDozeHost.isPowerSaveActive()) {
|
||||
nextState = DozeMachine.State.DOZE;
|
||||
@@ -182,6 +184,8 @@ public class DozeSuppressor implements DozeMachine.Part {
|
||||
|
||||
@Override
|
||||
public void onAlwaysOnSuppressedChanged(boolean suppressed) {
|
||||
// handles suppression changes, while DozeMachine#transitionPolicy handles gating
|
||||
// transitions to DOZE_AOD
|
||||
final DozeMachine.State nextState;
|
||||
if (mConfig.alwaysOnEnabled(UserHandle.USER_CURRENT) && !suppressed) {
|
||||
nextState = DozeMachine.State.DOZE_AOD;
|
||||
|
||||
Reference in New Issue
Block a user