Dump warning logs to prevent app crash while no top-resumed changes
Applications crashed due to duplicated top resumed activity change
events. Currently, the only possible scenario we know if that the
application invokes Looper#loop() and reverse the messages order.
Write warning logs vs. throwing exceptions to prevent application
crashes.
Bug: 140571893
Test: build and boot pass
Change-Id: If6f6c502b96ccc11b230ba075c61118f03e13d5c
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index b47d44d..4cc486a 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -4602,6 +4602,10 @@
}
if (r.isTopResumedActivity == onTop) {
+ if (!Build.IS_DEBUGGABLE) {
+ Slog.w(TAG, "Activity top position already set to onTop=" + onTop);
+ return;
+ }
throw new IllegalStateException("Activity top position already set to onTop=" + onTop);
}