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

Commit 729c1b02 authored by Alina Zaidi's avatar Alina Zaidi
Browse files

[Dev options][More flags] Update all usages of some flags to use

DesktopModeFlags.

Test: Current tests pass
Bug: 348193756
Flag: com.android.window.flags.show_desktop_windowing_dev_option
Change-Id: I1cdb64397e54f5397bda22b56163406fef4e2403
parent bcf873c3
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -35,7 +35,11 @@ enum class DesktopModeFlags(
) {
  // All desktop mode related flags will be added here
  DESKTOP_WINDOWING_MODE(Flags::enableDesktopWindowingMode, true),
  WALLPAPER_ACTIVITY(Flags::enableDesktopWindowingWallpaperActivity, true);
  WALLPAPER_ACTIVITY(Flags::enableDesktopWindowingWallpaperActivity, true),
  MODALS_POLICY(Flags::enableDesktopWindowingModalsPolicy, true),
  THEMED_APP_HEADERS(Flags::enableThemedAppHeaders, true),
  QUICK_SWITCH(Flags::enableDesktopWindowingQuickSwitch, true),
  APP_HEADER_WITH_TASK_DENSITY(Flags::enableAppHeaderWithTaskDensity, true);

  /**
   * Determines state of flag based on the actual flag and desktop mode developer option overrides.
+3 −2
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ import com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE
import com.android.wm.shell.recents.RecentTasksController
import com.android.wm.shell.recents.RecentsTransitionHandler
import com.android.wm.shell.recents.RecentsTransitionStateListener
import com.android.wm.shell.shared.desktopmode.DesktopModeFlags
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus.DESKTOP_DENSITY_OVERRIDE
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus.useDesktopOverrideDensity
@@ -348,7 +349,7 @@ class DesktopTasksController(
        wct: WindowContainerTransaction = WindowContainerTransaction(),
        transitionSource: DesktopModeTransitionSource,
    ) {
        if (Flags.enableDesktopWindowingModalsPolicy()
        if (DesktopModeFlags.MODALS_POLICY.isEnabled(context)
            && isTopActivityExemptFromDesktopWindowing(context, task)) {
            ProtoLog.w(
                WM_SHELL_DESKTOP_MODE,
@@ -971,7 +972,7 @@ class DesktopTasksController(
    }

    private fun isIncompatibleTask(task: TaskInfo) =
        Flags.enableDesktopWindowingModalsPolicy()
        DesktopModeFlags.MODALS_POLICY.isEnabled(context)
                && isTopActivityExemptFromDesktopWindowing(context, task)

    private fun shouldHandleTaskClosing(request: TransitionRequestInfo): Boolean {
+2 −1
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@ import com.android.wm.shell.desktopmode.DesktopTasksController.SnapPosition;
import com.android.wm.shell.desktopmode.DesktopWallpaperActivity;
import com.android.wm.shell.freeform.FreeformTaskTransitionStarter;
import com.android.wm.shell.shared.annotations.ShellBackgroundThread;
import com.android.wm.shell.shared.desktopmode.DesktopModeFlags;
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus;
import com.android.wm.shell.splitscreen.SplitScreen;
import com.android.wm.shell.splitscreen.SplitScreen.StageType;
@@ -1124,7 +1125,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel {
                && taskInfo.isFocused) {
            return false;
        }
        if (Flags.enableDesktopWindowingModalsPolicy()
        if (DesktopModeFlags.MODALS_POLICY.isEnabled(mContext)
                && isTopActivityExemptFromDesktopWindowing(mContext, taskInfo)) {
            return false;
        }
+2 −1
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ import com.android.wm.shell.common.DisplayLayout;
import com.android.wm.shell.common.ShellExecutor;
import com.android.wm.shell.common.SyncTransactionQueue;
import com.android.wm.shell.shared.annotations.ShellBackgroundThread;
import com.android.wm.shell.shared.desktopmode.DesktopModeFlags;
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus;
import com.android.wm.shell.splitscreen.SplitScreenController;
import com.android.wm.shell.windowdecor.common.OnTaskActionClickListener;
@@ -630,7 +631,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
        // TODO(b/301119301): consider moving the config data needed for diffs to relayout params
        // instead of using a whole Configuration as a parameter.
        final Configuration windowDecorConfig = new Configuration();
        if (Flags.enableAppHeaderWithTaskDensity() && isAppHeader) {
        if (DesktopModeFlags.APP_HEADER_WITH_TASK_DENSITY.isEnabled(context) && isAppHeader) {
            // Should match the density of the task. The task may have had its density overridden
            // to be different that SysUI's.
            windowDecorConfig.setTo(taskInfo.configuration);
+2 −2
Original line number Diff line number Diff line
@@ -31,8 +31,8 @@ import android.widget.ProgressBar
import androidx.core.animation.doOnEnd
import androidx.core.animation.doOnStart
import androidx.core.content.ContextCompat
import com.android.window.flags.Flags
import com.android.wm.shell.R
import com.android.wm.shell.shared.desktopmode.DesktopModeFlags

private const val OPEN_MAXIMIZE_MENU_DELAY_ON_HOVER_MS = 350
private const val MAX_DRAWABLE_ALPHA = 255
@@ -108,7 +108,7 @@ class MaximizeButtonView(
        baseForegroundColor: Int? = null,
        rippleDrawable: RippleDrawable? = null
    ) {
        if (Flags.enableThemedAppHeaders()) {
        if (DesktopModeFlags.THEMED_APP_HEADERS.isEnabled(context)) {
            requireNotNull(iconForegroundColor) { "Icon foreground color must be non-null" }
            requireNotNull(baseForegroundColor) { "Base foreground color must be non-null" }
            requireNotNull(rippleDrawable) { "Ripple drawable must be non-null" }
Loading