From 96aea2a8f42bfc55dd2b08c51698efb0d0559109 Mon Sep 17 00:00:00 2001 From: twyen Date: Wed, 27 Sep 2017 17:11:33 -0700 Subject: Use goAsync() and dialer executor to insert post call notifications Previously post call notifications are inserted by launching CallLogNotificationService. This usually works because the call has just broght dialer to the foreground and there are some grace period before the app is consider background again. However if the post call message comes later background check will crash the app. This CL made the broadcast receiver async and complete the insertion in a worker since it wouldn't take more than a few seconds. Bug: 66444859 Test: unit tests PiperOrigin-RevId: 170275928 Change-Id: I0ff396b51a173f2e4bab0bca6b6e5c5b56ab62da --- .../app/calllog/CallLogNotificationsService.java | 33 +--------------------- 1 file changed, 1 insertion(+), 32 deletions(-) (limited to 'java/com/android/dialer/app/calllog/CallLogNotificationsService.java') diff --git a/java/com/android/dialer/app/calllog/CallLogNotificationsService.java b/java/com/android/dialer/app/calllog/CallLogNotificationsService.java index 0490b9932..5949141f1 100644 --- a/java/com/android/dialer/app/calllog/CallLogNotificationsService.java +++ b/java/com/android/dialer/app/calllog/CallLogNotificationsService.java @@ -64,9 +64,6 @@ public class CallLogNotificationsService extends IntentService { private static final String ACTION_CANCEL_SINGLE_MISSED_CALL = "com.android.dialer.calllog.ACTION_CANCEL_SINGLE_MISSED_CALL"; - private static final String ACTION_INCOMING_POST_CALL = - "com.android.dialer.calllog.INCOMING_POST_CALL"; - /** Action to call back a missed call. */ public static final String ACTION_CALL_BACK_FROM_MISSED_CALL_NOTIFICATION = "com.android.dialer.calllog.CALL_BACK_FROM_MISSED_CALL_NOTIFICATION"; @@ -75,21 +72,6 @@ public class CallLogNotificationsService extends IntentService { public static final String ACTION_LEGACY_VOICEMAIL_DISMISSED = "com.android.dialer.calllog.ACTION_LEGACY_VOICEMAIL_DISMISSED"; - /** - * Extra to be included with {@link #ACTION_INCOMING_POST_CALL} to represent a post call note. - * - *

It must be a {@link String} - */ - private static final String EXTRA_POST_CALL_NOTE = "POST_CALL_NOTE"; - - /** - * Extra to be included with {@link #ACTION_INCOMING_POST_CALL} to represent the phone number the - * post call note came from. - * - *

It must be a {@link String} - */ - private static final String EXTRA_POST_CALL_NUMBER = "POST_CALL_NUMBER"; - private static final String EXTRA_PHONE_ACCOUNT_HANDLE = "PHONE_ACCOUNT_HANDLE"; public static final int UNKNOWN_MISSED_CALL_COUNT = -1; @@ -98,14 +80,6 @@ public class CallLogNotificationsService extends IntentService { super("CallLogNotificationsService"); } - public static void insertPostCallNote(Context context, String number, String postCallNote) { - Intent serviceIntent = new Intent(context, CallLogNotificationsService.class); - serviceIntent.setAction(ACTION_INCOMING_POST_CALL); - serviceIntent.putExtra(EXTRA_POST_CALL_NUMBER, number); - serviceIntent.putExtra(EXTRA_POST_CALL_NOTE, postCallNote); - context.startService(serviceIntent); - } - public static void markAllNewVoicemailsAsOld(Context context) { LogUtil.enterBlock("CallLogNotificationsService.markAllNewVoicemailsAsOld"); Intent serviceIntent = new Intent(context, CallLogNotificationsService.class); @@ -195,11 +169,6 @@ public class CallLogNotificationsService extends IntentService { LegacyVoicemailNotificationReceiver.setDismissed( this, intent.getParcelableExtra(EXTRA_PHONE_ACCOUNT_HANDLE), true); break; - case ACTION_INCOMING_POST_CALL: - String note = intent.getStringExtra(EXTRA_POST_CALL_NOTE); - String phoneNumber = intent.getStringExtra(EXTRA_POST_CALL_NUMBER); - MissedCallNotifier.getIstance(this).insertPostCallNotification(phoneNumber, note); - break; case ACTION_CANCEL_ALL_MISSED_CALLS: cancelAllMissedCalls(this); break; @@ -210,7 +179,7 @@ public class CallLogNotificationsService extends IntentService { TelecomUtil.cancelMissedCallsNotification(this); break; case ACTION_CALL_BACK_FROM_MISSED_CALL_NOTIFICATION: - MissedCallNotifier.getIstance(this) + MissedCallNotifier.getInstance(this) .callBackFromMissedCall( intent.getStringExtra( MissedCallNotificationReceiver.EXTRA_NOTIFICATION_PHONE_NUMBER), -- cgit v1.2.3