From e725d6f35754515bb4b8d7ee2a8081a1c8f0570b Mon Sep 17 00:00:00 2001 From: timhypeng Date: Tue, 20 Aug 2019 16:41:17 +0800 Subject: [PATCH] One of the HA will not be Active after switching sound path to Phone/Speaker during active call - If first summary is unavailable, not to show second summary. Bug: 132409181 Test: make -j42 RunSettingsRoboTests Change-Id: I0d2e426b15dae8ed38e0a1b5a9219209e1a0026c --- .../bluetooth/BluetoothDetailsHeaderController.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java b/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java index f5096054c78..fc74004fefe 100644 --- a/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java +++ b/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java @@ -20,6 +20,7 @@ import android.bluetooth.BluetoothDevice; import android.content.Context; import android.graphics.drawable.Drawable; import android.provider.DeviceConfig; +import android.text.TextUtils; import android.util.Pair; import androidx.preference.PreferenceFragmentCompat; @@ -74,10 +75,13 @@ public class BluetoothDetailsHeaderController extends BluetoothDetailsController final Pair pair = BluetoothUtils.getBtRainbowDrawableWithDescription(mContext, mCachedDevice); String summaryText = mCachedDevice.getConnectionSummary(); - // 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)); + if (TextUtils.isEmpty(summaryText)) { + // If first summary is unavailable, not to show second summary. + mHeaderController.setSecondSummary((CharSequence)null); + } else { + // If both the hearing aids are connected, two device status should be shown. + mHeaderController.setSecondSummary(mDeviceManager.getSubDeviceSummary(mCachedDevice)); + } mHeaderController.setLabel(mCachedDevice.getName()); mHeaderController.setIcon(pair.first); mHeaderController.setIconContentDescription(pair.second);