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

Commit d4757dbe authored by Danae Savvidi's avatar Danae Savvidi
Browse files

Flag Removal: cleanup for enable_port_in_display_layout

This is to remove the enable_port_in_display_layout flag and its references from the codebase.

Bug: 409606733
Flag: EXEMPT flag deletion
Test: atest DisplayServiceTests

Change-Id: I83a4be112f6c1b9d01a80f3d595ea886a290555f
parent b3477a65
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -71,7 +71,6 @@ class DeviceStateToLayoutMap {

    private final SparseArray<Layout> mLayoutMap = new SparseArray<>();
    private final DisplayIdProducer mIdProducer;
    private final boolean mIsPortInDisplayLayoutEnabled;

    DeviceStateToLayoutMap(DisplayIdProducer idProducer, DisplayManagerFlags flags) {
        this(idProducer, flags, getConfigFile());
@@ -79,7 +78,6 @@ class DeviceStateToLayoutMap {

    DeviceStateToLayoutMap(DisplayIdProducer idProducer, DisplayManagerFlags flags,
            File configFile) {
        mIsPortInDisplayLayoutEnabled = flags.isPortInDisplayLayoutEnabled();
        mIdProducer = idProducer;
        loadLayoutsFromConfig(configFile);
        createLayout(STATE_DEFAULT, DEFAULT_LAYOUT_NAME);
@@ -100,7 +98,6 @@ class DeviceStateToLayoutMap {
        ipw.println("-----------------------");
        ipw.increaseIndent();

        ipw.println("mIsPortInDisplayLayoutEnabled=" + mIsPortInDisplayLayoutEnabled);
        ipw.println("Registered Layouts:");
        for (int i = 0; i < mLayoutMap.size(); i++) {
            ipw.println("state(" + mLayoutMap.keyAt(i) + "): " + mLayoutMap.valueAt(i));
@@ -175,7 +172,7 @@ class DeviceStateToLayoutMap {
        if (xmlAddress != null) {
            return DisplayAddress.fromPhysicalDisplayId(xmlAddress.longValue());
        }
        if (!mIsPortInDisplayLayoutEnabled || display.getPort_optional() == null) {
        if (display.getPort_optional() == null) {
            throw new IllegalArgumentException(
                  "Must specify a display identifier in display layout configuration: " + display);
        }
+0 −11
Original line number Diff line number Diff line
@@ -41,10 +41,6 @@ public class DisplayManagerFlags {
    // 'adb shell setprop persist.log.tag.DisplayManagerFlags DEBUG && adb reboot'
    private static final boolean DEBUG = DebugUtils.isDebuggable(TAG);

    private final FlagState mPortInDisplayLayoutFlagState = new FlagState(
            Flags.FLAG_ENABLE_PORT_IN_DISPLAY_LAYOUT,
            Flags::enablePortInDisplayLayout);

    private final FlagState mAdaptiveToneImprovements1 = new FlagState(
            Flags.FLAG_ENABLE_ADAPTIVE_TONE_IMPROVEMENTS_1,
            Flags::enableAdaptiveToneImprovements1);
@@ -300,13 +296,6 @@ public class DisplayManagerFlags {
            Flags::enableOnDisplayAddedInObserver
    );

    /**
     * @return {@code true} if 'port' is allowed in display layout configuration file.
     */
    public boolean isPortInDisplayLayoutEnabled() {
        return mPortInDisplayLayoutFlagState.isEnabled();
    }

    /** Returns whether power throttling clamper is enabled on not. */
    public boolean isPowerThrottlingClamperEnabled() {
        return mPowerThrottlingClamperFlagState.isEnabled();
+0 −8
Original line number Diff line number Diff line
@@ -12,14 +12,6 @@ flag {
    is_exported: true
}

flag {
    name: "enable_port_in_display_layout"
    namespace: "display_manager"
    description: "Allows refering to displays by port in display layout"
    bug: "303058435"
    is_fixed_read_only: true
}

flag {
    name: "resolution_backup_restore"
    namespace: "display_manager"
+0 −9
Original line number Diff line number Diff line
@@ -270,17 +270,8 @@ public class DeviceStateToLayoutMapTest {
                IllegalArgumentException.class, () -> layout.postProcessLocked());
    }

    @Test
    public void testPortInLayout_disabledFlag() {
        Mockito.when(mMockFlags.isPortInDisplayLayoutEnabled()).thenReturn(false);
        assertThrows("Expected IllegalArgumentException when using <port>",
                IllegalArgumentException.class,
                () -> setupDeviceStateToLayoutMap(getPortContent()));
    }

    @Test
    public void testPortInLayout_readLayout() throws Exception {
        Mockito.when(mMockFlags.isPortInDisplayLayoutEnabled()).thenReturn(true);
        setupDeviceStateToLayoutMap(getPortContent());

        Layout configLayout = mDeviceStateToLayoutMap.get(0);