正在查看: Tasker v6.5.11 应用的 IntentServiceParallel.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Tasker v6.5.11 应用的 IntentServiceParallel.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.joaomgcd.taskerm.util;
import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.util.Log;
import com.joaomgcd.taskerm.util.IntentServiceParallel;
import cyanogenmod.app.ProfileManager;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
public abstract class IntentServiceParallel extends Service {
private final String i;
private final Handler q;
private AtomicInteger r;
private Integer s;
private final lj.j t;
static final class a extends yj.q implements xj.a<ExecutorService> {
a() {
super(0);
}
public static final Thread d(IntentServiceParallel intentServiceParallel, Runnable runnable) {
yj.p.i(intentServiceParallel, "this$0");
return new Thread(runnable, "IntentServiceParallel" + intentServiceParallel.e());
}
@Override
public final ExecutorService invoke() {
final IntentServiceParallel intentServiceParallel = IntentServiceParallel.this;
return Executors.newCachedThreadPool(new ThreadFactory() {
@Override
public final Thread newThread(Runnable runnable) {
Thread d;
d = IntentServiceParallel.a.d(IntentServiceParallel.this, runnable);
return d;
}
});
}
}
public IntentServiceParallel(String str) {
yj.p.i(str, ProfileManager.EXTRA_PROFILE_NAME);
this.i = str;
this.q = new Handler(Looper.getMainLooper());
this.r = new AtomicInteger(0);
this.t = lj.k.b(new a());
}
private final ExecutorService d() {
return (ExecutorService) this.t.getValue();
}
public static final void h(final IntentServiceParallel intentServiceParallel, Intent intent) {
Handler handler;
Runnable runnable;
yj.p.i(intentServiceParallel, "this$0");
try {
try {
intentServiceParallel.g(intent);
handler = intentServiceParallel.q;
runnable = new Runnable() {
@Override
public final void run() {
IntentServiceParallel.j(IntentServiceParallel.this);
}
};
} catch (RuntimeException e) {
intentServiceParallel.q.post(new Runnable() {
@Override
public final void run() {
IntentServiceParallel.i(e);
}
});
handler = intentServiceParallel.q;
runnable = new Runnable() {
@Override
public final void run() {
IntentServiceParallel.j(IntentServiceParallel.this);
}
};
}
handler.post(runnable);
} catch (Throwable th2) {
intentServiceParallel.q.post(new Runnable() {
@Override
public final void run() {
IntentServiceParallel.j(IntentServiceParallel.this);
}
});
throw th2;
}
}
public static final void i(RuntimeException runtimeException) {
yj.p.i(runtimeException, "$throwable");
throw runtimeException;
}
public static final void j(IntentServiceParallel intentServiceParallel) {
yj.p.i(intentServiceParallel, "this$0");
if (intentServiceParallel.r.decrementAndGet() > 0) {
return;
}
intentServiceParallel.k(intentServiceParallel.s);
}
private final void k(Integer num) {
Log.v("IntentServiceParallel", "Stopping with " + num + ";");
if (num != null) {
stopSelf(num.intValue());
} else {
stopSelf();
}
}
public final String e() {
return this.i;
}
public Void f(Intent intent) {
yj.p.i(intent, "intent");
return null;
}
protected abstract void g(Intent intent);
@Override
public IBinder onBind(Intent intent) {
return (IBinder) f(intent);
}
@Override
public void onDestroy() {
super.onDestroy();
d().shutdown();
}
@Override
public void onStart(final Intent intent, int i) {
if (intent == null) {
return;
}
int addAndGet = this.r.addAndGet(1);
this.s = Integer.valueOf(i);
Log.v("IntentServiceParallel", "Started with " + i + "; Current job count is " + addAndGet + ".");
d().submit(new Runnable() {
@Override
public final void run() {
IntentServiceParallel.h(IntentServiceParallel.this, intent);
}
});
}
@Override
public int onStartCommand(Intent intent, int i, int i2) {
onStart(intent, i2);
return 2;
}
}