mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-26 17:12:31 -06:00
195 lines
8.1 KiB
Java
195 lines
8.1 KiB
Java
|
package androidx.profileinstaller;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.content.pm.PackageInfo;
|
||
|
import android.content.pm.PackageManager;
|
||
|
import android.os.Build;
|
||
|
import androidx.concurrent.futures.ResolvableFuture;
|
||
|
import com.google.common.util.concurrent.ListenableFuture;
|
||
|
import java.io.DataInputStream;
|
||
|
import java.io.DataOutputStream;
|
||
|
import java.io.File;
|
||
|
import java.io.FileInputStream;
|
||
|
import java.io.FileOutputStream;
|
||
|
import java.io.IOException;
|
||
|
import java.lang.annotation.Retention;
|
||
|
import java.lang.annotation.RetentionPolicy;
|
||
|
import java.util.Objects;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public final class ProfileVerifier {
|
||
|
private static final String CUR_PROFILES_BASE_DIR = "/data/misc/profiles/cur/0/";
|
||
|
private static final String PROFILE_FILE_NAME = "primary.prof";
|
||
|
private static final String PROFILE_INSTALLED_CACHE_FILE_NAME = "profileInstalled";
|
||
|
private static final String REF_PROFILES_BASE_DIR = "/data/misc/profiles/ref/";
|
||
|
private static final String TAG = "ProfileVerifier";
|
||
|
private static final ResolvableFuture<CompilationStatus> sFuture = ResolvableFuture.create();
|
||
|
private static final Object SYNC_OBJ = new Object();
|
||
|
private static CompilationStatus sCompilationStatus = null;
|
||
|
|
||
|
public static ListenableFuture<CompilationStatus> getCompilationStatusAsync() {
|
||
|
return sFuture;
|
||
|
}
|
||
|
|
||
|
private ProfileVerifier() {
|
||
|
}
|
||
|
|
||
|
public static CompilationStatus writeProfileVerification(Context context) {
|
||
|
return writeProfileVerification(context, false);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* JADX WARN: Can't wrap try/catch for region: R(16:19|20|21|(2:58|59)(1:23)|24|(8:31|(1:35)|(1:42)|43|(2:50|51)|47|48|49)|(1:57)|(1:35)|(3:37|40|42)|43|(1:45)|50|51|47|48|49) */
|
||
|
/* JADX WARN: Code restructure failed: missing block: B:53:0x00c4, code lost:
|
||
|
|
||
|
r6 = androidx.profileinstaller.ProfileVerifier.CompilationStatus.RESULT_CODE_ERROR_CANT_WRITE_PROFILE_VERIFICATION_RESULT_CACHE_FILE;
|
||
|
*/
|
||
|
/* JADX WARN: Code restructure failed: missing block: B:55:0x0095, code lost:
|
||
|
|
||
|
r6 = 1;
|
||
|
*/
|
||
|
/*
|
||
|
Code decompiled incorrectly, please refer to instructions dump.
|
||
|
To view partially-correct add '--show-bad-code' argument
|
||
|
*/
|
||
|
public static androidx.profileinstaller.ProfileVerifier.CompilationStatus writeProfileVerification(android.content.Context r18, boolean r19) {
|
||
|
/*
|
||
|
Method dump skipped, instructions count: 214
|
||
|
To view this dump add '--comments-level debug' option
|
||
|
*/
|
||
|
throw new UnsupportedOperationException("Method not decompiled: androidx.profileinstaller.ProfileVerifier.writeProfileVerification(android.content.Context, boolean):androidx.profileinstaller.ProfileVerifier$CompilationStatus");
|
||
|
}
|
||
|
|
||
|
private static CompilationStatus setCompilationStatus(int i, boolean z, boolean z2) {
|
||
|
CompilationStatus compilationStatus = new CompilationStatus(i, z, z2);
|
||
|
sCompilationStatus = compilationStatus;
|
||
|
sFuture.set(compilationStatus);
|
||
|
return sCompilationStatus;
|
||
|
}
|
||
|
|
||
|
private static long getPackageLastUpdateTime(Context context) throws PackageManager.NameNotFoundException {
|
||
|
PackageManager packageManager = context.getApplicationContext().getPackageManager();
|
||
|
if (Build.VERSION.SDK_INT >= 33) {
|
||
|
return Api33Impl.getPackageInfo(packageManager, context).lastUpdateTime;
|
||
|
}
|
||
|
return packageManager.getPackageInfo(context.getPackageName(), 0).lastUpdateTime;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* loaded from: classes2.dex */
|
||
|
public static class Cache {
|
||
|
private static final int SCHEMA = 1;
|
||
|
final long mInstalledCurrentProfileSize;
|
||
|
final long mPackageLastUpdateTime;
|
||
|
final int mResultCode;
|
||
|
final int mSchema;
|
||
|
|
||
|
Cache(int i, int i2, long j, long j2) {
|
||
|
this.mSchema = i;
|
||
|
this.mResultCode = i2;
|
||
|
this.mPackageLastUpdateTime = j;
|
||
|
this.mInstalledCurrentProfileSize = j2;
|
||
|
}
|
||
|
|
||
|
public boolean equals(Object obj) {
|
||
|
if (this == obj) {
|
||
|
return true;
|
||
|
}
|
||
|
if (obj == null || !(obj instanceof Cache)) {
|
||
|
return false;
|
||
|
}
|
||
|
Cache cache = (Cache) obj;
|
||
|
return this.mResultCode == cache.mResultCode && this.mPackageLastUpdateTime == cache.mPackageLastUpdateTime && this.mSchema == cache.mSchema && this.mInstalledCurrentProfileSize == cache.mInstalledCurrentProfileSize;
|
||
|
}
|
||
|
|
||
|
public int hashCode() {
|
||
|
return Objects.hash(Integer.valueOf(this.mResultCode), Long.valueOf(this.mPackageLastUpdateTime), Integer.valueOf(this.mSchema), Long.valueOf(this.mInstalledCurrentProfileSize));
|
||
|
}
|
||
|
|
||
|
void writeOnFile(File file) throws IOException {
|
||
|
file.delete();
|
||
|
DataOutputStream dataOutputStream = new DataOutputStream(new FileOutputStream(file));
|
||
|
try {
|
||
|
dataOutputStream.writeInt(this.mSchema);
|
||
|
dataOutputStream.writeInt(this.mResultCode);
|
||
|
dataOutputStream.writeLong(this.mPackageLastUpdateTime);
|
||
|
dataOutputStream.writeLong(this.mInstalledCurrentProfileSize);
|
||
|
dataOutputStream.close();
|
||
|
} catch (Throwable th) {
|
||
|
try {
|
||
|
dataOutputStream.close();
|
||
|
} catch (Throwable th2) {
|
||
|
th.addSuppressed(th2);
|
||
|
}
|
||
|
throw th;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static Cache readFromFile(File file) throws IOException {
|
||
|
DataInputStream dataInputStream = new DataInputStream(new FileInputStream(file));
|
||
|
try {
|
||
|
Cache cache = new Cache(dataInputStream.readInt(), dataInputStream.readInt(), dataInputStream.readLong(), dataInputStream.readLong());
|
||
|
dataInputStream.close();
|
||
|
return cache;
|
||
|
} catch (Throwable th) {
|
||
|
try {
|
||
|
dataInputStream.close();
|
||
|
} catch (Throwable th2) {
|
||
|
th.addSuppressed(th2);
|
||
|
}
|
||
|
throw th;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public static class CompilationStatus {
|
||
|
public static final int RESULT_CODE_COMPILED_WITH_PROFILE = 1;
|
||
|
public static final int RESULT_CODE_COMPILED_WITH_PROFILE_NON_MATCHING = 3;
|
||
|
public static final int RESULT_CODE_ERROR_CACHE_FILE_EXISTS_BUT_CANNOT_BE_READ = 131072;
|
||
|
public static final int RESULT_CODE_ERROR_CANT_WRITE_PROFILE_VERIFICATION_RESULT_CACHE_FILE = 196608;
|
||
|
private static final int RESULT_CODE_ERROR_CODE_BIT_SHIFT = 16;
|
||
|
public static final int RESULT_CODE_ERROR_PACKAGE_NAME_DOES_NOT_EXIST = 65536;
|
||
|
public static final int RESULT_CODE_ERROR_UNSUPPORTED_API_VERSION = 262144;
|
||
|
public static final int RESULT_CODE_NO_PROFILE = 0;
|
||
|
public static final int RESULT_CODE_PROFILE_ENQUEUED_FOR_COMPILATION = 2;
|
||
|
private final boolean mHasCurrentProfile;
|
||
|
private final boolean mHasReferenceProfile;
|
||
|
final int mResultCode;
|
||
|
|
||
|
@Retention(RetentionPolicy.SOURCE)
|
||
|
/* loaded from: classes2.dex */
|
||
|
public @interface ResultCode {
|
||
|
}
|
||
|
|
||
|
public int getProfileInstallResultCode() {
|
||
|
return this.mResultCode;
|
||
|
}
|
||
|
|
||
|
public boolean hasProfileEnqueuedForCompilation() {
|
||
|
return this.mHasCurrentProfile;
|
||
|
}
|
||
|
|
||
|
public boolean isCompiledWithProfile() {
|
||
|
return this.mHasReferenceProfile;
|
||
|
}
|
||
|
|
||
|
CompilationStatus(int i, boolean z, boolean z2) {
|
||
|
this.mResultCode = i;
|
||
|
this.mHasCurrentProfile = z2;
|
||
|
this.mHasReferenceProfile = z;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
/* loaded from: classes2.dex */
|
||
|
public static class Api33Impl {
|
||
|
private Api33Impl() {
|
||
|
}
|
||
|
|
||
|
static PackageInfo getPackageInfo(PackageManager packageManager, Context context) throws PackageManager.NameNotFoundException {
|
||
|
return packageManager.getPackageInfo(context.getPackageName(), PackageManager.PackageInfoFlags.of(0L));
|
||
|
}
|
||
|
}
|
||
|
}
|