60 lines
2.2 KiB
Java
60 lines
2.2 KiB
Java
package com.google.firebase.components;
|
|
|
|
import android.content.ComponentName;
|
|
import android.content.Context;
|
|
import android.content.pm.PackageManager;
|
|
import android.content.pm.ServiceInfo;
|
|
import android.os.Bundle;
|
|
import android.util.Log;
|
|
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
|
|
/* compiled from: com.google.firebase:firebase-common@@16.0.2 */
|
|
/* loaded from: classes.dex */
|
|
final class zzd implements zze<Context> {
|
|
private zzd() {
|
|
}
|
|
|
|
@Override // com.google.firebase.components.zze
|
|
public final /* synthetic */ List a(Context context) {
|
|
Bundle a2 = a2(context);
|
|
if (a2 == null) {
|
|
Log.w("ComponentDiscovery", "Could not retrieve metadata, returning empty list of registrars.");
|
|
return Collections.emptyList();
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
for (String str : a2.keySet()) {
|
|
if ("com.google.firebase.components.ComponentRegistrar".equals(a2.get(str)) && str.startsWith("com.google.firebase.components:")) {
|
|
arrayList.add(str.substring(31));
|
|
}
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
/* synthetic */ zzd(byte b) {
|
|
this();
|
|
}
|
|
|
|
/* renamed from: a, reason: avoid collision after fix types in other method */
|
|
private static Bundle a2(Context context) {
|
|
try {
|
|
PackageManager packageManager = context.getPackageManager();
|
|
if (packageManager == null) {
|
|
Log.w("ComponentDiscovery", "Context has no PackageManager.");
|
|
return null;
|
|
}
|
|
ServiceInfo serviceInfo = packageManager.getServiceInfo(new ComponentName(context, (Class<?>) ComponentDiscoveryService.class), PeripheralType.SERVO);
|
|
if (serviceInfo == null) {
|
|
Log.w("ComponentDiscovery", "ComponentDiscoveryService has no service info.");
|
|
return null;
|
|
}
|
|
return serviceInfo.metaData;
|
|
} catch (PackageManager.NameNotFoundException unused) {
|
|
Log.w("ComponentDiscovery", "Application info not found.");
|
|
return null;
|
|
}
|
|
}
|
|
}
|