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

Commit fc0321b1 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Decouple systemui shared componements from PipController(8/N)"

parents 2ccec3d0 2fd465d6
Loading
Loading
Loading
Loading
+1 −26
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import android.view.WindowManagerGlobal;

import com.android.systemui.shared.recents.view.AppTransitionAnimationSpecsFuture;
import com.android.systemui.shared.recents.view.RecentsTransition;
import com.android.systemui.shared.system.PinnedStackListenerForwarder.PinnedStackListener;

public class WindowManagerWrapper {

@@ -75,7 +74,7 @@ public class WindowManagerWrapper {
            WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
    public static final int WINDOWING_MODE_MULTI_WINDOW =
            WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
    public static final int WINDOWING_MODE_PINNED = WindowConfiguration.WINDOWING_MODE_PINNED;

    public static final int WINDOWING_MODE_SPLIT_SCREEN_PRIMARY =
            WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
    public static final int WINDOWING_MODE_SPLIT_SCREEN_SECONDARY =
@@ -84,13 +83,6 @@ public class WindowManagerWrapper {

    private static final WindowManagerWrapper sInstance = new WindowManagerWrapper();

    /**
     * Forwarder to which we can add multiple pinned stack listeners. Each listener will receive
     * updates from the window manager service.
     */
    private PinnedStackListenerForwarder mPinnedStackListenerForwarder =
            new PinnedStackListenerForwarder();

    public static WindowManagerWrapper getInstance() {
        return sInstance;
    }
@@ -187,23 +179,6 @@ public class WindowManagerWrapper {
        return NAV_BAR_POS_INVALID;
    }

    /**
     * Adds a pinned stack listener, which will receive updates from the window manager service
     * along with any other pinned stack listeners that were added via this method.
     */
    public void addPinnedStackListener(PinnedStackListener listener) throws RemoteException {
        mPinnedStackListenerForwarder.addListener(listener);
        WindowManagerGlobal.getWindowManagerService().registerPinnedStackListener(
                DEFAULT_DISPLAY, mPinnedStackListenerForwarder);
    }

    /**
     * Removes a pinned stack listener.
     */
    public void removePinnedStackListener(PinnedStackListener listener) {
        mPinnedStackListenerForwarder.removeListener(listener);
    }

    /**
     * Mirrors a specified display. The SurfaceControl returned is the root of the mirrored
     * hierarchy.
+3 −3
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;

import static com.android.systemui.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_CONTROLLER;
import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_BUBBLES;
import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.systemui.statusbar.StatusBarState.SHADE;
@@ -91,7 +90,6 @@ import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.PinnedStackListenerForwarder;
import com.android.systemui.shared.system.TaskStackChangeListener;
import com.android.systemui.shared.system.WindowManagerWrapper;
import com.android.systemui.statusbar.FeatureFlags;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.NotificationRemoveInterceptor;
@@ -115,6 +113,7 @@ import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.ZenModeController;
import com.android.systemui.util.FloatingContentCoordinator;
import com.android.systemui.wmshell.WindowManagerShellWrapper;

import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -366,6 +365,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
            INotificationManager notificationManager,
            @Nullable IStatusBarService statusBarService,
            WindowManager windowManager,
            WindowManagerShellWrapper windowManagerShellWrapper,
            LauncherApps launcherApps) {
        dumpManager.registerDumpable(TAG, this);
        mContext = context;
@@ -441,7 +441,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
        ActivityManagerWrapper.getInstance().registerTaskStackListener(mTaskStackListener);

        try {
            WindowManagerWrapper.getInstance().addPinnedStackListener(new BubblesImeListener());
            windowManagerShellWrapper.addPinnedStackListener(new BubblesImeListener());
        } catch (RemoteException e) {
            e.printStackTrace();
        }
+3 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.ZenModeController;
import com.android.systemui.util.FloatingContentCoordinator;
import com.android.systemui.wmshell.WindowManagerShellWrapper;

import dagger.Module;
import dagger.Provides;
@@ -73,6 +74,7 @@ public interface BubbleModule {
            INotificationManager notifManager,
            IStatusBarService statusBarService,
            WindowManager windowManager,
            WindowManagerShellWrapper windowManagerShellWrapper,
            LauncherApps launcherApps) {
        return new BubbleController(
                context,
@@ -96,6 +98,7 @@ public interface BubbleModule {
                notifManager,
                statusBarService,
                windowManager,
                windowManagerShellWrapper,
                launcherApps);
    }
}
+8 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ import com.android.systemui.shared.plugins.PluginManager;
import com.android.systemui.shared.plugins.PluginManagerImpl;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.DevicePolicyManagerWrapper;
import com.android.systemui.shared.system.WindowManagerWrapper;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.phone.AutoHideController;
@@ -312,6 +313,13 @@ public class DependencyProvider {

    /** */
    @Provides
    public WindowManagerWrapper providesWindowManagerWrapper() {
        return WindowManagerWrapper.getInstance();
    }

    /** */
    @Provides
    @SysUISingleton
    public SystemActions providesSystemActions(Context context) {
        return new SystemActions(context);
    }
+80 −22
Original line number Diff line number Diff line
@@ -16,9 +16,11 @@

package com.android.systemui.pip;

import android.content.res.Configuration;
import android.app.ActivityManager;
import android.content.ComponentName;
import android.media.session.MediaController;

import com.android.systemui.pip.phone.PipTouchHandler;
import com.android.systemui.pip.tv.PipController;
import com.android.systemui.shared.recents.IPinnedStackAnimationListener;

@@ -28,11 +30,6 @@ import java.io.PrintWriter;
 * Interface to engage picture in picture feature.
 */
public interface Pip {
    /**
     * Called when showing Pip menu.
     */
    void showPictureInPictureMenu();

    /**
     * Registers {@link com.android.systemui.pip.tv.PipController.Listener} that gets called.
     * whenever receiving notification on changes in PIP.
@@ -52,6 +49,14 @@ public interface Pip {
    default void closePip() {
    }

    /**
     * Dump the current state and information if need.
     *
     * @param pw The stream to dump information to.
     */
    default void dump(PrintWriter pw) {
    }

    /**
     * Expand PIP, it's possible that specific request to activate the window via Alt-tab.
     */
@@ -64,7 +69,11 @@ public interface Pip {
     * @return The state of defined in PipController.
     */
    default int getPlaybackState() {
        return 0;
        return -1;
    }

    default PipTouchHandler getPipTouchHandler() {
        return null;
    }

    /**
@@ -95,9 +104,61 @@ public interface Pip {
    }

    /**
     * Called when configuration change invoked.
     * Called whenever an Activity is moved to the pinned stack from another stack.
     */
    default void onActivityPinned(String packageName) {
    }

    /**
     * Called whenever an Activity is moved from the pinned stack to another stack
     */
    default void onActivityUnpinned(ComponentName topActivity) {
    }

    /**
     * Called whenever IActivityManager.startActivity is called on an activity that is already
     * running, but the task is either brought to the front or a new Intent is delivered to it.
     *
     * @param task        information about the task the activity was relaunched into
     * @param clearedTask whether or not the launch activity also cleared the task as a part of
     *                    starting
     */
    default void onActivityRestartAttempt(ActivityManager.RunningTaskInfo task,
            boolean clearedTask) {
    }

    /**
     * Called when display size or font size of settings changed
     */
    default void onDensityOrFontScaleChanged() {
    }

    /**
     * Called when overlay package change invoked.
     */
    default void onOverlayChanged() {
    }

    /**
     * Registers the session listener for the current user.
     */
    default void registerSessionListenerForCurrentUser() {
    }

    /**
     * Called when SysUI state changed.
     *
     * @param isSysUiStateValid Is SysUI state valid or not.
     * @param flag Current SysUI state.
     */
    default void onSystemUiStateChanged(boolean isSysUiStateValid, int flag) {
    }

    /**
     * Called when task stack changed.
     */
    void onConfigurationChanged(Configuration newConfig);
    default void onTaskStackChanged() {
    }

    /**
     * Removes a {@link PipController.Listener} from PipController.
@@ -136,6 +197,14 @@ public interface Pip {
    default void setShelfHeight(boolean visible, int height) {
    }

    /**
     * Registers the pinned stack animation listener.
     *
     * @param listener The listener of pinned stack animation.
     */
    default void setPinnedStackAnimationListener(IPinnedStackAnimationListener listener) {
    }

    /**
     * Set the pinned stack with {@link PipAnimationController.AnimationType}
     *
@@ -145,12 +214,9 @@ public interface Pip {
    }

    /**
     * Registers the pinned stack animation listener.
     *
     * @param listener The listener of pinned stack animation.
     * Called when showing Pip menu.
     */
    default void setPinnedStackAnimationListener(IPinnedStackAnimationListener listener) {
    }
    void showPictureInPictureMenu();

    /**
     * Suspends resizing operation on the Pip until {@link #resumePipResizing} is called.
@@ -159,12 +225,4 @@ public interface Pip {
     */
    default void suspendPipResizing(int reason) {
    }

    /**
     * Dump the current state and information if need.
     *
     * @param pw The stream to dump information to.
     */
    default void dump(PrintWriter pw) {
    }
}
Loading