Updated AndroidX libraries

This commit is contained in:
M66B
2019-07-06 10:46:15 +02:00
parent 7c856c7a9e
commit 24ea54f034
4 changed files with 47 additions and 20 deletions

View File

@@ -16,8 +16,6 @@
package androidx.lifecycle;
import android.os.SystemClock;
import androidx.annotation.MainThread;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
@@ -91,22 +89,14 @@ public abstract class ComputableLiveData<T> {
@Override
public void run() {
boolean computed;
long age;
do {
computed = false;
// compute can happen only in 1 thread but no reason to lock others.
if (mComputing.compareAndSet(false, true)) {
// as long as it is invalid, keep computing.
try {
age = SystemClock.elapsedRealtime();
T value = null;
while (mInvalid.compareAndSet(true, false)) {
long now = SystemClock.elapsedRealtime();
if (age + 1500 < now && value != null) {
eu.faircode.email.Log.i(mLiveData + " post age=" + (now - age));
age = now;
mLiveData.postValue(value);
}
computed = true;
value = compute();
}