mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-28 04:25:27 +00:00
Run update check service only in background
This commit is contained in:
parent
fc0df84edd
commit
f187213568
@ -9,6 +9,7 @@ import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
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 @@ public class SplashActivity extends BaseActivity {
|
||||
|
||||
// Schedule periodic update checks
|
||||
Utils.scheduleUpdateCheck();
|
||||
CheckUpdates.check();
|
||||
|
||||
// Setup shortcuts
|
||||
Shortcuts.setup(this);
|
||||
|
@ -3,6 +3,7 @@ package com.topjohnwu.magisk.components;
|
||||
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() {
|
||||
if (App.self.foreground == null) {
|
||||
Shell.getShell();
|
||||
CheckUpdates.check(this::onCheckDone);
|
||||
}
|
||||
return ListenableWorker.Result.success();
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,6 @@ public class Utils {
|
||||
ExistingPeriodicWorkPolicy.REPLACE, request);
|
||||
} else {
|
||||
WorkManager.getInstance().cancelUniqueWork(Const.ID.CHECK_MAGISK_UPDATE_WORKER_ID);
|
||||
CheckUpdates.check();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user