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

Commit cc2b5c14 authored by Yuichiro Hanada's avatar Yuichiro Hanada
Browse files

Send PictureInPictureParamsChange to the task requesting it

PictureInPictureParams change should be notified to the task which
requests it. It's especially important if the task is nested in another
task (e.g. a desk in desktop windowing).

Bug: 422654539
Test: atest MinimizeAutoPipAppWindowTest
Test: atest ActivityRecordTests
Flag: com.android.window.flags.enable_pip_params_update_notification_bugfix
Change-Id: I7d7f7c3e12d2109390112de315e1f55be089ec1b
parent ebb4d530
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -155,6 +155,7 @@ import static android.view.WindowManager.PROPERTY_ACTIVITY_EMBEDDING_SPLITS_ENAB
import static android.view.WindowManager.PROPERTY_ALLOW_UNTRUSTED_ACTIVITY_EMBEDDING_STATE_SHARING;
import static android.view.WindowManager.TRANSIT_RELAUNCH;
import static android.view.WindowManager.hasWindowExtensionsEnabled;
import static android.window.DesktopExperienceFlags.ENABLE_PIP_PARAMS_UPDATE_NOTIFICATION_BUGFIX;
import static android.window.DesktopExperienceFlags.ENABLE_RESTART_MENU_FOR_CONNECTED_DISPLAYS;
import static android.window.TransitionInfo.FLAGS_IS_OCCLUDED_NO_ANIMATION;
import static android.window.TransitionInfo.FLAG_IS_OCCLUDED;
@@ -9288,8 +9289,12 @@ final class ActivityRecord extends WindowToken {
    void setPictureInPictureParams(PictureInPictureParams p) {
        pictureInPictureArgs.copyOnlySet(p);
        adjustPictureInPictureParamsIfNeeded(getBounds());
        if (ENABLE_PIP_PARAMS_UPDATE_NOTIFICATION_BUGFIX.isTrue()) {
            getTask().onPictureInPictureParamsChanged();
        } else {
            getTask().getRootTask().onPictureInPictureParamsChanged();
        }
    }

    void setShouldDockBigOverlays(boolean shouldDockBigOverlays) {
        this.shouldDockBigOverlays = shouldDockBigOverlays;
+16 −0
Original line number Diff line number Diff line
@@ -2462,6 +2462,22 @@ public class ActivityRecordTests extends WindowTestsBase {
        assertTrue(activity.pictureInPictureArgs.isLaunchIntoPip());
    }

    @Test
    @EnableFlags(Flags.FLAG_ENABLE_PIP_PARAMS_UPDATE_NOTIFICATION_BUGFIX)
    public void testSetPictureInPictureParams() {
        final ActivityRecord activity = createActivityWith2LevelTask();
        final Task task = activity.getTask();
        final Task rootTask = task.getRootTask();
        final PictureInPictureParams params = new PictureInPictureParams
                .Builder()
                .setAutoEnterEnabled(true)
                .build();

        activity.setPictureInPictureParams(params);
        verify(rootTask, times(0)).onPictureInPictureParamsChanged();
        verify(task, times(1)).onPictureInPictureParamsChanged();
    }

    @Test
    public void testActivityServiceConnectionsHolder() {
        final ActivityRecord activity = new ActivityBuilder(mAtm).setCreateTask(true).build();