aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2020-12-11 23:01:26 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-12-11 23:01:26 +0000
commitbc2d2afa376554649803bb51c4b0daa6cab90b69 (patch)
treefba1ff135cf50d84bc93b4948f1bec6085f81f9f /src
parent3c851c6413bdfd2da5827ba238c7966c7f748527 (diff)
parenta8d6b1ff4a8c188ffdbff32dd2a63fda1b55b883 (diff)
downloadContactsProvider-bc2d2afa376554649803bb51c4b0daa6cab90b69.tar.gz
Provide allow-list to recipient of voicemail intents. am: a8d6b1ff4a
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/providers/ContactsProvider/+/13209414 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: Ie385b8d41a75309e197ade1d6d19a6d5a8e945bb
Diffstat (limited to 'src')
-rw-r--r--src/com/android/providers/contacts/VoicemailNotifier.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/com/android/providers/contacts/VoicemailNotifier.java b/src/com/android/providers/contacts/VoicemailNotifier.java
index 159cec73..b4033eac 100644
--- a/src/com/android/providers/contacts/VoicemailNotifier.java
+++ b/src/com/android/providers/contacts/VoicemailNotifier.java
@@ -1,5 +1,6 @@
package com.android.providers.contacts;
+import android.app.BroadcastOptions;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -27,6 +28,12 @@ public class VoicemailNotifier {
private final String TAG = "VoicemailNotifier";
+ /**
+ * Grant recipients of new voicemail broadcasts a 10sec allowlist so they can start a background
+ * service to do VVM processing.
+ */
+ private final long VOICEMAIL_ALLOW_LIST_DURATION_MILLIS = 10000;
+
private final Context mContext;
private final Uri mBaseUri;
@@ -85,7 +92,17 @@ public class VoicemailNotifier {
intent.putExtra(VoicemailContract.EXTRA_SELF_CHANGE,
callingPackages.contains(component.getPackageName()));
}
- mContext.sendBroadcast(intent);
+ if (intentAction.equals(VoicemailContract.ACTION_NEW_VOICEMAIL)) {
+ BroadcastOptions bopts = BroadcastOptions.makeBasic();
+ bopts.setTemporaryAppWhitelistDuration(VOICEMAIL_ALLOW_LIST_DURATION_MILLIS);
+ Log.i(TAG, String.format("sendNotification: allowMillis=%d, pkg=%s",
+ VOICEMAIL_ALLOW_LIST_DURATION_MILLIS, component.getPackageName()));
+ mContext.sendBroadcast(intent, android.Manifest.permission.READ_VOICEMAIL,
+ bopts.toBundle());
+ } else {
+ mContext.sendBroadcast(intent);
+ }
+
Log.v(TAG, String.format("Sent intent. act:%s, url:%s, comp:%s," +
" self_change:%s", intent.getAction(), intent.getData(),
component.getClassName(),