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

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

Merge "Update dnd settings summary" into pi-dev

parents b35baa53 ebcaeeb7
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -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
                    if (describeForeverCondition) {
                        return context.getString(R.string.zen_mode_forever);
                    } else {
                        return null;
                    }
                } else {
                    latestEndTime = tryParseCountdownConditionId(id);
                    if (latestEndTime > 0) {
+1 −1
Original line number Diff line number Diff line
@@ -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) {