Speed up startup time

This commit is contained in:
topjohnwu
2018-06-26 00:29:01 +08:00
parent 23f697d62b
commit 4601989d4a
11 changed files with 82 additions and 87 deletions
@@ -9,8 +9,6 @@ import com.topjohnwu.magisk.MagiskManager;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.utils.Const;
import com.topjohnwu.magisk.utils.RootUtils;
import com.topjohnwu.magisk.utils.Utils;
import com.topjohnwu.superuser.Shell;
public class OnBootIntentService extends IntentService {
@@ -22,12 +20,12 @@ public class OnBootIntentService extends IntentService {
public void onCreate() {
super.onCreate();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationCompat.Builder builder =
new NotificationCompat.Builder(this, Const.ID.NOTIFICATION_CHANNEL);
builder.setSmallIcon(R.drawable.ic_magisk_outline)
.setContentTitle("onBoot")
.setContentText("Running onBoot operations...");
startForeground(Const.ID.ONBOOT_NOTIFICATION_ID, builder.build());
startForeground(Const.ID.ONBOOT_NOTIFICATION_ID,
new NotificationCompat.Builder(this, Const.ID.NOTIFICATION_CHANNEL)
.setSmallIcon(R.drawable.ic_magisk_outline)
.setContentTitle("onBoot")
.setContentText("Running onBoot operations...")
.build());
}
}
@@ -40,11 +38,7 @@ public class OnBootIntentService extends IntentService {
* Check for dtbo status every boot time, and prompt user
* to reboot if dtbo wasn't patched and patched by Magisk Manager.
* */
MagiskManager mm = Utils.getMagiskManager(this);
mm.loadMagiskInfo();
mm.getDefaultInstallFlags();
if (Shell.rootAccess()) {
RootUtils.patchDTBO();
}
MagiskManager.get().loadMagiskInfo();
RootUtils.patchDTBO();
}
}