Add update notification

This commit is contained in:
topjohnwu
2017-02-17 08:51:51 +08:00
parent b58c7ba7c5
commit d99252f394
16 changed files with 222 additions and 107 deletions
@@ -1,17 +1,10 @@
package com.topjohnwu.magisk.receivers;
import android.app.IntentService;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
import com.topjohnwu.magisk.MagiskManager;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.utils.Shell;
import com.topjohnwu.magisk.utils.Utils;
import java.util.List;
import com.topjohnwu.magisk.services.BootupIntentService;
public class BootReceiver extends BroadcastReceiver {
@@ -20,25 +13,4 @@ public class BootReceiver extends BroadcastReceiver {
context.startService(new Intent(context, BootupIntentService.class));
}
public static class BootupIntentService extends IntentService {
public BootupIntentService() {
super("BootupIntentService");
}
@Override
protected void onHandleIntent(Intent intent) {
MagiskManager magiskManager = Utils.getMagiskManager(this);
magiskManager.initSuAccess();
magiskManager.updateMagiskInfo();
List<String> ret = Shell.sh("getprop persist.magisk.hide");
boolean started = Utils.isValidShellResponse(ret) && Integer.parseInt(ret.get(0)) != 0;
if (magiskManager.prefs.getBoolean("magiskhide", false) &&
!magiskManager.disabled && !started && magiskManager.magiskVersion > 11) {
magiskManager.toast(R.string.start_magiskhide, Toast.LENGTH_LONG);
Shell.su(true, MagiskManager.MAGISK_HIDE_PATH + "enable",
"setprop persist.magisk.hide 1");
}
}
}
}