Merge "Update dnd settings summary" into pi-dev

am: 8ecf40491b

Change-Id: I73182fe8a2b28da1968e628ce17f7149303d8507
This commit is contained in:
Beverly Tai
2018-04-09 13:07:02 -07:00
committed by android-build-merger
2 changed files with 13 additions and 6 deletions

View File

@@ -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) {

View File

@@ -210,7 +210,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) {