Fix regression where contacts and starred contacts wouldn't ring in DND.
A recent change was made to NotificationManager which deprecated the old
means of using EXTRA_PEOPLE when calling "matchesCallFilter".
This CL updates the "matchesCallFilter" to use the new replacement
EXTRA_PEOPLE_LIST means of specifying the contact URI.
Test: Manually tested ring during DND.
Bug: 72030702
Change-Id: Ia434d343abb6e3d7ebf5039c0626bc6b2ae85757
(cherry picked from commit 296489e016dda0b03fe83d0197e3609ec5155eef)
diff --git a/src/com/android/server/telecom/Ringer.java b/src/com/android/server/telecom/Ringer.java
index 4d97f4d..39a8185 100644
--- a/src/com/android/server/telecom/Ringer.java
+++ b/src/com/android/server/telecom/Ringer.java
@@ -30,6 +30,8 @@
import com.android.internal.annotations.VisibleForTesting;
+import java.util.ArrayList;
+
/**
* Controls the ringtone player.
*/
@@ -238,11 +240,13 @@
private boolean shouldRingForContact(Uri contactUri) {
final NotificationManager manager =
(NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
- final Bundle extras = new Bundle();
+ final Bundle peopleExtras = new Bundle();
if (contactUri != null) {
- extras.putStringArray(Notification.EXTRA_PEOPLE, new String[] {contactUri.toString()});
+ ArrayList<Notification.Person> personList = new ArrayList<>();
+ personList.add(new Notification.Person().setUri(contactUri.toString()));
+ peopleExtras.putParcelableArrayList(Notification.EXTRA_PEOPLE_LIST, personList);
}
- return manager.matchesCallFilter(extras);
+ return manager.matchesCallFilter(peopleExtras);
}
private boolean hasExternalRinger(Call foregroundCall) {