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

Commit 5b5a16e9 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
Merged-In: I667b5c57ef646c57a2f6912df7d233b1b5c0f89d
parent 734dde12
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -9663,6 +9663,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
@@ -192,5 +192,6 @@ public class SecureSettings {
        Settings.Secure.LOCKSCREEN_SHOW_CONTROLS,
        Settings.Secure.LOCKSCREEN_SHOW_WALLET,
        Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK,
        Settings.Secure.STATUS_BAR_SHOW_VIBRATE_ICON
    };
}
+1 −0
Original line number Diff line number Diff line
@@ -151,6 +151,7 @@ public class SecureSettingsValidators {
        VALIDATORS.put(Secure.LOCKSCREEN_SHOW_CONTROLS, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.LOCKSCREEN_SHOW_WALLET, 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
@@ -47,6 +47,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;
@@ -65,6 +66,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);
    /** */
@@ -242,6 +245,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;
@@ -266,13 +270,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
@@ -99,6 +99,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++) {
@@ -114,6 +115,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