42 lines
1.5 KiB
Java
42 lines
1.5 KiB
Java
package com.google.firebase.concurrent;
|
|
|
|
import android.os.Process;
|
|
import android.os.StrictMode;
|
|
import java.util.Locale;
|
|
import java.util.concurrent.Executors;
|
|
import java.util.concurrent.ThreadFactory;
|
|
import java.util.concurrent.atomic.AtomicLong;
|
|
|
|
/* loaded from: classes3.dex */
|
|
class CustomThreadFactory implements ThreadFactory {
|
|
private static final ThreadFactory DEFAULT = Executors.defaultThreadFactory();
|
|
private final String namePrefix;
|
|
private final StrictMode.ThreadPolicy policy;
|
|
private final int priority;
|
|
private final AtomicLong threadCount = new AtomicLong();
|
|
|
|
public CustomThreadFactory(String str, int i, StrictMode.ThreadPolicy threadPolicy) {
|
|
this.namePrefix = str;
|
|
this.priority = i;
|
|
this.policy = threadPolicy;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void lambda$newThread$0(Runnable runnable) {
|
|
Process.setThreadPriority(this.priority);
|
|
StrictMode.ThreadPolicy threadPolicy = this.policy;
|
|
if (threadPolicy != null) {
|
|
StrictMode.setThreadPolicy(threadPolicy);
|
|
}
|
|
runnable.run();
|
|
}
|
|
|
|
@Override // java.util.concurrent.ThreadFactory
|
|
public Thread newThread(Runnable runnable) {
|
|
Thread newThread = DEFAULT.newThread(new a(0, this, runnable));
|
|
Locale locale = Locale.ROOT;
|
|
newThread.setName(this.namePrefix + " Thread #" + this.threadCount.getAndIncrement());
|
|
return newThread;
|
|
}
|
|
}
|