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

Commit 701ebfc5 authored by William Escande's avatar William Escande
Browse files

HEARINGAID Enforce priviled on setVolume

HearingAid.setVolume is a new SystemAPI
Enforcing privileged permission

Tag: #refactor
Test: atest 'CtsBluetoothTestCases:android.bluetooth.cts.HearingAidProfileTest'
Bug: 216476895
Change-Id: Idd1258bceb054be7f29210a9e0e643e14e52788a
parent 8665a75c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -536,7 +536,10 @@ public class HearingAidService extends ProfileService {
                .getProfileConnectionPolicy(device, BluetoothProfile.HEARING_AID);
    }

    @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)
    void setVolume(int volume) {
        enforceCallingOrSelfPermission(BLUETOOTH_PRIVILEGED,
                "Need BLUETOOTH_PRIVILEGED permission");
        mHearingAidNativeInterface.setVolume(volume);
    }

+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ oneway interface IBluetoothHearingAid {
    void setConnectionPolicy(in BluetoothDevice device, int connectionPolicy, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
    void getConnectionPolicy(in BluetoothDevice device, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
    void setVolume(int volume, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);

    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")