Merge "Make Hearing devices preference always visible" into udc-qpr-dev am: 7df08d69be
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/23429459 Change-Id: I3e7126da14c0882753a6edb69d4455a4d3db5030 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -56,7 +56,8 @@ public class HearingAidHelper {
|
|||||||
* @return a list of hearing aids {@link BluetoothDevice} objects
|
* @return a list of hearing aids {@link BluetoothDevice} objects
|
||||||
*/
|
*/
|
||||||
public List<BluetoothDevice> getConnectedHearingAidDeviceList() {
|
public List<BluetoothDevice> getConnectedHearingAidDeviceList() {
|
||||||
if (!isHearingAidSupported()) {
|
if (mBluetoothAdapter == null || !mBluetoothAdapter.isEnabled()
|
||||||
|
|| !isHearingAidSupported()) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
final List<BluetoothDevice> deviceList = new ArrayList<>();
|
final List<BluetoothDevice> deviceList = new ArrayList<>();
|
||||||
@@ -88,9 +89,6 @@ public class HearingAidHelper {
|
|||||||
* supported.
|
* supported.
|
||||||
*/
|
*/
|
||||||
public boolean isHearingAidSupported() {
|
public boolean isHearingAidSupported() {
|
||||||
if (mBluetoothAdapter == null || !mBluetoothAdapter.isEnabled()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final List<Integer> supportedList = mBluetoothAdapter.getSupportedProfiles();
|
final List<Integer> supportedList = mBluetoothAdapter.getSupportedProfiles();
|
||||||
return supportedList.contains(BluetoothProfile.HEARING_AID)
|
return supportedList.contains(BluetoothProfile.HEARING_AID)
|
||||||
|| supportedList.contains(BluetoothProfile.HAP_CLIENT);
|
|| supportedList.contains(BluetoothProfile.HAP_CLIENT);
|
||||||
|
@@ -95,8 +95,7 @@ public class HearingAidHelperTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void isHearingAidSupported_supported_returnTrue() {
|
public void isHearingAidSupported_ashaSupported_returnTrue() {
|
||||||
mBluetoothAdapter.enable();
|
|
||||||
mShadowBluetoothAdapter.clearSupportedProfiles();
|
mShadowBluetoothAdapter.clearSupportedProfiles();
|
||||||
mShadowBluetoothAdapter.addSupportedProfiles(BluetoothProfile.HEARING_AID);
|
mShadowBluetoothAdapter.addSupportedProfiles(BluetoothProfile.HEARING_AID);
|
||||||
|
|
||||||
@@ -104,15 +103,20 @@ public class HearingAidHelperTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void isHearingAidSupported_bluetoothOff_returnFalse() {
|
public void isHearingAidSupported_hapSupported_returnTrue() {
|
||||||
|
mShadowBluetoothAdapter.clearSupportedProfiles();
|
||||||
|
mShadowBluetoothAdapter.addSupportedProfiles(BluetoothProfile.HAP_CLIENT);
|
||||||
|
|
||||||
|
assertThat(mHelper.isHearingAidSupported()).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isHearingAidSupported_unsupported_returnFalse() {
|
||||||
mShadowBluetoothAdapter.clearSupportedProfiles();
|
mShadowBluetoothAdapter.clearSupportedProfiles();
|
||||||
mShadowBluetoothAdapter.addSupportedProfiles(BluetoothProfile.HEARING_AID);
|
|
||||||
mBluetoothAdapter.disable();
|
|
||||||
|
|
||||||
assertThat(mHelper.isHearingAidSupported()).isFalse();
|
assertThat(mHelper.isHearingAidSupported()).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void isAllHearingAidRelatedProfilesReady_allReady_returnTrue() {
|
public void isAllHearingAidRelatedProfilesReady_allReady_returnTrue() {
|
||||||
when(mHearingAidProfile.isProfileReady()).thenReturn(true);
|
when(mHearingAidProfile.isProfileReady()).thenReturn(true);
|
||||||
|
Reference in New Issue
Block a user