Fix Connected devices page UI not update after paired
This CL before, onChanged(null) will cause PreferenceGroup didn't update UI in ConnectedDeviceDashboardFragment. This CL remove onChanged(null) and set unvisible of SliceView in the constructor. Bug: 142220754 Test: make -j42 RunSettingsRoboTests Change-Id: Ib20db373430589c5c5efbe8a4c866b7fae4f3399
This commit is contained in:
@@ -46,6 +46,7 @@ public class SlicePreference extends LayoutPreference {
|
||||
mSliceView = findViewById(R.id.slice_view);
|
||||
mSliceView.setShowTitleItems(true);
|
||||
mSliceView.setScrollable(false);
|
||||
mSliceView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void onSliceUpdated(Slice slice) {
|
||||
|
@@ -32,7 +32,6 @@ import com.android.settings.core.BasePreferenceController;
|
||||
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
|
||||
@@ -66,9 +65,6 @@ public class SlicePreferenceController extends BasePreferenceController implemen
|
||||
mUri = uri;
|
||||
mLiveData = SliceLiveData.fromUri(mContext, mUri, (int type, Throwable source) -> {
|
||||
Log.w(TAG, "Slice may be null. uri = " + uri + ", error = " + type);
|
||||
ThreadUtils.postOnMainThread(() -> {
|
||||
onChanged(null);
|
||||
});
|
||||
});
|
||||
|
||||
//TODO(b/120803703): figure out why we need to remove observer first
|
||||
|
Reference in New Issue
Block a user