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

Commit 6121826b authored by William Escande's avatar William Escande Committed by Gerrit Code Review
Browse files

Merge "catch exception and return error in ManagerService"

parents 3a568ccd c68ad73e
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
@@ -3420,22 +3420,26 @@ public class BluetoothManagerService extends IBluetoothManager.Stub {
    public int setBtHciSnoopLogMode(int mode) {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_PRIVILEGED,
                "Need BLUETOOTH_PRIVILEGED permission");
        final BluetoothProperties.snoop_log_mode_values snoopMode;

        switch (mode) {
            case BluetoothAdapter.BT_SNOOP_LOG_MODE_DISABLED:
                BluetoothProperties.snoop_log_mode(
                        BluetoothProperties.snoop_log_mode_values.DISABLED);
                snoopMode = BluetoothProperties.snoop_log_mode_values.DISABLED;
                break;
            case BluetoothAdapter.BT_SNOOP_LOG_MODE_FILTERED:
                BluetoothProperties.snoop_log_mode(
                        BluetoothProperties.snoop_log_mode_values.FILTERED);
                snoopMode = BluetoothProperties.snoop_log_mode_values.FILTERED;
                break;
            case BluetoothAdapter.BT_SNOOP_LOG_MODE_FULL:
                BluetoothProperties.snoop_log_mode(
                        BluetoothProperties.snoop_log_mode_values.FULL);
                snoopMode = BluetoothProperties.snoop_log_mode_values.FULL;
                break;
            default:
                BluetoothProperties.snoop_log_mode(
                        BluetoothProperties.snoop_log_mode_values.EMPTY);
                Log.e(TAG, "setBtHciSnoopLogMode: Not a valid mode:" + mode);
                return BluetoothStatusCodes.ERROR_BAD_PARAMETERS;
        }
        try {
            BluetoothProperties.snoop_log_mode(snoopMode);
        } catch (RuntimeException e) {
            Log.e(TAG, "setBtHciSnoopLogMode: Failed to set mode to " + mode + ": " + e);
            return BluetoothStatusCodes.ERROR_UNKNOWN;
        }
        return BluetoothStatusCodes.SUCCESS;