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

Commit a1d11d17 authored by jasonwshsu's avatar jasonwshsu
Browse files

Copy BluetoothHearingAid API into private for short-term only

* SettingsLib will use APIs getDeviceSideInternal() and
  getDeviceModeInternal() to improve hearing aids experience and change
  to formal call in next bluetooth release.

Bug: 224323976
Test: pre-submit
Tag: #feature
Change-Id: I5976d03a1542629e25e2f21473d057b3c7770b0f
parent bd6bdcfc
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -673,6 +673,38 @@ public final class BluetoothHearingAid implements BluetoothProfile {
        return defaultValue;
    }

    /**
     * Get the side of the device.
     *
     * TODO(b/231901542): Used by internal only to improve hearing aids experience in short-term.
     * Need to change to formal call in next bluetooth release.
     *
     * @param device Bluetooth device.
     * @return SIDE_LEFT or SIDE_RIGHT
     */
    @RequiresLegacyBluetoothPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
    private int getDeviceSideInternal(BluetoothDevice device) {
        return getDeviceSide(device);
    }

    /**
     * Get the mode of the device.
     *
     * TODO(b/231901542): Used by internal only to improve hearing aids experience in short-term.
     * Need to change to formal call in next bluetooth release.
     *
     * @param device Bluetooth device
     * @return MODE_MONAURAL or MODE_BINAURAL
     */
    @RequiresLegacyBluetoothPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
    private int getDeviceModeInternal(BluetoothDevice device) {
        return getDeviceMode(device);
    }

    private boolean isEnabled() {
        if (mAdapter.getState() == BluetoothAdapter.STATE_ON) return true;
        return false;