Merge "Add status bar state logs" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
54ea7684bb
@@ -173,7 +173,7 @@ public class StatusBarStateControllerImpl implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Record the to-be mState and mLastState
|
// Record the to-be mState and mLastState
|
||||||
recordHistoricalState(state, mState);
|
recordHistoricalState(state /* newState */, mState /* lastState */, false);
|
||||||
|
|
||||||
// b/139259891
|
// b/139259891
|
||||||
if (mState == StatusBarState.SHADE && state == StatusBarState.SHADE_LOCKED) {
|
if (mState == StatusBarState.SHADE && state == StatusBarState.SHADE_LOCKED) {
|
||||||
@@ -206,6 +206,7 @@ public class StatusBarStateControllerImpl implements
|
|||||||
@Override
|
@Override
|
||||||
public void setUpcomingState(int nextState) {
|
public void setUpcomingState(int nextState) {
|
||||||
mUpcomingState = nextState;
|
mUpcomingState = nextState;
|
||||||
|
recordHistoricalState(mUpcomingState /* newState */, mState /* lastState */, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
mHistoryIndex = (mHistoryIndex + 1) % HISTORY_SIZE;
|
||||||
HistoricalState state = mHistoricalRecords[mHistoryIndex];
|
HistoricalState state = mHistoricalRecords[mHistoryIndex];
|
||||||
state.mState = currentState;
|
state.mNewState = newState;
|
||||||
state.mLastState = lastState;
|
state.mLastState = lastState;
|
||||||
state.mTimestamp = System.currentTimeMillis();
|
state.mTimestamp = System.currentTimeMillis();
|
||||||
|
state.mUpcoming = upcoming;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For keeping track of our previous state to help with debugging
|
* For keeping track of our previous state to help with debugging
|
||||||
*/
|
*/
|
||||||
private static class HistoricalState {
|
private static class HistoricalState {
|
||||||
int mState;
|
int mNewState;
|
||||||
int mLastState;
|
int mLastState;
|
||||||
long mTimestamp;
|
long mTimestamp;
|
||||||
|
boolean mUpcoming;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (mTimestamp != 0) {
|
if (mTimestamp != 0) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("state=").append(mState)
|
if (mUpcoming) {
|
||||||
.append(" (").append(describe(mState)).append(")");
|
sb.append("upcoming-");
|
||||||
sb.append("lastState=").append(mLastState).append(" (").append(describe(mLastState))
|
}
|
||||||
|
sb.append("newState=").append(mNewState)
|
||||||
|
.append("(").append(describe(mNewState)).append(")");
|
||||||
|
sb.append(" lastState=").append(mLastState).append("(").append(describe(mLastState))
|
||||||
.append(")");
|
.append(")");
|
||||||
sb.append("timestamp=")
|
sb.append(" timestamp=")
|
||||||
.append(DateFormat.format("MM-dd HH:mm:ss", mTimestamp));
|
.append(DateFormat.format("MM-dd HH:mm:ss", mTimestamp));
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
|
|||||||
Reference in New Issue
Block a user