85 lines
3.2 KiB
Java
85 lines
3.2 KiB
Java
package com.bumptech.glide.module;
|
|
|
|
import android.content.Context;
|
|
import android.content.pm.ApplicationInfo;
|
|
import android.content.pm.PackageManager;
|
|
import android.util.Log;
|
|
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
|
import java.lang.reflect.InvocationTargetException;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
@Deprecated
|
|
/* loaded from: classes.dex */
|
|
public final class ManifestParser {
|
|
private final Context a;
|
|
|
|
public ManifestParser(Context context) {
|
|
this.a = context;
|
|
}
|
|
|
|
public List<GlideModule> a() {
|
|
if (Log.isLoggable("ManifestParser", 3)) {
|
|
Log.d("ManifestParser", "Loading Glide modules");
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
try {
|
|
ApplicationInfo applicationInfo = this.a.getPackageManager().getApplicationInfo(this.a.getPackageName(), PeripheralType.SERVO);
|
|
if (applicationInfo.metaData == null) {
|
|
if (Log.isLoggable("ManifestParser", 3)) {
|
|
Log.d("ManifestParser", "Got null app info metadata");
|
|
}
|
|
return arrayList;
|
|
}
|
|
if (Log.isLoggable("ManifestParser", 2)) {
|
|
Log.v("ManifestParser", "Got app info metadata: " + applicationInfo.metaData);
|
|
}
|
|
for (String str : applicationInfo.metaData.keySet()) {
|
|
if ("GlideModule".equals(applicationInfo.metaData.get(str))) {
|
|
arrayList.add(a(str));
|
|
if (Log.isLoggable("ManifestParser", 3)) {
|
|
Log.d("ManifestParser", "Loaded Glide module: " + str);
|
|
}
|
|
}
|
|
}
|
|
if (Log.isLoggable("ManifestParser", 3)) {
|
|
Log.d("ManifestParser", "Finished loading Glide modules");
|
|
}
|
|
return arrayList;
|
|
} catch (PackageManager.NameNotFoundException e) {
|
|
throw new RuntimeException("Unable to find metadata to parse GlideModules", e);
|
|
}
|
|
}
|
|
|
|
private static GlideModule a(String str) {
|
|
try {
|
|
Class<?> cls = Class.forName(str);
|
|
try {
|
|
Object newInstance = cls.getDeclaredConstructor(new Class[0]).newInstance(new Object[0]);
|
|
if (newInstance instanceof GlideModule) {
|
|
return (GlideModule) newInstance;
|
|
}
|
|
throw new RuntimeException("Expected instanceof GlideModule, but found: " + newInstance);
|
|
} catch (IllegalAccessException e) {
|
|
a(cls, e);
|
|
throw null;
|
|
} catch (InstantiationException e2) {
|
|
a(cls, e2);
|
|
throw null;
|
|
} catch (NoSuchMethodException e3) {
|
|
a(cls, e3);
|
|
throw null;
|
|
} catch (InvocationTargetException e4) {
|
|
a(cls, e4);
|
|
throw null;
|
|
}
|
|
} catch (ClassNotFoundException e5) {
|
|
throw new IllegalArgumentException("Unable to find GlideModule implementation", e5);
|
|
}
|
|
}
|
|
|
|
private static void a(Class<?> cls, Exception exc) {
|
|
throw new RuntimeException("Unable to instantiate GlideModule implementation for " + cls, exc);
|
|
}
|
|
}
|