38 lines
1.2 KiB
Java
38 lines
1.2 KiB
Java
|
package com.google.android.gms.common.util;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.content.pm.PackageInfo;
|
||
|
import android.content.pm.PackageItemInfo;
|
||
|
import android.content.pm.PackageManager;
|
||
|
import android.os.Bundle;
|
||
|
import com.google.android.gms.common.wrappers.Wrappers;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public class ClientLibraryUtils {
|
||
|
public static int getClientVersion(Context context, String str) {
|
||
|
PackageInfo packageInfo = getPackageInfo(context, str);
|
||
|
if (packageInfo != null && packageInfo.applicationInfo != null) {
|
||
|
Bundle bundle = (Bundle) PackageItemInfo.class.getField("metaData").get(packageInfo.applicationInfo);
|
||
|
if (bundle != null) {
|
||
|
return bundle.getInt("com.google.android.gms.version", -1);
|
||
|
}
|
||
|
}
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
public static PackageInfo getPackageInfo(Context context, String str) {
|
||
|
try {
|
||
|
return Wrappers.packageManager(context).getPackageInfo(str, 128);
|
||
|
} catch (PackageManager.NameNotFoundException unused) {
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static boolean isPackageSide() {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
private ClientLibraryUtils() {
|
||
|
}
|
||
|
}
|