- 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
54 lines
2.5 KiB
Java
54 lines
2.5 KiB
Java
package androidx.work.impl.background.systemalarm;
|
|
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.RestrictTo;
|
|
import androidx.annotation.WorkerThread;
|
|
import androidx.work.Clock;
|
|
import androidx.work.Logger;
|
|
import androidx.work.impl.background.systemalarm.SystemAlarmDispatcher;
|
|
import androidx.work.impl.constraints.WorkConstraintsTracker;
|
|
import androidx.work.impl.model.WorkSpec;
|
|
import androidx.work.impl.model.WorkSpecKt;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
|
/* loaded from: classes.dex */
|
|
class ConstraintsCommandHandler {
|
|
private static final String TAG = Logger.tagWithPrefix("ConstraintsCmdHandler");
|
|
private final Clock mClock;
|
|
private final Context mContext;
|
|
private final SystemAlarmDispatcher mDispatcher;
|
|
private final int mStartId;
|
|
private final WorkConstraintsTracker mWorkConstraintsTracker;
|
|
|
|
public ConstraintsCommandHandler(@NonNull Context context, Clock clock, int i, @NonNull SystemAlarmDispatcher systemAlarmDispatcher) {
|
|
this.mContext = context;
|
|
this.mClock = clock;
|
|
this.mStartId = i;
|
|
this.mDispatcher = systemAlarmDispatcher;
|
|
this.mWorkConstraintsTracker = new WorkConstraintsTracker(systemAlarmDispatcher.getWorkManager().getTrackers());
|
|
}
|
|
|
|
@WorkerThread
|
|
public void handleConstraintsChanged() {
|
|
List<WorkSpec> scheduledWork = this.mDispatcher.getWorkManager().getWorkDatabase().workSpecDao().getScheduledWork();
|
|
ConstraintProxy.updateAll(this.mContext, scheduledWork);
|
|
ArrayList<WorkSpec> arrayList = new ArrayList(scheduledWork.size());
|
|
long currentTimeMillis = this.mClock.currentTimeMillis();
|
|
for (WorkSpec workSpec : scheduledWork) {
|
|
if (currentTimeMillis >= workSpec.calculateNextRunTime() && (!workSpec.hasConstraints() || this.mWorkConstraintsTracker.areAllConstraintsMet(workSpec))) {
|
|
arrayList.add(workSpec);
|
|
}
|
|
}
|
|
for (WorkSpec workSpec2 : arrayList) {
|
|
String str = workSpec2.id;
|
|
Intent createDelayMetIntent = CommandHandler.createDelayMetIntent(this.mContext, WorkSpecKt.generationalId(workSpec2));
|
|
Logger.get().debug(TAG, "Creating a delay_met command for workSpec with id (" + str + ")");
|
|
this.mDispatcher.getTaskExecutor().getMainThreadExecutor().execute(new SystemAlarmDispatcher.AddRunnable(this.mDispatcher, createDelayMetIntent, this.mStartId));
|
|
}
|
|
}
|
|
}
|