Loading app/src/main/java/org/lineageos/updater/UpdatesActivity.java +4 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,10 @@ public class UpdatesActivity extends UpdatesListActivity implements UpdateImport super.onCreate(savedInstanceState); setContentView(R.layout.activity_updates); if (UpdaterService.isDeviceRebooted()) { Utils.removeInstalledUpdate(this); } mUpdateImporter = new UpdateImporter(this, this); UiModeManager uiModeManager = getSystemService(UiModeManager.class); Loading app/src/main/java/org/lineageos/updater/controller/UpdaterService.java +7 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,8 @@ public class UpdaterService extends Service { private static ConnectivityManager.NetworkCallback mConnectionStateMonitor; private static ConnectivityManager mConnectivityManager; private static boolean mDeviceRebooted = true; @Override public void onCreate() { super.onCreate(); Loading Loading @@ -267,6 +269,10 @@ public class UpdaterService extends Service { return mUpdaterController; } public static boolean isDeviceRebooted() { return mDeviceRebooted; } private void tryStopSelf() { if (isNetworkCallBackActive || areNotificationsActive()) return; if (!mHasClients && !mUpdaterController.hasActiveDownloads() && Loading @@ -287,6 +293,7 @@ public class UpdaterService extends Service { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences.Editor editor = pref.edit(); mNotificationBuilder.setPriority(NotificationCompat.PRIORITY_DEFAULT); mDeviceRebooted = false; switch (update.getStatus()) { case DELETED: { notifySystemUpdaterService(STATUS_WAITING_DOWNLOAD, update); Loading app/src/main/java/org/lineageos/updater/misc/Utils.java +5 −3 Original line number Diff line number Diff line Loading @@ -488,9 +488,11 @@ public class Utils { public static void removeInstalledUpdate(Context context) { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); String downloadId = pref.getString(Constants.PREF_NEEDS_DELETE_ID, null); if (downloadId != null) { UpdaterController controller = UpdaterController.getInstance(context); if (controller != null && downloadId != null) { if (controller != null) { controller.deleteUpdate(downloadId); } pref.edit().remove(Constants.PREF_NEEDS_DELETE_ID).apply(); } } Loading Loading
app/src/main/java/org/lineageos/updater/UpdatesActivity.java +4 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,10 @@ public class UpdatesActivity extends UpdatesListActivity implements UpdateImport super.onCreate(savedInstanceState); setContentView(R.layout.activity_updates); if (UpdaterService.isDeviceRebooted()) { Utils.removeInstalledUpdate(this); } mUpdateImporter = new UpdateImporter(this, this); UiModeManager uiModeManager = getSystemService(UiModeManager.class); Loading
app/src/main/java/org/lineageos/updater/controller/UpdaterService.java +7 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,8 @@ public class UpdaterService extends Service { private static ConnectivityManager.NetworkCallback mConnectionStateMonitor; private static ConnectivityManager mConnectivityManager; private static boolean mDeviceRebooted = true; @Override public void onCreate() { super.onCreate(); Loading Loading @@ -267,6 +269,10 @@ public class UpdaterService extends Service { return mUpdaterController; } public static boolean isDeviceRebooted() { return mDeviceRebooted; } private void tryStopSelf() { if (isNetworkCallBackActive || areNotificationsActive()) return; if (!mHasClients && !mUpdaterController.hasActiveDownloads() && Loading @@ -287,6 +293,7 @@ public class UpdaterService extends Service { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences.Editor editor = pref.edit(); mNotificationBuilder.setPriority(NotificationCompat.PRIORITY_DEFAULT); mDeviceRebooted = false; switch (update.getStatus()) { case DELETED: { notifySystemUpdaterService(STATUS_WAITING_DOWNLOAD, update); Loading
app/src/main/java/org/lineageos/updater/misc/Utils.java +5 −3 Original line number Diff line number Diff line Loading @@ -488,9 +488,11 @@ public class Utils { public static void removeInstalledUpdate(Context context) { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); String downloadId = pref.getString(Constants.PREF_NEEDS_DELETE_ID, null); if (downloadId != null) { UpdaterController controller = UpdaterController.getInstance(context); if (controller != null && downloadId != null) { if (controller != null) { controller.deleteUpdate(downloadId); } pref.edit().remove(Constants.PREF_NEEDS_DELETE_ID).apply(); } } Loading