Loading services/core/java/com/android/server/utils/AnrTimer.java +11 −9 Original line number Diff line number Diff line Loading @@ -193,6 +193,10 @@ public class AnrTimer<V> implements AutoCloseable { @GuardedBy("mLock") private int mTotalStarted = 0; /** The total number of timers that were restarted without an explicit cancel. */ @GuardedBy("mLock") private int mTotalRestarted = 0; /** The total number of errors detected. */ @GuardedBy("mLock") private int mTotalErrors = 0; Loading Loading @@ -434,10 +438,10 @@ public class AnrTimer<V> implements AutoCloseable { @Override void start(@NonNull V arg, int pid, int uid, long timeoutMs) { synchronized (mLock) { if (mTimerIdMap.containsKey(arg)) { // There is an existing timer. Cancel it. cancel(arg); } // If there is an existing timer, cancel it. This is a nop if the timer does not // exist. if (cancel(arg)) mTotalRestarted++; int timerId = nativeAnrTimerStart(mNative, pid, uid, timeoutMs, mExtend); if (timerId > 0) { mTimerIdMap.put(arg, timerId); Loading Loading @@ -546,10 +550,8 @@ public class AnrTimer<V> implements AutoCloseable { private Integer removeLocked(V arg) { Integer r = mTimerIdMap.remove(arg); if (r != null) { synchronized (mTimerArgMap) { mTimerArgMap.remove(r); } } return r; } } Loading Loading @@ -672,8 +674,8 @@ public class AnrTimer<V> implements AutoCloseable { synchronized (mLock) { pw.format("timer: %s\n", mLabel); pw.increaseIndent(); pw.format("started=%d maxStarted=%d running=%d expired=%d errors=%d\n", mTotalStarted, mMaxStarted, mTimerIdMap.size(), pw.format("started=%d maxStarted=%d restarted=%d running=%d expired=%d errors=%d\n", mTotalStarted, mMaxStarted, mTotalRestarted, mTimerIdMap.size(), mTotalExpired, mTotalErrors); pw.decreaseIndent(); mFeature.dump(pw, false); Loading services/core/jni/com_android_server_utils_AnrTimer.cpp +0 −2 Original line number Diff line number Diff line Loading @@ -487,7 +487,6 @@ class AnrTimerService::Ticker { timer_id_t front = headTimerId(); auto found = running_.find(key); if (found != running_.end()) running_.erase(found); if (front != headTimerId()) restartLocked(); } // Remove every timer associated with the service. Loading @@ -501,7 +500,6 @@ class AnrTimerService::Ticker { i++; } } if (front != headTimerId()) restartLocked(); } // Return the number of timers still running. Loading Loading
services/core/java/com/android/server/utils/AnrTimer.java +11 −9 Original line number Diff line number Diff line Loading @@ -193,6 +193,10 @@ public class AnrTimer<V> implements AutoCloseable { @GuardedBy("mLock") private int mTotalStarted = 0; /** The total number of timers that were restarted without an explicit cancel. */ @GuardedBy("mLock") private int mTotalRestarted = 0; /** The total number of errors detected. */ @GuardedBy("mLock") private int mTotalErrors = 0; Loading Loading @@ -434,10 +438,10 @@ public class AnrTimer<V> implements AutoCloseable { @Override void start(@NonNull V arg, int pid, int uid, long timeoutMs) { synchronized (mLock) { if (mTimerIdMap.containsKey(arg)) { // There is an existing timer. Cancel it. cancel(arg); } // If there is an existing timer, cancel it. This is a nop if the timer does not // exist. if (cancel(arg)) mTotalRestarted++; int timerId = nativeAnrTimerStart(mNative, pid, uid, timeoutMs, mExtend); if (timerId > 0) { mTimerIdMap.put(arg, timerId); Loading Loading @@ -546,10 +550,8 @@ public class AnrTimer<V> implements AutoCloseable { private Integer removeLocked(V arg) { Integer r = mTimerIdMap.remove(arg); if (r != null) { synchronized (mTimerArgMap) { mTimerArgMap.remove(r); } } return r; } } Loading Loading @@ -672,8 +674,8 @@ public class AnrTimer<V> implements AutoCloseable { synchronized (mLock) { pw.format("timer: %s\n", mLabel); pw.increaseIndent(); pw.format("started=%d maxStarted=%d running=%d expired=%d errors=%d\n", mTotalStarted, mMaxStarted, mTimerIdMap.size(), pw.format("started=%d maxStarted=%d restarted=%d running=%d expired=%d errors=%d\n", mTotalStarted, mMaxStarted, mTotalRestarted, mTimerIdMap.size(), mTotalExpired, mTotalErrors); pw.decreaseIndent(); mFeature.dump(pw, false); Loading
services/core/jni/com_android_server_utils_AnrTimer.cpp +0 −2 Original line number Diff line number Diff line Loading @@ -487,7 +487,6 @@ class AnrTimerService::Ticker { timer_id_t front = headTimerId(); auto found = running_.find(key); if (found != running_.end()) running_.erase(found); if (front != headTimerId()) restartLocked(); } // Remove every timer associated with the service. Loading @@ -501,7 +500,6 @@ class AnrTimerService::Ticker { i++; } } if (front != headTimerId()) restartLocked(); } // Return the number of timers still running. Loading