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

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

Merge "Make presentation immersive" into main

parents e18a7dcf 14218125
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ 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 android.annotation.NonNull;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
@@ -34,6 +36,8 @@ import android.view.ContextThemeWrapper;
import android.view.Display;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowInsets;
import android.view.WindowInsetsController;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams.WindowType;

@@ -277,6 +281,11 @@ public class Presentation extends Dialog {
    @Override
    public void show() {
        super.show();

        WindowInsetsController controller = getWindow().getInsetsController();
        if (controller != null && enablePresentationForConnectedDisplays()) {
            controller.hide(WindowInsets.Type.systemBars());
        }
    }

    /**
+8 −2
Original line number Diff line number Diff line
@@ -157,6 +157,7 @@ import static com.android.server.wm.utils.DisplayInfoOverrides.copyDisplayInfoFi
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.enablePersistingDensityScaleForConnectedDisplays;
import static com.android.window.flags.Flags.enablePresentationForConnectedDisplays;

import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -3835,13 +3836,18 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp

    /**
     * Looking for the focused window on this display if the top focused display hasn't been
     * found yet (topFocusedDisplayId is INVALID_DISPLAY) or per-display focused was allowed.
     * found yet (topFocusedDisplayId is INVALID_DISPLAY), per-display focused was allowed, or
     * the display is presenting. The last one is needed to update system bar visibility in response
     * to presentation visibility because per-display focus is needed to change system bar
     * visibility, but the display shouldn't get global focus when a presentation gets shown.
     *
     * @param topFocusedDisplayId Id of the top focused display.
     * @return The focused window or null if there isn't any or no need to seek.
     */
    WindowState findFocusedWindowIfNeeded(int topFocusedDisplayId) {
        return (hasOwnFocus() || topFocusedDisplayId == INVALID_DISPLAY)
        return (hasOwnFocus() || topFocusedDisplayId == INVALID_DISPLAY
                || (enablePresentationForConnectedDisplays()
                && mWmService.mPresentationController.isPresentationVisible(mDisplayId)))
                    ? findFocusedWindow() : null;
    }

+1 −1
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ class PresentationController implements DisplayManager.DisplayListener {
        return mPresentations.contains(displayId);
    }

    private boolean isPresentationVisible(int displayId) {
    boolean isPresentationVisible(int displayId) {
        final Presentation presentation = mPresentations.get(displayId);
        return presentation != null && presentation.mWin.mToken.isVisibleRequested();
    }