package defpackage;

import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Handler;
import j$.util.DesugarCollections;
import j$.util.Objects;
import java.util.ArrayList;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/* renamed from: ᵭᵰᵜ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C4153 implements InterfaceC4920 {

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public Handler f15517;

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public ThreadPoolExecutor f15518;

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public ThreadPoolExecutor f15519;

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final ˉːᵡ f15520;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final Context f15521;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final C3831 f15522;

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public ᵳʿˉ f15523;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final Object f15524 = new Object();

    public C4153(Context context, C3831 c3831) {
        ˀʾˀᵛ.ˏˋٴ(context, "Context cannot be null");
        this.f15521 = context.getApplicationContext();
        this.f15522 = c3831;
        this.f15520 = C4482.f16715;
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final void m9055() {
        synchronized (this.f15524) {
            try {
                if (this.f15523 == null) {
                    return;
                }
                if (this.f15519 == null) {
                    ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(0, 1, 15L, TimeUnit.SECONDS, new LinkedBlockingDeque(), new ThreadFactoryC0327(0, "emojiCompat"));
                    threadPoolExecutor.allowCoreThreadTimeOut(true);
                    this.f15518 = threadPoolExecutor;
                    this.f15519 = threadPoolExecutor;
                }
                this.f15519.execute(new RunnableC3566(25, this));
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    @Override // defpackage.InterfaceC4920
    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final void mo9056(ᵳʿˉ r2) {
        synchronized (this.f15524) {
            this.f15523 = r2;
        }
        m9055();
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final void m9057() {
        synchronized (this.f15524) {
            try {
                this.f15523 = null;
                Handler handler = this.f15517;
                if (handler != null) {
                    handler.removeCallbacks(null);
                }
                this.f15517 = null;
                ThreadPoolExecutor threadPoolExecutor = this.f15518;
                if (threadPoolExecutor != null) {
                    threadPoolExecutor.shutdown();
                }
                this.f15519 = null;
                this.f15518 = null;
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final C3491 m9058() {
        try {
            ˉːᵡ r1 = this.f15520;
            Context context = this.f15521;
            C3831 c3831 = this.f15522;
            r1.getClass();
            Object[] objArr = {c3831};
            ArrayList arrayList = new ArrayList(1);
            Object obj = objArr[0];
            Objects.requireNonNull(obj);
            arrayList.add(obj);
            C5045 c5045M3298 = AbstractC0965.m3298(context, DesugarCollections.unmodifiableList(arrayList));
            int i = c5045M3298.f18845;
            if (i != 0) {
                C1260.m3816(AbstractC3915.m8596(i, "fetchFonts failed (", ")"));
                return null;
            }
            C3491[] c3491Arr = (C3491[]) c5045M3298.f18846.get(0);
            if (c3491Arr != null && c3491Arr.length != 0) {
                return c3491Arr[0];
            }
            C1260.m3816("fetchFonts failed (empty result)");
            return null;
        } catch (PackageManager.NameNotFoundException e) {
            ᵨᴵᵺ.ᵪʩ("provider not found", e);
            return null;
        }
    }
}
