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

Commit 6b610456 authored by Victor Chang's avatar Victor Chang Committed by Automerger Merge Worker
Browse files

Merge "Revert "Clean up LogicalDisplayMapper"" into sc-dev am: 03c49c13

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13714652

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I411d1b949b231c460cee9a188f22d9634db7fc78
parents ef1986f4 03c49c13
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -810,9 +810,6 @@ public final class DisplayInfo implements Parcelable {
        if ((flags & Display.FLAG_TRUSTED) != 0) {
            result.append(", FLAG_TRUSTED");
        }
        if ((flags & Display.FLAG_OWN_DISPLAY_GROUP) != 0) {
            result.append(", FLAG_OWN_DISPLAY_GROUP");
        }
        return result.toString();
    }
}
+0 −9
Original line number Diff line number Diff line
@@ -673,15 +673,6 @@
        -->
    </integer-array>

    <!-- The device states (supplied by DeviceStateManager) that should be treated as unfolded by
         the display fold controller. Default is empty. -->
    <integer-array name="config_unfoldedDeviceStates">
        <!-- Example:
        <item>3</item>
        <item>4</item>
        -->
    </integer-array>

    <!-- Indicate the display area rect for foldable devices in folded state. -->
    <string name="config_foldedArea"></string>

+0 −1
Original line number Diff line number Diff line
@@ -3762,7 +3762,6 @@

  <!-- For Foldables -->
  <java-symbol type="array" name="config_foldedDeviceStates" />
  <java-symbol type="array" name="config_unfoldedDeviceStates" />
  <java-symbol type="string" name="config_foldedArea" />

  <java-symbol type="array" name="config_disableApksUnlessMatchedSku_apk_list" />
+15 −17
Original line number Diff line number Diff line
@@ -39,6 +39,10 @@ class DeviceStateToLayoutMap {

    public static final int STATE_DEFAULT = DeviceStateManager.INVALID_DEVICE_STATE;

    // TODO - b/168208162 - Remove these when we check in static definitions for layouts
    public static final int STATE_FOLDED = 100;
    public static final int STATE_UNFOLDED = 101;

    private final SparseArray<Layout> mLayoutMap = new SparseArray<>();

    DeviceStateToLayoutMap(Context context) {
@@ -64,7 +68,7 @@ class DeviceStateToLayoutMap {
        return layout;
    }

    private Layout createLayout(int state) {
    private Layout create(int state) {
        if (mLayoutMap.contains(state)) {
            Slog.e(TAG, "Attempted to create a second layout for state " + state);
            return null;
@@ -75,12 +79,10 @@ class DeviceStateToLayoutMap {
        return layout;
    }

    /**
     * Loads config.xml-specified folded configurations for foldable devices.
     */
    private void loadFoldedDisplayConfig(Context context) {
        final String[] strDisplayIds = context.getResources().getStringArray(
                com.android.internal.R.array.config_internalFoldedPhysicalDisplayIds);

        if (strDisplayIds.length != 2 || TextUtils.isEmpty(strDisplayIds[0])
                || TextUtils.isEmpty(strDisplayIds[1])) {
            Slog.w(TAG, "Folded display configuration invalid: [" + Arrays.toString(strDisplayIds)
@@ -101,23 +103,19 @@ class DeviceStateToLayoutMap {

        final int[] foldedDeviceStates = context.getResources().getIntArray(
                com.android.internal.R.array.config_foldedDeviceStates);
        final int[] unfoldedDeviceStates = context.getResources().getIntArray(
                com.android.internal.R.array.config_unfoldedDeviceStates);
        // Only add folded states if folded state config is not empty
        if (foldedDeviceStates.length == 0 || unfoldedDeviceStates.length == 0) {
        if (foldedDeviceStates.length == 0) {
            return;
        }

        for (int state : foldedDeviceStates) {
        // Create the folded state layout
            createLayout(state).createDisplayLocked(
        final Layout foldedLayout = create(STATE_FOLDED);
        foldedLayout.createDisplayLocked(
                DisplayAddress.fromPhysicalDisplayId(displayIds[0]), true /*isDefault*/);
        }

        for (int state : unfoldedDeviceStates) {
        // Create the unfolded state layout
            createLayout(state).createDisplayLocked(
        final Layout unfoldedLayout = create(STATE_UNFOLDED);
        unfoldedLayout.createDisplayLocked(
                DisplayAddress.fromPhysicalDisplayId(displayIds[1]), true /*isDefault*/);
    }
}
}
+1 −14
Original line number Diff line number Diff line
@@ -30,8 +30,6 @@ public class DisplayGroup {
    private final List<LogicalDisplay> mDisplays = new ArrayList<>();
    private final int mGroupId;

    private int mChangeCount;

    DisplayGroup(int groupId) {
        mGroupId = groupId;
    }
@@ -47,16 +45,11 @@ public class DisplayGroup {
     * @param display the {@link LogicalDisplay} to add to the Group
     */
    void addDisplayLocked(LogicalDisplay display) {
        if (!containsLocked(display)) {
            mChangeCount++;
        if (!mDisplays.contains(display)) {
            mDisplays.add(display);
        }
    }

    boolean containsLocked(LogicalDisplay display) {
        return mDisplays.contains(display);
    }

    /**
     * Removes the provided {@code display} from the Group.
     *
@@ -64,7 +57,6 @@ public class DisplayGroup {
     * @return {@code true} if the {@code display} was removed; otherwise {@code false}
     */
    boolean removeDisplayLocked(LogicalDisplay display) {
        mChangeCount++;
        return mDisplays.remove(display);
    }

@@ -73,11 +65,6 @@ public class DisplayGroup {
        return mDisplays.isEmpty();
    }

    /** Returns a count of the changes made to this display group. */
    int getChangeCountLocked() {
        return mChangeCount;
    }

    /** Returns the number of {@link LogicalDisplay LogicalDisplays} in the Group. */
    int getSizeLocked() {
        return mDisplays.size();
Loading