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

Commit 85bb2ef6 authored by Vinit Nayak's avatar Vinit Nayak Committed by Android (Google) Code Review
Browse files

Merge "Allow AppHandles to report screen positions to interested parties" into main

parents d8549381 d95ade7f
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -36,12 +36,13 @@ import com.android.wm.shell.splitscreen.SplitScreen;
import com.android.wm.shell.startingsurface.StartingSurface;
import com.android.wm.shell.sysui.ShellInterface;
import com.android.wm.shell.taskview.TaskViewFactory;
import com.android.wm.shell.windowdecor.viewholder.AppHandles;

import java.util.Optional;

import dagger.BindsInstance;
import dagger.Subcomponent;

import java.util.Optional;

/**
 * Dagger Subcomponent for WindowManager.  This class explicitly describes the interfaces exported
 * from the WM component into the SysUI component, and references the specific dependencies
@@ -120,6 +121,9 @@ public interface WMComponent {
    @WMSingleton
    Optional<AppZoomOut> getAppZoomOut();

    @WMSingleton
    Optional<AppHandles> getAppHandles();

    // Injector methods to support field injection

    /** Injector method for {@link BubbleBarExpandedView}. */
+16 −0
Original line number Diff line number Diff line
@@ -144,6 +144,8 @@ import com.android.wm.shell.unfold.ShellUnfoldProgressProvider;
import com.android.wm.shell.unfold.UnfoldAnimationController;
import com.android.wm.shell.unfold.UnfoldTransitionHandler;
import com.android.wm.shell.windowdecor.WindowDecorViewModel;
import com.android.wm.shell.windowdecor.viewholder.AppHandleNotifier;
import com.android.wm.shell.windowdecor.viewholder.AppHandles;

import dagger.BindsOptionalOf;
import dagger.Lazy;
@@ -1113,6 +1115,19 @@ public abstract class WMShellBaseModule {
                transitions);
    }

    //
    // AppHandle
    //

    @WMSingleton
    @Provides
    static Optional<AppHandles> provideAppHandles(Optional<AppHandleNotifier> appHandleNotifier) {
        return appHandleNotifier.map(AppHandleNotifier::asAppHandleImpl);
    }

    @BindsOptionalOf
    abstract AppHandleNotifier getAppHandleNotifier();

    //
    // Misc
    //
@@ -1142,6 +1157,7 @@ public abstract class WMShellBaseModule {
            Optional<RecentsTransitionHandler> recentsTransitionHandlerOptional,
            Optional<OneHandedController> oneHandedControllerOptional,
            Optional<AppZoomOutController> appZoomOutControllerOptional,
            Optional<AppHandles> appHandlesOptional,
            Optional<HideDisplayCutoutController> hideDisplayCutoutControllerOptional,
            Optional<ActivityEmbeddingController> activityEmbeddingOptional,
            Optional<MixedTransitionHandler> mixedTransitionHandler,
+15 −7
Original line number Diff line number Diff line
@@ -190,20 +190,20 @@ import com.android.wm.shell.windowdecor.common.viewhost.WindowDecorViewHostSuppl
import com.android.wm.shell.windowdecor.education.DesktopWindowingEducationPromoController;
import com.android.wm.shell.windowdecor.education.DesktopWindowingEducationTooltipController;
import com.android.wm.shell.windowdecor.tiling.DesktopTilingDecorViewModel;
import com.android.wm.shell.windowdecor.viewholder.AppHandleNotifier;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

import dagger.Binds;
import dagger.Lazy;
import dagger.Module;
import dagger.Provides;

import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.ExperimentalCoroutinesApi;
import kotlinx.coroutines.MainCoroutineDispatcher;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

/**
 * Provides dependencies from {@link com.android.wm.shell}, these dependencies are only accessible
 * from components within the WM subcomponent (can be explicitly exposed to the SysUIComponent, see
@@ -1132,7 +1132,8 @@ public abstract class WMShellModule {
            Optional<CompatUIHandler> compatUI,
            DesksOrganizer desksOrganizer,
            DesktopState desktopState,
            DesktopConfig desktopConfig
            DesktopConfig desktopConfig,
            AppHandleNotifier appHandleNotifier
    ) {
        if (!desktopState.canEnterDesktopModeOrShowAppHandle()) {
            return Optional.empty();
@@ -1151,7 +1152,7 @@ public abstract class WMShellModule {
                desktopModeUiEventLogger, taskResourceLoader, recentsTransitionHandler,
                desktopModeCompatPolicy, desktopTilingDecorViewModel,
                multiDisplayDragMoveIndicatorController, compatUI.orElse(null),
                desksOrganizer, desktopState, desktopConfig));
                desksOrganizer, desktopState, desktopConfig, appHandleNotifier));
    }

    @WMSingleton
@@ -1481,6 +1482,13 @@ public abstract class WMShellModule {
                        desktopState));
    }

    @WMSingleton
    @Provides
    static AppHandleNotifier provideAppHandleNotifier(
            @ShellMainThread ShellExecutor shellExecutor) {
        return new AppHandleNotifier(shellExecutor);
    }

    @WMSingleton
    @Provides
    static AppHandleEducationDatastoreRepository provideAppHandleEducationDatastoreRepository(
+3 −0
Original line number Diff line number Diff line
@@ -71,6 +71,8 @@ public enum ShellProtoLogGroup implements IProtoLogGroup {
            Consts.TAG_WM_COMPAT_UI),
    WM_SHELL_APP_COMPAT(Consts.ENABLE_DEBUG, Consts.ENABLE_LOG_TO_PROTO_DEBUG, false,
            Consts.TAG_WM_APP_COMPAT),
    WM_SHELL_APP_HANDLES(Consts.ENABLE_DEBUG, Consts.ENABLE_LOG_TO_PROTO_DEBUG, false,
            Consts.TAG_WM_APP_HANDLES),
    TEST_GROUP(true, true, false, "WindowManagerShellProtoLogTest");

    private final boolean mEnabled;
@@ -141,6 +143,7 @@ public enum ShellProtoLogGroup implements IProtoLogGroup {
        private static final String TAG_WM_COMPAT_UI = "CompatUi";
        private static final String TAG_WM_APP_COMPAT = "AppCompat";
        private static final String TAG_WM_BUBBLES = "Bubbles";
        private static final String TAG_WM_APP_HANDLES = "AppHandles";

        private static final boolean ENABLE_DEBUG = true;
        private static final boolean ENABLE_LOG_TO_PROTO_DEBUG = true;
+7 −3
Original line number Diff line number Diff line
@@ -155,6 +155,7 @@ import com.android.wm.shell.windowdecor.extension.InsetsStateKt;
import com.android.wm.shell.windowdecor.extension.TaskInfoKt;
import com.android.wm.shell.windowdecor.tiling.DesktopTilingDecorViewModel;
import com.android.wm.shell.windowdecor.tiling.SnapEventHandler;
import com.android.wm.shell.windowdecor.viewholder.AppHandleNotifier;
import com.android.wm.shell.windowdecor.viewholder.AppHandleViewHolder;
import com.android.wm.shell.windowdecor.viewholder.AppHeaderViewHolder;

@@ -317,7 +318,8 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
            CompatUIHandler compatUI,
            DesksOrganizer desksOrganizer,
            DesktopState desktopState,
            DesktopConfig desktopConfig) {
            DesktopConfig desktopConfig,
            AppHandleNotifier appHandleNotifier) {
        this(
                context,
                shellExecutor,
@@ -368,7 +370,8 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
                compatUI,
                desksOrganizer,
                desktopState,
                desktopConfig);
                desktopConfig,
                appHandleNotifier);
    }

    @VisibleForTesting
@@ -422,7 +425,8 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
            CompatUIHandler compatUI,
            DesksOrganizer desksOrganizer,
            DesktopState desktopState,
            DesktopConfig desktopConfig) {
            DesktopConfig desktopConfig,
            AppHandleNotifier appHandleNotifier) {
        mContext = context;
        mMainExecutor = shellExecutor;
        mMainHandler = mainHandler;
Loading