package o; import android.content.ComponentName; import android.content.Context; import android.content.pm.PackageItemInfo; import android.content.pm.PackageManager; import android.content.pm.ServiceInfo; import android.os.Bundle; import com.google.android.datatransport.runtime.backends.TransportBackendDiscovery; import java.lang.reflect.InvocationTargetException; import java.util.Collections; import java.util.HashMap; import java.util.Map; @fZH /* renamed from: o.boQ, reason: case insensitive filesystem */ /* loaded from: classes.dex */ final class C5191boQ implements ncN { private final Map a; private final SNw c; private final Sts e; /* JADX INFO: Access modifiers changed from: package-private */ @InterfaceC13391fZD public C5191boQ(Context context, SNw sNw) { this(new Sts(context), sNw); } private C5191boQ(Sts sts, SNw sNw) { this.a = new HashMap(); this.e = sts; this.c = sNw; } @Override // o.ncN public final Qno d(String str) { synchronized (this) { if (this.a.containsKey(str)) { return this.a.get(str); } InterfaceC6277cOD c = this.e.c(str); if (c == null) { return null; } SNw sNw = this.c; Qno create = c.create(new C16083kym(sNw.a, sNw.b, sNw.d, str)); this.a.put(str, create); return create; } } /* renamed from: o.boQ$Sts */ /* loaded from: classes.dex */ static class Sts { private final Context a; private Map c = null; Sts(Context context) { this.a = context; } final InterfaceC6277cOD c(String str) { Map map; if (this.c == null) { Bundle Hk_ = Hk_(this.a); if (Hk_ == null) { map = Collections.emptyMap(); } else { HashMap hashMap = new HashMap(); for (String str2 : Hk_.keySet()) { Object obj = Hk_.get(str2); if ((obj instanceof String) && str2.startsWith("backend:")) { for (String str3 : ((String) obj).split(",", -1)) { String trim = str3.trim(); if (!trim.isEmpty()) { hashMap.put(trim, str2.substring(8)); } } } } map = hashMap; } this.c = map; } String str4 = this.c.get(str); if (str4 == null) { return null; } try { return (InterfaceC6277cOD) Class.forName(str4).asSubclass(InterfaceC6277cOD.class).getDeclaredConstructor(new Class[0]).newInstance(new Object[0]); } catch (ClassNotFoundException unused) { new Object[]{str4}; return null; } catch (IllegalAccessException unused2) { new Object[]{str4}; return null; } catch (InstantiationException unused3) { new Object[]{str4}; return null; } catch (NoSuchMethodException unused4) { new Object[]{str4}; return null; } catch (InvocationTargetException unused5) { new Object[]{str4}; return null; } } private static Bundle Hk_(Context context) { ServiceInfo serviceInfo; try { PackageManager packageManager = context.getPackageManager(); if (packageManager == null || (serviceInfo = packageManager.getServiceInfo(new ComponentName(context, (Class) TransportBackendDiscovery.class), 128)) == null) { return null; } return (Bundle) PackageItemInfo.class.getField("metaData").get(serviceInfo); } catch (PackageManager.NameNotFoundException unused) { return null; } } } }