Make HearingAid code more generic

-handle UI updating when sub device connection state changes
-add test case

Bug: 112735753
Test: make -j42 RunSettingsRoboTests
Change-Id: Ie2643657c47a0956aac3f8cac4bfdbdea0399ce8
This commit is contained in:
timhypeng
2018-10-09 11:19:23 +08:00
committed by Hugh Chen
parent 2f5200ea5a
commit c95056d7b5
5 changed files with 36 additions and 7 deletions

View File

@@ -65,12 +65,10 @@ public class BluetoothDetailsHeaderController extends BluetoothDetailsController
.getBtClassDrawableWithDescription(mContext, mCachedDevice,
mContext.getResources().getFraction(R.fraction.bt_battery_scale_fraction, 1, 1));
String summaryText = mCachedDevice.getConnectionSummary();
// If both the hearing aids are connected, two battery status should be shown.
final String pairDeviceSummary = mDeviceManager
.getHearingAidPairDeviceSummary(mCachedDevice);
if (pairDeviceSummary != null) {
mHeaderController.setSecondSummary(pairDeviceSummary);
}
// If both the hearing aids are connected, two device status should be shown.
// If Second Summary is unavailable, to set it to null.
mHeaderController.setSecondSummary(
mDeviceManager.getSubDeviceSummary(mCachedDevice));
mHeaderController.setLabel(mCachedDevice.getName());
mHeaderController.setIcon(pair.first);
mHeaderController.setIconContentDescription(pair.second);