Allow activity coalescing when starting from last launched uid
When task bounds do not match, activity coalescing was not allowed.
This was initially implemented in commit abf6371 to prevent
coalescing when a host application launches multiple activities
of different apps simultaneously. This change prioritizes the
UID check before the bounds check.
Bug: 430687520
Test: start an app to Desktop, to background, start it again to bubble
Flag: EXEMPT bugfix
Change-Id: Idfbdacf51afb79e9611797a04a64e974de35caed
diff --git a/services/core/java/com/android/server/wm/ActivityMetricsLogger.java b/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
index 0f084d8..797bc06 100644
--- a/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
+++ b/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
@@ -434,6 +434,10 @@
|| mLastLaunchedActivity.getWindowingMode() != r.getWindowingMode()) {
return false;
}
+ if (mLastLaunchedActivity.isUid(r.launchedFromUid)) {
+ return true;
+ }
+
// The current task should be non-null because it is just launched. While the
// last task can be cleared when starting activity with FLAG_ACTIVITY_CLEAR_TASK.
final Task lastTask = mLastLaunchedActivity.getTask();
@@ -444,7 +448,8 @@
}
return lastTask.getBounds().equals(currentTask.getBounds());
}
- return mLastLaunchedActivity.isUid(r.launchedFromUid);
+
+ return false;
}
/** @return {@code true} if the activity matches a launched activity in this transition. */