Support dnd condition in Settings
- Add way to open QS detail panels directly
- Add internal broadcast that can launch apps when dnd mode changes
Change-Id: If2b6350dc31623f3bf2f64c7eb141cff5d3d4e89
diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java
index 89610e9..85d9831 100644
--- a/core/java/android/app/NotificationManager.java
+++ b/core/java/android/app/NotificationManager.java
@@ -128,6 +128,14 @@
= "android.app.action.INTERRUPTION_FILTER_CHANGED";
/**
+ * Intent that is broadcast when the state of getCurrentInterruptionFilter() changes.
+ * @hide
+ */
+ @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION)
+ public static final String ACTION_INTERRUPTION_FILTER_CHANGED_INTERNAL
+ = "android.app.action.INTERRUPTION_FILTER_CHANGED_INTERNAL";
+
+ /**
* {@link #getCurrentInterruptionFilter() Interruption filter} constant -
* Normal interruption filter.
*/
diff --git a/core/java/android/app/StatusBarManager.java b/core/java/android/app/StatusBarManager.java
index 5e8ad68..b899116 100644
--- a/core/java/android/app/StatusBarManager.java
+++ b/core/java/android/app/StatusBarManager.java
@@ -180,10 +180,17 @@
* Expand the settings panel.
*/
public void expandSettingsPanel() {
+ expandSettingsPanel(null);
+ }
+
+ /**
+ * Expand the settings panel and open a subPanel, pass null to just open the settings panel.
+ */
+ public void expandSettingsPanel(String subPanel) {
try {
final IStatusBarService svc = getService();
if (svc != null) {
- svc.expandSettingsPanel();
+ svc.expandSettingsPanel(subPanel);
}
} catch (RemoteException ex) {
// system process is dead anyway.
diff --git a/core/java/com/android/internal/statusbar/IStatusBar.aidl b/core/java/com/android/internal/statusbar/IStatusBar.aidl
index 11ef18b..849d314 100644
--- a/core/java/com/android/internal/statusbar/IStatusBar.aidl
+++ b/core/java/com/android/internal/statusbar/IStatusBar.aidl
@@ -28,7 +28,7 @@
void removeIcon(int index);
void disable(int state1, int state2);
void animateExpandNotificationsPanel();
- void animateExpandSettingsPanel();
+ void animateExpandSettingsPanel(String subPanel);
void animateCollapsePanels();
void setSystemUiVisibility(int vis, int mask);
void topAppWindowChanged(boolean menuVisible);
diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl
index 6c957be..0a4ad06 100644
--- a/core/java/com/android/internal/statusbar/IStatusBarService.aidl
+++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl
@@ -39,7 +39,7 @@
void topAppWindowChanged(boolean menuVisible);
void setImeWindowStatus(in IBinder token, int vis, int backDisposition,
boolean showImeSwitcher);
- void expandSettingsPanel();
+ void expandSettingsPanel(String subPanel);
void setCurrentUser(int newUserId);
// ---- Methods below are for use by the status bar policy services ----
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
index ae8542a..16fd9eb 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
@@ -154,6 +154,20 @@
}
}
+ public void openDetails(String subPanel) {
+ QSTile<?> tile = getTile(subPanel);
+ showDetailAdapter(true, tile.getDetailAdapter(), new int[] {getWidth() / 2, 0});
+ }
+
+ private QSTile<?> getTile(String subPanel) {
+ for (int i = 0; i < mRecords.size(); i++) {
+ if (subPanel.equals(mRecords.get(i).tile.getTileSpec())) {
+ return mRecords.get(i).tile;
+ }
+ }
+ return mHost.createTile(subPanel);
+ }
+
protected void createCustomizePanel() {
mCustomizePanel = (QSCustomizer) LayoutInflater.from(mContext)
.inflate(R.layout.qs_customize_panel, null);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
index 10d4a96..deedae0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
@@ -91,7 +91,7 @@
public void disable(int state1, int state2, boolean animate);
public void animateExpandNotificationsPanel();
public void animateCollapsePanels(int flags);
- public void animateExpandSettingsPanel();
+ public void animateExpandSettingsPanel(String obj);
public void setSystemUiVisibility(int vis, int mask);
public void topAppWindowChanged(boolean visible);
public void setImeWindowStatus(IBinder token, int vis, int backDisposition,
@@ -157,10 +157,10 @@
}
}
- public void animateExpandSettingsPanel() {
+ public void animateExpandSettingsPanel(String subPanel) {
synchronized (mList) {
mHandler.removeMessages(MSG_EXPAND_SETTINGS);
- mHandler.sendEmptyMessage(MSG_EXPAND_SETTINGS);
+ mHandler.obtainMessage(MSG_EXPAND_SETTINGS, subPanel).sendToTarget();
}
}
@@ -353,7 +353,7 @@
mCallbacks.animateCollapsePanels(0);
break;
case MSG_EXPAND_SETTINGS:
- mCallbacks.animateExpandSettingsPanel();
+ mCallbacks.animateExpandSettingsPanel((String) msg.obj);
break;
case MSG_SET_SYSTEMUI_VISIBILITY:
mCallbacks.setSystemUiVisibility(msg.arg1, msg.arg2);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 76b8223..8f7c95e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -2162,7 +2162,7 @@
animateExpandNotificationsPanel();
break;
case MSG_OPEN_SETTINGS_PANEL:
- animateExpandSettingsPanel();
+ animateExpandSettingsPanel((String) m.obj);
break;
case MSG_CLOSE_PANELS:
animateCollapsePanels();
@@ -2305,7 +2305,7 @@
}
@Override
- public void animateExpandSettingsPanel() {
+ public void animateExpandSettingsPanel(String subPanel) {
if (SPEW) Log.d(TAG, "animateExpand: mExpandedVisible=" + mExpandedVisible);
if (!panelsEnabled()) {
return;
@@ -2314,6 +2314,10 @@
// Settings are not available in setup
if (!mUserSetup) return;
+
+ if (subPanel != null) {
+ mQSPanel.openDetails(subPanel);
+ }
mNotificationPanel.expandWithQs();
if (false) postStartTracing();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
index 856a774..44b41c5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
@@ -135,7 +135,7 @@
}
@Override
- public void animateExpandSettingsPanel() {
+ public void animateExpandSettingsPanel(String subPanel) {
}
@Override
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 07343a9..1464ea4 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -880,6 +880,9 @@
@Override
void onZenModeChanged() {
sendRegisteredOnlyBroadcast(NotificationManager.ACTION_INTERRUPTION_FILTER_CHANGED);
+ getContext().sendBroadcastAsUser(
+ new Intent(NotificationManager.ACTION_INTERRUPTION_FILTER_CHANGED_INTERNAL),
+ UserHandle.ALL, android.Manifest.permission.MANAGE_NOTIFICATIONS);
synchronized(mNotificationList) {
updateInterruptionFilterLocked();
}
diff --git a/services/core/java/com/android/server/notification/ZenModeHelper.java b/services/core/java/com/android/server/notification/ZenModeHelper.java
index 3c891df..6030bab 100644
--- a/services/core/java/com/android/server/notification/ZenModeHelper.java
+++ b/services/core/java/com/android/server/notification/ZenModeHelper.java
@@ -564,6 +564,7 @@
private boolean evaluateZenMode(String reason, boolean setRingerMode) {
if (DEBUG) Log.d(TAG, "evaluateZenMode");
+ final int zenBefore = mZenMode;
final int zen = computeZenMode();
ZenLog.traceSetZenMode(zen, reason);
mZenMode = zen;
@@ -573,7 +574,7 @@
applyZenToRingerMode();
}
applyRestrictions();
- if (zen != mZenMode) {
+ if (zen != zenBefore) {
mHandler.postDispatchOnZenModeChanged();
}
return true;
diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
index 19b03d5..fc27170 100644
--- a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
+++ b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
@@ -216,12 +216,12 @@
}
@Override
- public void expandSettingsPanel() {
+ public void expandSettingsPanel(String subPanel) {
enforceExpandStatusBar();
if (mBar != null) {
try {
- mBar.animateExpandSettingsPanel();
+ mBar.animateExpandSettingsPanel(subPanel);
} catch (RemoteException ex) {
}
}