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

Commit a426167c authored by Hongwei Wang's avatar Hongwei Wang
Browse files

[PiP2] Fix NPE when create a split-screen

Fixed NPE thrown from PipTransitionHandler when DefaultMixedHandler
tries to query for PiP presense, root caused by the deprecated
PipTaskOrganizer reference when in PiP2.

Flag: com.android.wm.shell.enable_pip2
Bug: 375247956
Test: manual, create a split-screen when PiP2 is on
Test: manual, swipe a split-screen to home, with PiP-able Activity
Change-Id: I0ae1791f9ec6bbeaf59313b68653449ffa09d2fc
parent 18eb83c2
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ import com.android.wm.shell.ShellTaskOrganizer;
import com.android.wm.shell.common.pip.PipBoundsAlgorithm;
import com.android.wm.shell.common.pip.PipBoundsState;
import com.android.wm.shell.common.pip.PipMenuController;
import com.android.wm.shell.common.split.SplitScreenUtils;
import com.android.wm.shell.protolog.ShellProtoLogGroup;
import com.android.wm.shell.sysui.ShellInit;
import com.android.wm.shell.transition.DefaultMixedHandler;
@@ -312,10 +311,10 @@ public abstract class PipTransitionController implements Transitions.TransitionH
    }

    /** Whether a particular package is same as current pip package. */
    public boolean isPackageActiveInPip(String packageName) {
        final TaskInfo inPipTask = mPipOrganizer.getTaskInfo();
        return packageName != null && inPipTask != null && mPipOrganizer.isInPip()
                && packageName.equals(SplitScreenUtils.getPackageName(inPipTask.baseIntent));
    public boolean isPackageActiveInPip(@Nullable String packageName) {
        return packageName != null
                && mPipBoundsState.getLastPipComponentName() != null
                && packageName.equals(mPipBoundsState.getLastPipComponentName().getPackageName());
    }

    /** Add PiP-related changes to `outWCT` for the given request. */