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

Commit 63d75f87 authored by Pavlin Radoslavov's avatar Pavlin Radoslavov Committed by android-build-merger
Browse files

Merge "Remove unnecessary null pointer initialization for class variables" am: 934ea395

am: e1967d59

Change-Id: I618f7e15e1a6efcfdfcd811ef193ae029598d850
parents 3454a4a2 e1967d59
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -57,16 +57,16 @@ public class A2dpService extends ProfileService {
    private static final boolean DBG = true;
    private static final String TAG = "A2dpService";

    private BluetoothAdapter mAdapter = null;
    private HandlerThread mStateMachinesThread = null;
    private BluetoothAdapter mAdapter;
    private HandlerThread mStateMachinesThread;
    private Avrcp mAvrcp;

    @VisibleForTesting
    A2dpNativeInterface mA2dpNativeInterface = null;
    A2dpNativeInterface mA2dpNativeInterface;
    private AudioManager mAudioManager;

    private A2dpCodecConfig mA2dpCodecConfig = null;
    private BluetoothDevice mActiveDevice = null;
    private A2dpCodecConfig mA2dpCodecConfig;
    private BluetoothDevice mActiveDevice;

    private final ConcurrentMap<BluetoothDevice, A2dpStateMachine> mStateMachines =
            new ConcurrentHashMap<>();
@@ -76,8 +76,8 @@ public class A2dpService extends ProfileService {
    // Upper limit of all A2DP devices that are Connected or Connecting
    private int mMaxConnectedAudioDevices = 1;

    private BroadcastReceiver mBondStateChangedReceiver = null;
    private BroadcastReceiver mConnectionStateChangedReceiver = null;
    private BroadcastReceiver mBondStateChangedReceiver;
    private BroadcastReceiver mConnectionStateChangedReceiver;

    public A2dpService() {
        mA2dpNativeInterface = A2dpNativeInterface.getInstance();
@@ -252,7 +252,7 @@ public class A2dpService extends ProfileService {
    public List<BluetoothDevice> getConnectedDevices() {
        enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
        synchronized (mStateMachines) {
            List<BluetoothDevice> devices = new ArrayList<BluetoothDevice>();
            List<BluetoothDevice> devices = new ArrayList<>();
            for (A2dpStateMachine sm : mStateMachines.values()) {
                if (sm.isConnected()) {
                    devices.add(sm.getDevice());
@@ -294,7 +294,7 @@ public class A2dpService extends ProfileService {
    List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
        enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
        synchronized (mStateMachines) {
            List<BluetoothDevice> devices = new ArrayList<BluetoothDevice>();
            List<BluetoothDevice> devices = new ArrayList<>();
            Set<BluetoothDevice> bondedDevices = mAdapter.getBondedDevices();

            for (BluetoothDevice device : bondedDevices) {
@@ -835,7 +835,7 @@ public class A2dpService extends ProfileService {
        public List<BluetoothDevice> getConnectedDevices() {
            A2dpService service = getService();
            if (service == null) {
                return new ArrayList<BluetoothDevice>(0);
                return new ArrayList<>(0);
            }
            return service.getConnectedDevices();
        }
@@ -844,7 +844,7 @@ public class A2dpService extends ProfileService {
        public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
            A2dpService service = getService();
            if (service == null) {
                return new ArrayList<BluetoothDevice>(0);
                return new ArrayList<>(0);
            }
            return service.getDevicesMatchingConnectionStates(states);
        }
+2 −2
Original line number Diff line number Diff line
@@ -42,9 +42,9 @@ public class A2dpStackEvent {
    static final int AUDIO_STATE_STARTED = 2;

    public int type = EVENT_TYPE_NONE;
    public BluetoothDevice device = null;
    public BluetoothDevice device;
    public int valueInt = 0;
    public BluetoothCodecStatus codecStatus = null;
    public BluetoothCodecStatus codecStatus;

    A2dpStackEvent(int type) {
        this.type = type;
+1 −1
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ final class A2dpStateMachine extends StateMachine {

    private final BluetoothDevice mDevice;
    private boolean mIsPlaying = false;
    private BluetoothCodecStatus mCodecStatus = null;
    private BluetoothCodecStatus mCodecStatus;

    A2dpStateMachine(BluetoothDevice device, A2dpService svc, Context context,
                     A2dpNativeInterface a2dpNativeInterface, Looper looper) {
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ public class A2dpServiceTest {
    private BluetoothDevice mTestDevice;
    private static final int TIMEOUT_MS = 1000;    // 1s

    private BroadcastReceiver mConnectionStateChangedReceiver = null;
    private BroadcastReceiver mConnectionStateChangedReceiver;
    private final BlockingQueue<Intent> mConnectionStateChangedQueue = new LinkedBlockingQueue<>();

    @Mock private AdapterService mAdapterService;