Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 156fc9f6 authored by Wenyi Wang's avatar Wenyi Wang
Browse files

Create channel if channel is not available

Bug: 36530928

Test: follow steps to repro in http://b/36530928#comment2
      and make sure no crash is seen when importing from SIM or Vcard.
      Also hard code to stop listening for ACTION_BOOT_COMPLETED and
      make sure channel is created before setting channel;

Change-Id: Ib061e299082670c24a0e248da5a61285cd944ea6
parent 1aa5775c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -153,6 +153,7 @@ public class SimImportService extends Service {

    @Override
    public int onStartCommand(Intent intent, int flags, final int startId) {
        ContactsNotificationChannelsUtil.createDefaultChannel(this);
        final ImportTask task = createTaskForIntent(intent, startId);
        if (task == null) {
            new StopTask(this, startId).executeOnExecutor(mExecutor);
+4 −0
Original line number Diff line number Diff line
@@ -220,6 +220,7 @@ public class NotificationImportExportListener implements VCardImportExportListen
                .appendQueryParameter(CancelActivity.TYPE, String.valueOf(type)).build();
        intent.setData(uri);

        ContactsNotificationChannelsUtil.createDefaultChannel(context);
        final NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
        builder.setOngoing(true)
                .setChannel(ContactsNotificationChannelsUtil.DEFAULT_CHANNEL)
@@ -247,6 +248,7 @@ public class NotificationImportExportListener implements VCardImportExportListen
     */
    /* package */ static Notification constructCancelNotification(
            Context context, String description) {
        ContactsNotificationChannelsUtil.createDefaultChannel(context);
        return new NotificationCompat.Builder(context)
                .setChannel(ContactsNotificationChannelsUtil.DEFAULT_CHANNEL)
                .setAutoCancel(true)
@@ -278,6 +280,7 @@ public class NotificationImportExportListener implements VCardImportExportListen
     */
    /* package */ static Notification constructFinishNotificationWithFlags(
            Context context, String title, String description, Intent intent, int flags) {
        ContactsNotificationChannelsUtil.createDefaultChannel(context);
        return new NotificationCompat.Builder(context)
                .setChannel(ContactsNotificationChannelsUtil.DEFAULT_CHANNEL)
                .setAutoCancel(true)
@@ -302,6 +305,7 @@ public class NotificationImportExportListener implements VCardImportExportListen
     */
    /* package */ static Notification constructImportFailureNotification(
            Context context, String reason) {
        ContactsNotificationChannelsUtil.createDefaultChannel(context);
        return new NotificationCompat.Builder(context)
                .setChannel(ContactsNotificationChannelsUtil.DEFAULT_CHANNEL)
                .setAutoCancel(true)