b.java 源代码
package j1;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import java.util.ArrayList;
import java.util.List;
public final class b {
private final Context f23245a;
public b(Context context) {
this.f23245a = context;
}
private static a b(String str) {
try {
Class<?> cls = Class.forName(str);
try {
Object newInstance = cls.newInstance();
if (newInstance instanceof a) {
return (a) newInstance;
}
throw new RuntimeException("Expected instanceof GlideModule, but found: " + newInstance);
} catch (IllegalAccessException e6) {
throw new RuntimeException("Unable to instantiate GlideModule implementation for " + cls, e6);
} catch (InstantiationException e7) {
throw new RuntimeException("Unable to instantiate GlideModule implementation for " + cls, e7);
}
} catch (ClassNotFoundException e8) {
throw new IllegalArgumentException("Unable to find GlideModule implementation", e8);
}
}
public List<a> a() {
ArrayList arrayList = new ArrayList();
try {
ApplicationInfo applicationInfo = this.f23245a.getPackageManager().getApplicationInfo(this.f23245a.getPackageName(), 128);
Bundle bundle = applicationInfo.metaData;
if (bundle != null) {
for (String str : bundle.keySet()) {
if ("GlideModule".equals(applicationInfo.metaData.get(str))) {
arrayList.add(b(str));
}
}
}
return arrayList;
} catch (PackageManager.NameNotFoundException e6) {
throw new RuntimeException("Unable to find metadata to parse GlideModules", e6);
}
}
}