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

Commit 19ba9dbc authored by Himanshu Rawat's avatar Himanshu Rawat
Browse files

Make Android Headtracker Service a restricted service

Android Bluetooth GATT prevents applications from accessing managed
GATT services like HOGP, LE Audio profiles, etc. Android Headtracker
Service is a managed service and applications should not be able to
read/write its characteristics.

Test: mmm packages/modules/Bluetooth
Test: Manual | connect with an earbud with Android Headtracker Service
using a GATT client app, try reading the AHS characteristics.
Flag: EXEMPT bugfix
Bug: 350085606

Change-Id: I94c3043ac807c74b12580d0e3719e79b62d67c46
parent 883b574e
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ import com.android.bluetooth.btservice.CompanionManager;
import com.android.bluetooth.btservice.MetricsLogger;
import com.android.bluetooth.btservice.ProfileService;
import com.android.bluetooth.flags.Flags;
import com.android.bluetooth.hid.HidHostService;
import com.android.bluetooth.le_scan.TransitionalScanHelper;
import com.android.internal.annotations.VisibleForTesting;

@@ -3398,8 +3399,15 @@ public class GattService extends ProfileService {
        return false;
    }

    private boolean isAndroidHeadtrackerSrvcUuid(final UUID uuid) {
        return HidHostService.ANDROID_HEADTRACKER_UUID.getUuid().equals(uuid);
    }

    private boolean isRestrictedSrvcUuid(final UUID uuid) {
        return isFidoSrvcUuid(uuid) || isAndroidTvRemoteSrvcUuid(uuid) || isLeAudioSrvcUuid(uuid);
        return isFidoSrvcUuid(uuid)
                || isAndroidTvRemoteSrvcUuid(uuid)
                || isLeAudioSrvcUuid(uuid)
                || isAndroidHeadtrackerSrvcUuid(uuid);
    }

    private int getDeviceType(BluetoothDevice device) {