- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
130 lines
4.6 KiB
Java
130 lines
4.6 KiB
Java
package com.facebook.bolts;
|
|
|
|
import java.util.Locale;
|
|
import java.util.concurrent.Executor;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.Executors;
|
|
import java.util.concurrent.ScheduledExecutorService;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.text.StringsKt__StringsKt;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class BoltsExecutors {
|
|
public static final Companion Companion = new Companion(null);
|
|
private static final BoltsExecutors INSTANCE = new BoltsExecutors();
|
|
private final ExecutorService background;
|
|
private final Executor immediate;
|
|
private final ScheduledExecutorService scheduled;
|
|
|
|
public static final ExecutorService background() {
|
|
return Companion.background();
|
|
}
|
|
|
|
private BoltsExecutors() {
|
|
ExecutorService newCachedThreadPool;
|
|
if (Companion.isAndroidRuntime()) {
|
|
newCachedThreadPool = AndroidExecutors.Companion.newCachedThreadPool();
|
|
} else {
|
|
newCachedThreadPool = Executors.newCachedThreadPool();
|
|
Intrinsics.checkNotNullExpressionValue(newCachedThreadPool, "newCachedThreadPool()");
|
|
}
|
|
this.background = newCachedThreadPool;
|
|
ScheduledExecutorService newSingleThreadScheduledExecutor = Executors.newSingleThreadScheduledExecutor();
|
|
Intrinsics.checkNotNullExpressionValue(newSingleThreadScheduledExecutor, "newSingleThreadScheduledExecutor()");
|
|
this.scheduled = newSingleThreadScheduledExecutor;
|
|
this.immediate = new ImmediateExecutor();
|
|
}
|
|
|
|
public static final class ImmediateExecutor implements Executor {
|
|
public static final Companion Companion = new Companion(null);
|
|
private static final int MAX_DEPTH = 15;
|
|
private final ThreadLocal<Integer> executionDepth = new ThreadLocal<>();
|
|
|
|
private final int incrementDepth() {
|
|
Integer num = this.executionDepth.get();
|
|
if (num == null) {
|
|
num = 0;
|
|
}
|
|
int intValue = num.intValue() + 1;
|
|
this.executionDepth.set(Integer.valueOf(intValue));
|
|
return intValue;
|
|
}
|
|
|
|
private final int decrementDepth() {
|
|
Integer num = this.executionDepth.get();
|
|
if (num == null) {
|
|
num = 0;
|
|
}
|
|
int intValue = num.intValue() - 1;
|
|
if (intValue == 0) {
|
|
this.executionDepth.remove();
|
|
} else {
|
|
this.executionDepth.set(Integer.valueOf(intValue));
|
|
}
|
|
return intValue;
|
|
}
|
|
|
|
@Override // java.util.concurrent.Executor
|
|
public void execute(Runnable command) {
|
|
Intrinsics.checkNotNullParameter(command, "command");
|
|
try {
|
|
if (incrementDepth() <= 15) {
|
|
command.run();
|
|
} else {
|
|
BoltsExecutors.Companion.background().execute(command);
|
|
}
|
|
decrementDepth();
|
|
} catch (Throwable th) {
|
|
decrementDepth();
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
public static final class Companion {
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
private Companion() {
|
|
}
|
|
}
|
|
}
|
|
|
|
public static final class Companion {
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
private Companion() {
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public final boolean isAndroidRuntime() {
|
|
boolean contains$default;
|
|
String property = System.getProperty("java.runtime.name");
|
|
if (property == null) {
|
|
return false;
|
|
}
|
|
Locale US = Locale.US;
|
|
Intrinsics.checkNotNullExpressionValue(US, "US");
|
|
String lowerCase = property.toLowerCase(US);
|
|
Intrinsics.checkNotNullExpressionValue(lowerCase, "(this as java.lang.String).toLowerCase(locale)");
|
|
contains$default = StringsKt__StringsKt.contains$default(lowerCase, "android", false, 2, null);
|
|
return contains$default;
|
|
}
|
|
|
|
public final ExecutorService background() {
|
|
return BoltsExecutors.INSTANCE.background;
|
|
}
|
|
|
|
public final ScheduledExecutorService scheduled$facebook_bolts_release() {
|
|
return BoltsExecutors.INSTANCE.scheduled;
|
|
}
|
|
|
|
public final Executor immediate$facebook_bolts_release() {
|
|
return BoltsExecutors.INSTANCE.immediate;
|
|
}
|
|
}
|
|
}
|