diff --git a/app/src/main/java/com/topjohnwu/magisk/SplashActivity.java b/app/src/main/java/com/topjohnwu/magisk/SplashActivity.java index e47cf01ee63b..3f4700338ba0 100644 --- a/app/src/main/java/com/topjohnwu/magisk/SplashActivity.java +++ b/app/src/main/java/com/topjohnwu/magisk/SplashActivity.java @@ -9,6 +9,7 @@ import com.topjohnwu.magisk.components.BaseActivity; import com.topjohnwu.magisk.database.RepoDatabaseHelper; +import com.topjohnwu.magisk.tasks.CheckUpdates; import com.topjohnwu.magisk.tasks.UpdateRepos; import com.topjohnwu.magisk.uicomponents.Notifications; import com.topjohnwu.magisk.uicomponents.Shortcuts; @@ -63,6 +64,7 @@ private void initAndStart() { // Schedule periodic update checks Utils.scheduleUpdateCheck(); + CheckUpdates.check(); // Setup shortcuts Shortcuts.setup(this); diff --git a/app/src/main/java/com/topjohnwu/magisk/components/UpdateCheckService.java b/app/src/main/java/com/topjohnwu/magisk/components/UpdateCheckService.java index 4fe184d17e20..d76738f13715 100644 --- a/app/src/main/java/com/topjohnwu/magisk/components/UpdateCheckService.java +++ b/app/src/main/java/com/topjohnwu/magisk/components/UpdateCheckService.java @@ -3,6 +3,7 @@ import androidx.annotation.NonNull; import androidx.work.ListenableWorker; +import com.topjohnwu.magisk.App; import com.topjohnwu.magisk.BuildConfig; import com.topjohnwu.magisk.Config; import com.topjohnwu.magisk.tasks.CheckUpdates; @@ -14,8 +15,10 @@ public class UpdateCheckService extends DelegateWorker { @NonNull @Override public ListenableWorker.Result doWork() { - Shell.getShell(); - CheckUpdates.check(this::onCheckDone); + if (App.self.foreground == null) { + Shell.getShell(); + CheckUpdates.check(this::onCheckDone); + } return ListenableWorker.Result.success(); } diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/Utils.java b/app/src/main/java/com/topjohnwu/magisk/utils/Utils.java index 0705ae4c11b2..d7f18fd60c6c 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/Utils.java +++ b/app/src/main/java/com/topjohnwu/magisk/utils/Utils.java @@ -158,7 +158,6 @@ public static void scheduleUpdateCheck() { ExistingPeriodicWorkPolicy.REPLACE, request); } else { WorkManager.getInstance().cancelUniqueWork(Const.ID.CHECK_MAGISK_UPDATE_WORKER_ID); - CheckUpdates.check(); } }