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

Commit b6a40eb6 authored by Jacqueline Bronger's avatar Jacqueline Bronger Committed by Automerger Merge Worker
Browse files

Merge "Handle PiP params changes in onTaskInfoChanged" into tm-dev am: 936456ae

parents 5f5f4eb0 936456ae
Loading
Loading
Loading
Loading
+0 −16
Original line number Diff line number Diff line
@@ -43,12 +43,6 @@ oneway interface IPinnedTaskListener {
     */
    void onImeVisibilityChanged(boolean imeVisible, int imeHeight);

    /**
     * Called when the set of actions for the current PiP activity changes, or when the listener
     * is first registered to allow the listener to synchronize its state with the controller.
     */
    void onActionsChanged(in ParceledListSlice<RemoteAction> actions, in RemoteAction closeAction);

    /**
     * Called by the window manager to notify the listener that Activity (was or is in pinned mode)
     * is hidden (either stopped or removed). This is generally used as a signal to reset saved
@@ -56,14 +50,4 @@ oneway interface IPinnedTaskListener {
     * {@param componentName} represents the application component of PiP window.
     */
    void onActivityHidden(in ComponentName componentName);

    /**
     * Called by the window manager when the aspect ratio is reset.
     */
    void onAspectRatioChanged(float aspectRatio);

    /**
      * Called by the window manager when the expanded aspect ratio is reset.
    */
    void onExpandedAspectRatioChanged(float aspectRatio);
}
+13 −2
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import com.android.wm.shell.common.annotations.ShellMainThread;
import com.android.wm.shell.pip.Pip;
import com.android.wm.shell.pip.PipAnimationController;
import com.android.wm.shell.pip.PipMediaController;
import com.android.wm.shell.pip.PipParamsChangedForwarder;
import com.android.wm.shell.pip.PipSnapAlgorithm;
import com.android.wm.shell.pip.PipSurfaceTransactionHelper;
import com.android.wm.shell.pip.PipTaskOrganizer;
@@ -41,6 +42,7 @@ import com.android.wm.shell.pip.tv.TvPipBoundsState;
import com.android.wm.shell.pip.tv.TvPipController;
import com.android.wm.shell.pip.tv.TvPipMenuController;
import com.android.wm.shell.pip.tv.TvPipNotificationController;
import com.android.wm.shell.pip.tv.TvPipTaskOrganizer;
import com.android.wm.shell.pip.tv.TvPipTransition;
import com.android.wm.shell.splitscreen.SplitScreenController;
import com.android.wm.shell.transition.Transitions;
@@ -67,6 +69,7 @@ public abstract class TvPipModule {
            PipTransitionController pipTransitionController,
            TvPipNotificationController tvPipNotificationController,
            TaskStackListenerImpl taskStackListener,
            PipParamsChangedForwarder pipParamsChangedForwarder,
            DisplayController displayController,
            WindowManagerShellWrapper windowManagerShellWrapper,
            @ShellMainThread ShellExecutor mainExecutor,
@@ -82,6 +85,7 @@ public abstract class TvPipModule {
                        pipMediaController,
                        tvPipNotificationController,
                        taskStackListener,
                        pipParamsChangedForwarder,
                        displayController,
                        windowManagerShellWrapper,
                        mainExecutor,
@@ -163,15 +167,22 @@ public abstract class TvPipModule {
            TvPipBoundsAlgorithm tvPipBoundsAlgorithm,
            PipAnimationController pipAnimationController,
            PipTransitionController pipTransitionController,
            PipParamsChangedForwarder pipParamsChangedForwarder,
            PipSurfaceTransactionHelper pipSurfaceTransactionHelper,
            Optional<SplitScreenController> splitScreenControllerOptional,
            DisplayController displayController,
            PipUiEventLogger pipUiEventLogger, ShellTaskOrganizer shellTaskOrganizer,
            @ShellMainThread ShellExecutor mainExecutor) {
        return new PipTaskOrganizer(context,
        return new TvPipTaskOrganizer(context,
                syncTransactionQueue, pipTransitionState, tvPipBoundsState, tvPipBoundsAlgorithm,
                tvPipMenuController, pipAnimationController, pipSurfaceTransactionHelper,
                pipTransitionController, splitScreenControllerOptional,
                pipTransitionController, pipParamsChangedForwarder, splitScreenControllerOptional,
                displayController, pipUiEventLogger, shellTaskOrganizer, mainExecutor);
    }

    @WMSingleton
    @Provides
    static PipParamsChangedForwarder providePipParamsChangedForwarder() {
        return new PipParamsChangedForwarder();
    }
}
+13 −5
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ import com.android.wm.shell.pip.PipAnimationController;
import com.android.wm.shell.pip.PipBoundsAlgorithm;
import com.android.wm.shell.pip.PipBoundsState;
import com.android.wm.shell.pip.PipMediaController;
import com.android.wm.shell.pip.PipParamsChangedForwarder;
import com.android.wm.shell.pip.PipSnapAlgorithm;
import com.android.wm.shell.pip.PipSurfaceTransactionHelper;
import com.android.wm.shell.pip.PipTaskOrganizer;
@@ -216,14 +217,14 @@ public class WMShellModule {
            PipTouchHandler pipTouchHandler, PipTransitionController pipTransitionController,
            WindowManagerShellWrapper windowManagerShellWrapper,
            TaskStackListenerImpl taskStackListener,
            PipParamsChangedForwarder pipParamsChangedForwarder,
            Optional<OneHandedController> oneHandedController,
            @ShellMainThread ShellExecutor mainExecutor) {
        return Optional.ofNullable(PipController.create(context, displayController,
                pipAppOpsListener, pipBoundsAlgorithm, pipKeepClearAlgorithm, pipBoundsState,
                pipMotionHelper,
                pipMediaController, phonePipMenuController, pipTaskOrganizer, pipTouchHandler,
                pipTransitionController, windowManagerShellWrapper, taskStackListener,
                oneHandedController, mainExecutor));
                pipMotionHelper, pipMediaController, phonePipMenuController, pipTaskOrganizer,
                pipTouchHandler, pipTransitionController, windowManagerShellWrapper,
                taskStackListener, pipParamsChangedForwarder, oneHandedController, mainExecutor));
    }

    @WMSingleton
@@ -297,6 +298,7 @@ public class WMShellModule {
            PipAnimationController pipAnimationController,
            PipSurfaceTransactionHelper pipSurfaceTransactionHelper,
            PipTransitionController pipTransitionController,
            PipParamsChangedForwarder pipParamsChangedForwarder,
            Optional<SplitScreenController> splitScreenControllerOptional,
            DisplayController displayController,
            PipUiEventLogger pipUiEventLogger, ShellTaskOrganizer shellTaskOrganizer,
@@ -304,7 +306,7 @@ public class WMShellModule {
        return new PipTaskOrganizer(context,
                syncTransactionQueue, pipTransitionState, pipBoundsState, pipBoundsAlgorithm,
                menuPhoneController, pipAnimationController, pipSurfaceTransactionHelper,
                pipTransitionController, splitScreenControllerOptional,
                pipTransitionController, pipParamsChangedForwarder, splitScreenControllerOptional,
                displayController, pipUiEventLogger, shellTaskOrganizer, mainExecutor);
    }

@@ -391,4 +393,10 @@ public class WMShellModule {
                rootTaskDisplayAreaOrganizer
        );
    }

    @WMSingleton
    @Provides
    static PipParamsChangedForwarder providePipParamsChangedForwarder() {
        return new PipParamsChangedForwarder();
    }
}
+0 −52
Original line number Diff line number Diff line
@@ -16,9 +16,7 @@

package com.android.wm.shell.pip;

import android.app.RemoteAction;
import android.content.ComponentName;
import android.content.pm.ParceledListSlice;
import android.os.RemoteException;
import android.view.IPinnedTaskListener;
import android.view.WindowManagerGlobal;
@@ -72,31 +70,12 @@ public class PinnedStackListenerForwarder {
        }
    }

    private void onActionsChanged(ParceledListSlice<RemoteAction> actions,
            RemoteAction closeAction) {
        for (PinnedTaskListener listener : mListeners) {
            listener.onActionsChanged(actions, closeAction);
        }
    }

    private void onActivityHidden(ComponentName componentName) {
        for (PinnedTaskListener listener : mListeners) {
            listener.onActivityHidden(componentName);
        }
    }

    private void onAspectRatioChanged(float aspectRatio) {
        for (PinnedTaskListener listener : mListeners) {
            listener.onAspectRatioChanged(aspectRatio);
        }
    }

    private void onExpandedAspectRatioChanged(float aspectRatio) {
        for (PinnedTaskListener listener : mListeners) {
            listener.onExpandedAspectRatioChanged(aspectRatio);
        }
    }

    @BinderThread
    private class PinnedTaskListenerImpl extends IPinnedTaskListener.Stub {
        @Override
@@ -113,36 +92,12 @@ public class PinnedStackListenerForwarder {
            });
        }

        @Override
        public void onActionsChanged(ParceledListSlice<RemoteAction> actions,
                RemoteAction closeAction) {
            mMainExecutor.execute(() -> {
                PinnedStackListenerForwarder.this.onActionsChanged(actions, closeAction);
            });
        }

        @Override
        public void onActivityHidden(ComponentName componentName) {
            mMainExecutor.execute(() -> {
                PinnedStackListenerForwarder.this.onActivityHidden(componentName);
            });
        }

        @Override
        public void onAspectRatioChanged(float aspectRatio) {
            mMainExecutor.execute(() -> {
                PinnedStackListenerForwarder.this.onAspectRatioChanged(aspectRatio);
            });
        }

        @Override
        public void onExpandedAspectRatioChanged(float aspectRatio) {
            mMainExecutor.execute(() -> {
                PinnedStackListenerForwarder.this.onExpandedAspectRatioChanged(aspectRatio);
            });
        }


    }

    /**
@@ -154,13 +109,6 @@ public class PinnedStackListenerForwarder {

        public void onImeVisibilityChanged(boolean imeVisible, int imeHeight) {}

        public void onActionsChanged(ParceledListSlice<RemoteAction> actions,
                RemoteAction closeAction) {}

        public void onActivityHidden(ComponentName componentName) {}

        public void onAspectRatioChanged(float aspectRatio) {}

        public void onExpandedAspectRatioChanged(float aspectRatio) {}
    }
}
+3 −2
Original line number Diff line number Diff line
@@ -26,12 +26,13 @@ import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
import android.annotation.Nullable;
import android.app.ActivityManager.RunningTaskInfo;
import android.app.RemoteAction;
import android.content.pm.ParceledListSlice;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.view.SurfaceControl;
import android.view.WindowManager;

import java.util.List;

/**
 *  Interface to allow {@link com.android.wm.shell.pip.PipTaskOrganizer} to call into
 *  PiP menu when certain events happen (task appear/vanish, PiP move, etc.)
@@ -66,7 +67,7 @@ public interface PipMenuController {
    /**
     * Given a set of actions, update the menu.
     */
    void setAppActions(ParceledListSlice<RemoteAction> appActions, RemoteAction closeAction);
    void setAppActions(List<RemoteAction> appActions, RemoteAction closeAction);

    /**
     * Resize the PiP menu with the given bounds. The PiP SurfaceControl is given if there is a
Loading