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

Commit b977b414 authored by Hyundo Moon's avatar Hyundo Moon Committed by Automerger Merge Worker
Browse files

Merge "Add Binder tests for ProfileServices" am: 7b981c90

parents 4e2844d1 7b981c90
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -364,12 +364,16 @@ public class AvrcpControllerService extends ProfileService {
    }

    //Binder object: Must be static class or memory leak may occur
    private static class AvrcpControllerServiceBinder extends IBluetoothAvrcpController.Stub
    @VisibleForTesting
    static class AvrcpControllerServiceBinder extends IBluetoothAvrcpController.Stub
            implements IProfileServiceBinder {
        private AvrcpControllerService mService;

        @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
        private AvrcpControllerService getService(AttributionSource source) {
            if (Utils.isInstrumentationTestMode()) {
                return mService;
            }
            if (!Utils.checkServiceAvailable(mService, TAG)
                    || !Utils.checkCallerIsSystemOrActiveOrManagedUser(mService, TAG)
                    || !Utils.checkConnectPermissionForDataDelivery(mService, source, TAG)) {
+6 −2
Original line number Diff line number Diff line
@@ -260,7 +260,8 @@ public class HeadsetClientService extends ProfileService {
    /**
     * Handlers for incoming service calls
     */
    private static class BluetoothHeadsetClientBinder extends IBluetoothHeadsetClient.Stub
    @VisibleForTesting
    static class BluetoothHeadsetClientBinder extends IBluetoothHeadsetClient.Stub
            implements IProfileServiceBinder {
        private HeadsetClientService mService;

@@ -275,6 +276,9 @@ public class HeadsetClientService extends ProfileService {

        @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
        private HeadsetClientService getService(AttributionSource source) {
            if (Utils.isInstrumentationTestMode()) {
                return mService;
            }
            if (!Utils.checkServiceAvailable(mService, TAG)
                    || !Utils.checkCallerIsSystemOrActiveOrManagedUser(mService, TAG)
                    || !Utils.checkConnectPermissionForDataDelivery(mService, source, TAG)) {
@@ -777,7 +781,7 @@ public class HeadsetClientService extends ProfileService {
        return connectedDevices;
    }

    private List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
    List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
        List<BluetoothDevice> devices = new ArrayList<BluetoothDevice>();
        synchronized (mStateMachineMap) {
            for (BluetoothDevice bd : mStateMachineMap.keySet()) {
+5 −1
Original line number Diff line number Diff line
@@ -325,7 +325,8 @@ public class HidHostService extends ProfileService {
    /**
     * Handlers for incoming service calls
     */
    private static class BluetoothHidHostBinder extends IBluetoothHidHost.Stub
    @VisibleForTesting
    static class BluetoothHidHostBinder extends IBluetoothHidHost.Stub
            implements IProfileServiceBinder {
        private HidHostService mService;

@@ -340,6 +341,9 @@ public class HidHostService extends ProfileService {

        @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
        private HidHostService getService(AttributionSource source) {
            if (Utils.isInstrumentationTestMode()) {
                return mService;
            }
            if (!Utils.checkServiceAvailable(mService, TAG)
                    || !Utils.checkCallerIsSystemOrActiveOrManagedUser(mService, TAG)
                    || !Utils.checkConnectPermissionForDataDelivery(mService, source, TAG)) {
+6 −2
Original line number Diff line number Diff line
@@ -556,7 +556,7 @@ public class BluetoothMapService extends ProfileService {
        }
    }

    private List<BluetoothDevice> getConnectedDevices() {
    List<BluetoothDevice> getConnectedDevices() {
        List<BluetoothDevice> devices = new ArrayList<>();
        synchronized (this) {
            if (mState == BluetoothMap.STATE_CONNECTED && sRemoteDevice != null) {
@@ -1209,12 +1209,16 @@ public class BluetoothMapService extends ProfileService {
     * This class implements the IBluetoothMap interface - or actually it validates the
     * preconditions for calling the actual functionality in the MapService, and calls it.
     */
    private static class BluetoothMapBinder extends IBluetoothMap.Stub
    @VisibleForTesting
    static class BluetoothMapBinder extends IBluetoothMap.Stub
            implements IProfileServiceBinder {
        private BluetoothMapService mService;

        @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
        private BluetoothMapService getService(AttributionSource source) {
            if (Utils.isInstrumentationTestMode()) {
                return mService;
            }
            if (!Utils.checkServiceAvailable(mService, TAG)
                    || !Utils.checkCallerIsSystemOrActiveOrManagedUser(mService, TAG)
                    || !Utils.checkConnectPermissionForDataDelivery(mService, source, TAG)) {
+5 −1
Original line number Diff line number Diff line
@@ -270,7 +270,8 @@ public class PanService extends ProfileService {
    /**
     * Handlers for incoming service calls
     */
    private static class BluetoothPanBinder extends IBluetoothPan.Stub
    @VisibleForTesting
    static class BluetoothPanBinder extends IBluetoothPan.Stub
            implements IProfileServiceBinder {
        private PanService mService;

@@ -285,6 +286,9 @@ public class PanService extends ProfileService {

        @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
        private PanService getService(AttributionSource source) {
            if (Utils.isInstrumentationTestMode()) {
                return mService;
            }
            if (!Utils.checkServiceAvailable(mService, TAG)
                    || !Utils.checkCallerIsSystemOrActiveOrManagedUser(mService, TAG)
                    || !Utils.checkConnectPermissionForDataDelivery(mService, source, TAG)) {
Loading