Add Discord community version (64-bit only)

- Added realracing3-community.apk (71.57 MB)
- Removed 32-bit support (armeabi-v7a)
- Only includes arm64-v8a libraries
- Decompiled source code included
- Added README-community.md with analysis
This commit is contained in:
2026-02-18 15:48:36 -08:00
parent c19eb3d7ff
commit c080f0d97f
26930 changed files with 2529574 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
package androidx.work.impl.background.greedy;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.work.Clock;
import androidx.work.Logger;
import androidx.work.RunnableScheduler;
import androidx.work.impl.Scheduler;
import androidx.work.impl.model.WorkSpec;
import java.util.HashMap;
import java.util.Map;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes.dex */
public class DelayedWorkTracker {
static final String TAG = Logger.tagWithPrefix("DelayedWorkTracker");
private final Clock mClock;
final Scheduler mImmediateScheduler;
private final RunnableScheduler mRunnableScheduler;
private final Map<String, Runnable> mRunnables = new HashMap();
public DelayedWorkTracker(@NonNull Scheduler scheduler, @NonNull RunnableScheduler runnableScheduler, @NonNull Clock clock) {
this.mImmediateScheduler = scheduler;
this.mRunnableScheduler = runnableScheduler;
this.mClock = clock;
}
public void schedule(@NonNull final WorkSpec workSpec, long j) {
Runnable remove = this.mRunnables.remove(workSpec.id);
if (remove != null) {
this.mRunnableScheduler.cancel(remove);
}
Runnable runnable = new Runnable() { // from class: androidx.work.impl.background.greedy.DelayedWorkTracker.1
@Override // java.lang.Runnable
public void run() {
Logger.get().debug(DelayedWorkTracker.TAG, "Scheduling work " + workSpec.id);
DelayedWorkTracker.this.mImmediateScheduler.schedule(workSpec);
}
};
this.mRunnables.put(workSpec.id, runnable);
this.mRunnableScheduler.scheduleWithDelay(j - this.mClock.currentTimeMillis(), runnable);
}
public void unschedule(@NonNull String str) {
Runnable remove = this.mRunnables.remove(str);
if (remove != null) {
this.mRunnableScheduler.cancel(remove);
}
}
}

View File

@@ -0,0 +1,242 @@
package androidx.work.impl.background.greedy;
import android.content.Context;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import androidx.work.Configuration;
import androidx.work.Constraints;
import androidx.work.Logger;
import androidx.work.RunnableScheduler;
import androidx.work.WorkInfo;
import androidx.work.WorkRequest;
import androidx.work.impl.ExecutionListener;
import androidx.work.impl.Processor;
import androidx.work.impl.Scheduler;
import androidx.work.impl.StartStopToken;
import androidx.work.impl.StartStopTokens;
import androidx.work.impl.WorkLauncher;
import androidx.work.impl.constraints.ConstraintsState;
import androidx.work.impl.constraints.OnConstraintsStateChangedListener;
import androidx.work.impl.constraints.WorkConstraintsTracker;
import androidx.work.impl.constraints.WorkConstraintsTrackerKt;
import androidx.work.impl.constraints.trackers.Trackers;
import androidx.work.impl.model.WorkGenerationalId;
import androidx.work.impl.model.WorkSpec;
import androidx.work.impl.model.WorkSpecKt;
import androidx.work.impl.utils.ProcessUtils;
import androidx.work.impl.utils.taskexecutor.TaskExecutor;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import kotlinx.coroutines.Job;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes.dex */
public class GreedyScheduler implements Scheduler, OnConstraintsStateChangedListener, ExecutionListener {
private static final int NON_THROTTLE_RUN_ATTEMPT_COUNT = 5;
private static final String TAG = Logger.tagWithPrefix("GreedyScheduler");
private final Configuration mConfiguration;
private final WorkConstraintsTracker mConstraintsTracker;
private final Context mContext;
private DelayedWorkTracker mDelayedWorkTracker;
Boolean mInDefaultProcess;
private final Processor mProcessor;
private boolean mRegisteredExecutionListener;
private final TaskExecutor mTaskExecutor;
private final TimeLimiter mTimeLimiter;
private final WorkLauncher mWorkLauncher;
private final Map<WorkGenerationalId, Job> mConstrainedWorkSpecs = new HashMap();
private final Object mLock = new Object();
private final StartStopTokens mStartStopTokens = StartStopTokens.create();
private final Map<WorkGenerationalId, AttemptData> mFirstRunAttempts = new HashMap();
@Override // androidx.work.impl.Scheduler
public boolean hasLimitedSchedulingSlots() {
return false;
}
@VisibleForTesting
public void setDelayedWorkTracker(@NonNull DelayedWorkTracker delayedWorkTracker) {
this.mDelayedWorkTracker = delayedWorkTracker;
}
public GreedyScheduler(@NonNull Context context, @NonNull Configuration configuration, @NonNull Trackers trackers, @NonNull Processor processor, @NonNull WorkLauncher workLauncher, @NonNull TaskExecutor taskExecutor) {
this.mContext = context;
RunnableScheduler runnableScheduler = configuration.getRunnableScheduler();
this.mDelayedWorkTracker = new DelayedWorkTracker(this, runnableScheduler, configuration.getClock());
this.mTimeLimiter = new TimeLimiter(runnableScheduler, workLauncher);
this.mTaskExecutor = taskExecutor;
this.mConstraintsTracker = new WorkConstraintsTracker(trackers);
this.mConfiguration = configuration;
this.mProcessor = processor;
this.mWorkLauncher = workLauncher;
}
@Override // androidx.work.impl.Scheduler
public void schedule(@NonNull WorkSpec... workSpecArr) {
if (this.mInDefaultProcess == null) {
checkDefaultProcess();
}
if (!this.mInDefaultProcess.booleanValue()) {
Logger.get().info(TAG, "Ignoring schedule request in a secondary process");
return;
}
registerExecutionListenerIfNeeded();
HashSet<WorkSpec> hashSet = new HashSet();
HashSet hashSet2 = new HashSet();
for (WorkSpec workSpec : workSpecArr) {
if (!this.mStartStopTokens.contains(WorkSpecKt.generationalId(workSpec))) {
long max = Math.max(workSpec.calculateNextRunTime(), throttleIfNeeded(workSpec));
long currentTimeMillis = this.mConfiguration.getClock().currentTimeMillis();
if (workSpec.state == WorkInfo.State.ENQUEUED) {
if (currentTimeMillis < max) {
DelayedWorkTracker delayedWorkTracker = this.mDelayedWorkTracker;
if (delayedWorkTracker != null) {
delayedWorkTracker.schedule(workSpec, max);
}
} else if (workSpec.hasConstraints()) {
Constraints constraints = workSpec.constraints;
if (constraints.requiresDeviceIdle()) {
Logger.get().debug(TAG, "Ignoring " + workSpec + ". Requires device idle.");
} else if (constraints.hasContentUriTriggers()) {
Logger.get().debug(TAG, "Ignoring " + workSpec + ". Requires ContentUri triggers.");
} else {
hashSet.add(workSpec);
hashSet2.add(workSpec.id);
}
} else if (!this.mStartStopTokens.contains(WorkSpecKt.generationalId(workSpec))) {
Logger.get().debug(TAG, "Starting work for " + workSpec.id);
StartStopToken startStopToken = this.mStartStopTokens.tokenFor(workSpec);
this.mTimeLimiter.track(startStopToken);
this.mWorkLauncher.startWork(startStopToken);
}
}
}
}
synchronized (this.mLock) {
try {
if (!hashSet.isEmpty()) {
Logger.get().debug(TAG, "Starting tracking for " + TextUtils.join(",", hashSet2));
for (WorkSpec workSpec2 : hashSet) {
WorkGenerationalId generationalId = WorkSpecKt.generationalId(workSpec2);
if (!this.mConstrainedWorkSpecs.containsKey(generationalId)) {
this.mConstrainedWorkSpecs.put(generationalId, WorkConstraintsTrackerKt.listen(this.mConstraintsTracker, workSpec2, this.mTaskExecutor.getTaskCoroutineDispatcher(), this));
}
}
}
} catch (Throwable th) {
throw th;
}
}
}
private void checkDefaultProcess() {
this.mInDefaultProcess = Boolean.valueOf(ProcessUtils.isDefaultProcess(this.mContext, this.mConfiguration));
}
@Override // androidx.work.impl.Scheduler
public void cancel(@NonNull String str) {
if (this.mInDefaultProcess == null) {
checkDefaultProcess();
}
if (!this.mInDefaultProcess.booleanValue()) {
Logger.get().info(TAG, "Ignoring schedule request in non-main process");
return;
}
registerExecutionListenerIfNeeded();
Logger.get().debug(TAG, "Cancelling work ID " + str);
DelayedWorkTracker delayedWorkTracker = this.mDelayedWorkTracker;
if (delayedWorkTracker != null) {
delayedWorkTracker.unschedule(str);
}
for (StartStopToken startStopToken : this.mStartStopTokens.remove(str)) {
this.mTimeLimiter.cancel(startStopToken);
this.mWorkLauncher.stopWork(startStopToken);
}
}
@Override // androidx.work.impl.constraints.OnConstraintsStateChangedListener
public void onConstraintsStateChanged(@NonNull WorkSpec workSpec, @NonNull ConstraintsState constraintsState) {
WorkGenerationalId generationalId = WorkSpecKt.generationalId(workSpec);
if (constraintsState instanceof ConstraintsState.ConstraintsMet) {
if (this.mStartStopTokens.contains(generationalId)) {
return;
}
Logger.get().debug(TAG, "Constraints met: Scheduling work ID " + generationalId);
StartStopToken startStopToken = this.mStartStopTokens.tokenFor(generationalId);
this.mTimeLimiter.track(startStopToken);
this.mWorkLauncher.startWork(startStopToken);
return;
}
Logger.get().debug(TAG, "Constraints not met: Cancelling work ID " + generationalId);
StartStopToken remove = this.mStartStopTokens.remove(generationalId);
if (remove != null) {
this.mTimeLimiter.cancel(remove);
this.mWorkLauncher.stopWorkWithReason(remove, ((ConstraintsState.ConstraintsNotMet) constraintsState).getReason());
}
}
@Override // androidx.work.impl.ExecutionListener
public void onExecuted(@NonNull WorkGenerationalId workGenerationalId, boolean z) {
StartStopToken remove = this.mStartStopTokens.remove(workGenerationalId);
if (remove != null) {
this.mTimeLimiter.cancel(remove);
}
removeConstraintTrackingFor(workGenerationalId);
if (z) {
return;
}
synchronized (this.mLock) {
this.mFirstRunAttempts.remove(workGenerationalId);
}
}
private void removeConstraintTrackingFor(@NonNull WorkGenerationalId workGenerationalId) {
Job remove;
synchronized (this.mLock) {
remove = this.mConstrainedWorkSpecs.remove(workGenerationalId);
}
if (remove != null) {
Logger.get().debug(TAG, "Stopping tracking for " + workGenerationalId);
remove.cancel(null);
}
}
private void registerExecutionListenerIfNeeded() {
if (this.mRegisteredExecutionListener) {
return;
}
this.mProcessor.addExecutionListener(this);
this.mRegisteredExecutionListener = true;
}
private long throttleIfNeeded(WorkSpec workSpec) {
long max;
synchronized (this.mLock) {
try {
WorkGenerationalId generationalId = WorkSpecKt.generationalId(workSpec);
AttemptData attemptData = this.mFirstRunAttempts.get(generationalId);
if (attemptData == null) {
attemptData = new AttemptData(workSpec.runAttemptCount, this.mConfiguration.getClock().currentTimeMillis());
this.mFirstRunAttempts.put(generationalId, attemptData);
}
max = attemptData.mTimeStamp + (Math.max((workSpec.runAttemptCount - attemptData.mRunAttemptCount) - 5, 0) * WorkRequest.DEFAULT_BACKOFF_DELAY_MILLIS);
} catch (Throwable th) {
throw th;
}
}
return max;
}
public static class AttemptData {
final int mRunAttemptCount;
final long mTimeStamp;
private AttemptData(int i, long j) {
this.mRunAttemptCount = i;
this.mTimeStamp = j;
}
}
}

View File

@@ -0,0 +1,72 @@
package androidx.work.impl.background.greedy;
import androidx.work.RunnableScheduler;
import androidx.work.impl.StartStopToken;
import androidx.work.impl.WorkLauncher;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
@SourceDebugExtension({"SMAP\nTimeLimiter.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TimeLimiter.kt\nandroidx/work/impl/background/greedy/TimeLimiter\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,45:1\n1#2:46\n*E\n"})
/* loaded from: classes.dex */
public final class TimeLimiter {
private final WorkLauncher launcher;
private final Object lock;
private final RunnableScheduler runnableScheduler;
private final long timeoutMs;
private final Map<StartStopToken, Runnable> tracked;
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public TimeLimiter(RunnableScheduler runnableScheduler, WorkLauncher launcher) {
this(runnableScheduler, launcher, 0L, 4, null);
Intrinsics.checkNotNullParameter(runnableScheduler, "runnableScheduler");
Intrinsics.checkNotNullParameter(launcher, "launcher");
}
public TimeLimiter(RunnableScheduler runnableScheduler, WorkLauncher launcher, long j) {
Intrinsics.checkNotNullParameter(runnableScheduler, "runnableScheduler");
Intrinsics.checkNotNullParameter(launcher, "launcher");
this.runnableScheduler = runnableScheduler;
this.launcher = launcher;
this.timeoutMs = j;
this.lock = new Object();
this.tracked = new LinkedHashMap();
}
public /* synthetic */ TimeLimiter(RunnableScheduler runnableScheduler, WorkLauncher workLauncher, long j, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(runnableScheduler, workLauncher, (i & 4) != 0 ? TimeUnit.MINUTES.toMillis(90L) : j);
}
/* JADX INFO: Access modifiers changed from: private */
public static final void track$lambda$0(TimeLimiter timeLimiter, StartStopToken startStopToken) {
timeLimiter.launcher.stopWork(startStopToken, 3);
}
public final void track(final StartStopToken token) {
Intrinsics.checkNotNullParameter(token, "token");
Runnable runnable = new Runnable() { // from class: androidx.work.impl.background.greedy.TimeLimiter$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
TimeLimiter.track$lambda$0(TimeLimiter.this, token);
}
};
synchronized (this.lock) {
this.tracked.put(token, runnable);
}
this.runnableScheduler.scheduleWithDelay(this.timeoutMs, runnable);
}
public final void cancel(StartStopToken token) {
Runnable remove;
Intrinsics.checkNotNullParameter(token, "token");
synchronized (this.lock) {
remove = this.tracked.remove(token);
}
if (remove != null) {
this.runnableScheduler.cancel(remove);
}
}
}