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

Commit 5af7219c authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Add removeActiveDevice and enforce BLUETOOTH_PRIVILEGED in...

Merge "Add removeActiveDevice and enforce BLUETOOTH_PRIVILEGED in setActiveDevice and removeActiveDevice SystemApis" am: 409688be am: 314c26d2 am: 8cfea2e2

Change-Id: I11f556a861287cf229cdbd6087d687bff2cca4cb
parents ad0bd07c 8cfea2e2
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -1483,6 +1483,20 @@ public class AdapterService extends Service {
            return service.getConnectionState(device);
        }

        @Override
        public boolean removeActiveDevice(@ActiveDeviceUse int profiles) {
            if (!Utils.checkCaller()) {
                Log.w(TAG, "removeActiveDevice() - Not allowed for non-active user");
                return false;
            }

            AdapterService service = getService();
            if (service == null) {
                return false;
            }
            return service.setActiveDevice(null, profiles);
        }

        @Override
        public boolean setActiveDevice(BluetoothDevice device, @ActiveDeviceUse int profiles) {
            if (!Utils.checkCaller()) {
@@ -2307,7 +2321,8 @@ public class AdapterService extends Service {
     * @return false if profiles value is not one of the constants we accept, true otherwise
     */
    public boolean setActiveDevice(BluetoothDevice device, @ActiveDeviceUse int profiles) {
        enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH ADMIN permission");
        enforceCallingOrSelfPermission(
                BLUETOOTH_PRIVILEGED, "Need BLUETOOTH_PRIVILEGED permission");

        boolean setA2dp = false;
        boolean setHeadset = false;