package o; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageItemInfo; import android.content.pm.PackageManager; import android.os.Bundle; import android.util.Log; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.List; @Deprecated /* loaded from: classes.dex */ public final class QYn { private final Context a; public QYn(Context context) { this.a = context; } public final List e() { ArrayList arrayList = new ArrayList(); try { ApplicationInfo applicationInfo = this.a.getPackageManager().getApplicationInfo(this.a.getPackageName(), 128); if (PackageItemInfo.class.getField("metaData").get(applicationInfo) == null) { return arrayList; } if (Log.isLoggable("ManifestParser", 2)) { PackageItemInfo.class.getField("metaData").get(applicationInfo); } for (String str : ((Bundle) PackageItemInfo.class.getField("metaData").get(applicationInfo)).keySet()) { if ("GlideModule".equals(((Bundle) PackageItemInfo.class.getField("metaData").get(applicationInfo)).get(str))) { arrayList.add(d(str)); Log.isLoggable("ManifestParser", 3); } } return arrayList; } catch (PackageManager.NameNotFoundException e) { throw new RuntimeException("Unable to find metadata to parse GlideModules", e); } } private static Ebx d(String str) { try { Class cls = Class.forName(str); try { Object newInstance = cls.getDeclaredConstructor(new Class[0]).newInstance(new Object[0]); if (!(newInstance instanceof Ebx)) { throw new RuntimeException("Expected instanceof GlideModule, but found: ".concat(String.valueOf(newInstance))); } return (Ebx) newInstance; } catch (IllegalAccessException e) { throw new RuntimeException("Unable to instantiate GlideModule implementation for ".concat(String.valueOf(cls)), e); } catch (InstantiationException e2) { throw new RuntimeException("Unable to instantiate GlideModule implementation for ".concat(String.valueOf(cls)), e2); } catch (NoSuchMethodException e3) { throw new RuntimeException("Unable to instantiate GlideModule implementation for ".concat(String.valueOf(cls)), e3); } catch (InvocationTargetException e4) { throw new RuntimeException("Unable to instantiate GlideModule implementation for ".concat(String.valueOf(cls)), e4); } } catch (ClassNotFoundException e5) { throw new IllegalArgumentException("Unable to find GlideModule implementation", e5); } } }