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
|
* Appends the doze state that was suppressed to the doze event log
|
||||||
* @param suppressedState The {@link DozeMachine.State} that was suppressed
|
* @param suppressedState The {@link DozeMachine.State} that was suppressed
|
||||||
|
* @param reason what suppressed always on
|
||||||
*/
|
*/
|
||||||
public void traceAlwaysOnSuppressed(DozeMachine.State suppressedState) {
|
public void traceAlwaysOnSuppressed(DozeMachine.State suppressedState, String reason) {
|
||||||
mLogger.logAlwaysOnSuppressed(suppressedState);
|
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, {
|
buffer.log(TAG, INFO, {
|
||||||
str1 = state.name
|
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;
|
return State.FINISH;
|
||||||
}
|
}
|
||||||
if (mDozeHost.isAlwaysOnSuppressed() && requestedState.isAlwaysOn()) {
|
if (mDozeHost.isAlwaysOnSuppressed() && requestedState.isAlwaysOn()) {
|
||||||
Log.i(TAG, "Doze is suppressed. Suppressing state: " + requestedState);
|
Log.i(TAG, "Doze is suppressed by an app. Suppressing state: " + requestedState);
|
||||||
mDozeLog.traceAlwaysOnSuppressed(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;
|
return State.DOZE;
|
||||||
}
|
}
|
||||||
if ((mState == State.DOZE_AOD_PAUSED || mState == State.DOZE_AOD_PAUSING
|
if ((mState == State.DOZE_AOD_PAUSED || mState == State.DOZE_AOD_PAUSING
|
||||||
|
|||||||
@@ -136,6 +136,8 @@ public class DozeService extends DreamService
|
|||||||
@Override
|
@Override
|
||||||
public void setDozeScreenState(int state) {
|
public void setDozeScreenState(int state) {
|
||||||
super.setDozeScreenState(state);
|
super.setDozeScreenState(state);
|
||||||
|
if (mDozeMachine != null) {
|
||||||
mDozeMachine.onScreenState(state);
|
mDozeMachine.onScreenState(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -166,6 +166,8 @@ public class DozeSuppressor implements DozeMachine.Part {
|
|||||||
private DozeHost.Callback mHostCallback = new DozeHost.Callback() {
|
private DozeHost.Callback mHostCallback = new DozeHost.Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void onPowerSaveChanged(boolean active) {
|
public void onPowerSaveChanged(boolean active) {
|
||||||
|
// handles suppression changes, while DozeMachine#transitionPolicy handles gating
|
||||||
|
// transitions to DOZE_AOD
|
||||||
DozeMachine.State nextState = null;
|
DozeMachine.State nextState = null;
|
||||||
if (mDozeHost.isPowerSaveActive()) {
|
if (mDozeHost.isPowerSaveActive()) {
|
||||||
nextState = DozeMachine.State.DOZE;
|
nextState = DozeMachine.State.DOZE;
|
||||||
@@ -182,6 +184,8 @@ public class DozeSuppressor implements DozeMachine.Part {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAlwaysOnSuppressedChanged(boolean suppressed) {
|
public void onAlwaysOnSuppressedChanged(boolean suppressed) {
|
||||||
|
// handles suppression changes, while DozeMachine#transitionPolicy handles gating
|
||||||
|
// transitions to DOZE_AOD
|
||||||
final DozeMachine.State nextState;
|
final DozeMachine.State nextState;
|
||||||
if (mConfig.alwaysOnEnabled(UserHandle.USER_CURRENT) && !suppressed) {
|
if (mConfig.alwaysOnEnabled(UserHandle.USER_CURRENT) && !suppressed) {
|
||||||
nextState = DozeMachine.State.DOZE_AOD;
|
nextState = DozeMachine.State.DOZE_AOD;
|
||||||
|
|||||||
Reference in New Issue
Block a user