what-the-bank/sources/o/LWt.java

275 lines
9.2 KiB
Java

package o;
import android.content.Context;
import android.content.pm.PackageManager;
import android.database.ContentObserver;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import java.nio.ByteBuffer;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
import o.C16349neT;
import o.LWt;
import o.ubj;
/* loaded from: classes.dex */
public class LWt extends C16349neT.HBt {
private static final LWm f = new LWm();
/* loaded from: classes.dex */
public static abstract class RVV {
public abstract long c();
}
public LWt(Context context, WXG wxg) {
super(new Sts(context, wxg, f));
}
public LWt b(Executor executor) {
((Sts) a()).b(executor);
return this;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public static class Sts implements C16349neT.ojQ {
private final Object a = new Object();
C16349neT.ZqN b;
private final LWm c;
private Executor d;
private final Context e;
private Runnable f;
private final WXG g;
private ContentObserver h;
private ThreadPoolExecutor i;
private Handler j;
/* renamed from: o, reason: collision with root package name */
private RVV f8252o;
Sts(Context context, WXG wxg, LWm lWm) {
if (context == null) {
throw new NullPointerException("Context cannot be null");
}
if (wxg != null) {
this.e = context.getApplicationContext();
this.g = wxg;
this.c = lWm;
return;
}
throw new NullPointerException("FontRequest cannot be null");
}
public void b(Executor executor) {
synchronized (this.a) {
this.d = executor;
}
}
@Override // o.C16349neT.ojQ
public void e(C16349neT.ZqN zqN) {
if (zqN != null) {
synchronized (this.a) {
this.b = zqN;
}
d();
return;
}
throw new NullPointerException("LoaderCallback cannot be null");
}
/* JADX INFO: Access modifiers changed from: package-private */
public void d() {
synchronized (this.a) {
if (this.b == null) {
return;
}
if (this.d == null) {
ThreadPoolExecutor c = GOe.c("emojiCompat");
this.i = c;
this.d = c;
}
this.d.execute(new Runnable(this) { // from class: o.VSC
public final LWt.Sts b;
@Override // java.lang.Runnable
public final void run() {
this.b.b();
}
{
this.b = this;
}
});
}
}
private ubj.HBt c() {
try {
ubj.IeS e = this.c.e(this.e, this.g);
if (e.b() != 0) {
StringBuilder sb = new StringBuilder("fetchFonts failed (");
sb.append(e.b());
sb.append(")");
throw new RuntimeException(sb.toString());
}
ubj.HBt[] e2 = e.e();
if (e2 == null || e2.length == 0) {
throw new RuntimeException("fetchFonts failed (empty result)");
}
return e2[0];
} catch (PackageManager.NameNotFoundException e3) {
throw new RuntimeException("provider not found", e3);
}
}
private void xJ_(Uri uri, long j) {
synchronized (this.a) {
Handler handler = this.j;
if (handler == null) {
if (Build.VERSION.SDK_INT < 28) {
handler = new Handler(Looper.getMainLooper());
} else {
handler = Handler.createAsync(Looper.getMainLooper());
}
this.j = handler;
}
if (this.h == null) {
ContentObserver contentObserver = new ContentObserver(this, handler) { // from class: o.LWt.Sts.5
final Sts d;
{
this.d = this;
}
@Override // android.database.ContentObserver
public void onChange(boolean z, Uri uri2) {
this.d.d();
}
};
this.h = contentObserver;
this.c.xH_(this.e, uri, contentObserver);
}
if (this.f == null) {
this.f = new Runnable(this) { // from class: o.cWZ
public final LWt.Sts e;
@Override // java.lang.Runnable
public final void run() {
this.e.d();
}
{
this.e = this;
}
};
}
handler.postDelayed(this.f, j);
}
}
private void a() {
synchronized (this.a) {
this.b = null;
ContentObserver contentObserver = this.h;
if (contentObserver != null) {
this.c.xI_(this.e, contentObserver);
this.h = null;
}
Handler handler = this.j;
if (handler != null) {
handler.removeCallbacks(this.f);
}
this.j = null;
ThreadPoolExecutor threadPoolExecutor = this.i;
if (threadPoolExecutor != null) {
threadPoolExecutor.shutdown();
}
this.d = null;
this.i = null;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public void b() {
synchronized (this.a) {
if (this.b == null) {
return;
}
try {
ubj.HBt c = c();
int a = c.a();
if (a == 2) {
synchronized (this.a) {
RVV rvv = this.f8252o;
if (rvv != null) {
long c2 = rvv.c();
if (c2 >= 0) {
xJ_(c.qG_(), c2);
return;
}
}
}
}
if (a != 0) {
StringBuilder sb = new StringBuilder("fetchFonts result is not OK. (");
sb.append(a);
sb.append(")");
throw new RuntimeException(sb.toString());
}
try {
Lfp.b("EmojiCompat.FontRequestEmojiCompatConfig.buildTypeface");
Typeface xG_ = this.c.xG_(this.e, c);
ByteBuffer po_ = ioR.po_(this.e, null, c.qG_());
if (po_ == null || xG_ == null) {
throw new RuntimeException("Unable to open file.");
}
kem xK_ = kem.xK_(xG_, po_);
Lfp.c();
synchronized (this.a) {
C16349neT.ZqN zqN = this.b;
if (zqN != null) {
zqN.c(xK_);
}
}
a();
} catch (Throwable th) {
Lfp.c();
throw th;
}
} catch (Throwable th2) {
synchronized (this.a) {
C16349neT.ZqN zqN2 = this.b;
if (zqN2 != null) {
zqN2.d(th2);
}
a();
}
}
}
}
}
/* loaded from: classes.dex */
public static class LWm {
public ubj.IeS e(Context context, WXG wxg) throws PackageManager.NameNotFoundException {
return ubj.qD_(context, null, wxg);
}
public Typeface xG_(Context context, ubj.HBt hBt) throws PackageManager.NameNotFoundException {
return ubj.qC_(context, null, new ubj.HBt[]{hBt});
}
public void xH_(Context context, Uri uri, ContentObserver contentObserver) {
context.getContentResolver().registerContentObserver(uri, false, contentObserver);
}
public void xI_(Context context, ContentObserver contentObserver) {
context.getContentResolver().unregisterContentObserver(contentObserver);
}
}
}