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
|
|
|
|
2017-02-07 02:01:32 +08:00
|
|
|
import com.topjohnwu.magisk.MagiskManager;
|
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 {
|
2017-02-05 22:02:14 +08:00
|
|
|
|
2017-01-29 16:52:43 +08:00
|
|
|
@Override
|
|
|
|
public void onReceive(Context context, Intent intent) {
|
2017-02-07 02:01:32 +08:00
|
|
|
MagiskManager magiskManager = (MagiskManager) context.getApplicationContext();
|
|
|
|
magiskManager.initSuAccess();
|
|
|
|
magiskManager.updateMagiskInfo();
|
2017-02-05 22:02:14 +08:00
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
2017-02-07 02:01:32 +08:00
|
|
|
if (prefs.getBoolean("magiskhide", false) && !magiskManager.disabled && magiskManager.magiskVersion > 10.3) {
|
2017-02-05 22:02:14 +08:00
|
|
|
Toast.makeText(context, R.string.start_magiskhide, Toast.LENGTH_SHORT).show();
|
|
|
|
new Async.MagiskHide(true).enable();
|
|
|
|
}
|
2017-01-29 16:52:43 +08:00
|
|
|
}
|
|
|
|
}
|