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

Commit b6518a0b authored by Beverly Tai's avatar Beverly Tai Committed by Android (Google) Code Review
Browse files

Merge "Add disable methods in StatusBarManager" into qt-r1-dev

parents 97a04f92 54fead82
Loading
Loading
Loading
Loading
+62 −2
Original line number Diff line number Diff line
@@ -433,6 +433,9 @@ public class StatusBarManager {
        private boolean mNotificationPeeking;
        private boolean mRecents;
        private boolean mSearch;
        private boolean mSystemIcons;
        private boolean mClock;
        private boolean mNotificationIcons;

        /** @hide */
        public DisableInfo(int flags1, int flags2) {
@@ -441,6 +444,9 @@ public class StatusBarManager {
            mNotificationPeeking = (flags1 & DISABLE_NOTIFICATION_ALERTS) != 0;
            mRecents = (flags1 & DISABLE_RECENT) != 0;
            mSearch = (flags1 & DISABLE_SEARCH) != 0;
            mSystemIcons = (flags1 & DISABLE_SYSTEM_INFO) != 0;
            mClock = (flags1 & DISABLE_CLOCK) != 0;
            mNotificationIcons = (flags1 & DISABLE_NOTIFICATION_ICONS) != 0;
        }

        /** @hide */
@@ -526,6 +532,48 @@ public class StatusBarManager {
            mSearch = disabled;
        }

        /**
         * @return {@code true} if system icons are disabled
         *
         * @hide
         */
        public boolean areSystemIconsDisabled() {
            return mSystemIcons;
        }

        /** * @hide */
        public void setSystemIconsDisabled(boolean disabled) {
            mSystemIcons = disabled;
        }

        /**
         * @return {@code true} if the clock icon is disabled
         *
         * @hide
         */
        public boolean isClockDisabled() {
            return mClock;
        }

        /** * @hide */
        public void setClockDisabled(boolean disabled) {
            mClock = disabled;
        }

        /**
         * @return {@code true} if notification icons are disabled
         *
         * @hide
         */
        public boolean areNotificationIconsDisabled() {
            return mNotificationIcons;
        }

        /** * @hide */
        public void setNotificationIconsDisabled(boolean disabled) {
            mNotificationIcons = disabled;
        }

        /**
         * @return {@code true} if no components are disabled (default state)
         *
@@ -535,7 +583,7 @@ public class StatusBarManager {
        @TestApi
        public boolean areAllComponentsEnabled() {
            return !mStatusBarExpansion && !mNavigateHome && !mNotificationPeeking && !mRecents
                    && !mSearch;
                    && !mSearch && !mSystemIcons && !mClock && !mNotificationIcons;
        }

        /** @hide */
@@ -545,6 +593,9 @@ public class StatusBarManager {
            mNotificationPeeking = false;
            mRecents = false;
            mSearch = false;
            mSystemIcons = false;
            mClock = false;
            mNotificationIcons = false;
        }

        /**
@@ -554,7 +605,7 @@ public class StatusBarManager {
         */
        public boolean areAllComponentsDisabled() {
            return mStatusBarExpansion && mNavigateHome && mNotificationPeeking
                    && mRecents && mSearch;
                    && mRecents && mSearch && mSystemIcons && mClock && mNotificationIcons;
        }

        /** @hide */
@@ -564,6 +615,9 @@ public class StatusBarManager {
            mNotificationPeeking = true;
            mRecents = true;
            mSearch = true;
            mSystemIcons = true;
            mClock = true;
            mNotificationIcons = true;
        }

        @Override
@@ -576,6 +630,9 @@ public class StatusBarManager {
                    .append(mNotificationPeeking ? "disabled" : "enabled");
            sb.append(" mRecents=").append(mRecents ? "disabled" : "enabled");
            sb.append(" mSearch=").append(mSearch ? "disabled" : "enabled");
            sb.append(" mSystemIcons=").append(mSystemIcons ? "disabled" : "enabled");
            sb.append(" mClock=").append(mClock ? "disabled" : "enabled");
            sb.append(" mNotificationIcons=").append(mNotificationIcons ? "disabled" : "enabled");

            return sb.toString();

@@ -596,6 +653,9 @@ public class StatusBarManager {
            if (mNotificationPeeking) disable1 |= DISABLE_NOTIFICATION_ALERTS;
            if (mRecents) disable1 |= DISABLE_RECENT;
            if (mSearch) disable1 |= DISABLE_SEARCH;
            if (mSystemIcons) disable1 |= DISABLE_SYSTEM_INFO;
            if (mClock) disable1 |= DISABLE_CLOCK;
            if (mNotificationIcons) disable1 |= DISABLE_NOTIFICATION_ICONS;

            return new Pair<Integer, Integer>(disable1, disable2);
        }
+12 −1
Original line number Diff line number Diff line
@@ -161,7 +161,15 @@ public class StatusBarShellCommand extends ShellCommand {
                case "statusbar-expansion":
                    info.setStatusBarExpansionDisabled(true);
                    break;

                case "system-icons":
                    info.setSystemIconsDisabled(true);
                    break;
                case "clock":
                    info.setClockDisabled(true);
                    break;
                case "notification-icons":
                    info.setNotificationIconsDisabled(true);
                    break;
                default:
                    break;
            }
@@ -221,6 +229,9 @@ public class StatusBarShellCommand extends ShellCommand {
        pw.println("        recents             - disable recents/overview");
        pw.println("        notification-peek   - disable notification peeking");
        pw.println("        statusbar-expansion - disable status bar expansion");
        pw.println("        system-icons        - disable system icons appearing in status bar");
        pw.println("        clock               - disable clock appearing in status bar");
        pw.println("        notification-icons  - disable notification icons from status bar");
        pw.println("");
    }