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

Commit 4a50a8ec authored by Yong Shi's avatar Yong Shi Committed by takeshi tanigawa
Browse files

Show mobile icons with left-to-right in order of slot index

Icon list of status bar is displayed as first items go to the right
of second items. But mobile icon has order of slot index
and these must be shown with left-to-right([Slot1][Slot2]..).
Reverse the sort order in icon list beforehand.

Test: manual - Checked that the SIM-slot1 icon is shown on the left
side of SIM-slot2.
Test: auto - Passed StatusBarIconListTest.
Bug: 123931542

Change-Id: I2d9fcd63e9ef05f96ba4a17de78bb834b71729e8
parent 533b2960
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import com.android.systemui.tuner.TunerService.Tunable;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import static com.android.systemui.statusbar.phone.StatusBarIconController.TAG_PRIMARY;
@@ -121,7 +122,7 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
        // Remove all the icons.
        for (int i = currentSlots.size() - 1; i >= 0; i--) {
            Slot s = currentSlots.get(i);
            slotsToReAdd.put(s, s.getHolderListInViewOrder());
            slotsToReAdd.put(s, s.getHolderList());
            removeAllIconsForSlot(s.getName());
        }

@@ -200,6 +201,10 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
        Slot mobileSlot = getSlot(slot);
        int slotIndex = getSlotIndex(slot);

        // Reverse the sort order to show icons with left to right([Slot1][Slot2]..).
        // StatusBarIconList has UI design that first items go to the right of second items.
        Collections.reverse(iconStates);

        for (MobileIconState state : iconStates) {
            StatusBarIconHolder holder = mobileSlot.getHolderForTag(state.subId);
            if (holder == null) {
+19 −0
Original line number Diff line number Diff line
@@ -249,6 +249,25 @@ public class StatusBarIconList {
            return holders;
        }

        /**
         * Build a list of the {@link StatusBarIconHolder}s in the same order.
         * This provides a safe list that can be iterated and inserted into its group.
         *
         * @return all holders contained here
         */
        public List<StatusBarIconHolder> getHolderList() {
            ArrayList<StatusBarIconHolder> holders = new ArrayList<>();
            if (mHolder != null) {
                holders.add(mHolder);
            }

            if (mSubSlots != null) {
                holders.addAll(mSubSlots);
            }

            return holders;
        }

        @Override
        public String toString() {
            return String.format("(%s) %s", mName, subSlotsString());