package o; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.ComponentInfo; import android.content.pm.PackageItemInfo; import android.content.pm.PackageManager; import android.content.pm.ProviderInfo; import android.content.pm.ResolveInfo; import android.content.pm.Signature; import android.os.Build; import com.huawei.hms.support.api.entity.common.CommonConstant; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import o.C16349neT; /* loaded from: classes.dex */ public final class WoW { public static LWt e(Context context) { return (LWt) new IeS(null).d(context); } /* loaded from: classes.dex */ public static class IeS { private final LWm a; public IeS(LWm lWm) { this.a = lWm == null ? c() : lWm; } public C16349neT.HBt d(Context context) { return e(context, a(context)); } private C16349neT.HBt e(Context context, WXG wxg) { if (wxg == null) { return null; } return new LWt(context, wxg); } WXG a(Context context) { PackageManager packageManager = context.getPackageManager(); if (packageManager != null) { ProviderInfo xt_ = xt_(packageManager); if (xt_ == null) { return null; } try { return xr_(xt_, packageManager); } catch (PackageManager.NameNotFoundException unused) { return null; } } throw new NullPointerException("Package manager required to locate emoji font provider"); } private ProviderInfo xt_(PackageManager packageManager) { Iterator it = this.a.xy_(packageManager, new Intent("androidx.content.action.LOAD_EMOJI_FONT"), 0).iterator(); while (it.hasNext()) { ProviderInfo xx_ = this.a.xx_(it.next()); if (xs_(xx_)) { return xx_; } } return null; } private boolean xs_(ProviderInfo providerInfo) { return (providerInfo == null || ComponentInfo.class.getField("applicationInfo").get(providerInfo) == null || (((ApplicationInfo) ComponentInfo.class.getField("applicationInfo").get(providerInfo)).flags & 1) != 1) ? false : true; } private WXG xr_(ProviderInfo providerInfo, PackageManager packageManager) throws PackageManager.NameNotFoundException { String str = providerInfo.authority; String str2 = (String) PackageItemInfo.class.getField(CommonConstant.ReqAccessTokenParam.PACKAGE_NAME).get(providerInfo); return new WXG(str, str2, "emojicompat-emoji-font", xq_(this.a.xz_(packageManager, str2))); } private List> xq_(Signature[] signatureArr) { ArrayList arrayList = new ArrayList(); for (Signature signature : signatureArr) { arrayList.add(signature.toByteArray()); } return Collections.singletonList(arrayList); } private static LWm c() { if (Build.VERSION.SDK_INT >= 28) { return new HBt(); } return new RVV(); } } /* loaded from: classes.dex */ public static class LWm { public Signature[] xz_(PackageManager packageManager, String str) throws PackageManager.NameNotFoundException { return packageManager.getPackageInfo(str, 64).signatures; } public List xy_(PackageManager packageManager, Intent intent, int i) { return Collections.emptyList(); } public ProviderInfo xx_(ResolveInfo resolveInfo) { throw new IllegalStateException("Unable to get provider info prior to API 19"); } } /* loaded from: classes.dex */ public static class RVV extends LWm { @Override // o.WoW.LWm public List xy_(PackageManager packageManager, Intent intent, int i) { return packageManager.queryIntentContentProviders(intent, i); } @Override // o.WoW.LWm public ProviderInfo xx_(ResolveInfo resolveInfo) { return resolveInfo.providerInfo; } } /* loaded from: classes.dex */ public static class HBt extends RVV { @Override // o.WoW.LWm public Signature[] xz_(PackageManager packageManager, String str) throws PackageManager.NameNotFoundException { return packageManager.getPackageInfo(str, 64).signatures; } } }