Fix trampoline activities when relaunching PiP
- We should be checking the actual launched-from package since that stores
the source package across trampoline activities
Bug: 35458117
Test: Enter PiP from a trampoline activity, launch again from Launcher
and ensure that it is expanded
Change-Id: Ia0e586e8b21dee63b513bd61a41a24e7da4325e1
diff --git a/services/core/java/com/android/server/am/ActivityStarter.java b/services/core/java/com/android/server/am/ActivityStarter.java
index 4b07af0..7605a1e 100644
--- a/services/core/java/com/android/server/am/ActivityStarter.java
+++ b/services/core/java/com/android/server/am/ActivityStarter.java
@@ -585,10 +585,8 @@
// The activity was already running in the pinned stack so it wasn't started, but either
// brought to the front or the new intent was delivered to it since it was already in
// front. Notify anyone interested in this piece of information.
- final ComponentName sourceComponent = sourceRecord == null ? null :
- sourceRecord.realActivity;
mService.mTaskChangeNotificationController.notifyPinnedActivityRestartAttempt(
- sourceComponent);
+ sourceRecord.launchedFromPackage);
return;
}
}
diff --git a/services/core/java/com/android/server/am/TaskChangeNotificationController.java b/services/core/java/com/android/server/am/TaskChangeNotificationController.java
index 2990dff..9dfc7cd 100644
--- a/services/core/java/com/android/server/am/TaskChangeNotificationController.java
+++ b/services/core/java/com/android/server/am/TaskChangeNotificationController.java
@@ -97,7 +97,7 @@
};
private final TaskStackConsumer mNotifyPinnedActivityRestartAttempt = (l, m) -> {
- l.onPinnedActivityRestartAttempt((ComponentName) m.obj);
+ l.onPinnedActivityRestartAttempt((String) m.obj);
};
private final TaskStackConsumer mNotifyPinnedStackAnimationEnded = (l, m) -> {
@@ -267,11 +267,11 @@
* running in the pinned stack and the activity was not actually started, but the task is
* either brought to the front or a new Intent is delivered to it.
*/
- void notifyPinnedActivityRestartAttempt(ComponentName sourceComponent) {
+ void notifyPinnedActivityRestartAttempt(String launchedFromPackage) {
mHandler.removeMessages(NOTIFY_PINNED_ACTIVITY_RESTART_ATTEMPT_LISTENERS_MSG);
final Message msg =
mHandler.obtainMessage(NOTIFY_PINNED_ACTIVITY_RESTART_ATTEMPT_LISTENERS_MSG,
- sourceComponent);
+ launchedFromPackage);
forAllLocalListeners(mNotifyPinnedActivityRestartAttempt, msg);
msg.sendToTarget();
}
diff --git a/services/core/java/com/android/server/wm/PinnedStackController.java b/services/core/java/com/android/server/wm/PinnedStackController.java
index 6a8417dc..cfeb198 100644
--- a/services/core/java/com/android/server/wm/PinnedStackController.java
+++ b/services/core/java/com/android/server/wm/PinnedStackController.java
@@ -233,7 +233,7 @@
* @return the movement bounds for the given {@param stackBounds} and the current state of the
* controller.
*/
- Rect getMovementBounds(Rect stackBounds) {
+ private Rect getMovementBounds(Rect stackBounds) {
return getMovementBounds(stackBounds, true /* adjustForIme */);
}
@@ -241,7 +241,7 @@
* @return the movement bounds for the given {@param stackBounds} and the current state of the
* controller.
*/
- Rect getMovementBounds(Rect stackBounds, boolean adjustForIme) {
+ private Rect getMovementBounds(Rect stackBounds, boolean adjustForIme) {
final Rect movementBounds = new Rect();
getInsetBounds(movementBounds);