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

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

Merge "Control presentation policy with FLAG_PRESENTATION on internal displays" into main

parents 771d4992 4b024ab8
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -3394,6 +3394,12 @@
         mirror the content of the default display. -->
    <bool name="config_localDisplaysMirrorContent">true</bool>

    <!-- When true, the {@link Display#FLAG_PRESENTATION} flag is set to all internal displays.
         When false, presentations are not allowed on internal displays by default, but vendors can
         still explicitly override this by explicitly adding the flag to the internal display(s).
    -->
    <bool name="config_allowPresentationOnInternalDisplay">true</bool>

    <!-- When true, udfps vote is ignored. This feature is disabled by default. -->
    <bool name="config_ignoreUdfpsVote">false</bool>

+1 −0
Original line number Diff line number Diff line
@@ -431,6 +431,7 @@
  <java-symbol type="bool" name="config_guestUserAutoCreated" />
  <java-symbol type="bool" name="config_guestUserAllowEphemeralStateChange" />
  <java-symbol type="bool" name="config_localDisplaysMirrorContent" />
  <java-symbol type="bool" name="config_allowPresentationOnInternalDisplay" />
  <java-symbol type="bool" name="config_ignoreUdfpsVote" />
  <java-symbol type="bool" name="config_enableProximityService" />
  <java-symbol type="bool" name="config_enableVirtualDeviceManager" />
+5 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.server.display;

import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
import static android.view.Display.Mode.INVALID_MODE_ID;
import static android.window.DesktopExperienceFlags.ENABLE_PRESENTATION_FOR_CONNECTED_DISPLAYS;

import static com.android.server.display.BrightnessMappingStrategy.INVALID_NITS;

@@ -845,6 +846,10 @@ final class LocalDisplayAdapter extends DisplayAdapter {
                if (mStaticDisplayInfo.isInternal) {
                    mInfo.type = Display.TYPE_INTERNAL;
                    mInfo.touch = DisplayDeviceInfo.TOUCH_INTERNAL;
                    if (ENABLE_PRESENTATION_FOR_CONNECTED_DISPLAYS.isTrue()
                            && res.getBoolean(R.bool.config_allowPresentationOnInternalDisplay)) {
                        mInfo.flags |= DisplayDeviceInfo.FLAG_PRESENTATION;
                    }
                    mInfo.flags |= DisplayDeviceInfo.FLAG_ROTATES_WITH_CONTENT;
                    if (mInfo.name == null) {
                        mInfo.name = res.getString(R.string.display_manager_built_in_display_name);
+12 −3
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server.wm;

import static android.view.Display.TYPE_INTERNAL;
import static android.view.WindowManager.LayoutParams.TYPE_PRESENTATION;
import static android.view.WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION;
import static android.window.DesktopExperienceFlags.ENABLE_PRESENTATION_FOR_CONNECTED_DISPLAYS;
@@ -106,8 +107,16 @@ class PresentationController implements DisplayManager.DisplayListener {
            return false;
        }

        if (!displayContent.getDisplay().isPublicPresentation()) {
            // A normal presentation is allowed only on a display with the presentation flag.
            return false;
        }

        // All the legacy static policies related to window types and presentation flags have
        // been checked at this point. Below are newer dynamic policies that check actual existence
        // of presentation windows and host tasks.
        if (!ENABLE_PRESENTATION_FOR_CONNECTED_DISPLAYS.isTrue()) {
            return displayContent.getDisplay().isPublicPresentation();
            return true;
        }

        boolean allDisplaysArePresenting = true;
@@ -145,9 +154,9 @@ class PresentationController implements DisplayManager.DisplayListener {
            // A presentation can't cover its own host task.
            return false;
        }
        if (hostTask == null && !displayContent.getDisplay().isPublicPresentation()) {
        if (hostTask == null && displayContent.getDisplay().getType() == TYPE_INTERNAL) {
            // A globally focused host task on a different display is needed to show a
            // presentation on a non-presenting display.
            // presentation on an internal display.
            return false;
        }

+1 −0
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ public class PossibleDisplayInfoMapperTests extends WindowTestsBase {

        mDefaultDisplayInfo = new DisplayInfo(baseDisplayInfo);
        initializeDisplayInfo(mDefaultDisplayInfo, DEFAULT_DISPLAY, new Rect(0, 0, 500, 800));
        mDefaultDisplayInfo.flags &= ~FLAG_PRESENTATION;
        mSecondDisplayInfo = new DisplayInfo(baseDisplayInfo);
        // Use the same display id for any display in the same group, due to the assumption that
        // any display in the same grouped can be swapped out for each other (while maintaining the
Loading