Add disable methods in StatusBarManager
Test: manual
Bug: 132844641
Change-Id: Ibee48629c6ddb523cafa45238668cb00553f2d5b
diff --git a/core/java/android/app/StatusBarManager.java b/core/java/android/app/StatusBarManager.java
index af2d774..205e7a1 100644
--- a/core/java/android/app/StatusBarManager.java
+++ b/core/java/android/app/StatusBarManager.java
@@ -433,6 +433,9 @@
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 @@
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 */
@@ -527,6 +533,48 @@
}
/**
+ * @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)
*
* @hide
@@ -535,7 +583,7 @@
@TestApi
public boolean areAllComponentsEnabled() {
return !mStatusBarExpansion && !mNavigateHome && !mNotificationPeeking && !mRecents
- && !mSearch;
+ && !mSearch && !mSystemIcons && !mClock && !mNotificationIcons;
}
/** @hide */
@@ -545,6 +593,9 @@
mNotificationPeeking = false;
mRecents = false;
mSearch = false;
+ mSystemIcons = false;
+ mClock = false;
+ mNotificationIcons = false;
}
/**
@@ -554,7 +605,7 @@
*/
public boolean areAllComponentsDisabled() {
return mStatusBarExpansion && mNavigateHome && mNotificationPeeking
- && mRecents && mSearch;
+ && mRecents && mSearch && mSystemIcons && mClock && mNotificationIcons;
}
/** @hide */
@@ -564,6 +615,9 @@
mNotificationPeeking = true;
mRecents = true;
mSearch = true;
+ mSystemIcons = true;
+ mClock = true;
+ mNotificationIcons = true;
}
@Override
@@ -576,6 +630,9 @@
.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 @@
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);
}
diff --git a/services/core/java/com/android/server/statusbar/StatusBarShellCommand.java b/services/core/java/com/android/server/statusbar/StatusBarShellCommand.java
index b121298..d7f86cd 100644
--- a/services/core/java/com/android/server/statusbar/StatusBarShellCommand.java
+++ b/services/core/java/com/android/server/statusbar/StatusBarShellCommand.java
@@ -161,7 +161,15 @@
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 @@
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("");
}