diff options
| -rw-r--r-- | core/java/android/service/notification/ZenModeConfig.java | 17 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java | 2 |
2 files changed, 13 insertions, 6 deletions
diff --git a/core/java/android/service/notification/ZenModeConfig.java b/core/java/android/service/notification/ZenModeConfig.java index 3830b7ac1aee..daecea71d926 100644 --- a/core/java/android/service/notification/ZenModeConfig.java +++ b/core/java/android/service/notification/ZenModeConfig.java @@ -1487,14 +1487,18 @@ public class ZenModeConfig implements Parcelable { /** * Returns a description of the current do not disturb settings from config. * - If turned on manually and end time is known, returns end time. + * - If turned on manually and end time is on forever until turned off, return null if + * describeForeverCondition is false, else return String describing indefinite behavior * - If turned on by an automatic rule, returns the automatic rule name. * - If on due to an app, returns the app name. * - If there's a combination of rules/apps that trigger, then shows the one that will * last the longest if applicable. - * @return null if do not disturb is off. + * @return null if DND is off or describeForeverCondition is false and + * DND is on forever (until turned off) */ - public static String getDescription(Context context, boolean zenOn, ZenModeConfig config) { - if (!zenOn) { + public static String getDescription(Context context, boolean zenOn, ZenModeConfig config, + boolean describeForeverCondition) { + if (!zenOn || config == null) { return null; } @@ -1513,8 +1517,11 @@ public class ZenModeConfig implements Parcelable { } else { if (id == null) { // Do not disturb manually triggered to remain on forever until turned off - // No subtext - return null; + if (describeForeverCondition) { + return context.getString(R.string.zen_mode_forever); + } else { + return null; + } } else { latestEndTime = tryParseCountdownConditionId(id); if (latestEndTime > 0) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java index 7dcf5c0c3b35..4b312f533024 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java @@ -209,7 +209,7 @@ public class DndTile extends QSTileImpl<BooleanState> { state.slash.isSlashed = !state.value; state.label = getTileLabel(); state.secondaryLabel = ZenModeConfig.getDescription(mContext,zen != Global.ZEN_MODE_OFF, - mController.getConfig()); + mController.getConfig(), false); state.icon = ResourceIcon.get(R.drawable.ic_qs_dnd_on); checkIfRestrictionEnforcedByAdminOnly(state, UserManager.DISALLOW_ADJUST_VOLUME); switch (zen) { |