SRE/02-Easy5/E5/sources/androidx/profileinstaller/ProfileInstallerInitializer.java
2025-03-31 16:33:42 +02:00

100 lines
3.7 KiB
Java

package androidx.profileinstaller;
import android.content.Context;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.view.Choreographer;
import androidx.startup.Initializer;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/* loaded from: classes.dex */
public class ProfileInstallerInitializer implements Initializer<Result> {
private static final int DELAY_MS = 5000;
public static class Result {
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // androidx.startup.Initializer
public Result create(Context context) {
if (Build.VERSION.SDK_INT < 24) {
return new Result();
}
delayAfterFirstFrame(context.getApplicationContext());
return new Result();
}
void delayAfterFirstFrame(final Context context) {
Choreographer16Impl.postFrameCallback(new Runnable() { // from class: androidx.profileinstaller.ProfileInstallerInitializer$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
ProfileInstallerInitializer.this.m170xfbd6c934(context);
}
});
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: installAfterDelay, reason: merged with bridge method [inline-methods] */
public void m170xfbd6c934(final Context context) {
Handler handler;
if (Build.VERSION.SDK_INT >= 28) {
handler = Handler28Impl.createAsync(Looper.getMainLooper());
} else {
handler = new Handler(Looper.getMainLooper());
}
handler.postDelayed(new Runnable() { // from class: androidx.profileinstaller.ProfileInstallerInitializer$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
ProfileInstallerInitializer.writeInBackground(context);
}
}, new Random().nextInt(Math.max(1000, 1)) + DELAY_MS);
}
@Override // androidx.startup.Initializer
public List<Class<? extends Initializer<?>>> dependencies() {
return Collections.emptyList();
}
/* JADX INFO: Access modifiers changed from: private */
public static void writeInBackground(final Context context) {
new ThreadPoolExecutor(0, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue()).execute(new Runnable() { // from class: androidx.profileinstaller.ProfileInstallerInitializer$$ExternalSyntheticLambda2
@Override // java.lang.Runnable
public final void run() {
ProfileInstaller.writeProfile(context);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
static class Choreographer16Impl {
private Choreographer16Impl() {
}
public static void postFrameCallback(final Runnable runnable) {
Choreographer.getInstance().postFrameCallback(new Choreographer.FrameCallback() { // from class: androidx.profileinstaller.ProfileInstallerInitializer$Choreographer16Impl$$ExternalSyntheticLambda0
@Override // android.view.Choreographer.FrameCallback
public final void doFrame(long j) {
runnable.run();
}
});
}
}
private static class Handler28Impl {
private Handler28Impl() {
}
public static Handler createAsync(Looper looper) {
Handler createAsync;
createAsync = Handler.createAsync(looper);
return createAsync;
}
}
}