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.huawei.agconnect.core.ServiceDiscovery; import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; /* loaded from: classes2.dex */ public final class Zck { final Context c; /* loaded from: classes2.dex */ static class IeS implements Serializable, Comparator> { @Override // java.util.Comparator public final /* synthetic */ int compare(Map.Entry entry, Map.Entry entry2) { return entry.getValue().intValue() - entry2.getValue().intValue(); } /* synthetic */ IeS(byte b) { this(); } private IeS() { } } private Bundle Og_() { PackageManager packageManager = this.c.getPackageManager(); if (packageManager == null) { return null; } try { ServiceInfo serviceInfo = packageManager.getServiceInfo(new ComponentName(this.c, (Class) ServiceDiscovery.class), 128); if (serviceInfo != null) { return (Bundle) PackageItemInfo.class.getField("metaData").get(serviceInfo); } } catch (PackageManager.NameNotFoundException e) { e.getLocalizedMessage(); } return null; } /* JADX INFO: Access modifiers changed from: package-private */ public final List a() { byte b; ArrayList arrayList = new ArrayList(); Bundle Og_ = Og_(); if (Og_ == null) { return arrayList; } HashMap hashMap = new HashMap(10); Iterator it = Og_.keySet().iterator(); while (true) { b = 0; if (!it.hasNext()) { break; } String next = it.next(); if ("o.WyQ".equals(Og_.getString(next))) { String[] split = next.split(":"); if (split.length == 2) { try { hashMap.put(split[0], Integer.valueOf(split[1])); } catch (NumberFormatException e) { e.getMessage(); } } else if (split.length == 1) { hashMap.put(split[0], 1000); } } } ArrayList arrayList2 = new ArrayList(hashMap.entrySet()); Collections.sort(arrayList2, new IeS(b)); Iterator it2 = arrayList2.iterator(); while (it2.hasNext()) { arrayList.add(((Map.Entry) it2.next()).getKey()); } return arrayList; } /* JADX INFO: Access modifiers changed from: package-private */ public static T d(String str) { try { if (InterfaceC1159WyQ.class.isAssignableFrom(Class.forName(str))) { return (T) Class.forName(str).newInstance(); } return null; } catch (ClassNotFoundException e) { e.getMessage(); return null; } catch (IllegalAccessException e2) { e = e2; e.getLocalizedMessage(); return null; } catch (InstantiationException e3) { e = e3; e.getLocalizedMessage(); return null; } } /* JADX INFO: Access modifiers changed from: package-private */ public Zck(Context context) { this.c = context; } }