mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-01 05:55:26 +00:00
Minor cleanup in check updates
This commit is contained in:
parent
3550d1e61c
commit
240d14779a
@ -117,7 +117,6 @@ public class MagiskManager extends Application {
|
|||||||
shellLogging = false;
|
shellLogging = false;
|
||||||
}
|
}
|
||||||
magiskHide = prefs.getBoolean("magiskhide", true);
|
magiskHide = prefs.getBoolean("magiskhide", true);
|
||||||
updateNotification = prefs.getBoolean("notification", true);
|
|
||||||
initSU();
|
initSU();
|
||||||
updateMagiskInfo();
|
updateMagiskInfo();
|
||||||
updateBlockInfo();
|
updateBlockInfo();
|
||||||
@ -183,6 +182,7 @@ public class MagiskManager extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateMagiskInfo() {
|
public void updateMagiskInfo() {
|
||||||
|
updateNotification = prefs.getBoolean("notification", true);
|
||||||
List<String> ret;
|
List<String> ret;
|
||||||
ret = shell.sh("magisk -v");
|
ret = shell.sh("magisk -v");
|
||||||
if (!Utils.isValidShellResponse(ret)) {
|
if (!Utils.isValidShellResponse(ret)) {
|
||||||
|
@ -54,7 +54,7 @@ public class LoadRepos extends ParallelTask<Void, Void, Void> {
|
|||||||
repoDB.clearRepo();
|
repoDB.clearRepo();
|
||||||
}
|
}
|
||||||
etags = new ArrayList<>(
|
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 {
|
private void loadJSON(String jsonString) throws Exception {
|
||||||
|
@ -42,9 +42,9 @@ public class ProcessRepoZip extends ParallelTask<Void, Void, Boolean> {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
// Create temp file
|
// Create temp file
|
||||||
File temp1 = new File(magiskManager.getCacheDir(), "1.zip");
|
File temp1 = new File(activity.getCacheDir(), "1.zip");
|
||||||
File temp2 = new File(magiskManager.getCacheDir(), "2.zip");
|
File temp2 = new File(activity.getCacheDir(), "2.zip");
|
||||||
magiskManager.getCacheDir().mkdirs();
|
activity.getCacheDir().mkdirs();
|
||||||
temp1.createNewFile();
|
temp1.createNewFile();
|
||||||
temp2.createNewFile();
|
temp2.createNewFile();
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ public class ProcessRepoZip extends ParallelTask<Void, Void, Boolean> {
|
|||||||
progressDialog.dismiss();
|
progressDialog.dismiss();
|
||||||
if (result) {
|
if (result) {
|
||||||
if (Shell.rootAccess() && mInstall) {
|
if (Shell.rootAccess() && mInstall) {
|
||||||
magiskManager.startActivity(new Intent(magiskManager, FlashActivity.class).setData(mUri));
|
activity.startActivity(new Intent(activity, FlashActivity.class).setData(mUri));
|
||||||
} else {
|
} else {
|
||||||
Utils.showUriSnack(activity, mUri);
|
Utils.showUriSnack(activity, mUri);
|
||||||
}
|
}
|
||||||
|
@ -4,24 +4,15 @@ import android.app.job.JobParameters;
|
|||||||
import android.app.job.JobService;
|
import android.app.job.JobService;
|
||||||
|
|
||||||
import com.topjohnwu.magisk.asyncs.CheckUpdates;
|
import com.topjohnwu.magisk.asyncs.CheckUpdates;
|
||||||
|
import com.topjohnwu.magisk.utils.Utils;
|
||||||
|
|
||||||
public class UpdateCheckService extends JobService {
|
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
|
@Override
|
||||||
protected void onPostExecute(Void v) {
|
public boolean onStartJob(JobParameters params) {
|
||||||
jobFinished(params, false);
|
Utils.getMagiskManager(this).updateMagiskInfo();
|
||||||
super.onPostExecute(v);
|
new CheckUpdates(this, true)
|
||||||
}
|
.setCallBack(() -> jobFinished(params, false)).exec();
|
||||||
}.exec();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user