Add status bar state logs
Log the upcoming status bar state Test: manually check logs (sysui dumpsys) Bug: 205587594 Change-Id: I3316faac4bea5a79863092d79fed33216308dc21
This commit is contained in:
@@ -173,7 +173,7 @@ public class StatusBarStateControllerImpl implements
|
||||
}
|
||||
|
||||
// Record the to-be mState and mLastState
|
||||
recordHistoricalState(state, mState);
|
||||
recordHistoricalState(state /* newState */, mState /* lastState */, false);
|
||||
|
||||
// b/139259891
|
||||
if (mState == StatusBarState.SHADE && state == StatusBarState.SHADE_LOCKED) {
|
||||
@@ -206,6 +206,7 @@ public class StatusBarStateControllerImpl implements
|
||||
@Override
|
||||
public void setUpcomingState(int nextState) {
|
||||
mUpcomingState = nextState;
|
||||
recordHistoricalState(mUpcomingState /* newState */, mState /* lastState */, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -505,31 +506,36 @@ public class StatusBarStateControllerImpl implements
|
||||
}
|
||||
}
|
||||
|
||||
private void recordHistoricalState(int currentState, int lastState) {
|
||||
private void recordHistoricalState(int newState, int lastState, boolean upcoming) {
|
||||
mHistoryIndex = (mHistoryIndex + 1) % HISTORY_SIZE;
|
||||
HistoricalState state = mHistoricalRecords[mHistoryIndex];
|
||||
state.mState = currentState;
|
||||
state.mNewState = newState;
|
||||
state.mLastState = lastState;
|
||||
state.mTimestamp = System.currentTimeMillis();
|
||||
state.mUpcoming = upcoming;
|
||||
}
|
||||
|
||||
/**
|
||||
* For keeping track of our previous state to help with debugging
|
||||
*/
|
||||
private static class HistoricalState {
|
||||
int mState;
|
||||
int mNewState;
|
||||
int mLastState;
|
||||
long mTimestamp;
|
||||
boolean mUpcoming;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (mTimestamp != 0) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("state=").append(mState)
|
||||
.append(" (").append(describe(mState)).append(")");
|
||||
sb.append("lastState=").append(mLastState).append(" (").append(describe(mLastState))
|
||||
if (mUpcoming) {
|
||||
sb.append("upcoming-");
|
||||
}
|
||||
sb.append("newState=").append(mNewState)
|
||||
.append("(").append(describe(mNewState)).append(")");
|
||||
sb.append(" lastState=").append(mLastState).append("(").append(describe(mLastState))
|
||||
.append(")");
|
||||
sb.append("timestamp=")
|
||||
sb.append(" timestamp=")
|
||||
.append(DateFormat.format("MM-dd HH:mm:ss", mTimestamp));
|
||||
|
||||
return sb.toString();
|
||||
|
||||
Reference in New Issue
Block a user