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

Commit 46b5a7db authored by Kazuki Takise's avatar Kazuki Takise Committed by Android (Google) Code Review
Browse files

Merge "Fix desktop experience flag usages" into main

parents 7fad8780 6a5f316e
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -19,8 +19,7 @@ package android.app;
import static android.view.WindowManager.LayoutParams.INVALID_WINDOW_TYPE;
import static android.view.WindowManager.LayoutParams.TYPE_PRESENTATION;
import static android.view.WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION;

import static com.android.window.flags.Flags.enablePresentationForConnectedDisplays;
import static android.window.DesktopExperienceFlags.ENABLE_PRESENTATION_FOR_CONNECTED_DISPLAYS;

import android.annotation.NonNull;
import android.compat.annotation.UnsupportedAppUsage;
@@ -283,7 +282,7 @@ public class Presentation extends Dialog {
        super.show();

        WindowInsetsController controller = getWindow().getInsetsController();
        if (controller != null && enablePresentationForConnectedDisplays()) {
        if (controller != null && ENABLE_PRESENTATION_FOR_CONNECTED_DISPLAYS.isTrue()) {
            controller.hide(WindowInsets.Type.systemBars());
        }
    }
+2 −2
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction
import android.widget.ImageButton
import android.widget.ImageView
import android.widget.TextView
import android.window.DesktopExperienceFlags
import android.window.DesktopModeFlags
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
@@ -51,7 +52,6 @@ import com.android.internal.R.color.materialColorSecondaryContainer
import com.android.internal.R.color.materialColorSurfaceContainerHigh
import com.android.internal.R.color.materialColorSurfaceContainerLow
import com.android.internal.R.color.materialColorSurfaceDim
import com.android.window.flags.Flags
import com.android.wm.shell.R
import com.android.wm.shell.desktopmode.DesktopModeUiEventLogger
import com.android.wm.shell.desktopmode.DesktopModeUiEventLogger.DesktopUiEventEnum.A11Y_ACTION_MAXIMIZE_RESTORE
@@ -385,7 +385,7 @@ class AppHeaderViewHolder(
    }

    private fun updateAppNameLayoutAndEffect() {
        if (!Flags.enableRestartMenuForConnectedDisplays()) return
        if (!DesktopExperienceFlags.ENABLE_RESTART_MENU_FOR_CONNECTED_DISPLAYS.isTrue()) return
        appNameTextView.viewTreeObserver.addOnPreDrawListener(
            object : ViewTreeObserver.OnPreDrawListener {
                override fun onPreDraw(): Boolean {
+4 −4
Original line number Diff line number Diff line
@@ -20,12 +20,12 @@ import static android.content.pm.ActivityInfo.CONFIG_COLOR_MODE;
import static android.content.pm.ActivityInfo.CONFIG_DENSITY;
import static android.content.pm.ActivityInfo.CONFIG_TOUCHSCREEN;
import static android.view.Display.TYPE_INTERNAL;
import static android.window.DesktopExperienceFlags.ENABLE_DISPLAY_COMPAT_MODE;
import static android.window.DesktopExperienceFlags.ENABLE_RESTART_MENU_FOR_CONNECTED_DISPLAYS;

import android.annotation.NonNull;
import android.content.pm.ApplicationInfo;

import com.android.window.flags.Flags;

/**
 * Encapsulate app-compat logic for multi-display environments.
 *
@@ -64,7 +64,7 @@ class AppCompatDisplayCompatModePolicy {
     */
    boolean isRestartMenuEnabledForDisplayMove() {
        // Restart menu is only available to apps in display compat mode.
        return Flags.enableRestartMenuForConnectedDisplays() && mDisplayChangedWithoutRestart
        return ENABLE_RESTART_MENU_FOR_CONNECTED_DISPLAYS.isTrue() && mDisplayChangedWithoutRestart
                && getDisplayCompatModeConfigMask() != 0;
    }

@@ -101,7 +101,7 @@ class AppCompatDisplayCompatModePolicy {
     * display compat mode is not enabled for the activity.
     */
    int getDisplayCompatModeConfigMask() {
        if (!Flags.enableDisplayCompatMode()) return 0;
        if (!ENABLE_DISPLAY_COMPAT_MODE.isTrue()) return 0;

        if (mActivityRecord.info.applicationInfo.category != ApplicationInfo.CATEGORY_GAME) {
            // A large majority of apps that crash with display move are games. Apply this compat
+2 −2
Original line number Diff line number Diff line
@@ -22,8 +22,8 @@ import static android.content.pm.ActivityInfo.SIZE_CHANGES_SUPPORTED_OVERRIDE;
import static android.content.pm.ActivityInfo.SIZE_CHANGES_UNSUPPORTED_METADATA;
import static android.content.pm.ActivityInfo.SIZE_CHANGES_UNSUPPORTED_OVERRIDE;
import static android.content.res.Configuration.ORIENTATION_UNDEFINED;
import static android.window.DesktopExperienceFlags.ENABLE_SIZE_COMPAT_MODE_IMPROVEMENTS_FOR_CONNECTED_DISPLAYS;

import static com.android.window.flags.Flags.enableSizeCompatModeImprovementsForConnectedDisplays;
import static com.android.server.wm.AppCompatUtils.isInDesktopMode;

import android.annotation.NonNull;
@@ -371,7 +371,7 @@ class AppCompatSizeCompatModePolicy {
        // relatively fixed.
        overrideConfig.colorMode = fullConfig.colorMode;
        overrideConfig.densityDpi = fullConfig.densityDpi;
        if (enableSizeCompatModeImprovementsForConnectedDisplays()) {
        if (ENABLE_SIZE_COMPAT_MODE_IMPROVEMENTS_FOR_CONNECTED_DISPLAYS.isTrue()) {
            overrideConfig.touchscreen = fullConfig.touchscreen;
            overrideConfig.navigation = fullConfig.navigation;
            overrideConfig.keyboard = fullConfig.keyboard;
+2 −2
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_TO_FRONT;
import static android.view.inputmethod.ImeTracker.DEBUG_IME_VISIBILITY;
import static android.window.DesktopExperienceFlags.ENABLE_PRESENTATION_FOR_CONNECTED_DISPLAYS;
import static android.window.DisplayAreaOrganizer.FEATURE_IME;
import static android.window.DisplayAreaOrganizer.FEATURE_ROOT;

@@ -154,7 +155,6 @@ import static com.android.server.wm.utils.DisplayInfoOverrides.WM_OVERRIDE_FIELD
import static com.android.server.wm.utils.DisplayInfoOverrides.copyDisplayInfoFields;
import static com.android.server.wm.utils.RegionUtils.forEachRectReverse;
import static com.android.server.wm.utils.RegionUtils.rectListToRegion;
import static com.android.window.flags.Flags.enablePresentationForConnectedDisplays;

import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -3862,7 +3862,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
     */
    WindowState findFocusedWindowIfNeeded(int topFocusedDisplayId) {
        return (hasOwnFocus() || topFocusedDisplayId == INVALID_DISPLAY
                || (enablePresentationForConnectedDisplays()
                || (ENABLE_PRESENTATION_FOR_CONNECTED_DISPLAYS.isTrue()
                && mWmService.mPresentationController.isPresentationVisible(mDisplayId)))
                    ? findFocusedWindow() : null;
    }
Loading