Loading android/app/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -341,6 +341,7 @@ android_app { "-Xep:EqualsHashCode:ERROR", "-Xep:FallThrough:ERROR", "-Xep:Finalize:ERROR", "-Xep:GuardedBy:ERROR", "-Xep:HidingField:ERROR", "-Xep:InconsistentHashCode:ERROR", "-Xep:InlineMeInliner:ERROR", Loading android/app/src/com/android/bluetooth/a2dp/A2dpService.java +19 −9 Original line number Diff line number Diff line Loading @@ -524,12 +524,14 @@ public class A2dpService extends ProfileService { @VisibleForTesting public boolean setSilenceMode(@NonNull BluetoothDevice device, boolean silence) { Log.d(TAG, "setSilenceMode(" + device + "): " + silence); synchronized (mStateMachines) { if (silence && Objects.equals(mActiveDevice, device)) { removeActiveDevice(true); } else if (!silence && mActiveDevice == null) { // Set the device as the active device if currently no active device. setActiveDevice(device); } } if (!mNativeInterface.setSilenceDevice(device, silence)) { Log.e(TAG, "Cannot set " + device + " silence mode " + silence + " in native layer"); return false; Loading Loading @@ -752,8 +754,10 @@ public class A2dpService extends ProfileService { public void setCodecConfigPreference(BluetoothDevice device, BluetoothCodecConfig codecConfig) { Log.d(TAG, "setCodecConfigPreference(" + device + "): " + Objects.toString(codecConfig)); if (device == null) { synchronized (mStateMachines) { device = mActiveDevice; } } if (device == null) { Log.e(TAG, "setCodecConfigPreference: Invalid device"); return; Loading @@ -779,8 +783,10 @@ public class A2dpService extends ProfileService { public void enableOptionalCodecs(BluetoothDevice device) { Log.d(TAG, "enableOptionalCodecs(" + device + ")"); if (device == null) { synchronized (mStateMachines) { device = mActiveDevice; } } if (device == null) { Log.e(TAG, "enableOptionalCodecs: Invalid device"); return; Loading @@ -807,8 +813,10 @@ public class A2dpService extends ProfileService { public void disableOptionalCodecs(BluetoothDevice device) { Log.d(TAG, "disableOptionalCodecs(" + device + ")"); if (device == null) { synchronized (mStateMachines) { device = mActiveDevice; } } if (device == null) { Log.e(TAG, "disableOptionalCodecs: Invalid device"); return; Loading Loading @@ -1685,7 +1693,9 @@ public class A2dpService extends ProfileService { @Override public void dump(StringBuilder sb) { super.dump(sb); synchronized (mStateMachines) { ProfileService.println(sb, "mActiveDevice: " + mActiveDevice); } ProfileService.println(sb, "mMaxConnectedAudioDevices: " + mMaxConnectedAudioDevices); if (mA2dpCodecConfig != null) { ProfileService.println(sb, "codecConfigPriorities:"); Loading android/app/src/com/android/bluetooth/avrcp/AvrcpNativeInterface.java +2 −2 Original line number Diff line number Diff line Loading @@ -59,10 +59,10 @@ public class AvrcpNativeInterface { if (sInstance == null) { sInstance = new AvrcpNativeInterface(); } } return sInstance; } } /** Set singleton instance. */ @VisibleForTesting Loading android/app/src/com/android/bluetooth/btservice/ActiveDeviceManager.java +12 −4 Original line number Diff line number Diff line Loading @@ -1200,23 +1200,31 @@ public class ActiveDeviceManager implements AdapterService.BluetoothStateCallbac @VisibleForTesting BluetoothDevice getA2dpActiveDevice() { synchronized (mLock) { return mA2dpActiveDevice; } } @VisibleForTesting BluetoothDevice getHfpActiveDevice() { synchronized (mLock) { return mHfpActiveDevice; } } @VisibleForTesting Set<BluetoothDevice> getHearingAidActiveDevices() { synchronized (mLock) { return mHearingAidActiveDevices; } } @VisibleForTesting BluetoothDevice getLeAudioActiveDevice() { synchronized (mLock) { return mLeAudioActiveDevice; } } @GuardedBy("mLock") private long getHearingAidActiveHiSyncIdLocked() { Loading android/app/src/com/android/bluetooth/hfpclient/HeadsetClientService.java +10 −6 Original line number Diff line number Diff line Loading @@ -860,17 +860,21 @@ public class HeadsetClientService extends ProfileService { + allowed + ", " + Utils.getUidPidString()); synchronized (mStateMachineMap) { HeadsetClientStateMachine sm = mStateMachineMap.get(device); if (sm != null) { sm.setAudioRouteAllowed(allowed); } } } public boolean getAudioRouteAllowed(BluetoothDevice device) { synchronized (mStateMachineMap) { HeadsetClientStateMachine sm = mStateMachineMap.get(device); if (sm != null) { return sm.getAudioRouteAllowed(); } } return false; } Loading Loading
android/app/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -341,6 +341,7 @@ android_app { "-Xep:EqualsHashCode:ERROR", "-Xep:FallThrough:ERROR", "-Xep:Finalize:ERROR", "-Xep:GuardedBy:ERROR", "-Xep:HidingField:ERROR", "-Xep:InconsistentHashCode:ERROR", "-Xep:InlineMeInliner:ERROR", Loading
android/app/src/com/android/bluetooth/a2dp/A2dpService.java +19 −9 Original line number Diff line number Diff line Loading @@ -524,12 +524,14 @@ public class A2dpService extends ProfileService { @VisibleForTesting public boolean setSilenceMode(@NonNull BluetoothDevice device, boolean silence) { Log.d(TAG, "setSilenceMode(" + device + "): " + silence); synchronized (mStateMachines) { if (silence && Objects.equals(mActiveDevice, device)) { removeActiveDevice(true); } else if (!silence && mActiveDevice == null) { // Set the device as the active device if currently no active device. setActiveDevice(device); } } if (!mNativeInterface.setSilenceDevice(device, silence)) { Log.e(TAG, "Cannot set " + device + " silence mode " + silence + " in native layer"); return false; Loading Loading @@ -752,8 +754,10 @@ public class A2dpService extends ProfileService { public void setCodecConfigPreference(BluetoothDevice device, BluetoothCodecConfig codecConfig) { Log.d(TAG, "setCodecConfigPreference(" + device + "): " + Objects.toString(codecConfig)); if (device == null) { synchronized (mStateMachines) { device = mActiveDevice; } } if (device == null) { Log.e(TAG, "setCodecConfigPreference: Invalid device"); return; Loading @@ -779,8 +783,10 @@ public class A2dpService extends ProfileService { public void enableOptionalCodecs(BluetoothDevice device) { Log.d(TAG, "enableOptionalCodecs(" + device + ")"); if (device == null) { synchronized (mStateMachines) { device = mActiveDevice; } } if (device == null) { Log.e(TAG, "enableOptionalCodecs: Invalid device"); return; Loading @@ -807,8 +813,10 @@ public class A2dpService extends ProfileService { public void disableOptionalCodecs(BluetoothDevice device) { Log.d(TAG, "disableOptionalCodecs(" + device + ")"); if (device == null) { synchronized (mStateMachines) { device = mActiveDevice; } } if (device == null) { Log.e(TAG, "disableOptionalCodecs: Invalid device"); return; Loading Loading @@ -1685,7 +1693,9 @@ public class A2dpService extends ProfileService { @Override public void dump(StringBuilder sb) { super.dump(sb); synchronized (mStateMachines) { ProfileService.println(sb, "mActiveDevice: " + mActiveDevice); } ProfileService.println(sb, "mMaxConnectedAudioDevices: " + mMaxConnectedAudioDevices); if (mA2dpCodecConfig != null) { ProfileService.println(sb, "codecConfigPriorities:"); Loading
android/app/src/com/android/bluetooth/avrcp/AvrcpNativeInterface.java +2 −2 Original line number Diff line number Diff line Loading @@ -59,10 +59,10 @@ public class AvrcpNativeInterface { if (sInstance == null) { sInstance = new AvrcpNativeInterface(); } } return sInstance; } } /** Set singleton instance. */ @VisibleForTesting Loading
android/app/src/com/android/bluetooth/btservice/ActiveDeviceManager.java +12 −4 Original line number Diff line number Diff line Loading @@ -1200,23 +1200,31 @@ public class ActiveDeviceManager implements AdapterService.BluetoothStateCallbac @VisibleForTesting BluetoothDevice getA2dpActiveDevice() { synchronized (mLock) { return mA2dpActiveDevice; } } @VisibleForTesting BluetoothDevice getHfpActiveDevice() { synchronized (mLock) { return mHfpActiveDevice; } } @VisibleForTesting Set<BluetoothDevice> getHearingAidActiveDevices() { synchronized (mLock) { return mHearingAidActiveDevices; } } @VisibleForTesting BluetoothDevice getLeAudioActiveDevice() { synchronized (mLock) { return mLeAudioActiveDevice; } } @GuardedBy("mLock") private long getHearingAidActiveHiSyncIdLocked() { Loading
android/app/src/com/android/bluetooth/hfpclient/HeadsetClientService.java +10 −6 Original line number Diff line number Diff line Loading @@ -860,17 +860,21 @@ public class HeadsetClientService extends ProfileService { + allowed + ", " + Utils.getUidPidString()); synchronized (mStateMachineMap) { HeadsetClientStateMachine sm = mStateMachineMap.get(device); if (sm != null) { sm.setAudioRouteAllowed(allowed); } } } public boolean getAudioRouteAllowed(BluetoothDevice device) { synchronized (mStateMachineMap) { HeadsetClientStateMachine sm = mStateMachineMap.get(device); if (sm != null) { return sm.getAudioRouteAllowed(); } } return false; } Loading