Updater: Delete updates only after refreshing the notification
* Looks like we first need to process the notification before we can delete an update Change-Id: I49f6c03a109f908e8a7b01f02b821a68ab273af3
This commit is contained in:
@@ -89,13 +89,6 @@ class ABUpdateInstaller {
|
||||
update.setInstallProgress(0);
|
||||
update.setStatus(UpdateStatus.INSTALLED);
|
||||
mUpdaterController.notifyUpdateChange(mDownloadId);
|
||||
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(
|
||||
mContext);
|
||||
boolean deleteUpdate = pref.getBoolean(Constants.PREF_AUTO_DELETE_UPDATES,
|
||||
false);
|
||||
if (deleteUpdate) {
|
||||
mUpdaterController.deleteUpdate(mDownloadId);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@@ -23,6 +23,7 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
@@ -31,11 +32,13 @@ import android.util.Log;
|
||||
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import org.lineageos.updater.R;
|
||||
import org.lineageos.updater.UpdaterReceiver;
|
||||
import org.lineageos.updater.UpdatesActivity;
|
||||
import org.lineageos.updater.misc.BuildInfoUtils;
|
||||
import org.lineageos.updater.misc.Constants;
|
||||
import org.lineageos.updater.misc.StringGenerator;
|
||||
import org.lineageos.updater.misc.Utils;
|
||||
import org.lineageos.updater.model.UpdateInfo;
|
||||
@@ -400,6 +403,13 @@ public class UpdaterService extends Service {
|
||||
mNotificationBuilder.setOngoing(false);
|
||||
mNotificationBuilder.setAutoCancel(true);
|
||||
mNotificationManager.notify(NOTIFICATION_ID, mNotificationBuilder.build());
|
||||
|
||||
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
boolean deleteUpdate = pref.getBoolean(Constants.PREF_AUTO_DELETE_UPDATES, false);
|
||||
if (deleteUpdate) {
|
||||
mUpdaterController.deleteUpdate(update.getDownloadId());
|
||||
}
|
||||
|
||||
tryStopSelf();
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user