Do not check update twice

This commit is contained in:
topjohnwu 2019-02-02 02:27:15 -05:00
parent bb7560e441
commit 70eba568af
2 changed files with 5 additions and 4 deletions

View File

@ -28,7 +28,7 @@ public class SplashActivity extends BaseActivity {
String pkg = Config.get(Config.Key.SU_MANAGER);
if (pkg != null && getPackageName().equals(BuildConfig.APPLICATION_ID)) {
Config.remove(Config.Key.SU_MANAGER);
Shell.su("pm uninstall " + pkg).exec();
Shell.su("pm uninstall " + pkg).submit();
}
if (TextUtils.equals(pkg, getPackageName())) {
try {
@ -57,8 +57,6 @@ public class SplashActivity extends BaseActivity {
Shortcuts.setup(this);
if (Networking.checkNetworkStatus(this)) {
// Fire update check
CheckUpdates.check();
// Repo update check
new UpdateRepos().exec();
}

View File

@ -10,6 +10,7 @@ import com.topjohnwu.magisk.Config;
import com.topjohnwu.magisk.Const;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.components.UpdateCheckService;
import com.topjohnwu.magisk.tasks.CheckUpdates;
import java.util.concurrent.TimeUnit;
@ -30,10 +31,12 @@ public class AppUtils {
.Builder(ClassMap.get(UpdateCheckService.class), 12, TimeUnit.HOURS)
.setConstraints(constraints)
.build();
WorkManager.getInstance().enqueueUniquePeriodicWork(Const.ID.CHECK_MAGISK_UPDATE_WORKER_ID,
WorkManager.getInstance().enqueueUniquePeriodicWork(
Const.ID.CHECK_MAGISK_UPDATE_WORKER_ID,
ExistingPeriodicWorkPolicy.REPLACE, request);
} else {
WorkManager.getInstance().cancelUniqueWork(Const.ID.CHECK_MAGISK_UPDATE_WORKER_ID);
CheckUpdates.check();
}
}