summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2022-09-18 09:45:29 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2022-09-18 09:45:29 +0000
commitc32f5d527008d969ea92b0280eef1a593d36265d (patch)
tree85657317c9f0d31855548273861627aaf2d608da /src
parent548f5cebb6c97ff2506e11297a789b6d753c9800 (diff)
parentdfa61a40cc12a5a745172e9aeb49ace8e9005cbf (diff)
downloadContacts-c32f5d527008d969ea92b0280eef1a593d36265d.tar.gz
Merge "When importing contacts was interrupted, clear notification."
Diffstat (limited to 'src')
-rw-r--r--src/com/android/contacts/vcard/VCardService.java8
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();