From 4949a793851e3581f1fcb0f0258046b88366b0d0 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Fri, 17 Mar 2023 10:17:29 -0600 Subject: [PATCH] Kick off health checks with lock held. We've seen evidence from Log.wtf() that health checks are racing with other mutations because the AMS lock isn't held. To mitigate this, perform health checks through our Handler where the lock is acquired. Bug: 267673062 Test: treehugger Change-Id: I8c7411bc42475789373c29c57cbd384faaf7b9ee --- .../java/com/android/server/am/BroadcastQueueModernImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/am/BroadcastQueueModernImpl.java b/services/core/java/com/android/server/am/BroadcastQueueModernImpl.java index bef16b6f081c2..b298a774deddf 100644 --- a/services/core/java/com/android/server/am/BroadcastQueueModernImpl.java +++ b/services/core/java/com/android/server/am/BroadcastQueueModernImpl.java @@ -1339,7 +1339,7 @@ class BroadcastQueueModernImpl extends BroadcastQueue { }, ActivityManager.UID_OBSERVER_CACHED, 0, "android"); // Kick off periodic health checks - checkHealthLocked(); + mLocalHandler.sendEmptyMessage(MSG_CHECK_HEALTH); } @Override