import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnStart;
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
mUri = uri;
mLiveData = SliceLiveData.fromUri(mContext, mUri, (int type, Throwable source) -> {
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