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

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

Merge "Add single interface for SysUI to call into Shell" into tm-qpr-dev

parents a4f1d064 b5ebf4be
Loading
Loading
Loading
Loading
+12 −17
Original line number Original line Diff line number Diff line
@@ -101,6 +101,8 @@ import com.android.wm.shell.draganddrop.DragAndDropController;
import com.android.wm.shell.onehanded.OneHandedController;
import com.android.wm.shell.onehanded.OneHandedController;
import com.android.wm.shell.onehanded.OneHandedTransitionCallback;
import com.android.wm.shell.onehanded.OneHandedTransitionCallback;
import com.android.wm.shell.pip.PinnedStackListenerForwarder;
import com.android.wm.shell.pip.PinnedStackListenerForwarder;
import com.android.wm.shell.sysui.ConfigurationChangeListener;
import com.android.wm.shell.sysui.ShellController;


import java.io.PrintWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.ArrayList;
@@ -119,7 +121,7 @@ import java.util.function.IntConsumer;
 *
 *
 * The controller manages addition, removal, and visible state of bubbles on screen.
 * The controller manages addition, removal, and visible state of bubbles on screen.
 */
 */
public class BubbleController {
public class BubbleController implements ConfigurationChangeListener {


    private static final String TAG = TAG_WITH_CLASS_NAME ? "BubbleController" : TAG_BUBBLES;
    private static final String TAG = TAG_WITH_CLASS_NAME ? "BubbleController" : TAG_BUBBLES;


@@ -155,6 +157,7 @@ public class BubbleController {
    private final DisplayController mDisplayController;
    private final DisplayController mDisplayController;
    private final TaskViewTransitions mTaskViewTransitions;
    private final TaskViewTransitions mTaskViewTransitions;
    private final SyncTransactionQueue mSyncQueue;
    private final SyncTransactionQueue mSyncQueue;
    private final ShellController mShellController;


    // Used to post to main UI thread
    // Used to post to main UI thread
    private final ShellExecutor mMainExecutor;
    private final ShellExecutor mMainExecutor;
@@ -224,6 +227,7 @@ public class BubbleController {


  
  
    public BubbleController(Context context,
    public BubbleController(Context context,
            ShellController shellController,
            BubbleData data,
            BubbleData data,
            @Nullable BubbleStackView.SurfaceSynchronizer synchronizer,
            @Nullable BubbleStackView.SurfaceSynchronizer synchronizer,
            FloatingContentCoordinator floatingContentCoordinator,
            FloatingContentCoordinator floatingContentCoordinator,
@@ -246,6 +250,7 @@ public class BubbleController {
            TaskViewTransitions taskViewTransitions,
            TaskViewTransitions taskViewTransitions,
            SyncTransactionQueue syncQueue) {
            SyncTransactionQueue syncQueue) {
        mContext = context;
        mContext = context;
        mShellController = shellController;
        mLauncherApps = launcherApps;
        mLauncherApps = launcherApps;
        mBarService = statusBarService == null
        mBarService = statusBarService == null
                ? IStatusBarService.Stub.asInterface(
                ? IStatusBarService.Stub.asInterface(
@@ -414,6 +419,8 @@ public class BubbleController {
        // Clear out any persisted bubbles on disk that no longer have a valid user.
        // Clear out any persisted bubbles on disk that no longer have a valid user.
        List<UserInfo> users = mUserManager.getAliveUsers();
        List<UserInfo> users = mUserManager.getAliveUsers();
        mDataRepository.sanitizeBubbles(users);
        mDataRepository.sanitizeBubbles(users);

        mShellController.addConfigurationChangeListener(this);
    }
    }


    @VisibleForTesting
    @VisibleForTesting
@@ -798,7 +805,8 @@ public class BubbleController {
        mSavedBubbleKeysPerUser.remove(userId);
        mSavedBubbleKeysPerUser.remove(userId);
    }
    }


    private void updateForThemeChanges() {
    @Override
    public void onThemeChanged() {
        if (mStackView != null) {
        if (mStackView != null) {
            mStackView.onThemeChanged();
            mStackView.onThemeChanged();
        }
        }
@@ -818,7 +826,8 @@ public class BubbleController {
        }
        }
    }
    }


    private void onConfigChanged(Configuration newConfig) {
    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        if (mBubblePositioner != null) {
        if (mBubblePositioner != null) {
            mBubblePositioner.update();
            mBubblePositioner.update();
        }
        }
@@ -1677,13 +1686,6 @@ public class BubbleController {
            });
            });
        }
        }


        @Override
        public void updateForThemeChanges() {
            mMainExecutor.execute(() -> {
                BubbleController.this.updateForThemeChanges();
            });
        }

        @Override
        @Override
        public void expandStackAndSelectBubble(BubbleEntry entry) {
        public void expandStackAndSelectBubble(BubbleEntry entry) {
            mMainExecutor.execute(() -> {
            mMainExecutor.execute(() -> {
@@ -1822,13 +1824,6 @@ public class BubbleController {
            });
            });
        }
        }


        @Override
        public void onConfigChanged(Configuration newConfig) {
            mMainExecutor.execute(() -> {
                BubbleController.this.onConfigChanged(newConfig);
            });
        }

        @Override
        @Override
        public void onNotificationPanelExpandedChanged(boolean expanded) {
        public void onNotificationPanelExpandedChanged(boolean expanded) {
            mMainExecutor.execute(
            mMainExecutor.execute(
+0 −10
Original line number Original line Diff line number Diff line
@@ -107,9 +107,6 @@ public interface Bubbles {
    /** Tell the stack of bubbles to collapse. */
    /** Tell the stack of bubbles to collapse. */
    void collapseStack();
    void collapseStack();


    /** Tell the controller need update its UI to fit theme. */
    void updateForThemeChanges();

    /**
    /**
     * Request the stack expand if needed, then select the specified Bubble as current.
     * Request the stack expand if needed, then select the specified Bubble as current.
     * If no bubble exists for this entry, one is created.
     * If no bubble exists for this entry, one is created.
@@ -255,13 +252,6 @@ public interface Bubbles {
     */
     */
    void onUserRemoved(int removedUserId);
    void onUserRemoved(int removedUserId);


    /**
     * Called when config changed.
     *
     * @param newConfig the new config.
     */
    void onConfigChanged(Configuration newConfig);

    /** Description of current bubble state. */
    /** Description of current bubble state. */
    void dump(PrintWriter pw, String[] args);
    void dump(PrintWriter pw, String[] args);


+3 −0
Original line number Original line Diff line number Diff line
@@ -48,6 +48,7 @@ import com.android.wm.shell.pip.tv.TvPipNotificationController;
import com.android.wm.shell.pip.tv.TvPipTaskOrganizer;
import com.android.wm.shell.pip.tv.TvPipTaskOrganizer;
import com.android.wm.shell.pip.tv.TvPipTransition;
import com.android.wm.shell.pip.tv.TvPipTransition;
import com.android.wm.shell.splitscreen.SplitScreenController;
import com.android.wm.shell.splitscreen.SplitScreenController;
import com.android.wm.shell.sysui.ShellController;
import com.android.wm.shell.transition.Transitions;
import com.android.wm.shell.transition.Transitions;


import java.util.Optional;
import java.util.Optional;
@@ -64,6 +65,7 @@ public abstract class TvPipModule {
    @Provides
    @Provides
    static Optional<Pip> providePip(
    static Optional<Pip> providePip(
            Context context,
            Context context,
            ShellController shellController,
            TvPipBoundsState tvPipBoundsState,
            TvPipBoundsState tvPipBoundsState,
            TvPipBoundsAlgorithm tvPipBoundsAlgorithm,
            TvPipBoundsAlgorithm tvPipBoundsAlgorithm,
            TvPipBoundsController tvPipBoundsController,
            TvPipBoundsController tvPipBoundsController,
@@ -81,6 +83,7 @@ public abstract class TvPipModule {
        return Optional.of(
        return Optional.of(
                TvPipController.create(
                TvPipController.create(
                        context,
                        context,
                        shellController,
                        tvPipBoundsState,
                        tvPipBoundsState,
                        tvPipBoundsAlgorithm,
                        tvPipBoundsAlgorithm,
                        tvPipBoundsController,
                        tvPipBoundsController,
+29 −6
Original line number Original line Diff line number Diff line
@@ -83,6 +83,8 @@ import com.android.wm.shell.startingsurface.StartingSurface;
import com.android.wm.shell.startingsurface.StartingWindowController;
import com.android.wm.shell.startingsurface.StartingWindowController;
import com.android.wm.shell.startingsurface.StartingWindowTypeAlgorithm;
import com.android.wm.shell.startingsurface.StartingWindowTypeAlgorithm;
import com.android.wm.shell.startingsurface.phone.PhoneStartingWindowTypeAlgorithm;
import com.android.wm.shell.startingsurface.phone.PhoneStartingWindowTypeAlgorithm;
import com.android.wm.shell.sysui.ShellController;
import com.android.wm.shell.sysui.ShellInterface;
import com.android.wm.shell.tasksurfacehelper.TaskSurfaceHelper;
import com.android.wm.shell.tasksurfacehelper.TaskSurfaceHelper;
import com.android.wm.shell.tasksurfacehelper.TaskSurfaceHelperController;
import com.android.wm.shell.tasksurfacehelper.TaskSurfaceHelperController;
import com.android.wm.shell.transition.ShellTransitions;
import com.android.wm.shell.transition.ShellTransitions;
@@ -160,10 +162,13 @@ public abstract class WMShellBaseModule {
    @WMSingleton
    @WMSingleton
    @Provides
    @Provides
    static DragAndDropController provideDragAndDropController(Context context,
    static DragAndDropController provideDragAndDropController(Context context,
            DisplayController displayController, UiEventLogger uiEventLogger,
            ShellController shellController,
            IconProvider iconProvider, @ShellMainThread ShellExecutor mainExecutor) {
            DisplayController displayController,
        return new DragAndDropController(context, displayController, uiEventLogger, iconProvider,
            UiEventLogger uiEventLogger,
                mainExecutor);
            IconProvider iconProvider,
            @ShellMainThread ShellExecutor mainExecutor) {
        return new DragAndDropController(context, shellController, displayController, uiEventLogger,
                iconProvider, mainExecutor);
    }
    }


    @WMSingleton
    @WMSingleton
@@ -378,9 +383,11 @@ public abstract class WMShellBaseModule {
    @WMSingleton
    @WMSingleton
    @Provides
    @Provides
    static Optional<HideDisplayCutoutController> provideHideDisplayCutoutController(Context context,
    static Optional<HideDisplayCutoutController> provideHideDisplayCutoutController(Context context,
            DisplayController displayController, @ShellMainThread ShellExecutor mainExecutor) {
            ShellController shellController, DisplayController displayController,
            @ShellMainThread ShellExecutor mainExecutor) {
        return Optional.ofNullable(
        return Optional.ofNullable(
                HideDisplayCutoutController.create(context, displayController, mainExecutor));
                HideDisplayCutoutController.create(context, shellController, displayController,
                        mainExecutor));
    }
    }


    //
    //
@@ -634,6 +641,22 @@ public abstract class WMShellBaseModule {
        return Optional.of(new ActivityEmbeddingController(context, transitions));
        return Optional.of(new ActivityEmbeddingController(context, transitions));
    }
    }


    //
    // SysUI -> Shell interface
    //

    @WMSingleton
    @Provides
    static ShellInterface provideShellSysuiCallbacks(ShellController shellController) {
        return shellController.asShell();
    }

    @WMSingleton
    @Provides
    static ShellController provideShellController(@ShellMainThread ShellExecutor mainExecutor) {
        return new ShellController(mainExecutor);
    }

    //
    //
    // Misc
    // Misc
    //
    //
+10 −5
Original line number Original line Diff line number Diff line
@@ -71,6 +71,7 @@ import com.android.wm.shell.pip.phone.PipMotionHelper;
import com.android.wm.shell.pip.phone.PipTouchHandler;
import com.android.wm.shell.pip.phone.PipTouchHandler;
import com.android.wm.shell.recents.RecentTasksController;
import com.android.wm.shell.recents.RecentTasksController;
import com.android.wm.shell.splitscreen.SplitScreenController;
import com.android.wm.shell.splitscreen.SplitScreenController;
import com.android.wm.shell.sysui.ShellController;
import com.android.wm.shell.transition.Transitions;
import com.android.wm.shell.transition.Transitions;
import com.android.wm.shell.unfold.ShellUnfoldProgressProvider;
import com.android.wm.shell.unfold.ShellUnfoldProgressProvider;
import com.android.wm.shell.unfold.UnfoldAnimationController;
import com.android.wm.shell.unfold.UnfoldAnimationController;
@@ -134,6 +135,7 @@ public abstract class WMShellModule {
    @WMSingleton
    @WMSingleton
    @Provides
    @Provides
    static BubbleController provideBubbleController(Context context,
    static BubbleController provideBubbleController(Context context,
            ShellController shellController,
            BubbleData data,
            BubbleData data,
            FloatingContentCoordinator floatingContentCoordinator,
            FloatingContentCoordinator floatingContentCoordinator,
            IStatusBarService statusBarService,
            IStatusBarService statusBarService,
@@ -153,7 +155,7 @@ public abstract class WMShellModule {
            @ShellBackgroundThread ShellExecutor bgExecutor,
            @ShellBackgroundThread ShellExecutor bgExecutor,
            TaskViewTransitions taskViewTransitions,
            TaskViewTransitions taskViewTransitions,
            SyncTransactionQueue syncQueue) {
            SyncTransactionQueue syncQueue) {
        return new BubbleController(context, data, null /* synchronizer */,
        return new BubbleController(context, shellController, data, null /* synchronizer */,
                floatingContentCoordinator,
                floatingContentCoordinator,
                new BubbleDataRepository(context, launcherApps, mainExecutor),
                new BubbleDataRepository(context, launcherApps, mainExecutor),
                statusBarService, windowManager, windowManagerShellWrapper, userManager,
                statusBarService, windowManager, windowManagerShellWrapper, userManager,
@@ -205,12 +207,14 @@ public abstract class WMShellModule {
    @Provides
    @Provides
    @DynamicOverride
    @DynamicOverride
    static OneHandedController provideOneHandedController(Context context,
    static OneHandedController provideOneHandedController(Context context,
            ShellController shellController,
            WindowManager windowManager, DisplayController displayController,
            WindowManager windowManager, DisplayController displayController,
            DisplayLayout displayLayout, TaskStackListenerImpl taskStackListener,
            DisplayLayout displayLayout, TaskStackListenerImpl taskStackListener,
            UiEventLogger uiEventLogger, InteractionJankMonitor jankMonitor,
            UiEventLogger uiEventLogger, InteractionJankMonitor jankMonitor,
            @ShellMainThread ShellExecutor mainExecutor, @ShellMainThread Handler mainHandler) {
            @ShellMainThread ShellExecutor mainExecutor, @ShellMainThread Handler mainHandler) {
        return OneHandedController.create(context, windowManager, displayController, displayLayout,
        return OneHandedController.create(context, shellController, windowManager,
                taskStackListener, jankMonitor, uiEventLogger, mainExecutor, mainHandler);
                displayController, displayLayout, taskStackListener, jankMonitor, uiEventLogger,
                mainExecutor, mainHandler);
    }
    }


    //
    //
@@ -242,7 +246,8 @@ public abstract class WMShellModule {


    @WMSingleton
    @WMSingleton
    @Provides
    @Provides
    static Optional<Pip> providePip(Context context, DisplayController displayController,
    static Optional<Pip> providePip(Context context,
            ShellController shellController, DisplayController displayController,
            PipAppOpsListener pipAppOpsListener, PipBoundsAlgorithm pipBoundsAlgorithm,
            PipAppOpsListener pipAppOpsListener, PipBoundsAlgorithm pipBoundsAlgorithm,
            PipKeepClearAlgorithm pipKeepClearAlgorithm, PipBoundsState pipBoundsState,
            PipKeepClearAlgorithm pipKeepClearAlgorithm, PipBoundsState pipBoundsState,
            PipMotionHelper pipMotionHelper, PipMediaController pipMediaController,
            PipMotionHelper pipMotionHelper, PipMediaController pipMediaController,
@@ -254,7 +259,7 @@ public abstract class WMShellModule {
            PipParamsChangedForwarder pipParamsChangedForwarder,
            PipParamsChangedForwarder pipParamsChangedForwarder,
            Optional<OneHandedController> oneHandedController,
            Optional<OneHandedController> oneHandedController,
            @ShellMainThread ShellExecutor mainExecutor) {
            @ShellMainThread ShellExecutor mainExecutor) {
        return Optional.ofNullable(PipController.create(context, displayController,
        return Optional.ofNullable(PipController.create(context, shellController, displayController,
                pipAppOpsListener, pipBoundsAlgorithm, pipKeepClearAlgorithm, pipBoundsState,
                pipAppOpsListener, pipBoundsAlgorithm, pipKeepClearAlgorithm, pipBoundsState,
                pipMotionHelper,
                pipMotionHelper,
                pipMediaController, phonePipMenuController, pipTaskOrganizer, pipTransitionState,
                pipMediaController, phonePipMenuController, pipTaskOrganizer, pipTransitionState,
Loading