Watchdog:do not need add or clear operation when mMonitorQueue is empty.
Bug: 374920072
Flag: EXEMPT minor optimization
Change-Id: I5a90968cdf35917c6ce8a9fe65ea5643975484a8
diff --git a/services/core/java/com/android/server/Watchdog.java b/services/core/java/com/android/server/Watchdog.java
index 918f130..0dedb73 100644
--- a/services/core/java/com/android/server/Watchdog.java
+++ b/services/core/java/com/android/server/Watchdog.java
@@ -289,7 +289,7 @@
public void scheduleCheckLocked(long handlerCheckerTimeoutMillis) {
mWaitMaxMillis = handlerCheckerTimeoutMillis;
- if (mCompleted) {
+ if (mCompleted && !mMonitorQueue.isEmpty()) {
// Safe to update monitors in queue, Handler is not in the middle of work
mMonitors.addAll(mMonitorQueue);
mMonitorQueue.clear();