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

Commit 225052be authored by Evan Laird's avatar Evan Laird
Browse files

Sysui changes to support vibrate icon setting

- Add a listener for the new setting Settings.Secure.STATUS_BAR_SHOW_VIBRATE_ICON
- Rebuild any IconManager that receives an updated blocklist
- Assert that any blocklist changes come in on the main thread

Test: atest CollapsedStatusBarFragmentTest
Bug: 220144337

Change-Id: I667b5c57ef646c57a2f6912df7d233b1b5c0f89d
parent 404db921
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -9964,6 +9964,13 @@ public final class Settings {
        public static final String LOCKSCREEN_USE_DOUBLE_LINE_CLOCK =
                "lockscreen_use_double_line_clock";
        /**
         * Whether to show the vibrate icon in the Status Bar (default off)
         *
         * @hide
         */
        public static final String STATUS_BAR_SHOW_VIBRATE_ICON = "status_bar_show_vibrate_icon";
        /**
         * Specifies whether the web action API is enabled.
         *
+1 −0
Original line number Diff line number Diff line
@@ -196,5 +196,6 @@ public class SecureSettings {
        Settings.Secure.LOCKSCREEN_SHOW_WALLET,
        Settings.Secure.LOCK_SCREEN_SHOW_QR_CODE_SCANNER,
        Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK,
        Settings.Secure.STATUS_BAR_SHOW_VIBRATE_ICON
    };
}
+1 −0
Original line number Diff line number Diff line
@@ -155,6 +155,7 @@ public class SecureSettingsValidators {
        VALIDATORS.put(Secure.LOCKSCREEN_SHOW_WALLET, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.LOCK_SCREEN_SHOW_QR_CODE_SCANNER, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.STATUS_BAR_SHOW_VIBRATE_ICON, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.DOZE_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.DOZE_ALWAYS_ON, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.DOZE_PICK_UP_GESTURE, BOOLEAN_VALIDATOR);
+12 −4
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ import com.android.systemui.statusbar.StatusIconDisplayable;
import com.android.systemui.statusbar.phone.StatusBarSignalPolicy.CallIndicatorIconState;
import com.android.systemui.statusbar.phone.StatusBarSignalPolicy.MobileIconState;
import com.android.systemui.statusbar.phone.StatusBarSignalPolicy.WifiIconState;
import com.android.systemui.util.Assert;

import java.util.ArrayList;
import java.util.List;
@@ -66,6 +67,8 @@ public interface StatusBarIconController {
    void addIconGroup(IconManager iconManager);
    /** */
    void removeIconGroup(IconManager iconManager);
    /** Refresh the state of an IconManager by recreating the views */
    void refreshIconGroup(IconManager iconManager);
    /** */
    void setExternalIcon(String slot);
    /** */
@@ -243,6 +246,7 @@ public interface StatusBarIconController {
        protected final int mIconSize;
        // Whether or not these icons show up in dumpsys
        protected boolean mShouldLog = false;
        private StatusBarIconController mController;

        // Enables SystemUI demo mode to take effect in this group
        protected boolean mDemoable = true;
@@ -267,13 +271,17 @@ public interface StatusBarIconController {
            mDemoable = demoable;
        }

        public void setBlockList(@Nullable List<String> blockList) {
            mBlockList.clear();
            if (blockList == null || blockList.isEmpty()) {
                return;
        void setController(StatusBarIconController controller) {
            mController = controller;
        }

        public void setBlockList(@Nullable List<String> blockList) {
            Assert.isMainThread();
            mBlockList.clear();
            mBlockList.addAll(blockList);
            if (mController != null) {
                mController.refreshIconGroup(this);
            }
        }

        public void setShouldLog(boolean should) {
+7 −0
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
            }
        }

        group.setController(this);
        mIconGroups.add(group);
        List<Slot> allSlots = getSlots();
        for (int i = 0; i < allSlots.size(); i++) {
@@ -115,6 +116,12 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
        }
    }

    @Override
    public void refreshIconGroup(IconManager iconManager) {
        removeIconGroup(iconManager);
        addIconGroup(iconManager);
    }

    private void refreshIconGroups() {
        for (int i = mIconGroups.size() - 1; i >= 0; --i) {
            IconManager group = mIconGroups.get(i);
Loading