Initial commit
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package com.google.android.gms.common.wrappers;
|
||||
|
||||
import android.content.Context;
|
||||
import com.google.android.gms.common.util.PlatformVersion;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class InstantApps {
|
||||
private static Context a;
|
||||
private static Boolean b;
|
||||
|
||||
public static synchronized boolean a(Context context) {
|
||||
synchronized (InstantApps.class) {
|
||||
Context applicationContext = context.getApplicationContext();
|
||||
if (a != null && b != null && a == applicationContext) {
|
||||
return b.booleanValue();
|
||||
}
|
||||
b = null;
|
||||
if (PlatformVersion.i()) {
|
||||
b = Boolean.valueOf(applicationContext.getPackageManager().isInstantApp());
|
||||
} else {
|
||||
try {
|
||||
context.getClassLoader().loadClass("com.google.android.instantapps.supervisor.InstantAppsRuntime");
|
||||
b = true;
|
||||
} catch (ClassNotFoundException unused) {
|
||||
b = false;
|
||||
}
|
||||
}
|
||||
a = applicationContext;
|
||||
return b.booleanValue();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,76 @@
|
||||
package com.google.android.gms.common.wrappers;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.AppOpsManager;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Binder;
|
||||
import android.os.Process;
|
||||
import com.google.android.gms.common.util.PlatformVersion;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class PackageManagerWrapper {
|
||||
private final Context a;
|
||||
|
||||
public PackageManagerWrapper(Context context) {
|
||||
this.a = context;
|
||||
}
|
||||
|
||||
public ApplicationInfo a(String str, int i) throws PackageManager.NameNotFoundException {
|
||||
return this.a.getPackageManager().getApplicationInfo(str, i);
|
||||
}
|
||||
|
||||
public PackageInfo b(String str, int i) throws PackageManager.NameNotFoundException {
|
||||
return this.a.getPackageManager().getPackageInfo(str, i);
|
||||
}
|
||||
|
||||
public final PackageInfo a(String str, int i, int i2) throws PackageManager.NameNotFoundException {
|
||||
return this.a.getPackageManager().getPackageInfo(str, 64);
|
||||
}
|
||||
|
||||
public CharSequence b(String str) throws PackageManager.NameNotFoundException {
|
||||
return this.a.getPackageManager().getApplicationLabel(this.a.getPackageManager().getApplicationInfo(str, 0));
|
||||
}
|
||||
|
||||
public final String[] a(int i) {
|
||||
return this.a.getPackageManager().getPackagesForUid(i);
|
||||
}
|
||||
|
||||
@TargetApi(19)
|
||||
public final boolean a(int i, String str) {
|
||||
if (PlatformVersion.e()) {
|
||||
try {
|
||||
((AppOpsManager) this.a.getSystemService("appops")).checkPackage(i, str);
|
||||
return true;
|
||||
} catch (SecurityException unused) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
String[] packagesForUid = this.a.getPackageManager().getPackagesForUid(i);
|
||||
if (str != null && packagesForUid != null) {
|
||||
for (String str2 : packagesForUid) {
|
||||
if (str.equals(str2)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int a(String str) {
|
||||
return this.a.checkCallingOrSelfPermission(str);
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
String nameForUid;
|
||||
if (Binder.getCallingUid() == Process.myUid()) {
|
||||
return InstantApps.a(this.a);
|
||||
}
|
||||
if (!PlatformVersion.i() || (nameForUid = this.a.getPackageManager().getNameForUid(Binder.getCallingUid())) == null) {
|
||||
return false;
|
||||
}
|
||||
return this.a.getPackageManager().isInstantApp(nameForUid);
|
||||
}
|
||||
}
|
23
sources/com/google/android/gms/common/wrappers/Wrappers.java
Normal file
23
sources/com/google/android/gms/common/wrappers/Wrappers.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package com.google.android.gms.common.wrappers;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Wrappers {
|
||||
private static Wrappers b = new Wrappers();
|
||||
private PackageManagerWrapper a = null;
|
||||
|
||||
public static PackageManagerWrapper a(Context context) {
|
||||
return b.b(context);
|
||||
}
|
||||
|
||||
private final synchronized PackageManagerWrapper b(Context context) {
|
||||
if (this.a == null) {
|
||||
if (context.getApplicationContext() != null) {
|
||||
context = context.getApplicationContext();
|
||||
}
|
||||
this.a = new PackageManagerWrapper(context);
|
||||
}
|
||||
return this.a;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user