mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-27 01:22:33 -06:00
474 lines
22 KiB
Java
474 lines
22 KiB
Java
|
package androidx.work.impl;
|
||
|
|
||
|
import android.app.PendingIntent;
|
||
|
import android.content.BroadcastReceiver;
|
||
|
import android.content.Context;
|
||
|
import android.text.TextUtils;
|
||
|
import androidx.arch.core.util.Function;
|
||
|
import androidx.lifecycle.LiveData;
|
||
|
import androidx.work.Configuration;
|
||
|
import androidx.work.ExistingPeriodicWorkPolicy;
|
||
|
import androidx.work.ExistingWorkPolicy;
|
||
|
import androidx.work.Logger;
|
||
|
import androidx.work.OneTimeWorkRequest;
|
||
|
import androidx.work.Operation;
|
||
|
import androidx.work.PeriodicWorkRequest;
|
||
|
import androidx.work.WorkContinuation;
|
||
|
import androidx.work.WorkInfo;
|
||
|
import androidx.work.WorkManager;
|
||
|
import androidx.work.WorkQuery;
|
||
|
import androidx.work.WorkRequest;
|
||
|
import androidx.work.impl.background.systemjob.SystemJobScheduler;
|
||
|
import androidx.work.impl.constraints.trackers.Trackers;
|
||
|
import androidx.work.impl.foreground.SystemForegroundDispatcher;
|
||
|
import androidx.work.impl.model.RawWorkInfoDaoKt;
|
||
|
import androidx.work.impl.model.WorkGenerationalId;
|
||
|
import androidx.work.impl.model.WorkSpec;
|
||
|
import androidx.work.impl.model.WorkSpecDaoKt;
|
||
|
import androidx.work.impl.utils.CancelWorkRunnable;
|
||
|
import androidx.work.impl.utils.ForceStopRunnable;
|
||
|
import androidx.work.impl.utils.LiveDataUtils;
|
||
|
import androidx.work.impl.utils.PreferenceUtils;
|
||
|
import androidx.work.impl.utils.PruneWorkRunnable;
|
||
|
import androidx.work.impl.utils.RawQueries;
|
||
|
import androidx.work.impl.utils.StatusRunnable;
|
||
|
import androidx.work.impl.utils.StopWorkRunnable;
|
||
|
import androidx.work.impl.utils.futures.SettableFuture;
|
||
|
import androidx.work.impl.utils.taskexecutor.TaskExecutor;
|
||
|
import androidx.work.multiprocess.RemoteWorkManager;
|
||
|
import com.google.common.util.concurrent.ListenableFuture;
|
||
|
import java.util.Collections;
|
||
|
import java.util.List;
|
||
|
import java.util.UUID;
|
||
|
import kotlinx.coroutines.flow.Flow;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public class WorkManagerImpl extends WorkManager {
|
||
|
public static final int CONTENT_URI_TRIGGER_API_LEVEL = 24;
|
||
|
public static final int MAX_PRE_JOB_SCHEDULER_API_LEVEL = 22;
|
||
|
public static final int MIN_JOB_SCHEDULER_API_LEVEL = 23;
|
||
|
public static final String REMOTE_WORK_MANAGER_CLIENT = "androidx.work.multiprocess.RemoteWorkManagerClient";
|
||
|
private Configuration mConfiguration;
|
||
|
private Context mContext;
|
||
|
private boolean mForceStopRunnableCompleted = false;
|
||
|
private PreferenceUtils mPreferenceUtils;
|
||
|
private Processor mProcessor;
|
||
|
private volatile RemoteWorkManager mRemoteWorkManager;
|
||
|
private BroadcastReceiver.PendingResult mRescheduleReceiverResult;
|
||
|
private List<Scheduler> mSchedulers;
|
||
|
private final Trackers mTrackers;
|
||
|
private WorkDatabase mWorkDatabase;
|
||
|
private TaskExecutor mWorkTaskExecutor;
|
||
|
private static final String TAG = Logger.tagWithPrefix("WorkManagerImpl");
|
||
|
private static WorkManagerImpl sDelegatedInstance = null;
|
||
|
private static WorkManagerImpl sDefaultInstance = null;
|
||
|
private static final Object sLock = new Object();
|
||
|
|
||
|
public Context getApplicationContext() {
|
||
|
return this.mContext;
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public Configuration getConfiguration() {
|
||
|
return this.mConfiguration;
|
||
|
}
|
||
|
|
||
|
public PreferenceUtils getPreferenceUtils() {
|
||
|
return this.mPreferenceUtils;
|
||
|
}
|
||
|
|
||
|
public Processor getProcessor() {
|
||
|
return this.mProcessor;
|
||
|
}
|
||
|
|
||
|
public List<Scheduler> getSchedulers() {
|
||
|
return this.mSchedulers;
|
||
|
}
|
||
|
|
||
|
public Trackers getTrackers() {
|
||
|
return this.mTrackers;
|
||
|
}
|
||
|
|
||
|
public WorkDatabase getWorkDatabase() {
|
||
|
return this.mWorkDatabase;
|
||
|
}
|
||
|
|
||
|
public TaskExecutor getWorkTaskExecutor() {
|
||
|
return this.mWorkTaskExecutor;
|
||
|
}
|
||
|
|
||
|
public static void setDelegate(WorkManagerImpl delegate) {
|
||
|
synchronized (sLock) {
|
||
|
sDelegatedInstance = delegate;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Deprecated
|
||
|
public static WorkManagerImpl getInstance() {
|
||
|
synchronized (sLock) {
|
||
|
WorkManagerImpl workManagerImpl = sDelegatedInstance;
|
||
|
if (workManagerImpl != null) {
|
||
|
return workManagerImpl;
|
||
|
}
|
||
|
return sDefaultInstance;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static boolean isInitialized() {
|
||
|
return getInstance() != null;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
public static WorkManagerImpl getInstance(Context context) {
|
||
|
WorkManagerImpl workManagerImpl;
|
||
|
synchronized (sLock) {
|
||
|
workManagerImpl = getInstance();
|
||
|
if (workManagerImpl == null) {
|
||
|
Context applicationContext = context.getApplicationContext();
|
||
|
if (applicationContext instanceof Configuration.Provider) {
|
||
|
initialize(applicationContext, ((Configuration.Provider) applicationContext).getWorkManagerConfiguration());
|
||
|
workManagerImpl = getInstance(applicationContext);
|
||
|
} else {
|
||
|
throw new IllegalStateException("WorkManager is not initialized properly. You have explicitly disabled WorkManagerInitializer in your manifest, have not manually called WorkManager#initialize at this point, and your Application does not implement Configuration.Provider.");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return workManagerImpl;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Code restructure failed: missing block: B:13:0x0016, code lost:
|
||
|
|
||
|
r3 = r3.getApplicationContext();
|
||
|
*/
|
||
|
/* JADX WARN: Code restructure failed: missing block: B:14:0x001c, code lost:
|
||
|
|
||
|
if (androidx.work.impl.WorkManagerImpl.sDefaultInstance != null) goto L15;
|
||
|
*/
|
||
|
/* JADX WARN: Code restructure failed: missing block: B:15:0x001e, code lost:
|
||
|
|
||
|
androidx.work.impl.WorkManagerImpl.sDefaultInstance = androidx.work.impl.WorkManagerImplExtKt.createWorkManager(r3, r4);
|
||
|
*/
|
||
|
/* JADX WARN: Code restructure failed: missing block: B:16:0x0024, code lost:
|
||
|
|
||
|
androidx.work.impl.WorkManagerImpl.sDelegatedInstance = androidx.work.impl.WorkManagerImpl.sDefaultInstance;
|
||
|
*/
|
||
|
/*
|
||
|
Code decompiled incorrectly, please refer to instructions dump.
|
||
|
To view partially-correct add '--show-bad-code' argument
|
||
|
*/
|
||
|
public static void initialize(android.content.Context r3, androidx.work.Configuration r4) {
|
||
|
/*
|
||
|
java.lang.Object r0 = androidx.work.impl.WorkManagerImpl.sLock
|
||
|
monitor-enter(r0)
|
||
|
androidx.work.impl.WorkManagerImpl r1 = androidx.work.impl.WorkManagerImpl.sDelegatedInstance // Catch: java.lang.Throwable -> L2a
|
||
|
if (r1 == 0) goto L14
|
||
|
androidx.work.impl.WorkManagerImpl r2 = androidx.work.impl.WorkManagerImpl.sDefaultInstance // Catch: java.lang.Throwable -> L2a
|
||
|
if (r2 != 0) goto Lc
|
||
|
goto L14
|
||
|
Lc:
|
||
|
java.lang.IllegalStateException r3 = new java.lang.IllegalStateException // Catch: java.lang.Throwable -> L2a
|
||
|
java.lang.String r4 = "WorkManager is already initialized. Did you try to initialize it manually without disabling WorkManagerInitializer? See WorkManager#initialize(Context, Configuration) or the class level Javadoc for more information."
|
||
|
r3.<init>(r4) // Catch: java.lang.Throwable -> L2a
|
||
|
throw r3 // Catch: java.lang.Throwable -> L2a
|
||
|
L14:
|
||
|
if (r1 != 0) goto L28
|
||
|
android.content.Context r3 = r3.getApplicationContext() // Catch: java.lang.Throwable -> L2a
|
||
|
androidx.work.impl.WorkManagerImpl r1 = androidx.work.impl.WorkManagerImpl.sDefaultInstance // Catch: java.lang.Throwable -> L2a
|
||
|
if (r1 != 0) goto L24
|
||
|
androidx.work.impl.WorkManagerImpl r3 = androidx.work.impl.WorkManagerImplExtKt.createWorkManager(r3, r4) // Catch: java.lang.Throwable -> L2a
|
||
|
androidx.work.impl.WorkManagerImpl.sDefaultInstance = r3 // Catch: java.lang.Throwable -> L2a
|
||
|
L24:
|
||
|
androidx.work.impl.WorkManagerImpl r3 = androidx.work.impl.WorkManagerImpl.sDefaultInstance // Catch: java.lang.Throwable -> L2a
|
||
|
androidx.work.impl.WorkManagerImpl.sDelegatedInstance = r3 // Catch: java.lang.Throwable -> L2a
|
||
|
L28:
|
||
|
monitor-exit(r0) // Catch: java.lang.Throwable -> L2a
|
||
|
return
|
||
|
L2a:
|
||
|
r3 = move-exception
|
||
|
monitor-exit(r0) // Catch: java.lang.Throwable -> L2a
|
||
|
throw r3
|
||
|
*/
|
||
|
throw new UnsupportedOperationException("Method not decompiled: androidx.work.impl.WorkManagerImpl.initialize(android.content.Context, androidx.work.Configuration):void");
|
||
|
}
|
||
|
|
||
|
public WorkManagerImpl(Context context, Configuration configuration, TaskExecutor workTaskExecutor, WorkDatabase workDatabase, List<Scheduler> schedulers, Processor processor, Trackers trackers) {
|
||
|
Context applicationContext = context.getApplicationContext();
|
||
|
if (Api24Impl.isDeviceProtectedStorage(applicationContext)) {
|
||
|
throw new IllegalStateException("Cannot initialize WorkManager in direct boot mode");
|
||
|
}
|
||
|
Logger.setLogger(new Logger.LogcatLogger(configuration.getMinimumLoggingLevel()));
|
||
|
this.mContext = applicationContext;
|
||
|
this.mWorkTaskExecutor = workTaskExecutor;
|
||
|
this.mWorkDatabase = workDatabase;
|
||
|
this.mProcessor = processor;
|
||
|
this.mTrackers = trackers;
|
||
|
this.mConfiguration = configuration;
|
||
|
this.mSchedulers = schedulers;
|
||
|
this.mPreferenceUtils = new PreferenceUtils(this.mWorkDatabase);
|
||
|
Schedulers.registerRescheduling(schedulers, this.mProcessor, workTaskExecutor.getSerialTaskExecutor(), this.mWorkDatabase, configuration);
|
||
|
this.mWorkTaskExecutor.executeOnTaskThread(new ForceStopRunnable(applicationContext, this));
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public Operation enqueue(List<? extends WorkRequest> requests) {
|
||
|
if (requests.isEmpty()) {
|
||
|
throw new IllegalArgumentException("enqueue needs at least one WorkRequest.");
|
||
|
}
|
||
|
return new WorkContinuationImpl(this, requests).enqueue();
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public WorkContinuation beginWith(List<OneTimeWorkRequest> work) {
|
||
|
if (work.isEmpty()) {
|
||
|
throw new IllegalArgumentException("beginWith needs at least one OneTimeWorkRequest.");
|
||
|
}
|
||
|
return new WorkContinuationImpl(this, work);
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public WorkContinuation beginUniqueWork(String uniqueWorkName, ExistingWorkPolicy existingWorkPolicy, List<OneTimeWorkRequest> work) {
|
||
|
if (work.isEmpty()) {
|
||
|
throw new IllegalArgumentException("beginUniqueWork needs at least one OneTimeWorkRequest.");
|
||
|
}
|
||
|
return new WorkContinuationImpl(this, uniqueWorkName, existingWorkPolicy, work);
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public Operation enqueueUniqueWork(String uniqueWorkName, ExistingWorkPolicy existingWorkPolicy, List<OneTimeWorkRequest> work) {
|
||
|
return new WorkContinuationImpl(this, uniqueWorkName, existingWorkPolicy, work).enqueue();
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public Operation enqueueUniquePeriodicWork(String uniqueWorkName, ExistingPeriodicWorkPolicy existingPeriodicWorkPolicy, PeriodicWorkRequest periodicWork) {
|
||
|
if (existingPeriodicWorkPolicy == ExistingPeriodicWorkPolicy.UPDATE) {
|
||
|
return WorkerUpdater.enqueueUniquelyNamedPeriodic(this, uniqueWorkName, periodicWork);
|
||
|
}
|
||
|
return createWorkContinuationForUniquePeriodicWork(uniqueWorkName, existingPeriodicWorkPolicy, periodicWork).enqueue();
|
||
|
}
|
||
|
|
||
|
public WorkContinuationImpl createWorkContinuationForUniquePeriodicWork(String uniqueWorkName, ExistingPeriodicWorkPolicy existingPeriodicWorkPolicy, PeriodicWorkRequest periodicWork) {
|
||
|
ExistingWorkPolicy existingWorkPolicy;
|
||
|
if (existingPeriodicWorkPolicy == ExistingPeriodicWorkPolicy.KEEP) {
|
||
|
existingWorkPolicy = ExistingWorkPolicy.KEEP;
|
||
|
} else {
|
||
|
existingWorkPolicy = ExistingWorkPolicy.REPLACE;
|
||
|
}
|
||
|
return new WorkContinuationImpl(this, uniqueWorkName, existingWorkPolicy, Collections.singletonList(periodicWork));
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public Operation cancelWorkById(UUID id) {
|
||
|
CancelWorkRunnable forId = CancelWorkRunnable.forId(id, this);
|
||
|
this.mWorkTaskExecutor.executeOnTaskThread(forId);
|
||
|
return forId.getOperation();
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public Operation cancelAllWorkByTag(final String tag) {
|
||
|
CancelWorkRunnable forTag = CancelWorkRunnable.forTag(tag, this);
|
||
|
this.mWorkTaskExecutor.executeOnTaskThread(forTag);
|
||
|
return forTag.getOperation();
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public Operation cancelUniqueWork(String uniqueWorkName) {
|
||
|
CancelWorkRunnable forName = CancelWorkRunnable.forName(uniqueWorkName, this, true);
|
||
|
this.mWorkTaskExecutor.executeOnTaskThread(forName);
|
||
|
return forName.getOperation();
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public Operation cancelAllWork() {
|
||
|
CancelWorkRunnable forAll = CancelWorkRunnable.forAll(this);
|
||
|
this.mWorkTaskExecutor.executeOnTaskThread(forAll);
|
||
|
return forAll.getOperation();
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public PendingIntent createCancelPendingIntent(UUID id) {
|
||
|
return PendingIntent.getService(this.mContext, 0, SystemForegroundDispatcher.createCancelWorkIntent(this.mContext, id.toString()), 167772160);
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public LiveData<Long> getLastCancelAllTimeMillisLiveData() {
|
||
|
return this.mPreferenceUtils.getLastCancelAllTimeMillisLiveData();
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public ListenableFuture<Long> getLastCancelAllTimeMillis() {
|
||
|
final SettableFuture create = SettableFuture.create();
|
||
|
final PreferenceUtils preferenceUtils = this.mPreferenceUtils;
|
||
|
this.mWorkTaskExecutor.executeOnTaskThread(new Runnable() { // from class: androidx.work.impl.WorkManagerImpl.1
|
||
|
@Override // java.lang.Runnable
|
||
|
public void run() {
|
||
|
try {
|
||
|
create.set(Long.valueOf(preferenceUtils.getLastCancelAllTimeMillis()));
|
||
|
} catch (Throwable th) {
|
||
|
create.setException(th);
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
return create;
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public Operation pruneWork() {
|
||
|
PruneWorkRunnable pruneWorkRunnable = new PruneWorkRunnable(this);
|
||
|
this.mWorkTaskExecutor.executeOnTaskThread(pruneWorkRunnable);
|
||
|
return pruneWorkRunnable.getOperation();
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public LiveData<WorkInfo> getWorkInfoByIdLiveData(UUID id) {
|
||
|
return LiveDataUtils.dedupedMappedLiveDataFor(this.mWorkDatabase.workSpecDao().getWorkStatusPojoLiveDataForIds(Collections.singletonList(id.toString())), new Function<List<WorkSpec.WorkInfoPojo>, WorkInfo>() { // from class: androidx.work.impl.WorkManagerImpl.2
|
||
|
@Override // androidx.arch.core.util.Function
|
||
|
public WorkInfo apply(List<WorkSpec.WorkInfoPojo> input) {
|
||
|
if (input == null || input.size() <= 0) {
|
||
|
return null;
|
||
|
}
|
||
|
return input.get(0).toWorkInfo();
|
||
|
}
|
||
|
}, this.mWorkTaskExecutor);
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public Flow<WorkInfo> getWorkInfoByIdFlow(UUID id) {
|
||
|
return WorkSpecDaoKt.getWorkStatusPojoFlowDataForIds(getWorkDatabase().workSpecDao(), id);
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public ListenableFuture<WorkInfo> getWorkInfoById(UUID id) {
|
||
|
StatusRunnable<WorkInfo> forUUID = StatusRunnable.forUUID(this, id);
|
||
|
this.mWorkTaskExecutor.getSerialTaskExecutor().execute(forUUID);
|
||
|
return forUUID.getFuture();
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public Flow<List<WorkInfo>> getWorkInfosByTagFlow(String tag) {
|
||
|
return WorkSpecDaoKt.getWorkStatusPojoFlowForTag(this.mWorkDatabase.workSpecDao(), this.mWorkTaskExecutor.getTaskCoroutineDispatcher(), tag);
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public LiveData<List<WorkInfo>> getWorkInfosByTagLiveData(String tag) {
|
||
|
return LiveDataUtils.dedupedMappedLiveDataFor(this.mWorkDatabase.workSpecDao().getWorkStatusPojoLiveDataForTag(tag), WorkSpec.WORK_INFO_MAPPER, this.mWorkTaskExecutor);
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public ListenableFuture<List<WorkInfo>> getWorkInfosByTag(String tag) {
|
||
|
StatusRunnable<List<WorkInfo>> forTag = StatusRunnable.forTag(this, tag);
|
||
|
this.mWorkTaskExecutor.getSerialTaskExecutor().execute(forTag);
|
||
|
return forTag.getFuture();
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public LiveData<List<WorkInfo>> getWorkInfosForUniqueWorkLiveData(String uniqueWorkName) {
|
||
|
return LiveDataUtils.dedupedMappedLiveDataFor(this.mWorkDatabase.workSpecDao().getWorkStatusPojoLiveDataForName(uniqueWorkName), WorkSpec.WORK_INFO_MAPPER, this.mWorkTaskExecutor);
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public Flow<List<WorkInfo>> getWorkInfosForUniqueWorkFlow(String uniqueWorkName) {
|
||
|
return WorkSpecDaoKt.getWorkStatusPojoFlowForName(this.mWorkDatabase.workSpecDao(), this.mWorkTaskExecutor.getTaskCoroutineDispatcher(), uniqueWorkName);
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public ListenableFuture<List<WorkInfo>> getWorkInfosForUniqueWork(String uniqueWorkName) {
|
||
|
StatusRunnable<List<WorkInfo>> forUniqueWork = StatusRunnable.forUniqueWork(this, uniqueWorkName);
|
||
|
this.mWorkTaskExecutor.getSerialTaskExecutor().execute(forUniqueWork);
|
||
|
return forUniqueWork.getFuture();
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public LiveData<List<WorkInfo>> getWorkInfosLiveData(WorkQuery workQuery) {
|
||
|
return LiveDataUtils.dedupedMappedLiveDataFor(this.mWorkDatabase.rawWorkInfoDao().getWorkInfoPojosLiveData(RawQueries.toRawQuery(workQuery)), WorkSpec.WORK_INFO_MAPPER, this.mWorkTaskExecutor);
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public Flow<List<WorkInfo>> getWorkInfosFlow(WorkQuery workQuery) {
|
||
|
return RawWorkInfoDaoKt.getWorkInfoPojosFlow(this.mWorkDatabase.rawWorkInfoDao(), this.mWorkTaskExecutor.getTaskCoroutineDispatcher(), RawQueries.toRawQuery(workQuery));
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public ListenableFuture<List<WorkInfo>> getWorkInfos(WorkQuery workQuery) {
|
||
|
StatusRunnable<List<WorkInfo>> forWorkQuerySpec = StatusRunnable.forWorkQuerySpec(this, workQuery);
|
||
|
this.mWorkTaskExecutor.getSerialTaskExecutor().execute(forWorkQuerySpec);
|
||
|
return forWorkQuerySpec.getFuture();
|
||
|
}
|
||
|
|
||
|
@Override // androidx.work.WorkManager
|
||
|
public ListenableFuture<WorkManager.UpdateResult> updateWork(WorkRequest request) {
|
||
|
return WorkerUpdater.updateWorkImpl(this, request);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public LiveData<List<WorkInfo>> getWorkInfosById(List<String> workSpecIds) {
|
||
|
return LiveDataUtils.dedupedMappedLiveDataFor(this.mWorkDatabase.workSpecDao().getWorkStatusPojoLiveDataForIds(workSpecIds), WorkSpec.WORK_INFO_MAPPER, this.mWorkTaskExecutor);
|
||
|
}
|
||
|
|
||
|
public RemoteWorkManager getRemoteWorkManager() {
|
||
|
if (this.mRemoteWorkManager == null) {
|
||
|
synchronized (sLock) {
|
||
|
if (this.mRemoteWorkManager == null) {
|
||
|
tryInitializeMultiProcessSupport();
|
||
|
if (this.mRemoteWorkManager == null && !TextUtils.isEmpty(this.mConfiguration.getDefaultProcessName())) {
|
||
|
throw new IllegalStateException("Invalid multiprocess configuration. Define an `implementation` dependency on :work:work-multiprocess library");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return this.mRemoteWorkManager;
|
||
|
}
|
||
|
|
||
|
public void stopForegroundWork(WorkGenerationalId id) {
|
||
|
this.mWorkTaskExecutor.executeOnTaskThread(new StopWorkRunnable(this.mProcessor, new StartStopToken(id), true));
|
||
|
}
|
||
|
|
||
|
public void rescheduleEligibleWork() {
|
||
|
SystemJobScheduler.cancelAll(getApplicationContext());
|
||
|
getWorkDatabase().workSpecDao().resetScheduledState();
|
||
|
Schedulers.schedule(getConfiguration(), getWorkDatabase(), getSchedulers());
|
||
|
}
|
||
|
|
||
|
public void onForceStopRunnableCompleted() {
|
||
|
synchronized (sLock) {
|
||
|
this.mForceStopRunnableCompleted = true;
|
||
|
BroadcastReceiver.PendingResult pendingResult = this.mRescheduleReceiverResult;
|
||
|
if (pendingResult != null) {
|
||
|
pendingResult.finish();
|
||
|
this.mRescheduleReceiverResult = null;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void setReschedulePendingResult(BroadcastReceiver.PendingResult rescheduleReceiverResult) {
|
||
|
synchronized (sLock) {
|
||
|
BroadcastReceiver.PendingResult pendingResult = this.mRescheduleReceiverResult;
|
||
|
if (pendingResult != null) {
|
||
|
pendingResult.finish();
|
||
|
}
|
||
|
this.mRescheduleReceiverResult = rescheduleReceiverResult;
|
||
|
if (this.mForceStopRunnableCompleted) {
|
||
|
rescheduleReceiverResult.finish();
|
||
|
this.mRescheduleReceiverResult = null;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void tryInitializeMultiProcessSupport() {
|
||
|
try {
|
||
|
this.mRemoteWorkManager = (RemoteWorkManager) Class.forName(REMOTE_WORK_MANAGER_CLIENT).getConstructor(Context.class, WorkManagerImpl.class).newInstance(this.mContext, this);
|
||
|
} catch (Throwable th) {
|
||
|
Logger.get().debug(TAG, "Unable to initialize multi-process support", th);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
static class Api24Impl {
|
||
|
private Api24Impl() {
|
||
|
}
|
||
|
|
||
|
static boolean isDeviceProtectedStorage(Context context) {
|
||
|
return context.isDeviceProtectedStorage();
|
||
|
}
|
||
|
}
|
||
|
}
|