diff options
author | Eric Erfanian <erfanian@google.com> | 2017-05-16 00:09:31 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-05-16 00:09:31 +0000 |
commit | c57430a61eab62e88372f386c75989dab6332608 (patch) | |
tree | b606f1899f80fcd0ea3ee753ce799883d5a673ab /java/com/android/dialer/app/calllog/MissedCallNotifier.java | |
parent | 9842b4a7fd1d852b1353af806da4913b4298d516 (diff) | |
parent | 0c9dbf507b53a12bdf577ff3e55c1686a2e089de (diff) |
Merge "Update Dialer to v10 RC32" into oc-dev
am: 0c9dbf507b
Change-Id: I5f90090090c6e430d83fcdd294082c1f5237ade8
Diffstat (limited to 'java/com/android/dialer/app/calllog/MissedCallNotifier.java')
-rw-r--r-- | java/com/android/dialer/app/calllog/MissedCallNotifier.java | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/java/com/android/dialer/app/calllog/MissedCallNotifier.java b/java/com/android/dialer/app/calllog/MissedCallNotifier.java index de07bb437..dd13298bc 100644 --- a/java/com/android/dialer/app/calllog/MissedCallNotifier.java +++ b/java/com/android/dialer/app/calllog/MissedCallNotifier.java @@ -31,6 +31,7 @@ import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; import android.support.annotation.WorkerThread; import android.support.v4.os.UserManagerCompat; +import android.support.v4.util.Pair; import android.text.BidiFormatter; import android.text.TextDirectionHeuristics; import android.text.TextUtils; @@ -44,6 +45,7 @@ import com.android.dialer.app.list.DialtactsPagerAdapter; import com.android.dialer.callintent.CallInitiationType; import com.android.dialer.callintent.CallIntentBuilder; import com.android.dialer.common.LogUtil; +import com.android.dialer.common.concurrent.DialerExecutor.Worker; import com.android.dialer.notification.NotificationChannelManager; import com.android.dialer.notification.NotificationChannelManager.Channel; import com.android.dialer.phonenumbercache.ContactInfo; @@ -55,7 +57,7 @@ import java.util.List; import java.util.Set; /** Creates a notification for calls that the user missed (neither answered nor rejected). */ -public class MissedCallNotifier { +public class MissedCallNotifier implements Worker<Pair<Integer, String>, Void> { /** The tag used to identify notifications from this class. */ static final String NOTIFICATION_TAG = "MissedCallNotifier"; @@ -72,11 +74,15 @@ public class MissedCallNotifier { this.callLogNotificationsQueryHelper = callLogNotificationsQueryHelper; } - /** Returns an instance of {@link MissedCallNotifier}. */ - public static MissedCallNotifier getInstance(Context context) { - CallLogNotificationsQueryHelper callLogNotificationsQueryHelper = - CallLogNotificationsQueryHelper.getInstance(context); - return new MissedCallNotifier(context, callLogNotificationsQueryHelper); + static MissedCallNotifier getIstance(Context context) { + return new MissedCallNotifier(context, CallLogNotificationsQueryHelper.getInstance(context)); + } + + @Nullable + @Override + public Void doInBackground(@Nullable Pair<Integer, String> input) throws Throwable { + updateMissedCallNotification(input.first, input.second); + return null; } /** @@ -88,8 +94,9 @@ public class MissedCallNotifier { * @param number the phone number of the most recent call to display if the call log cannot be * accessed. May be null if unknown. */ + @VisibleForTesting @WorkerThread - public void updateMissedCallNotification(int count, @Nullable String number) { + void updateMissedCallNotification(int count, @Nullable String number) { final int titleResId; CharSequence expandedText; // The text in the notification's line 1 and 2. @@ -375,7 +382,7 @@ public class MissedCallNotifier { private PendingIntent createCallBackPendingIntent(String number, @NonNull Uri callUri) { Intent intent = new Intent(context, CallLogNotificationsService.class); intent.setAction(CallLogNotificationsService.ACTION_CALL_BACK_FROM_MISSED_CALL_NOTIFICATION); - intent.putExtra(CallLogNotificationsService.EXTRA_MISSED_CALL_NUMBER, number); + intent.putExtra(MissedCallNotificationReceiver.EXTRA_NOTIFICATION_PHONE_NUMBER, number); intent.setData(callUri); // Use FLAG_UPDATE_CURRENT to make sure any previous pending intent is updated with the new // extra. |