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

Commit 6dd0dcc0 authored by Sukesh Ram's avatar Sukesh Ram Committed by Android (Google) Code Review
Browse files

Merge "Remove Windowing Prototype 1 from Codebase" into main

parents a2c45757 d37429a5
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -5884,15 +5884,6 @@ public final class Settings {
        @Readable
        public static final String MULTI_AUDIO_FOCUS_ENABLED = "multi_audio_focus_enabled";
        /**
         * Whether desktop mode is enabled or not.
         * 0 = off
         * 1 = on
         * @hide
         */
        @Readable
        public static final String DESKTOP_MODE = "desktop_mode";
        /**
         * The information of locale preference. This records user's preference to avoid
         * unsynchronized and existing locale preference in
@@ -6066,7 +6057,6 @@ public final class Settings {
            PRIVATE_SETTINGS.add(SHOW_BATTERY_PERCENT);
            PRIVATE_SETTINGS.add(DISPLAY_COLOR_MODE);
            PRIVATE_SETTINGS.add(DISPLAY_COLOR_MODE_VENDOR_HINT);
            PRIVATE_SETTINGS.add(DESKTOP_MODE);
            PRIVATE_SETTINGS.add(LOCALE_PREFERENCES);
            PRIVATE_SETTINGS.add(TOUCHPAD_POINTER_SPEED);
            PRIVATE_SETTINGS.add(TOUCHPAD_NATURAL_SCROLLING);
+5 −26
Original line number Diff line number Diff line
@@ -72,7 +72,6 @@ import com.android.wm.shell.compatui.CompatUIConfiguration;
import com.android.wm.shell.compatui.CompatUIController;
import com.android.wm.shell.compatui.CompatUIShellCommandHandler;
import com.android.wm.shell.desktopmode.DesktopMode;
import com.android.wm.shell.desktopmode.DesktopModeController;
import com.android.wm.shell.desktopmode.DesktopModeStatus;
import com.android.wm.shell.desktopmode.DesktopModeTaskRepository;
import com.android.wm.shell.desktopmode.DesktopTasksController;
@@ -109,13 +108,13 @@ import com.android.wm.shell.unfold.UnfoldAnimationController;
import com.android.wm.shell.unfold.UnfoldTransitionHandler;
import com.android.wm.shell.windowdecor.WindowDecorViewModel;

import java.util.Optional;

import dagger.BindsOptionalOf;
import dagger.Lazy;
import dagger.Module;
import dagger.Provides;

import java.util.Optional;

/**
 * Provides basic dependencies from {@link com.android.wm.shell}, these dependencies are only
 * accessible from components within the WM subcomponent (can be explicitly exposed to the
@@ -800,30 +799,10 @@ public abstract class WMShellBaseModule {
    @WMSingleton
    @Provides
    static Optional<DesktopMode> provideDesktopMode(
            Optional<DesktopModeController> desktopModeController,
            Optional<DesktopTasksController> desktopTasksController) {
        if (DesktopModeStatus.isProto2Enabled()) {
        return desktopTasksController.map(DesktopTasksController::asDesktopMode);
    }
        return desktopModeController.map(DesktopModeController::asDesktopMode);
    }

    @BindsOptionalOf
    @DynamicOverride
    abstract DesktopModeController optionalDesktopModeController();

    @WMSingleton
    @Provides
    static Optional<DesktopModeController> provideDesktopModeController(
            @DynamicOverride Optional<Lazy<DesktopModeController>> desktopModeController) {
        // Use optional-of-lazy for the dependency that this provider relies on.
        // Lazy ensures that this provider will not be the cause the dependency is created
        // when it will not be returned due to the condition below.
        if (DesktopModeStatus.isProto1Enabled()) {
            return desktopModeController.map(Lazy::get);
        }
        return Optional.empty();
    }

    @BindsOptionalOf
    @DynamicOverride
@@ -836,7 +815,7 @@ public abstract class WMShellBaseModule {
        // Use optional-of-lazy for the dependency that this provider relies on.
        // Lazy ensures that this provider will not be the cause the dependency is created
        // when it will not be returned due to the condition below.
        if (DesktopModeStatus.isProto2Enabled()) {
        if (DesktopModeStatus.isEnabled()) {
            return desktopTasksController.map(Lazy::get);
        }
        return Optional.empty();
@@ -853,7 +832,7 @@ public abstract class WMShellBaseModule {
        // Use optional-of-lazy for the dependency that this provider relies on.
        // Lazy ensures that this provider will not be the cause the dependency is created
        // when it will not be returned due to the condition below.
        if (DesktopModeStatus.isAnyEnabled()) {
        if (DesktopModeStatus.isEnabled()) {
            return desktopModeTaskRepository.map(Lazy::get);
        }
        return Optional.empty();
+3 −26
Original line number Diff line number Diff line
@@ -54,7 +54,6 @@ import com.android.wm.shell.common.annotations.ShellBackgroundThread;
import com.android.wm.shell.common.annotations.ShellMainThread;
import com.android.wm.shell.dagger.back.ShellBackAnimationModule;
import com.android.wm.shell.dagger.pip.PipModule;
import com.android.wm.shell.desktopmode.DesktopModeController;
import com.android.wm.shell.desktopmode.DesktopModeStatus;
import com.android.wm.shell.desktopmode.DesktopModeTaskRepository;
import com.android.wm.shell.desktopmode.DesktopTasksController;
@@ -197,10 +196,9 @@ public abstract class WMShellModule {
            ShellController shellController,
            SyncTransactionQueue syncQueue,
            Transitions transitions,
            Optional<DesktopModeController> desktopModeController,
            Optional<DesktopTasksController> desktopTasksController,
            RootTaskDisplayAreaOrganizer rootTaskDisplayAreaOrganizer) {
        if (DesktopModeStatus.isAnyEnabled()) {
        if (DesktopModeStatus.isEnabled()) {
            return new DesktopModeWindowDecorViewModel(
                    context,
                    mainHandler,
@@ -211,7 +209,6 @@ public abstract class WMShellModule {
                    shellController,
                    syncQueue,
                    transitions,
                    desktopModeController,
                    desktopTasksController,
                    rootTaskDisplayAreaOrganizer);
        }
@@ -353,13 +350,12 @@ public abstract class WMShellModule {
            @Nullable PipTransitionController pipTransitionController,
            Optional<RecentsTransitionHandler> recentsTransitionHandler,
            KeyguardTransitionHandler keyguardTransitionHandler,
            Optional<DesktopModeController> desktopModeController,
            Optional<DesktopTasksController> desktopTasksController,
            Optional<UnfoldTransitionHandler> unfoldHandler,
            Transitions transitions) {
        return new DefaultMixedHandler(shellInit, transitions, splitScreenOptional,
                pipTransitionController, recentsTransitionHandler,
                keyguardTransitionHandler, desktopModeController, desktopTasksController,
                keyguardTransitionHandler, desktopTasksController,
                unfoldHandler);
    }

@@ -468,24 +464,6 @@ public abstract class WMShellModule {
    // Desktop mode (optional feature)
    //

    @WMSingleton
    @Provides
    @DynamicOverride
    static DesktopModeController provideDesktopModeController(Context context,
            ShellInit shellInit,
            ShellController shellController,
            ShellTaskOrganizer shellTaskOrganizer,
            RootTaskDisplayAreaOrganizer rootTaskDisplayAreaOrganizer,
            Transitions transitions,
            @DynamicOverride DesktopModeTaskRepository desktopModeTaskRepository,
            @ShellMainThread Handler mainHandler,
            @ShellMainThread ShellExecutor mainExecutor
    ) {
        return new DesktopModeController(context, shellInit, shellController, shellTaskOrganizer,
                rootTaskDisplayAreaOrganizer, transitions, desktopModeTaskRepository, mainHandler,
                mainExecutor);
    }

    @WMSingleton
    @Provides
    @DynamicOverride
@@ -553,8 +531,7 @@ public abstract class WMShellModule {
    @ShellCreateTriggerOverride
    @Provides
    static Object provideIndependentShellComponentsToCreate(
            DefaultMixedHandler defaultMixedHandler,
            Optional<DesktopModeController> desktopModeController) {
            DefaultMixedHandler defaultMixedHandler) {
        return new Object();
    }
}
+0 −557

File deleted.

Preview size limit exceeded, changes collapsed.

+2 −52
Original line number Diff line number Diff line
@@ -16,14 +16,7 @@

package com.android.wm.shell.desktopmode;

import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE;

import android.content.Context;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.provider.Settings;

import com.android.internal.protolog.common.ProtoLog;

/**
 * Constants for desktop mode feature
@@ -31,13 +24,7 @@ import com.android.internal.protolog.common.ProtoLog;
public class DesktopModeStatus {

    /**
     * Flag to indicate whether desktop mode is available on the device
     */
    private static final boolean IS_SUPPORTED = SystemProperties.getBoolean(
            "persist.wm.debug.desktop_mode", false);

    /**
     * Flag to indicate whether desktop mode proto 2 is available on the device
     * Flag to indicate whether desktop mode proto is available on the device
     */
    private static final boolean IS_PROTO2_ENABLED = SystemProperties.getBoolean(
            "persist.wm.debug.desktop_mode_2", false);
@@ -63,28 +50,13 @@ public class DesktopModeStatus {
    private static final boolean IS_STASHING_ENABLED = SystemProperties.getBoolean(
            "persist.wm.debug.desktop_stashing", false);

    /**
     * Return {@code true} if desktop mode support is enabled
     */
    public static boolean isProto1Enabled() {
        return IS_SUPPORTED;
    }

    /**
     * Return {@code true} is desktop windowing proto 2 is enabled
     */
    public static boolean isProto2Enabled() {
    public static boolean isEnabled() {
        return IS_PROTO2_ENABLED;
    }

    /**
     * Return {@code true} if proto 1 or 2 is enabled.
     * Can be used to guard logic that is common for both prototypes.
     */
    public static boolean isAnyEnabled() {
        return isProto1Enabled() || isProto2Enabled();
    }

    /**
     * Return {@code true} if veiled resizing is active. If false, fluid resizing is used.
     */
@@ -99,26 +71,4 @@ public class DesktopModeStatus {
    public static boolean isStashingEnabled() {
        return IS_STASHING_ENABLED;
    }
    /**
     * Check if desktop mode is active
     *
     * @return {@code true} if active
     */
    public static boolean isActive(Context context) {
        if (!isAnyEnabled()) {
            return false;
        }
        if (isProto2Enabled()) {
            // Desktop mode is always active in prototype 2
            return true;
        }
        try {
            int result = Settings.System.getIntForUser(context.getContentResolver(),
                    Settings.System.DESKTOP_MODE, UserHandle.USER_CURRENT);
            return result != 0;
        } catch (Exception e) {
            ProtoLog.e(WM_SHELL_DESKTOP_MODE, "Failed to read DESKTOP_MODE setting %s", e);
            return false;
        }
    }
}
Loading