You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Fix crash on Android O
This commit is contained in:
@@ -3,14 +3,28 @@ package com.topjohnwu.magisk.receivers;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
|
||||
import com.topjohnwu.magisk.services.BootupIntentService;
|
||||
import com.topjohnwu.magisk.services.OnBootIntentService;
|
||||
import com.topjohnwu.magisk.utils.Utils;
|
||||
|
||||
public class BootReceiver extends BroadcastReceiver {
|
||||
|
||||
private void startIntentService(Context context) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
context.startForegroundService(new Intent(context, OnBootIntentService.class));
|
||||
} else {
|
||||
context.startService(new Intent(context, OnBootIntentService.class));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
context.startService(new Intent(context, BootupIntentService.class));
|
||||
if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
|
||||
Utils.getMagiskManager(context).initSU();
|
||||
// There is currently no need to start an IntentService onBoot
|
||||
// startIntentService(context);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user