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

Commit 6071c2d0 authored by Ikram Gabiyev's avatar Ikram Gabiyev
Browse files

Refactor PiP2 to include PiP menu related classes

Copy PhonePipMenuController into pip2.phone package
along with the custom View class implementations.

Copy PipSurfaceTransactionHelper into pip2 too with the plan
to refactor it later.

Also move PipMenuController interface into the common.pip package.

Bug: 322548939
Test: mp sysuig
Change-Id: I9a418a6237421ba33e2a87c227d0106c5a2e399b
parent 25bde8f1
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 The Android Open Source Project
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

package com.android.wm.shell.pip;
package com.android.wm.shell.common.pip;

import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
import static android.view.WindowManager.LayoutParams.FLAG_SLIPPERY;
@@ -33,12 +33,13 @@ import android.view.SurfaceControl;
import android.view.WindowManager;

import com.android.wm.shell.R;
import com.android.wm.shell.ShellTaskOrganizer;

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.)
 *  Interface to interact with PiP menu when certain events happen
 *  (task appear/vanish, PiP move, etc.).
 */
public interface PipMenuController {

@@ -52,15 +53,15 @@ public interface PipMenuController {
    float ALPHA_NO_CHANGE = -1f;

    /**
     * Called when
     * {@link PipTaskOrganizer#onTaskAppeared(RunningTaskInfo, SurfaceControl)}
     * Called when out implementation of
     * {@link ShellTaskOrganizer.TaskListener#onTaskAppeared(RunningTaskInfo, SurfaceControl)}
     * is called.
     */
    void attach(SurfaceControl leash);

    /**
     * Called when
     * {@link PipTaskOrganizer#onTaskVanished(RunningTaskInfo)} is called.
     * Called when our implementation of
     * {@link ShellTaskOrganizer.TaskListener#onTaskVanished(RunningTaskInfo)} is called.
     */
    void detach();

+17 −0
Original line number Diff line number Diff line
@@ -18,18 +18,23 @@ package com.android.wm.shell.dagger.pip;

import android.annotation.NonNull;
import android.content.Context;
import android.os.Handler;

import com.android.wm.shell.ShellTaskOrganizer;
import com.android.wm.shell.common.DisplayController;
import com.android.wm.shell.common.DisplayInsetsController;
import com.android.wm.shell.common.ShellExecutor;
import com.android.wm.shell.common.SystemWindows;
import com.android.wm.shell.common.annotations.ShellMainThread;
import com.android.wm.shell.common.pip.PipBoundsAlgorithm;
import com.android.wm.shell.common.pip.PipBoundsState;
import com.android.wm.shell.common.pip.PipDisplayLayoutState;
import com.android.wm.shell.common.pip.PipMediaController;
import com.android.wm.shell.common.pip.PipUiEventLogger;
import com.android.wm.shell.common.pip.PipUtils;
import com.android.wm.shell.dagger.WMShellBaseModule;
import com.android.wm.shell.dagger.WMSingleton;
import com.android.wm.shell.pip2.phone.PhonePipMenuController;
import com.android.wm.shell.pip2.phone.PipController;
import com.android.wm.shell.pip2.phone.PipScheduler;
import com.android.wm.shell.pip2.phone.PipTransition;
@@ -85,4 +90,16 @@ public abstract class Pip2Module {
            @ShellMainThread ShellExecutor mainExecutor) {
        return new PipScheduler(context, pipBoundsState, mainExecutor);
    }

    @WMSingleton
    @Provides
    static PhonePipMenuController providePipPhoneMenuController(Context context,
            PipBoundsState pipBoundsState, PipMediaController pipMediaController,
            SystemWindows systemWindows,
            PipUiEventLogger pipUiEventLogger,
            @ShellMainThread ShellExecutor mainExecutor,
            @ShellMainThread Handler mainHandler) {
        return new PhonePipMenuController(context, pipBoundsState, pipMediaController,
                systemWindows, pipUiEventLogger, mainExecutor, mainHandler);
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ import com.android.wm.shell.common.annotations.ShellMainThread;
import com.android.wm.shell.common.pip.PipBoundsAlgorithm;
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.PipUiEventLogger;
import com.android.wm.shell.common.pip.PipUtils;
import com.android.wm.shell.pip.phone.PipMotionHelper;
+1 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ 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.PipDisplayLayoutState;
import com.android.wm.shell.common.pip.PipMenuController;
import com.android.wm.shell.common.pip.PipUtils;
import com.android.wm.shell.protolog.ShellProtoLogGroup;
import com.android.wm.shell.splitscreen.SplitScreenController;
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import androidx.annotation.NonNull;
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.sysui.ShellInit;
import com.android.wm.shell.transition.Transitions;
Loading