Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 49affea2 authored by Winson Chung's avatar Winson Chung
Browse files

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
parent ec453e01
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -32,9 +32,10 @@ oneway interface ITaskStackListener {
     * running in the pinned stack and the activity is not actually started, but the task is either
     * brought to the front or a new Intent is delivered to it.
     *
     * @param sourceComponent the component name of the activity that initiated the restart attempt
     * @param launchedFromPackage the package name of the activity that initiated the restart
     *                            attempt
     */
    void onPinnedActivityRestartAttempt(in ComponentName sourceComponent);
    void onPinnedActivityRestartAttempt(String launchedFromPackage);

    /**
     * Called whenever the pinned stack is done animating a resize.
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ public abstract class TaskStackListener extends ITaskStackListener.Stub {
    }

    @Override
    public void onPinnedActivityRestartAttempt(ComponentName sourceComponent) throws RemoteException {
    public void onPinnedActivityRestartAttempt(String launchedFromPackage) throws RemoteException {
    }

    @Override
+4 −4
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ public class PipManager implements BasePipManager {
        }

        @Override
        public void onPinnedActivityRestartAttempt(ComponentName sourceComponent) {
        public void onPinnedActivityRestartAttempt(String launchedFromPackage) {
            if (!checkCurrentUserId(false /* debug */)) {
                return;
            }
@@ -84,11 +84,11 @@ public class PipManager implements BasePipManager {
            // Expand the activity back to fullscreen only if it was attempted to be restarted from
            // another package than the top activity in the stack
            boolean expandPipToFullscreen = true;
            if (sourceComponent != null) {
            if (launchedFromPackage != null) {
                ComponentName topActivity = PipUtils.getTopPinnedActivity(mContext,
                        mActivityManager);
                if (topActivity != null && topActivity.getPackageName().equals(
                        sourceComponent.getPackageName())) {
                if (topActivity != null
                        && topActivity.getPackageName().equals(launchedFromPackage)) {
                    expandPipToFullscreen = false;
                }
            }
+1 −1
Original line number Diff line number Diff line
@@ -695,7 +695,7 @@ public class PipManager implements BasePipManager {
        }

        @Override
        public void onPinnedActivityRestartAttempt(ComponentName sourceComponent) {
        public void onPinnedActivityRestartAttempt(String launchedFromPackage) {
            if (DEBUG) Log.d(TAG, "onPinnedActivityRestartAttempt()");
            if (!checkCurrentUserId(DEBUG)) {
                return;
+4 −5
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ public class SystemServicesProxy {
        public void onTaskStackChanged() { }
        public void onTaskSnapshotChanged(int taskId, TaskSnapshot snapshot) { }
        public void onActivityPinned() { }
        public void onPinnedActivityRestartAttempt(ComponentName sourceComponent) { }
        public void onPinnedActivityRestartAttempt(String launchedFromPackage) { }
        public void onPinnedStackAnimationEnded() { }
        public void onActivityForcedResizable(String packageName, int taskId) { }
        public void onActivityDismissingDockedStack() { }
@@ -198,10 +198,10 @@ public class SystemServicesProxy {
        }

        @Override
        public void onPinnedActivityRestartAttempt(ComponentName sourceComponent)
        public void onPinnedActivityRestartAttempt(String launchedFromPackage)
                throws RemoteException{
            mHandler.removeMessages(H.ON_PINNED_ACTIVITY_RESTART_ATTEMPT);
            mHandler.obtainMessage(H.ON_PINNED_ACTIVITY_RESTART_ATTEMPT, sourceComponent)
            mHandler.obtainMessage(H.ON_PINNED_ACTIVITY_RESTART_ATTEMPT, launchedFromPackage)
                    .sendToTarget();
        }

@@ -1244,8 +1244,7 @@ public class SystemServicesProxy {
                }
                case ON_PINNED_ACTIVITY_RESTART_ATTEMPT: {
                    for (int i = mTaskStackListeners.size() - 1; i >= 0; i--) {
                        mTaskStackListeners.get(i).onPinnedActivityRestartAttempt(
                                (ComponentName) msg.obj);
                        mTaskStackListeners.get(i).onPinnedActivityRestartAttempt((String) msg.obj);
                    }
                    break;
                }
Loading