diff options
author | taiki tsutsumi <taiki.tsutsumi@sony.com> | 2017-03-30 17:28:00 +0900 |
---|---|---|
committer | Mattias Nilsson <mattias.nilsson@sony.com> | 2022-09-17 00:34:24 +0200 |
commit | dfa61a40cc12a5a745172e9aeb49ace8e9005cbf (patch) | |
tree | 348aa07cc1815093f52bd02eb0133471169d5c39 /src/com/android/contacts/vcard | |
parent | bc0c9bf8051511caad1f452eeae3b37817888f19 (diff) | |
download | Contacts-dfa61a40cc12a5a745172e9aeb49ace8e9005cbf.tar.gz |
When importing contacts was interrupted, clear notification.
Clear nortification in Import / Export at the time of application end.
Co-authored-by: Mattias Nilsson <mattias.nilsson@sony.com>
Bug: TBD
Test: Manual
Change-Id: I9617d0a660ac7fc4b7ec9aa37210f44cce7492e1
Diffstat (limited to 'src/com/android/contacts/vcard')
-rw-r--r-- | src/com/android/contacts/vcard/VCardService.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/com/android/contacts/vcard/VCardService.java b/src/com/android/contacts/vcard/VCardService.java index 075d6bbaa..5e647c409 100644 --- a/src/com/android/contacts/vcard/VCardService.java +++ b/src/com/android/contacts/vcard/VCardService.java @@ -16,6 +16,7 @@ package com.android.contacts.vcard; import android.app.Notification; +import android.app.NotificationManager; import android.app.Service; import android.content.Intent; import android.media.MediaScannerConnection; @@ -129,6 +130,10 @@ public class VCardService extends Service { VCardCommonArguments.ARG_CALLING_ACTIVITY); } else { mCallingActivity = null; + // The intent will be null if the service is restarted after the app + // is killed but the notification may still exist so remove it. + NotificationManager nm = getSystemService(NotificationManager.class); + nm.cancelAll(); } return START_STICKY; } @@ -255,6 +260,9 @@ public class VCardService extends Service { } } } else { + // In case notification of import is still present and app is killed remove it + NotificationManager nm = getSystemService(NotificationManager.class); + nm.cancel(NotificationImportExportListener.DEFAULT_NOTIFICATION_TAG, jobId); Log.w(LOG_TAG, String.format("Tried to remove unknown job (id: %d)", jobId)); } stopServiceIfAppropriate(); |