diff --git a/app/src/main/java/com/topjohnwu/magisk/MagiskManager.java b/app/src/main/java/com/topjohnwu/magisk/MagiskManager.java index f9fc54b85..c5cbf038c 100644 --- a/app/src/main/java/com/topjohnwu/magisk/MagiskManager.java +++ b/app/src/main/java/com/topjohnwu/magisk/MagiskManager.java @@ -117,7 +117,6 @@ public class MagiskManager extends Application { shellLogging = false; } magiskHide = prefs.getBoolean("magiskhide", true); - updateNotification = prefs.getBoolean("notification", true); initSU(); updateMagiskInfo(); updateBlockInfo(); @@ -183,6 +182,7 @@ public class MagiskManager extends Application { } public void updateMagiskInfo() { + updateNotification = prefs.getBoolean("notification", true); List ret; ret = shell.sh("magisk -v"); if (!Utils.isValidShellResponse(ret)) { diff --git a/app/src/main/java/com/topjohnwu/magisk/asyncs/LoadRepos.java b/app/src/main/java/com/topjohnwu/magisk/asyncs/LoadRepos.java index 27d8b4f81..42cf8bdd9 100644 --- a/app/src/main/java/com/topjohnwu/magisk/asyncs/LoadRepos.java +++ b/app/src/main/java/com/topjohnwu/magisk/asyncs/LoadRepos.java @@ -54,7 +54,7 @@ public class LoadRepos extends ParallelTask { repoDB.clearRepo(); } etags = new ArrayList<>( - Arrays.asList(magiskManager.prefs.getString(ETAG_KEY, "").split(","))); + Arrays.asList(prefs.getString(ETAG_KEY, "").split(","))); } private void loadJSON(String jsonString) throws Exception { diff --git a/app/src/main/java/com/topjohnwu/magisk/asyncs/ProcessRepoZip.java b/app/src/main/java/com/topjohnwu/magisk/asyncs/ProcessRepoZip.java index e60124220..e99467027 100644 --- a/app/src/main/java/com/topjohnwu/magisk/asyncs/ProcessRepoZip.java +++ b/app/src/main/java/com/topjohnwu/magisk/asyncs/ProcessRepoZip.java @@ -42,9 +42,9 @@ public class ProcessRepoZip extends ParallelTask { try { // Create temp file - File temp1 = new File(magiskManager.getCacheDir(), "1.zip"); - File temp2 = new File(magiskManager.getCacheDir(), "2.zip"); - magiskManager.getCacheDir().mkdirs(); + File temp1 = new File(activity.getCacheDir(), "1.zip"); + File temp2 = new File(activity.getCacheDir(), "2.zip"); + activity.getCacheDir().mkdirs(); temp1.createNewFile(); temp2.createNewFile(); @@ -87,7 +87,7 @@ public class ProcessRepoZip extends ParallelTask { progressDialog.dismiss(); if (result) { if (Shell.rootAccess() && mInstall) { - magiskManager.startActivity(new Intent(magiskManager, FlashActivity.class).setData(mUri)); + activity.startActivity(new Intent(activity, FlashActivity.class).setData(mUri)); } else { Utils.showUriSnack(activity, mUri); } diff --git a/app/src/main/java/com/topjohnwu/magisk/services/UpdateCheckService.java b/app/src/main/java/com/topjohnwu/magisk/services/UpdateCheckService.java index a3a9af478..07bd80a9d 100644 --- a/app/src/main/java/com/topjohnwu/magisk/services/UpdateCheckService.java +++ b/app/src/main/java/com/topjohnwu/magisk/services/UpdateCheckService.java @@ -4,24 +4,15 @@ import android.app.job.JobParameters; import android.app.job.JobService; import com.topjohnwu.magisk.asyncs.CheckUpdates; +import com.topjohnwu.magisk.utils.Utils; public class UpdateCheckService extends JobService { + @Override public boolean onStartJob(JobParameters params) { - new CheckUpdates(this, true){ - @Override - protected Void doInBackground(Void... voids) { - magiskManager.updateMagiskInfo(); - magiskManager.updateNotification = magiskManager.prefs.getBoolean("notification", true); - return super.doInBackground(voids); - } - - @Override - protected void onPostExecute(Void v) { - jobFinished(params, false); - super.onPostExecute(v); - } - }.exec(); + Utils.getMagiskManager(this).updateMagiskInfo(); + new CheckUpdates(this, true) + .setCallBack(() -> jobFinished(params, false)).exec(); return true; }