Initial import of ADIF API reverse-engineering toolkit
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package com.google.android.gms.common.wrappers;
|
||||
|
||||
import android.content.Context;
|
||||
import com.google.android.gms.common.annotation.KeepForSdk;
|
||||
import com.google.android.gms.common.util.PlatformVersion;
|
||||
|
||||
@KeepForSdk
|
||||
/* loaded from: classes3.dex */
|
||||
public class InstantApps {
|
||||
private static Context zza;
|
||||
private static Boolean zzb;
|
||||
|
||||
@KeepForSdk
|
||||
public static synchronized boolean isInstantApp(Context context) {
|
||||
Boolean bool;
|
||||
synchronized (InstantApps.class) {
|
||||
Context applicationContext = context.getApplicationContext();
|
||||
Context context2 = zza;
|
||||
if (context2 != null && (bool = zzb) != null && context2 == applicationContext) {
|
||||
return bool.booleanValue();
|
||||
}
|
||||
zzb = null;
|
||||
if (PlatformVersion.isAtLeastO()) {
|
||||
zzb = Boolean.valueOf(applicationContext.getPackageManager().isInstantApp());
|
||||
} else {
|
||||
try {
|
||||
context.getClassLoader().loadClass("com.google.android.instantapps.supervisor.InstantAppsRuntime");
|
||||
zzb = Boolean.TRUE;
|
||||
} catch (ClassNotFoundException unused) {
|
||||
zzb = Boolean.FALSE;
|
||||
}
|
||||
}
|
||||
zza = applicationContext;
|
||||
return zzb.booleanValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.google.android.gms.common.wrappers;
|
||||
|
||||
import N.b;
|
||||
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.annotation.KeepForSdk;
|
||||
import com.google.android.gms.common.util.PlatformVersion;
|
||||
|
||||
@KeepForSdk
|
||||
/* loaded from: classes3.dex */
|
||||
public class PackageManagerWrapper {
|
||||
protected final Context zza;
|
||||
|
||||
public PackageManagerWrapper(Context context) {
|
||||
this.zza = context;
|
||||
}
|
||||
|
||||
@KeepForSdk
|
||||
public int checkCallingOrSelfPermission(String str) {
|
||||
return this.zza.checkCallingOrSelfPermission(str);
|
||||
}
|
||||
|
||||
@KeepForSdk
|
||||
public int checkPermission(String str, String str2) {
|
||||
return this.zza.getPackageManager().checkPermission(str, str2);
|
||||
}
|
||||
|
||||
@KeepForSdk
|
||||
public ApplicationInfo getApplicationInfo(String str, int i) throws PackageManager.NameNotFoundException {
|
||||
return this.zza.getPackageManager().getApplicationInfo(str, i);
|
||||
}
|
||||
|
||||
@KeepForSdk
|
||||
public CharSequence getApplicationLabel(String str) throws PackageManager.NameNotFoundException {
|
||||
return this.zza.getPackageManager().getApplicationLabel(this.zza.getPackageManager().getApplicationInfo(str, 0));
|
||||
}
|
||||
|
||||
@KeepForSdk
|
||||
public b getApplicationLabelAndIcon(String str) throws PackageManager.NameNotFoundException {
|
||||
ApplicationInfo applicationInfo = this.zza.getPackageManager().getApplicationInfo(str, 0);
|
||||
return new b(this.zza.getPackageManager().getApplicationLabel(applicationInfo), this.zza.getPackageManager().getApplicationIcon(applicationInfo));
|
||||
}
|
||||
|
||||
@KeepForSdk
|
||||
public PackageInfo getPackageInfo(String str, int i) throws PackageManager.NameNotFoundException {
|
||||
return this.zza.getPackageManager().getPackageInfo(str, i);
|
||||
}
|
||||
|
||||
@KeepForSdk
|
||||
public boolean isCallerInstantApp() {
|
||||
String nameForUid;
|
||||
if (Binder.getCallingUid() == Process.myUid()) {
|
||||
return InstantApps.isInstantApp(this.zza);
|
||||
}
|
||||
if (!PlatformVersion.isAtLeastO() || (nameForUid = this.zza.getPackageManager().getNameForUid(Binder.getCallingUid())) == null) {
|
||||
return false;
|
||||
}
|
||||
return this.zza.getPackageManager().isInstantApp(nameForUid);
|
||||
}
|
||||
|
||||
@TargetApi(19)
|
||||
public final boolean zza(int i, String str) {
|
||||
if (PlatformVersion.isAtLeastKitKat()) {
|
||||
try {
|
||||
AppOpsManager appOpsManager = (AppOpsManager) this.zza.getSystemService("appops");
|
||||
if (appOpsManager == null) {
|
||||
throw new NullPointerException("context.getSystemService(Context.APP_OPS_SERVICE) is null");
|
||||
}
|
||||
appOpsManager.checkPackage(i, str);
|
||||
return true;
|
||||
} catch (SecurityException unused) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
String[] packagesForUid = this.zza.getPackageManager().getPackagesForUid(i);
|
||||
if (str != null && packagesForUid != null) {
|
||||
for (String str2 : packagesForUid) {
|
||||
if (str.equals(str2)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.google.android.gms.common.wrappers;
|
||||
|
||||
import android.content.Context;
|
||||
import com.google.android.gms.common.annotation.KeepForSdk;
|
||||
import com.google.android.gms.common.util.VisibleForTesting;
|
||||
|
||||
@KeepForSdk
|
||||
/* loaded from: classes3.dex */
|
||||
public class Wrappers {
|
||||
private static Wrappers zza = new Wrappers();
|
||||
private PackageManagerWrapper zzb = null;
|
||||
|
||||
@KeepForSdk
|
||||
public static PackageManagerWrapper packageManager(Context context) {
|
||||
return zza.zza(context);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public final synchronized PackageManagerWrapper zza(Context context) {
|
||||
try {
|
||||
if (this.zzb == null) {
|
||||
if (context.getApplicationContext() != null) {
|
||||
context = context.getApplicationContext();
|
||||
}
|
||||
this.zzb = new PackageManagerWrapper(context);
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
throw th;
|
||||
}
|
||||
return this.zzb;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user