package androidx.work.impl.utils; import androidx.work.WorkInfo; import androidx.work.WorkQuery; import androidx.work.impl.WorkManagerImpl; import androidx.work.impl.model.WorkSpec; import androidx.work.impl.utils.futures.SettableFuture; import com.google.common.util.concurrent.ListenableFuture; import java.util.List; import java.util.UUID; /* loaded from: classes2.dex */ public abstract class StatusRunnable implements Runnable { private final SettableFuture mFuture = SettableFuture.create(); public ListenableFuture getFuture() { return this.mFuture; } abstract T runInternal(); @Override // java.lang.Runnable public void run() { try { this.mFuture.set(runInternal()); } catch (Throwable th) { this.mFuture.setException(th); } } public static StatusRunnable> forStringIds(final WorkManagerImpl workManager, final List ids) { return new StatusRunnable>() { // from class: androidx.work.impl.utils.StatusRunnable.1 @Override // androidx.work.impl.utils.StatusRunnable public List runInternal() { return WorkSpec.WORK_INFO_MAPPER.apply(WorkManagerImpl.this.getWorkDatabase().workSpecDao().getWorkStatusPojoForIds(ids)); } }; } public static StatusRunnable forUUID(final WorkManagerImpl workManager, final UUID id) { return new StatusRunnable() { // from class: androidx.work.impl.utils.StatusRunnable.2 /* JADX INFO: Access modifiers changed from: package-private */ /* JADX WARN: Can't rename method to resolve collision */ @Override // androidx.work.impl.utils.StatusRunnable public WorkInfo runInternal() { WorkSpec.WorkInfoPojo workStatusPojoForId = WorkManagerImpl.this.getWorkDatabase().workSpecDao().getWorkStatusPojoForId(id.toString()); if (workStatusPojoForId != null) { return workStatusPojoForId.toWorkInfo(); } return null; } }; } public static StatusRunnable> forTag(final WorkManagerImpl workManager, final String tag) { return new StatusRunnable>() { // from class: androidx.work.impl.utils.StatusRunnable.3 /* JADX INFO: Access modifiers changed from: package-private */ @Override // androidx.work.impl.utils.StatusRunnable public List runInternal() { return WorkSpec.WORK_INFO_MAPPER.apply(WorkManagerImpl.this.getWorkDatabase().workSpecDao().getWorkStatusPojoForTag(tag)); } }; } public static StatusRunnable> forUniqueWork(final WorkManagerImpl workManager, final String name) { return new StatusRunnable>() { // from class: androidx.work.impl.utils.StatusRunnable.4 /* JADX INFO: Access modifiers changed from: package-private */ @Override // androidx.work.impl.utils.StatusRunnable public List runInternal() { return WorkSpec.WORK_INFO_MAPPER.apply(WorkManagerImpl.this.getWorkDatabase().workSpecDao().getWorkStatusPojoForName(name)); } }; } public static StatusRunnable> forWorkQuerySpec(final WorkManagerImpl workManager, final WorkQuery querySpec) { return new StatusRunnable>() { // from class: androidx.work.impl.utils.StatusRunnable.5 /* JADX INFO: Access modifiers changed from: package-private */ @Override // androidx.work.impl.utils.StatusRunnable public List runInternal() { return WorkSpec.WORK_INFO_MAPPER.apply(WorkManagerImpl.this.getWorkDatabase().rawWorkInfoDao().getWorkInfoPojos(RawQueries.toRawQuery(querySpec))); } }; } }