diff options
Diffstat (limited to 'android/service/notification')
-rw-r--r-- | android/service/notification/NotificationListenerService.java | 5 | ||||
-rw-r--r-- | android/service/notification/ZenModeConfig.java | 22 |
2 files changed, 18 insertions, 9 deletions
diff --git a/android/service/notification/NotificationListenerService.java b/android/service/notification/NotificationListenerService.java index 3726e66d..32737c54 100644 --- a/android/service/notification/NotificationListenerService.java +++ b/android/service/notification/NotificationListenerService.java @@ -28,6 +28,7 @@ import android.app.Notification.Builder; import android.app.NotificationChannel; import android.app.NotificationChannelGroup; import android.app.NotificationManager; +import android.app.Person; import android.app.Service; import android.companion.CompanionDeviceManager; import android.content.ComponentName; @@ -1195,13 +1196,13 @@ public abstract class NotificationListenerService extends Service { */ private void maybePopulatePeople(Notification notification) { if (getContext().getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.P) { - ArrayList<Notification.Person> people = notification.extras.getParcelableArrayList( + ArrayList<Person> people = notification.extras.getParcelableArrayList( Notification.EXTRA_PEOPLE_LIST); if (people != null && people.isEmpty()) { int size = people.size(); String[] peopleArray = new String[size]; for (int i = 0; i < size; i++) { - Notification.Person person = people.get(i); + Person person = people.get(i); peopleArray[i] = person.resolveToLegacyUri(); } notification.extras.putStringArray(Notification.EXTRA_PEOPLE, peopleArray); diff --git a/android/service/notification/ZenModeConfig.java b/android/service/notification/ZenModeConfig.java index 3830b7ac..7b01f7a4 100644 --- a/android/service/notification/ZenModeConfig.java +++ b/android/service/notification/ZenModeConfig.java @@ -83,7 +83,8 @@ public class ZenModeConfig implements Parcelable { private static final int DAY_MINUTES = 24 * 60; private static final int ZERO_VALUE_MS = 10 * SECONDS_MS; - // Default allow categories set in readXml() from default_zen_mode_config.xml, fallback values: + // Default allow categories set in readXml() from default_zen_mode_config.xml, + // fallback/upgrade values: private static final boolean DEFAULT_ALLOW_ALARMS = true; private static final boolean DEFAULT_ALLOW_MEDIA = true; private static final boolean DEFAULT_ALLOW_SYSTEM = false; @@ -97,7 +98,7 @@ public class ZenModeConfig implements Parcelable { private static final int DEFAULT_SUPPRESSED_VISUAL_EFFECTS = Policy.getAllSuppressedVisualEffects(); - public static final int XML_VERSION = 6; + public static final int XML_VERSION = 7; public static final String ZEN_TAG = "zen"; private static final String ZEN_ATT_VERSION = "version"; private static final String ZEN_ATT_USER = "user"; @@ -1487,14 +1488,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 +1518,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) { |