alexandroid/decompiled/jadx/sources/androidx/work/impl/utils/LiveDataUtils.java
KaKi87 a47fad5135 📦 Add decompiled Alexa 2.2.730155.0 (jadx, apktool, Hermes strings)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 00:04:16 +01:00

75 lines
3.5 KiB
Java

package androidx.work.impl.utils;
import android.annotation.SuppressLint;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.arch.core.util.Function;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MediatorLiveData;
import androidx.lifecycle.Observer;
import androidx.work.impl.utils.taskexecutor.TaskExecutor;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes14.dex */
public class LiveDataUtils {
/* JADX INFO: Add missing generic type declarations: [In] */
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
/* renamed from: androidx.work.impl.utils.LiveDataUtils$1, reason: invalid class name */
public class AnonymousClass1<In> implements Observer<In> {
Out mCurrentOutput = null;
final /* synthetic */ Object val$lock;
final /* synthetic */ Function val$mappingMethod;
final /* synthetic */ MediatorLiveData val$outputLiveData;
final /* synthetic */ TaskExecutor val$workTaskExecutor;
public AnonymousClass1(TaskExecutor taskExecutor, Object obj, Function function, MediatorLiveData mediatorLiveData) {
this.val$workTaskExecutor = taskExecutor;
this.val$lock = obj;
this.val$mappingMethod = function;
this.val$outputLiveData = mediatorLiveData;
}
@Override // androidx.lifecycle.Observer
public void onChanged(@Nullable final In in) {
this.val$workTaskExecutor.executeOnTaskThread(new Runnable() { // from class: androidx.work.impl.utils.LiveDataUtils.1.1
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r1v2, types: [Out, java.lang.Object] */
@Override // java.lang.Runnable
public void run() {
synchronized (AnonymousClass1.this.val$lock) {
try {
?? apply = AnonymousClass1.this.val$mappingMethod.apply(in);
AnonymousClass1 anonymousClass1 = AnonymousClass1.this;
Out out = anonymousClass1.mCurrentOutput;
if (out == 0 && apply != 0) {
anonymousClass1.mCurrentOutput = apply;
anonymousClass1.val$outputLiveData.postValue(apply);
} else if (out != 0 && !out.equals(apply)) {
AnonymousClass1 anonymousClass12 = AnonymousClass1.this;
anonymousClass12.mCurrentOutput = apply;
anonymousClass12.val$outputLiveData.postValue(apply);
}
} catch (Throwable th) {
throw th;
}
}
}
});
}
}
private LiveDataUtils() {
}
@NonNull
@SuppressLint({"LambdaLast"})
public static <In, Out> LiveData<Out> dedupedMappedLiveDataFor(@NonNull LiveData<In> liveData, @NonNull Function<In, Out> function, @NonNull TaskExecutor taskExecutor) {
Object obj = new Object();
MediatorLiveData mediatorLiveData = new MediatorLiveData();
mediatorLiveData.addSource(liveData, new AnonymousClass1(taskExecutor, obj, function, mediatorLiveData));
return mediatorLiveData;
}
}