Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f16b295c authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Hearing Aid Service: Don't sent suppress noisy intent"

parents 6b0774d0 50bb8763
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -618,19 +618,24 @@ public class HearingAidService extends ProfileService {
            if (DBG) {
                Log.d(TAG, "Set Hearing Aid audio to disconnected");
            }
            mAudioManager.setHearingAidDeviceConnectionState(mPreviousAudioDevice,
                    BluetoothProfile.STATE_DISCONNECTED);
            boolean suppressNoisyIntent =
                    (getConnectionState(mPreviousAudioDevice) == BluetoothProfile.STATE_CONNECTED);
            mAudioManager.setBluetoothHearingAidDeviceConnectionState(
                    mPreviousAudioDevice, BluetoothProfile.STATE_DISCONNECTED,
                    suppressNoisyIntent, 0);
            mPreviousAudioDevice = null;
        } else {
            if (DBG) {
                Log.d(TAG, "Set Hearing Aid audio to connected");
            }
            if (mPreviousAudioDevice != null) {
                mAudioManager.setHearingAidDeviceConnectionState(mPreviousAudioDevice,
                        BluetoothProfile.STATE_DISCONNECTED);
                mAudioManager.setBluetoothHearingAidDeviceConnectionState(
                        mPreviousAudioDevice, BluetoothProfile.STATE_DISCONNECTED,
                        true, 0);
            }
            mAudioManager.setHearingAidDeviceConnectionState(device,
                    BluetoothProfile.STATE_CONNECTED);
            mAudioManager.setBluetoothHearingAidDeviceConnectionState(
                    device, BluetoothProfile.STATE_CONNECTED,
                    true, 0);
            mPreviousAudioDevice = device;
        }
    }
+6 −4
Original line number Diff line number Diff line
@@ -498,8 +498,9 @@ public class HearingAidServiceTest {
        Assert.assertTrue(mService.getConnectedDevices().contains(mRightDevice));

        // Verify the audio is routed to Hearing Aid Profile
        verify(mAudioManager).setHearingAidDeviceConnectionState(any(BluetoothDevice.class),
                eq(BluetoothProfile.STATE_CONNECTED));
        verify(mAudioManager).setBluetoothHearingAidDeviceConnectionState(
                any(BluetoothDevice.class), eq(BluetoothProfile.STATE_CONNECTED),
                eq(true), eq(0));

        // Send a disconnect request
        Assert.assertTrue("Disconnect failed", mService.disconnect(mLeftDevice));
@@ -546,8 +547,9 @@ public class HearingAidServiceTest {
        Assert.assertFalse(mService.getConnectedDevices().contains(mRightDevice));

        // Verify the audio is not routed to Hearing Aid Profile
        verify(mAudioManager).setHearingAidDeviceConnectionState(any(BluetoothDevice.class),
                eq(BluetoothProfile.STATE_DISCONNECTED));
        verify(mAudioManager).setBluetoothHearingAidDeviceConnectionState(
                any(BluetoothDevice.class), eq(BluetoothProfile.STATE_DISCONNECTED),
                eq(false), eq(0));
    }

    /**