36 lines
1.2 KiB
Java
Raw Normal View History

2017-01-29 16:52:43 +08:00
package com.topjohnwu.magisk.receivers;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
2017-02-01 23:54:32 +08:00
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.widget.Toast;
2017-01-29 16:52:43 +08:00
import com.topjohnwu.magisk.Global;
2017-02-01 23:54:32 +08:00
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.utils.Async;
2017-01-29 16:52:43 +08:00
public class BootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
2017-02-05 04:40:52 +08:00
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();
2017-01-29 16:52:43 +08:00
}
}