diff options
author | mdooley <mdooley@google.com> | 2017-10-11 15:43:10 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-10-11 15:43:10 +0000 |
commit | 0a7e44ef1f93b08aa205c0b5f33e67e44571f4a5 (patch) | |
tree | a943bc9d1016bd608f84d9832bfcaad34c56cea0 /java | |
parent | 7c932042b6f0cc5a7917a0d19db120d87e3f96b2 (diff) | |
parent | 252fed4f12b9206506132171a30eab760af503a2 (diff) |
Merge changes If11b88a0,I34444857,Ie64f7daa
am: 252fed4f12
Change-Id: Ic83fd8eedd79bc9d6021416bb9960425e265006c
Diffstat (limited to 'java')
3 files changed, 43 insertions, 3 deletions
diff --git a/java/com/android/dialer/app/calllog/MissedCallNotifier.java b/java/com/android/dialer/app/calllog/MissedCallNotifier.java index eb7fab8fc..8a986dc41 100644 --- a/java/com/android/dialer/app/calllog/MissedCallNotifier.java +++ b/java/com/android/dialer/app/calllog/MissedCallNotifier.java @@ -18,6 +18,7 @@ package com.android.dialer.app.calllog; import android.app.Notification; import android.app.Notification.Builder; import android.app.PendingIntent; +import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; @@ -32,6 +33,9 @@ import android.support.annotation.WorkerThread; import android.support.v4.os.BuildCompat; import android.support.v4.os.UserManagerCompat; import android.support.v4.util.Pair; +import android.telecom.PhoneAccount; +import android.telecom.PhoneAccountHandle; +import android.telecom.TelecomManager; import android.text.BidiFormatter; import android.text.TextDirectionHeuristics; import android.text.TextUtils; @@ -57,6 +61,7 @@ import com.android.dialer.phonenumbercache.ContactInfo; import com.android.dialer.phonenumberutil.PhoneNumberHelper; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.IntentUtil; +import java.util.Iterator; import java.util.List; import java.util.Set; @@ -113,6 +118,8 @@ public class MissedCallNotifier implements Worker<Pair<Integer, String>, Void> { List<NewCall> newCalls = callLogNotificationsQueryHelper.getNewMissedCalls(); + removeSelfManagedCalls(newCalls); + if ((newCalls != null && newCalls.isEmpty()) || count == 0) { // No calls to notify about: clear the notification. CallLogNotificationsQueryHelper.markAllMissedCallsInCallLogAsRead(context); @@ -236,6 +243,39 @@ public class MissedCallNotifier implements Worker<Pair<Integer, String>, Void> { } } + /** + * Remove self-managed calls from {@code newCalls}. If a {@link PhoneAccount} declared it is + * {@link PhoneAccount#CAPABILITY_SELF_MANAGED}, it should handle the in call UI and notifications + * itself, but might still write to call log with {@link + * PhoneAccount#EXTRA_LOG_SELF_MANAGED_CALLS}. + */ + private void removeSelfManagedCalls(@Nullable List<NewCall> newCalls) { + if (newCalls == null) { + return; + } + TelecomManager telecomManager = context.getSystemService(TelecomManager.class); + Iterator<NewCall> iterator = newCalls.iterator(); + while (iterator.hasNext()) { + NewCall call = iterator.next(); + if (call.accountComponentName == null || call.accountId == null) { + continue; + } + PhoneAccountHandle phoneAccountHandle = + new PhoneAccountHandle( + ComponentName.unflattenFromString(call.accountComponentName), call.accountId); + PhoneAccount phoneAccount = telecomManager.getPhoneAccount(phoneAccountHandle); + if (phoneAccount == null) { + continue; + } + if (phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_SELF_MANAGED)) { + LogUtil.i( + "MissedCallNotifier.removeSelfManagedCalls", + "ignoring self-managed call " + call.callsUri); + iterator.remove(); + } + } + } + public static void cancelAllMissedCallNotifications(@NonNull Context context) { NotificationManagerUtils.cancelAllInGroup(context, GROUP_KEY); } diff --git a/java/com/android/dialer/app/res/values/strings.xml b/java/com/android/dialer/app/res/values/strings.xml index 841eb9c9b..485bd8994 100644 --- a/java/com/android/dialer/app/res/values/strings.xml +++ b/java/com/android/dialer/app/res/values/strings.xml @@ -652,7 +652,7 @@ <string name="voicemail_transcription_branding_text">Transcribed by Google</string> <!-- Label indicating that a voicemail transcription is in progress [CHAR LIMIT=64] --> - <string name="voicemail_transcription_in_progress">Google is transcribing…</string> + <string name="voicemail_transcription_in_progress">Transcribing…</string> <!-- Label indicating that a voicemail transcription failed [CHAR LIMIT=64] --> <string name="voicemail_transcription_failed">Transcript not available.</string> diff --git a/java/com/android/dialer/searchfragment/nearbyplaces/res/values/strings.xml b/java/com/android/dialer/searchfragment/nearbyplaces/res/values/strings.xml index 31bc31751..7fb38f6b2 100644 --- a/java/com/android/dialer/searchfragment/nearbyplaces/res/values/strings.xml +++ b/java/com/android/dialer/searchfragment/nearbyplaces/res/values/strings.xml @@ -19,11 +19,11 @@ <string name="nearby_places">Nearby places</string> <!-- Shown as a prompt to turn on location permissions and/or enable location to allow nearby places search [CHAR LIMIT=NONE]--> - <string name="search_location_permission">To get contact information for places near you, allow access to your location.</string> + <string name="search_location_permission">To get contact information for places near you, allow access to your location</string> <!-- Text on a button asking the user to grant the location permission --> <string name="nearby_places_allow">Allow</string> <!-- Text on a button which dismisses a prompt asking to grand the location permission --> <string name="nearby_places_dismiss">Dismiss</string> -</resources>
\ No newline at end of file +</resources> |