Fix IllegalStateException in recyclerview
- Fixed by updating UI in mainthread Fixes: 142241908 Fixes: 142220754 Test: manual test if it crashes again Change-Id: Ia83b66d3e60201bc524dbfab69bdeaa5201d38c2
This commit is contained in:
@@ -32,6 +32,7 @@ import com.android.settings.core.BasePreferenceController;
|
|||||||
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
||||||
import com.android.settingslib.core.lifecycle.events.OnStart;
|
import com.android.settingslib.core.lifecycle.events.OnStart;
|
||||||
import com.android.settingslib.core.lifecycle.events.OnStop;
|
import com.android.settingslib.core.lifecycle.events.OnStop;
|
||||||
|
import com.android.settingslib.utils.ThreadUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default {@link BasePreferenceController} for {@link SliceView}. It will take {@link Uri} for
|
* Default {@link BasePreferenceController} for {@link SliceView}. It will take {@link Uri} for
|
||||||
@@ -65,7 +66,9 @@ public class SlicePreferenceController extends BasePreferenceController implemen
|
|||||||
mUri = uri;
|
mUri = uri;
|
||||||
mLiveData = SliceLiveData.fromUri(mContext, mUri, (int type, Throwable source) -> {
|
mLiveData = SliceLiveData.fromUri(mContext, mUri, (int type, Throwable source) -> {
|
||||||
Log.w(TAG, "Slice may be null. uri = " + uri + ", error = " + type);
|
Log.w(TAG, "Slice may be null. uri = " + uri + ", error = " + type);
|
||||||
onChanged(null);
|
ThreadUtils.postOnMainThread(() -> {
|
||||||
|
onChanged(null);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
//TODO(b/120803703): figure out why we need to remove observer first
|
//TODO(b/120803703): figure out why we need to remove observer first
|
||||||
|
Reference in New Issue
Block a user