From 2ca4318cc1ee57dda907ba2069bd61d162b1baef Mon Sep 17 00:00:00 2001 From: Eric Erfanian Date: Thu, 31 Aug 2017 06:57:16 -0700 Subject: Update Dialer source to latest internal Google revision. Previously, Android's Dialer app was developed in an internal Google source control system and only exported to public during AOSP drops. The Dialer team is now switching to a public development model similar to the telephony team. This CL represents all internal Google changes that were committed to Dialer between the public O release and today's tip of tree on internal master. This CL squashes those changes into a single commit. In subsequent changes, changes will be exported on a per-commit basis. Test: make, flash install, run Merged-In: I45270eaa8ce732d71a1bd84b08c7fa0e99af3160 Change-Id: I529aaeb88535b9533c0ae4ef4e6c1222d4e0f1c8 PiperOrigin-RevId: 167068436 --- java/com/android/incallui/spam/SpamNotificationService.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'java/com/android/incallui/spam/SpamNotificationService.java') diff --git a/java/com/android/incallui/spam/SpamNotificationService.java b/java/com/android/incallui/spam/SpamNotificationService.java index 7888fc84e..91377db83 100644 --- a/java/com/android/incallui/spam/SpamNotificationService.java +++ b/java/com/android/incallui/spam/SpamNotificationService.java @@ -16,7 +16,6 @@ package com.android.incallui.spam; -import android.app.NotificationManager; import android.app.Service; import android.content.Context; import android.content.Intent; @@ -30,6 +29,7 @@ import com.android.dialer.logging.ContactLookupResult; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.logging.ReportingLocation; +import com.android.dialer.notification.DialerNotificationManager; import com.android.dialer.spam.Spam; import com.android.incallui.call.DialerCall; @@ -47,19 +47,22 @@ public class SpamNotificationService extends Service { private static final String EXTRA_PHONE_NUMBER = "service_phone_number"; private static final String EXTRA_CALL_ID = "service_call_id"; private static final String EXTRA_CALL_START_TIME_MILLIS = "service_call_start_time_millis"; + private static final String EXTRA_NOTIFICATION_TAG = "service_notification_tag"; private static final String EXTRA_NOTIFICATION_ID = "service_notification_id"; private static final String EXTRA_CONTACT_LOOKUP_RESULT_TYPE = "service_contact_lookup_result_type"; /** Creates an intent to start this service. */ public static Intent createServiceIntent( - Context context, DialerCall call, String action, int notificationId) { + Context context, DialerCall call, String action, String notificationTag, int notificationId) { Intent intent = new Intent(context, SpamNotificationService.class); intent.setAction(action); intent.putExtra(EXTRA_PHONE_NUMBER, call.getNumber()); intent.putExtra(EXTRA_CALL_ID, call.getUniqueCallId()); intent.putExtra(EXTRA_CALL_START_TIME_MILLIS, call.getTimeAddedMs()); + intent.putExtra(EXTRA_NOTIFICATION_TAG, notificationTag); intent.putExtra(EXTRA_NOTIFICATION_ID, notificationId); - intent.putExtra(EXTRA_CONTACT_LOOKUP_RESULT_TYPE, call.getLogState().contactLookupResult); + intent.putExtra( + EXTRA_CONTACT_LOOKUP_RESULT_TYPE, call.getLogState().contactLookupResult.getNumber()); return intent; } @@ -80,13 +83,13 @@ public class SpamNotificationService extends Service { return START_NOT_STICKY; } String number = intent.getStringExtra(EXTRA_PHONE_NUMBER); + String notificationTag = intent.getStringExtra(EXTRA_NOTIFICATION_TAG); int notificationId = intent.getIntExtra(EXTRA_NOTIFICATION_ID, 1); String countryIso = GeoUtil.getCurrentCountryIso(this); ContactLookupResult.Type contactLookupResultType = ContactLookupResult.Type.forNumber(intent.getIntExtra(EXTRA_CONTACT_LOOKUP_RESULT_TYPE, 0)); - ((NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE)) - .cancel(number, notificationId); + DialerNotificationManager.cancel(this, notificationTag, notificationId); switch (intent.getAction()) { case SpamNotificationActivity.ACTION_MARK_NUMBER_AS_SPAM: -- cgit v1.2.3