aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-12-12 22:04:11 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-12-12 22:04:11 +0000
commit764e404dc209e0e6e121de5ee189aea3e59cb7d7 (patch)
tree2046844cae9e4ef82a9db6f864ccb9659624f90a
parentb4e4a8bccd0bbfdb713df318788702a18dfc489a (diff)
parenta8d6b1ff4a8c188ffdbff32dd2a63fda1b55b883 (diff)
downloadContactsProvider-android11-qpr2-release.tar.gz
Change-Id: Idc467b04142a9ef92df67b736cbf65d577b912ec
-rw-r--r--AndroidManifest.xml2
-rw-r--r--src/com/android/providers/contacts/VoicemailNotifier.java19
2 files changed, 20 insertions, 1 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 9542e6d9..be62fc16 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -4,6 +4,8 @@
android:sharedUserLabel="@string/sharedUserLabel">
<uses-permission android:name="android.permission.BIND_DIRECTORY_SEARCH" />
+ <!-- For sending voicemail intents -->
+ <uses-permission android:name="android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS_PRIVILEGED" />
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
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(),