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

Commit 5a1e4cf8 authored by Jaikumar Ganesh's avatar Jaikumar Ganesh
Browse files

Update BT APIs return type from Set to List.

Change-Id: Ia27220dd26cde13007f6938c830517ee7f6968ce
parent 03cd78cf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -321,7 +321,7 @@ public final class BluetoothDeviceProfileState extends HierarchicalStateMachine
                              mA2dpService.getDevicesMatchingConnectionStates(
                                  new int[] {BluetoothA2dp.STATE_CONNECTED,
                                             BluetoothProfile.STATE_CONNECTING,
                                             BluetoothProfile.STATE_DISCONNECTING}).length == 0) {
                                             BluetoothProfile.STATE_DISCONNECTING}).size() == 0) {
                            mA2dpService.connect(mDevice);
                        }
                        if (mService.getInputDevicePriority(mDevice) ==
+6 −10
Original line number Diff line number Diff line
@@ -24,10 +24,8 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Log;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.ArrayList;
import java.util.List;

/**
 * Public API for controlling the Bluetooth HID (Input Device) Profile
@@ -167,18 +165,16 @@ public final class BluetoothInputDevice {

    /** Check if any Input Device is connected.
     *
     * @return a unmodifiable set of connected Input Devices, or null on error.
     * @return List of devices, empty List on error.
     * @hide
     */
    public Set<BluetoothDevice> getConnectedInputDevices() {
    public List<BluetoothDevice> getConnectedInputDevices() {
        if (DBG) log("getConnectedInputDevices()");
        try {
            return Collections.unmodifiableSet(
                    new HashSet<BluetoothDevice>(
                        Arrays.asList(mService.getConnectedInputDevices())));
            return mService.getConnectedInputDevices();
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
            return null;
            return new ArrayList<BluetoothDevice>();
        }
    }

+8 −12
Original line number Diff line number Diff line
@@ -19,15 +19,13 @@ package android.bluetooth;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.content.Context;
import android.os.ServiceManager;
import android.os.RemoteException;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Log;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.ArrayList;
import java.util.List;

/**
 * @hide
@@ -154,18 +152,16 @@ public final class BluetoothPan {
   *
   * Does not include devices that are currently connecting or disconnecting
   *
   * @return a unmodifiable set of connected PAN Devices, or null on error.
   * @return List of PAN devices or empty on Error
   * @hide
   */
   public Set<BluetoothDevice> getConnectedDevices() {
   public List<BluetoothDevice> getConnectedDevices() {
      if (DBG) log("getConnectedDevices");
      try {
          return Collections.unmodifiableSet(
                  new HashSet<BluetoothDevice>(
                      Arrays.asList(mService.getConnectedPanDevices())));
          return mService.getConnectedPanDevices();
      } catch (RemoteException e) {
          Log.e(TAG, "", e);
          return null;
          return new ArrayList<BluetoothDevice>();
      }
   }

+2 −2
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ interface IBluetooth
    // HID profile APIs
    boolean connectInputDevice(in BluetoothDevice device);
    boolean disconnectInputDevice(in BluetoothDevice device);
    BluetoothDevice[] getConnectedInputDevices();  // change to Set<> once AIDL supports
    List<BluetoothDevice> getConnectedInputDevices();
    int getInputDeviceState(in BluetoothDevice device);
    boolean setInputDevicePriority(in BluetoothDevice device, int priority);
    int getInputDevicePriority(in BluetoothDevice device);
@@ -89,7 +89,7 @@ interface IBluetooth
    boolean isTetheringOn();
    void setBluetoothTethering(boolean value);
    int getPanDeviceState(in BluetoothDevice device);
    BluetoothDevice[] getConnectedPanDevices();
    List<BluetoothDevice> getConnectedPanDevices();
    boolean connectPanDevice(in BluetoothDevice device);
    boolean disconnectPanDevice(in BluetoothDevice device);
}
+5 −4
Original line number Diff line number Diff line
@@ -29,11 +29,12 @@ import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.os.ParcelUuid;
import android.os.PowerManager;
import android.util.Log;

import java.util.HashMap;
import java.util.List;
import java.util.Set;
import android.os.PowerManager;


/**
@@ -629,7 +630,7 @@ class BluetoothEventLoop {
    }

    private boolean isOtherInputDeviceConnected(String address) {
        Set<BluetoothDevice> devices =
        List<BluetoothDevice> devices =
            mBluetoothService.lookupInputDevicesMatchingStates(new int[] {
                                                BluetoothInputDevice.STATE_CONNECTING,
                                                BluetoothInputDevice.STATE_CONNECTED});
@@ -654,7 +655,7 @@ class BluetoothEventLoop {
    }

    private boolean isOtherSinkInNonDisconnectedState(String address) {
        Set<BluetoothDevice> devices =
        List<BluetoothDevice> devices =
            mA2dp.getDevicesMatchingConnectionStates(new int[] {BluetoothA2dp.STATE_CONNECTED,
                                                     BluetoothA2dp.STATE_CONNECTING,
                                                     BluetoothA2dp.STATE_DISCONNECTING});
Loading