single component HFP device has no battery info in the Device details page

-get full summary when the metadata does not contain the battery
information
-remove unexpected "test_summary" text

Bug: 237594992
Test: make -j50 RunSettingsGoogleRoboTests ROBOTEST_FILTER=AppBypassBroadcastReceiverTest

Change-Id: I3e3682cf88cdd147d4b7cd68f37f5e33f01c788d
This commit is contained in:
timhypeng
2022-09-22 07:10:20 +00:00
committed by Tim Peng
parent f9b0a270db
commit 7c4e04b187
2 changed files with 6 additions and 3 deletions

View File

@@ -42,8 +42,7 @@
android:layout_marginTop="2dp" android:layout_marginTop="2dp"
android:singleLine="false" android:singleLine="false"
android:ellipsize="marquee" android:ellipsize="marquee"
android:textDirection="locale" android:textDirection="locale"/>
android:text="test_summary"/>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@@ -182,9 +182,9 @@ public class AdvancedBluetoothDetailsHeaderController extends BasePreferenceCont
final TextView title = mLayoutPreference.findViewById(R.id.entity_header_title); final TextView title = mLayoutPreference.findViewById(R.id.entity_header_title);
title.setText(mCachedDevice.getName()); title.setText(mCachedDevice.getName());
final TextView summary = mLayoutPreference.findViewById(R.id.entity_header_summary); final TextView summary = mLayoutPreference.findViewById(R.id.entity_header_summary);
summary.setText(mCachedDevice.getConnectionSummary(true /* shortSummary */));
if (!mCachedDevice.isConnected() || mCachedDevice.isBusy()) { if (!mCachedDevice.isConnected() || mCachedDevice.isBusy()) {
summary.setText(mCachedDevice.getConnectionSummary(true /* shortSummary */));
updateDisconnectLayout(); updateDisconnectLayout();
return; return;
} }
@@ -196,6 +196,9 @@ public class AdvancedBluetoothDetailsHeaderController extends BasePreferenceCont
mLayoutPreference.findViewById(R.id.layout_left).setVisibility(View.GONE); mLayoutPreference.findViewById(R.id.layout_left).setVisibility(View.GONE);
mLayoutPreference.findViewById(R.id.layout_right).setVisibility(View.GONE); mLayoutPreference.findViewById(R.id.layout_right).setVisibility(View.GONE);
summary.setText(mCachedDevice.getConnectionSummary(
BluetoothUtils.getIntMetaData(device, BluetoothDevice.METADATA_MAIN_BATTERY)
!= BluetoothUtils.META_INT_ERROR));
updateSubLayout(mLayoutPreference.findViewById(R.id.layout_middle), updateSubLayout(mLayoutPreference.findViewById(R.id.layout_middle),
BluetoothDevice.METADATA_MAIN_ICON, BluetoothDevice.METADATA_MAIN_ICON,
BluetoothDevice.METADATA_MAIN_BATTERY, BluetoothDevice.METADATA_MAIN_BATTERY,
@@ -207,6 +210,7 @@ public class AdvancedBluetoothDetailsHeaderController extends BasePreferenceCont
BluetoothDevice.DEVICE_TYPE_UNTETHERED_HEADSET) BluetoothDevice.DEVICE_TYPE_UNTETHERED_HEADSET)
|| BluetoothUtils.getBooleanMetaData(device, || BluetoothUtils.getBooleanMetaData(device,
BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET)) { BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET)) {
summary.setText(mCachedDevice.getConnectionSummary(true /* shortSummary */));
updateSubLayout(mLayoutPreference.findViewById(R.id.layout_left), updateSubLayout(mLayoutPreference.findViewById(R.id.layout_left),
BluetoothDevice.METADATA_UNTETHERED_LEFT_ICON, BluetoothDevice.METADATA_UNTETHERED_LEFT_ICON,
BluetoothDevice.METADATA_UNTETHERED_LEFT_BATTERY, BluetoothDevice.METADATA_UNTETHERED_LEFT_BATTERY,