Don't use Lambda when register callback
This CL before, the lambda callback is different it cause callback didn't unregister. If you re-enter bluetooth detail page many times, onDeviceAttributesChanged() will be called many times cause UI not smooth. This CL remove the lambda callback and show the UI when device connected. Fixes: 141583252 Test: Manual Change-Id: Icd3e84b2d461d9b949f080269dfa2bb5b5d5cb73
This commit is contained in:
@@ -112,7 +112,7 @@ public class AdvancedBluetoothDetailsHeaderController extends BasePreferenceCont
|
||||
if (!isAvailable()) {
|
||||
return;
|
||||
}
|
||||
mCachedDevice.registerCallback(this::onDeviceAttributesChanged);
|
||||
mCachedDevice.registerCallback(this);
|
||||
mBluetoothAdapter.addOnMetadataChangedListener(mCachedDevice.getDevice(),
|
||||
mContext.getMainExecutor(), mMetadataListener);
|
||||
}
|
||||
@@ -122,7 +122,7 @@ public class AdvancedBluetoothDetailsHeaderController extends BasePreferenceCont
|
||||
if (!isAvailable()) {
|
||||
return;
|
||||
}
|
||||
mCachedDevice.unregisterCallback(this::onDeviceAttributesChanged);
|
||||
mCachedDevice.unregisterCallback(this);
|
||||
mBluetoothAdapter.removeOnMetadataChangedListener(mCachedDevice.getDevice(),
|
||||
mMetadataListener);
|
||||
}
|
||||
@@ -153,7 +153,7 @@ public class AdvancedBluetoothDetailsHeaderController extends BasePreferenceCont
|
||||
final TextView summary = mLayoutPreference.findViewById(R.id.entity_header_summary);
|
||||
summary.setText(mCachedDevice.getConnectionSummary(true /* shortSummary */));
|
||||
|
||||
if (!mCachedDevice.isConnected()) {
|
||||
if (!mCachedDevice.isConnected() || mCachedDevice.isBusy()) {
|
||||
updateDisconnectLayout();
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user