mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-24 19:17:38 +00:00
Do not check update twice
This commit is contained in:
parent
bb7560e441
commit
70eba568af
@ -28,7 +28,7 @@ public class SplashActivity extends BaseActivity {
|
|||||||
String pkg = Config.get(Config.Key.SU_MANAGER);
|
String pkg = Config.get(Config.Key.SU_MANAGER);
|
||||||
if (pkg != null && getPackageName().equals(BuildConfig.APPLICATION_ID)) {
|
if (pkg != null && getPackageName().equals(BuildConfig.APPLICATION_ID)) {
|
||||||
Config.remove(Config.Key.SU_MANAGER);
|
Config.remove(Config.Key.SU_MANAGER);
|
||||||
Shell.su("pm uninstall " + pkg).exec();
|
Shell.su("pm uninstall " + pkg).submit();
|
||||||
}
|
}
|
||||||
if (TextUtils.equals(pkg, getPackageName())) {
|
if (TextUtils.equals(pkg, getPackageName())) {
|
||||||
try {
|
try {
|
||||||
@ -57,8 +57,6 @@ public class SplashActivity extends BaseActivity {
|
|||||||
Shortcuts.setup(this);
|
Shortcuts.setup(this);
|
||||||
|
|
||||||
if (Networking.checkNetworkStatus(this)) {
|
if (Networking.checkNetworkStatus(this)) {
|
||||||
// Fire update check
|
|
||||||
CheckUpdates.check();
|
|
||||||
// Repo update check
|
// Repo update check
|
||||||
new UpdateRepos().exec();
|
new UpdateRepos().exec();
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import com.topjohnwu.magisk.Config;
|
|||||||
import com.topjohnwu.magisk.Const;
|
import com.topjohnwu.magisk.Const;
|
||||||
import com.topjohnwu.magisk.R;
|
import com.topjohnwu.magisk.R;
|
||||||
import com.topjohnwu.magisk.components.UpdateCheckService;
|
import com.topjohnwu.magisk.components.UpdateCheckService;
|
||||||
|
import com.topjohnwu.magisk.tasks.CheckUpdates;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@ -30,10 +31,12 @@ public class AppUtils {
|
|||||||
.Builder(ClassMap.get(UpdateCheckService.class), 12, TimeUnit.HOURS)
|
.Builder(ClassMap.get(UpdateCheckService.class), 12, TimeUnit.HOURS)
|
||||||
.setConstraints(constraints)
|
.setConstraints(constraints)
|
||||||
.build();
|
.build();
|
||||||
WorkManager.getInstance().enqueueUniquePeriodicWork(Const.ID.CHECK_MAGISK_UPDATE_WORKER_ID,
|
WorkManager.getInstance().enqueueUniquePeriodicWork(
|
||||||
|
Const.ID.CHECK_MAGISK_UPDATE_WORKER_ID,
|
||||||
ExistingPeriodicWorkPolicy.REPLACE, request);
|
ExistingPeriodicWorkPolicy.REPLACE, request);
|
||||||
} else {
|
} else {
|
||||||
WorkManager.getInstance().cancelUniqueWork(Const.ID.CHECK_MAGISK_UPDATE_WORKER_ID);
|
WorkManager.getInstance().cancelUniqueWork(Const.ID.CHECK_MAGISK_UPDATE_WORKER_ID);
|
||||||
|
CheckUpdates.check();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user