Optimize root shell and startups

This commit is contained in:
topjohnwu
2017-02-05 22:02:14 +08:00
parent 0886dca385
commit b3b2149ebb
6 changed files with 85 additions and 97 deletions
@@ -12,24 +12,15 @@ import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.utils.Async;
public class BootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
new Async.RootTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
Global.initSuAccess();
Global.updateMagiskInfo();
return null;
}
@Override
protected void onPostExecute(Void v) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
if (prefs.getBoolean("magiskhide", false) && !Global.Info.disabled && Global.Info.magiskVersion >= 11) {
Toast.makeText(context, R.string.start_magiskhide, Toast.LENGTH_SHORT).show();
new Async.MagiskHide().enable();
}
}
}.exec();
Global.initSuAccess();
Global.updateMagiskInfo();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
if (prefs.getBoolean("magiskhide", false) && !Global.Info.disabled && Global.Info.magiskVersion > 10.3) {
Toast.makeText(context, R.string.start_magiskhide, Toast.LENGTH_SHORT).show();
new Async.MagiskHide(true).enable();
}
}
}