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

Commit 8452504d authored by Perry Wu's avatar Perry Wu
Browse files

[PIP] Split implementation of isPackageActiveInPip for PIP1 and PIP2

This reverts a change made to isPackageActiveInPip() for PIP1 to fix
an issue where we never reset lastPipComponentName. We still need
to investigate this behavior for PIP2 as there are changes in core
that affect how TransitionInfo is being constructed.

Bug: 379013276
Flag: EXEMPT bugfix
Test: manually follow steps in bug report, verify split starts properly
Change-Id: Ie66d5d3efbba13c649dbd63670625b155eeef30d
parent fc5ccc5e
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ import com.android.wm.shell.common.pip.PipBoundsState;
import com.android.wm.shell.common.pip.PipDisplayLayoutState;
import com.android.wm.shell.common.pip.PipMenuController;
import com.android.wm.shell.common.pip.PipUtils;
import com.android.wm.shell.common.split.SplitScreenUtils;
import com.android.wm.shell.protolog.ShellProtoLogGroup;
import com.android.wm.shell.shared.TransitionUtil;
import com.android.wm.shell.shared.pip.PipContentOverlay;
@@ -1346,6 +1347,13 @@ public class PipTransition extends PipTransitionController {
        return true;
    }

    @Override
    public boolean isPackageActiveInPip(@Nullable String packageName) {
        final TaskInfo inPipTask = mPipOrganizer.getTaskInfo();
        return packageName != null && inPipTask != null && mPipOrganizer.isInPip()
                && packageName.equals(SplitScreenUtils.getPackageName(inPipTask.baseIntent));
    }

    private void updatePipForUnhandledTransition(@NonNull TransitionInfo.Change pipChange,
            @NonNull SurfaceControl.Transaction startTransaction,
            @NonNull SurfaceControl.Transaction finishTransaction) {
+2 −3
Original line number Diff line number Diff line
@@ -312,9 +312,8 @@ public abstract class PipTransitionController implements Transitions.TransitionH

    /** Whether a particular package is same as current pip package. */
    public boolean isPackageActiveInPip(@Nullable String packageName) {
        return packageName != null
                && mPipBoundsState.getLastPipComponentName() != null
                && packageName.equals(mPipBoundsState.getLastPipComponentName().getPackageName());
        // No-op, to be handled differently in PIP1 and PIP2
        return false;
    }

    /** Add PiP-related changes to `outWCT` for the given request. */
+7 −0
Original line number Diff line number Diff line
@@ -909,4 +909,11 @@ public class PipTransition extends PipTransitionController implements
                break;
        }
    }

    @Override
    public boolean isPackageActiveInPip(@Nullable String packageName) {
        return packageName != null
                && mPipBoundsState.getLastPipComponentName() != null
                && packageName.equals(mPipBoundsState.getLastPipComponentName().getPackageName());
    }
}