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

Commit c4dd7a82 authored by Matthew DeVore's avatar Matthew DeVore
Browse files

Add flag for surfacing display topology prototype

This will force the topology pane to show in the displays list UI, and
make the displays list UI accessible from the connected devices
fragment, regardless of the number of actual devices connected.

Once the display topology pane is using real data, this will still be
useful to not skip the display list UI, which currently can only be
shown when there is more than one external display connected.

To turn off, use:
$ adb shell device_config put display_manager com.android.settings.flags.display_topology_pane_in_display_list false

Test: verify "External Display" is always shown in connected devices list
Test: verify displays list is shown when 0 or 1 external display is connected
Bug: b/352648432
Flag: com.android.settings.flags.display_topology_pane_in_display_list
Change-Id: Ic9205c69d9de09e6fb8ae33e17fbf00fe5574447
parent 8eee5a48
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -15,6 +15,13 @@ flag {
  bug: "253296253"
}

flag {
  name: "display_topology_pane_in_display_list"
  namespace: "display_manager"
  description: "Shows the connected display setting and shows the topology pane in the display list, even with only one display connected."
  bug: "352648432"
}

flag {
  name: "enable_auth_challenge_for_usb_preferences"
  namespace: "safety_center"
+9 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static android.view.Display.INVALID_DISPLAY;
import static com.android.settings.connecteddevice.display.ExternalDisplaySettingsConfiguration.EXTERNAL_DISPLAY_HELP_URL;
import static com.android.settings.connecteddevice.display.ExternalDisplaySettingsConfiguration.DISPLAY_ID_ARG;
import static com.android.settings.connecteddevice.display.ExternalDisplaySettingsConfiguration.EXTERNAL_DISPLAY_NOT_FOUND_RESOURCE;
import static com.android.settings.connecteddevice.display.ExternalDisplaySettingsConfiguration.forceShowDisplayList;
import static com.android.settings.connecteddevice.display.ExternalDisplaySettingsConfiguration.isDisplayAllowed;
import static com.android.settings.connecteddevice.display.ExternalDisplaySettingsConfiguration.isUseDisplaySettingEnabled;
import static com.android.settings.connecteddevice.display.ExternalDisplaySettingsConfiguration.isResolutionSettingEnabled;
@@ -295,13 +296,20 @@ public class ExternalDisplayPreferenceFragment extends SettingsPreferenceFragmen
        updateScreenForDisplayId(getDisplayIdArg(), screen, mInjector.getContext());
    }

    private boolean okayToBypassDisplayListSelection() {
        if (mInjector != null && forceShowDisplayList(mInjector.getFlags())) {
            return false;
        }
        return !mPreviouslyShownListOfDisplays;
    }

    private void updateScreenForDisplayId(final int displayId,
            @NonNull final PreferenceScreen screen, @NonNull Context context) {
        final var displaysToShow = getDisplaysToShow(displayId);
        if (displaysToShow.isEmpty() && displayId == INVALID_DISPLAY) {
            showTextWhenNoDisplaysToShow(screen, context);
        } else if (displaysToShow.size() == 1
                && ((displayId == INVALID_DISPLAY && !mPreviouslyShownListOfDisplays)
                && ((displayId == INVALID_DISPLAY && okayToBypassDisplayListSelection())
                        || displaysToShow.get(0).getDisplayId() == displayId)) {
            showDisplaySettings(displaysToShow.get(0), screen, context);
        } else if (displayId == INVALID_DISPLAY) {
+10 −1
Original line number Diff line number Diff line
@@ -319,7 +319,16 @@ public class ExternalDisplaySettingsConfiguration {
     */
    public static boolean isExternalDisplaySettingsPageEnabled(@NonNull FeatureFlags flags) {
        return flags.rotationConnectedDisplaySetting()
                || flags.resolutionAndEnableConnectedDisplaySetting();
                || flags.resolutionAndEnableConnectedDisplaySetting()
                || flags.displayTopologyPaneInDisplayList();
    }

    /**
     * If true, indicates the display list activity should be shown even if there is only one
     * display.
     */
    public static boolean forceShowDisplayList(@NonNull FeatureFlags flags) {
        return flags.displayTopologyPaneInDisplayList();
    }

    static boolean isDisplayAllowed(@NonNull Display display,
+5 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.settings.connecteddevice.display;

import static com.android.settings.connecteddevice.display.ExternalDisplaySettingsConfiguration.forceShowDisplayList;
import static com.android.settings.connecteddevice.display.ExternalDisplaySettingsConfiguration.isDisplayAllowed;

import android.content.Context;
@@ -142,6 +143,10 @@ public class ExternalDisplayUpdater {
            }
        }

        if (forceShowDisplayList(mInjector.getFlags())) {
            return context.getString(R.string.external_display_off);
        }

        for (var display : mInjector.getAllDisplays()) {
            if (display != null && isDisplayAllowed(display, mInjector)) {
                return context.getString(R.string.external_display_off);
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ package com.android.settings.connecteddevice;

import static com.android.settings.core.BasePreferenceController.AVAILABLE_UNSEARCHABLE;
import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
import static com.android.settings.flags.Flags.FLAG_DISPLAY_TOPOLOGY_PANE_IN_DISPLAY_LIST;
import static com.android.settings.flags.Flags.FLAG_RESOLUTION_AND_ENABLE_CONNECTED_DISPLAY_SETTING;
import static com.android.settings.flags.Flags.FLAG_ROTATION_CONNECTED_DISPLAY_SETTING;

@@ -128,6 +129,7 @@ public class ConnectedDeviceGroupControllerTest {
    @Before
    public void setUp() {
        MockitoAnnotations.initMocks(this);
        mFakeFeatureFlags.setFlag(FLAG_DISPLAY_TOPOLOGY_PANE_IN_DISPLAY_LIST, false);
        mFakeFeatureFlags.setFlag(FLAG_ROTATION_CONNECTED_DISPLAY_SETTING, true);
        mFakeFeatureFlags.setFlag(FLAG_RESOLUTION_AND_ENABLE_CONNECTED_DISPLAY_SETTING, true);

Loading