Update BT header using BT metadata

As for unthethered headset, get BT data from BT metadata, rather than
CachedBluetoothDevice

Bug: 122460277
Test: RunSettingsRoboTests
Change-Id: Ifb5507cbbce9602726ba272c12d1bf95eff91001
This commit is contained in:
jackqdyulei
2019-01-23 13:00:13 -08:00
parent 1fc7629dda
commit 47123c8224
5 changed files with 208 additions and 11 deletions

View File

@@ -16,6 +16,7 @@
package com.android.settings.bluetooth;
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import androidx.preference.PreferenceFragmentCompat;
@@ -43,6 +44,13 @@ public class BluetoothDetailsButtonsController extends BluetoothDetailsControlle
mIsConnected = device.isConnected();
}
@Override
public boolean isAvailable() {
final boolean unthetheredHeadset = Utils.getBooleanMetaData(mCachedDevice.getDevice(),
BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET);
return !unthetheredHeadset;
}
private void onForgetButtonPressed() {
ForgetDeviceDialogFragment fragment =
ForgetDeviceDialogFragment.newInstance(mCachedDevice.getAddress());