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

Commit 17f616f7 authored by Sandro Meier's avatar Sandro Meier Committed by Android (Google) Code Review
Browse files

Merge "Add Display flag "FLAG_STEAL_TOP_FOCUS_DISABLED""

parents 2e3a2483 8c40ca1f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -4244,6 +4244,7 @@ package android.hardware.display {
    method @RequiresPermission(android.Manifest.permission.CONFIGURE_DISPLAY_BRIGHTNESS) public void setBrightnessConfiguration(android.hardware.display.BrightnessConfiguration);
    method @RequiresPermission(android.Manifest.permission.CONFIGURE_DISPLAY_BRIGHTNESS) public void setBrightnessConfigurationForDisplay(@NonNull android.hardware.display.BrightnessConfiguration, @NonNull String);
    method @Deprecated @RequiresPermission(android.Manifest.permission.CONTROL_DISPLAY_SATURATION) public void setSaturationLevel(float);
    field public static final int VIRTUAL_DISPLAY_FLAG_STEAL_TOP_FOCUS_DISABLED = 65536; // 0x10000
    field public static final int VIRTUAL_DISPLAY_FLAG_TRUSTED = 1024; // 0x400
  }
+13 −0
Original line number Diff line number Diff line
@@ -139,6 +139,7 @@ public final class DisplayManager {
            VIRTUAL_DISPLAY_FLAG_ALWAYS_UNLOCKED,
            VIRTUAL_DISPLAY_FLAG_TOUCH_FEEDBACK_DISABLED,
            VIRTUAL_DISPLAY_FLAG_OWN_FOCUS,
            VIRTUAL_DISPLAY_FLAG_STEAL_TOP_FOCUS_DISABLED,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface VirtualDisplayFlag {}
@@ -429,6 +430,18 @@ public final class DisplayManager {
    public static final int VIRTUAL_DISPLAY_FLAG_DEVICE_DISPLAY_GROUP = 1 << 15;


    /**
     * Virtual display flags: Indicates that the display should not become the top focused display
     * by stealing the top focus from another display.
     *
     * @see Display#FLAG_STEAL_TOP_FOCUS_DISABLED
     * @see #createVirtualDisplay
     * @see #VIRTUAL_DISPLAY_FLAG_OWN_FOCUS
     * @hide
     */
    @SystemApi
    public static final int VIRTUAL_DISPLAY_FLAG_STEAL_TOP_FOCUS_DISABLED = 1 << 16;

    /** @hide */
    @IntDef(prefix = {"MATCH_CONTENT_FRAMERATE_"}, value = {
            MATCH_CONTENT_FRAMERATE_UNKNOWN,
+2 −2
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.hardware.display.DisplayManager.VirtualDisplayFlag;
import android.media.projection.MediaProjection;
import android.os.Handler;
import android.os.Parcel;
import android.os.Parcelable;
import android.view.Surface;
@@ -35,7 +34,8 @@ import java.util.List;

/**
 * Holds configuration used to create {@link VirtualDisplay} instances. See
 * {@link MediaProjection#createVirtualDisplay(VirtualDisplayConfig, VirtualDisplay.Callback, Handler)}.
 * {@link MediaProjection#createVirtualDisplay} and
 * {@link android.companion.virtual.VirtualDeviceManager.VirtualDevice#createVirtualDisplay}.
 *
 * @hide
 */
+38 −0
Original line number Diff line number Diff line
@@ -331,6 +331,34 @@ public final class Display {
     */
    public static final int FLAG_OWN_FOCUS = 1 << 11;

    /**
     * Flag: Indicates that the display should not become the top focused display by stealing the
     * top focus from another display.
     *
     * <p>The result is that only targeted input events (displayId of input event matches the
     * displayId of the display) can reach this display. A display with this flag set can still
     * become the top focused display, if the system consists of only one display or if all
     * displays have this flag set. In both cases the default display becomes the top focused
     * display.
     *
     * <p>Note:  A display only has a focused window if either
     * - the display is the top focused display or
     * - the display manages its own focus (via {@link #FLAG_OWN_FOCUS})
     * - or all the displays manage their own focus (via {@code config_perDisplayFocusEnabled} flag)
     * If a display has no focused window, no input event is dispatched to it. Therefore this
     * flag is only useful together with {@link #FLAG_OWN_FOCUS} and will be
     * ignored if it is not set.
     *
     * <p>Note: The framework only supports IME on the top focused display (b/262520411). Therefore,
     * Enabling this flag on a display implicitly disables showing any IME. This is not intended
     * behavior but cannot be fixed until b/262520411 is implemented. If you need IME on display do
     * not set this flag.
     *
     * @hide
     * @see #getFlags()
     */
    public static final int FLAG_STEAL_TOP_FOCUS_DISABLED = 1 << 12;

    /**
     * Display flag: Indicates that the contents of the display should not be scaled
     * to fit the physical screen dimensions.  Used for development only to emulate
@@ -1705,6 +1733,16 @@ public final class Display {
        return (mFlags & FLAG_TRUSTED) == FLAG_TRUSTED;
    }

    /**
     * @return {@code true} if the display can steal the top focus from another display.
     *
     * @see #FLAG_STEAL_TOP_FOCUS_DISABLED
     * @hide
     */
    public boolean canStealTopFocus() {
        return (mFlags & FLAG_STEAL_TOP_FOCUS_DISABLED) == 0;
    }

    private void updateDisplayInfoLocked() {
        // Note: The display manager caches display info objects on our behalf.
        DisplayInfo newInfo = mGlobal.getDisplayInfo(mDisplayId);
+12 −0
Original line number Diff line number Diff line
@@ -2035,6 +2035,12 @@
      "group": "WM_DEBUG_ANIM",
      "at": "com\/android\/server\/wm\/SurfaceAnimator.java"
    },
    "-206549078": {
      "message": "Not moving display (displayId=%d) to top. Top focused displayId=%d. Reason: config_perDisplayFocusEnabled",
      "level": "INFO",
      "group": "WM_DEBUG_FOCUS_LIGHT",
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
    },
    "-203358733": {
      "message": "commitFinishDrawingLocked: mDrawState=READY_TO_SHOW %s",
      "level": "INFO",
@@ -2263,6 +2269,12 @@
      "group": "WM_DEBUG_RESIZE",
      "at": "com\/android\/server\/wm\/WindowState.java"
    },
    "34682671": {
      "message": "Not moving display (displayId=%d) to top. Top focused displayId=%d. Reason: FLAG_STEAL_TOP_FOCUS_DISABLED",
      "level": "INFO",
      "group": "WM_DEBUG_FOCUS_LIGHT",
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
    },
    "35398067": {
      "message": "goodToGo(): onAnimationStart, transit=%s, apps=%d, wallpapers=%d, nonApps=%d",
      "level": "DEBUG",
Loading