Remove useless service

This commit is contained in:
topjohnwu 2018-12-29 14:14:29 +08:00
parent 3ccac8c3b8
commit 52137fd64f
5 changed files with 15 additions and 46 deletions

View File

@ -71,11 +71,6 @@
<!-- Service -->
<service
android:name="a.j"
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />
<!-- Hardcode GMS version -->
<meta-data
android:name="com.google.android.gms.version"

View File

@ -1,7 +1,5 @@
package a;
import com.topjohnwu.magisk.services.OnBootService;
public class j extends OnBootService {
public class j {
/* stub */
}

View File

@ -4,7 +4,6 @@ import com.topjohnwu.core.App;
import com.topjohnwu.magisk.components.AboutCardRow;
import com.topjohnwu.magisk.receivers.GeneralReceiver;
import com.topjohnwu.magisk.receivers.ShortcutReceiver;
import com.topjohnwu.magisk.services.OnBootService;
import com.topjohnwu.magisk.services.UpdateCheckService;
import java.util.HashMap;
@ -23,7 +22,6 @@ public class ClassMap {
classMap.put(UpdateCheckService.class, a.g.class);
classMap.put(GeneralReceiver.class, a.h.class);
classMap.put(ShortcutReceiver.class, a.i.class);
classMap.put(OnBootService.class, a.j.class);
classMap.put(AboutCardRow.class, a.l.class);
classMap.put(SuRequestActivity.class, a.m.class);
}

View File

@ -3,16 +3,18 @@ package com.topjohnwu.magisk.receivers;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import com.topjohnwu.core.App;
import com.topjohnwu.core.Const;
import com.topjohnwu.core.Data;
import com.topjohnwu.magisk.ClassMap;
import com.topjohnwu.magisk.SuRequestActivity;
import com.topjohnwu.magisk.services.OnBootService;
import com.topjohnwu.magisk.components.Notifications;
import com.topjohnwu.magisk.utils.DownloadApp;
import com.topjohnwu.magisk.utils.SuConnector;
import com.topjohnwu.superuser.Shell;
import com.topjohnwu.superuser.ShellUtils;
public class GeneralReceiver extends BroadcastReceiver {
@ -48,8 +50,17 @@ public class GeneralReceiver extends BroadcastReceiver {
break;
case "boot":
default:
/* The actual on-boot trigger */
OnBootService.enqueueWork(app);
AsyncTask.THREAD_POOL_EXECUTOR.execute(() -> {
/* Devices with DTBO might want to patch dtbo.img.
* However, that is not possible if Magisk is installed by
* patching boot image with Magisk Manager and flashed via
* fastboot, since at that time we do not have root.
* Check for dtbo status every boot time, and prompt user
* to reboot if dtbo wasn't patched and patched by Magisk Manager.
* */
if (Shell.rootAccess() && ShellUtils.fastCmdResult("mm_patch_dtbo"))
Notifications.dtboPatched();
});
break;
}
break;

View File

@ -1,33 +0,0 @@
package com.topjohnwu.magisk.services;
import android.content.Context;
import android.content.Intent;
import com.topjohnwu.core.Const;
import com.topjohnwu.magisk.ClassMap;
import com.topjohnwu.magisk.components.Notifications;
import com.topjohnwu.superuser.Shell;
import com.topjohnwu.superuser.ShellUtils;
import androidx.annotation.NonNull;
import androidx.core.app.JobIntentService;
public class OnBootService extends JobIntentService {
public static void enqueueWork(Context context) {
enqueueWork(context, ClassMap.get(OnBootService.class), Const.ID.ONBOOT_SERVICE_ID, new Intent());
}
@Override
protected void onHandleWork(@NonNull Intent intent) {
/* Devices with DTBO might want to patch dtbo.img.
* However, that is not possible if Magisk is installed by
* patching boot image with Magisk Manager and flashed via
* fastboot, since at that time we do not have root.
* Check for dtbo status every boot time, and prompt user
* to reboot if dtbo wasn't patched and patched by Magisk Manager.
* */
if (Shell.rootAccess() && ShellUtils.fastCmdResult("mm_patch_dtbo"))
Notifications.dtboPatched();
}
}