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:
hughchen
2019-10-15 17:27:13 +08:00
parent ca3639a668
commit 1605b0364c
2 changed files with 1 additions and 4 deletions

View File

@@ -46,6 +46,7 @@ public class SlicePreference extends LayoutPreference {
mSliceView = findViewById(R.id.slice_view); mSliceView = findViewById(R.id.slice_view);
mSliceView.setShowTitleItems(true); mSliceView.setShowTitleItems(true);
mSliceView.setScrollable(false); mSliceView.setScrollable(false);
mSliceView.setVisibility(View.GONE);
} }
public void onSliceUpdated(Slice slice) { public void onSliceUpdated(Slice slice) {

View File

@@ -32,7 +32,6 @@ 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
@@ -66,9 +65,6 @@ 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);
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