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

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

Merge "A2dpSinkService enforces BLUETOOTH_PRIVILEGED permission for...

Merge "A2dpSinkService enforces BLUETOOTH_PRIVILEGED permission for implementations of all BluetoothA2dpSink System APIs"
parents b3189ad7 f41933bd
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -328,7 +328,8 @@ public class A2dpSinkService extends ProfileService {
     * @return true if connectionPolicy is set, false on error
     * @return true if connectionPolicy is set, false on error
     */
     */
    public boolean setConnectionPolicy(BluetoothDevice device, int connectionPolicy) {
    public boolean setConnectionPolicy(BluetoothDevice device, int connectionPolicy) {
        enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH_ADMIN permission");
        enforceCallingOrSelfPermission(
                BLUETOOTH_PRIVILEGED, "Need BLUETOOTH_PRIVILEGED permission");
        if (DBG) {
        if (DBG) {
            Log.d(TAG, "Saved connectionPolicy " + device + " = " + connectionPolicy);
            Log.d(TAG, "Saved connectionPolicy " + device + " = " + connectionPolicy);
        }
        }
@@ -349,7 +350,8 @@ public class A2dpSinkService extends ProfileService {
     * @return connection policy of the specified device
     * @return connection policy of the specified device
     */
     */
    public int getConnectionPolicy(BluetoothDevice device) {
    public int getConnectionPolicy(BluetoothDevice device) {
        enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH_ADMIN permission");
        enforceCallingOrSelfPermission(
                BLUETOOTH_PRIVILEGED, "Need BLUETOOTH_PRIVILEGED permission");
        return AdapterService.getAdapterService().getDatabase()
        return AdapterService.getAdapterService().getDatabase()
                .getProfileConnectionPolicy(device, BluetoothProfile.A2DP_SINK);
                .getProfileConnectionPolicy(device, BluetoothProfile.A2DP_SINK);
    }
    }
@@ -376,7 +378,8 @@ public class A2dpSinkService extends ProfileService {
    }
    }


    boolean isA2dpPlaying(BluetoothDevice device) {
    boolean isA2dpPlaying(BluetoothDevice device) {
        enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
        enforceCallingOrSelfPermission(
                BLUETOOTH_PRIVILEGED, "Need BLUETOOTH_PRIVILEGED permission");
        return mA2dpSinkStreamHandler.isPlaying();
        return mA2dpSinkStreamHandler.isPlaying();
    }
    }