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

Commit 8b6aefdc authored by Ben Lin's avatar Ben Lin
Browse files

Desktop: Use new WM API to check for Desktop-host eligibility.

Bug: 384568161
Test: Manual
Test: ran CD smoke tests
Flag:com.android.server.display.feature.flags.enable_display_content_mode_management

Change-Id: I22d45015fc01b504be6a00ef359dc456505c463e
parent 8abee260
Loading
Loading
Loading
Loading
+15 −0
Original line number Original line Diff line number Diff line
@@ -80,6 +80,8 @@ import static android.view.WindowLayoutParamsProto.WINDOW_ANIMATIONS;
import static android.view.WindowLayoutParamsProto.X;
import static android.view.WindowLayoutParamsProto.X;
import static android.view.WindowLayoutParamsProto.Y;
import static android.view.WindowLayoutParamsProto.Y;


import static com.android.server.display.feature.flags.Flags.FLAG_ENABLE_DISPLAY_CONTENT_MODE_MANAGEMENT;

import android.Manifest.permission;
import android.Manifest.permission;
import android.annotation.CallbackExecutor;
import android.annotation.CallbackExecutor;
import android.annotation.FlaggedApi;
import android.annotation.FlaggedApi;
@@ -1872,6 +1874,19 @@ public interface WindowManager extends ViewManager {
        return false;
        return false;
    }
    }


    /**
     * Indicates that the display is eligible for the desktop mode from WindowManager's perspective.
     *
     * @param displayId The id of the display.
     * @return {@code true} if the display is eligible for the desktop mode from WindowManager's
     * perspective.
     * @hide
     */
    @FlaggedApi(FLAG_ENABLE_DISPLAY_CONTENT_MODE_MANAGEMENT)
    default boolean isEligibleForDesktopMode(int displayId) {
        return false;
    }

    /**
    /**
     * Sets the policy for how the display should show IME.
     * Sets the policy for how the display should show IME.
     *
     *
+10 −0
Original line number Original line Diff line number Diff line
@@ -307,6 +307,16 @@ public class WindowManagerImpl implements WindowManager {
        return false;
        return false;
    }
    }


    @Override
    public boolean isEligibleForDesktopMode(int displayId) {
        try {
            return WindowManagerGlobal.getWindowManagerService()
                    .isEligibleForDesktopMode(displayId);
        } catch (RemoteException e) {
        }
        return false;
    }

    @Override
    @Override
    public void setDisplayImePolicy(int displayId, @DisplayImePolicy int imePolicy) {
    public void setDisplayImePolicy(int displayId, @DisplayImePolicy int imePolicy) {
        try {
        try {
+1 −1
Original line number Original line Diff line number Diff line
@@ -290,7 +290,7 @@ public class DesktopModeStatus {
                || display.getType() == Display.TYPE_OVERLAY)
                || display.getType() == Display.TYPE_OVERLAY)
                && enableDisplayContentModeManagement()) {
                && enableDisplayContentModeManagement()) {
            final WindowManager wm = context.getSystemService(WindowManager.class);
            final WindowManager wm = context.getSystemService(WindowManager.class);
            return wm != null && wm.shouldShowSystemDecors(display.getDisplayId());
            return wm != null && wm.isEligibleForDesktopMode(display.getDisplayId());
        }
        }


        return false;
        return false;