Don't need to wrap another layer of context
This commit is contained in:
parent
588b3d14a3
commit
626507093a
@ -6,7 +6,6 @@ import androidx.annotation.NonNull;
|
||||
import androidx.work.Worker;
|
||||
import androidx.work.WorkerParameters;
|
||||
|
||||
import com.topjohnwu.magisk.HacksKt;
|
||||
import com.topjohnwu.magisk.base.DelegateWorker;
|
||||
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
@ -19,7 +18,7 @@ public abstract class w<T extends DelegateWorker> extends Worker {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
w(@NonNull Context context, @NonNull WorkerParameters workerParams) {
|
||||
super(HacksKt.wrap(context, false), workerParams);
|
||||
super(context, workerParams);
|
||||
try {
|
||||
base = ((Class<T>) ((ParameterizedType) getClass().getGenericSuperclass())
|
||||
.getActualTypeArguments()[0]).newInstance();
|
||||
|
@ -165,12 +165,13 @@ private class JobSchedulerWrapper(private val base: JobScheduler) : JobScheduler
|
||||
return base.getPendingJob(jobId)
|
||||
}
|
||||
|
||||
fun JobInfo.patch(): JobInfo {
|
||||
private fun JobInfo.patch(): JobInfo {
|
||||
// We need to patch the component of JobInfo to access WorkManager SystemJobService
|
||||
|
||||
val name = service.className
|
||||
val component = ComponentName(service.packageName, Info.stub?.componentMap?.get(name)
|
||||
?: name)
|
||||
val component = ComponentName(
|
||||
service.packageName,
|
||||
Info.stub!!.componentMap[name] ?: name)
|
||||
|
||||
// Clone the JobInfo except component
|
||||
val builder = JobInfo.Builder(id, component)
|
||||
|
Loading…
Reference in New Issue
Block a user