Magisk/app/src/full/java/a/w.java

36 lines
922 B
Java
Raw Normal View History

2018-12-27 14:07:47 +00:00
package a;
import android.content.Context;
import com.topjohnwu.magisk.services.DelegateWorker;
import java.lang.reflect.ParameterizedType;
import androidx.annotation.NonNull;
import androidx.work.Worker;
import androidx.work.WorkerParameters;
public class w<T extends DelegateWorker> extends Worker {
/* Wrapper class to workaround Proguard -keep class * extends Worker */
private T base;
@SuppressWarnings("unchecked")
w(@NonNull Context context, @NonNull WorkerParameters workerParams) {
super(context, workerParams);
try {
base = ((Class<T>) ((ParameterizedType) getClass().getGenericSuperclass())
.getActualTypeArguments()[0]).newInstance();
2018-12-27 21:15:59 +00:00
} catch (Exception ignored) {}
2018-12-27 14:07:47 +00:00
}
@NonNull
@Override
public Result doWork() {
if (base == null)
return Result.failure();
return base.doWork();
}
}