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

Commit 82b82ea8 authored by Rahul Sabnis's avatar Rahul Sabnis
Browse files

Enforce privileged permissions for SystemApis in HidHostService and

BluetoothMapService

Bug: 149238030
Test: Manual
Change-Id: I8fa47527271e87de98fb6c14424f09ef8bc0ea6a
parent a85834bf
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.bluetooth.hid;

import static com.android.bluetooth.Utils.enforceBluetoothPrivilegedPermission;

import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothHidHost;
import android.bluetooth.BluetoothProfile;
@@ -355,11 +357,17 @@ public class HidHostService extends ProfileService {
            if (service == null) {
                return BluetoothHidHost.STATE_DISCONNECTED;
            }
            enforceBluetoothPrivilegedPermission(service);
            return service.getConnectionState(device);
        }

        @Override
        public List<BluetoothDevice> getConnectedDevices() {
            HidHostService service = getService();
            if (service == null) {
                return new ArrayList<>();
            }
            enforceBluetoothPrivilegedPermission(service);
            return getDevicesMatchingConnectionStates(new int[]{BluetoothProfile.STATE_CONNECTED});
        }

+3 −0
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@

package com.android.bluetooth.map;

import static com.android.bluetooth.Utils.enforceBluetoothPrivilegedPermission;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.bluetooth.BluetoothAdapter;
@@ -1244,6 +1246,7 @@ public class BluetoothMapService extends ProfileService {
            if (service == null) {
                return new ArrayList<>(0);
            }
            enforceBluetoothPrivilegedPermission(service);
            return service.getConnectedDevices();
        }