Loading android/app/jni/Android.bp +0 −2 Original line number Diff line number Diff line Loading @@ -25,11 +25,9 @@ cc_library_shared { "libchrome", "libnativehelper", "liblog", "libutils", ], static_libs: [ "libbluetooth-types", "libcutils", ], cflags: [ "-Wall", Loading android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp +1 −7 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ #include "utils/Log.h" #include "utils/misc.h" #include <cutils/properties.h> #include <dlfcn.h> #include <errno.h> #include <pthread.h> Loading Loading @@ -598,17 +597,12 @@ static bt_os_callouts_t sBluetoothOsCallouts = { acquire_wake_lock_callout, release_wake_lock_callout, }; #define PROPERTY_BT_LIBRARY_NAME "ro.bluetooth.library_name" #define DEFAULT_BT_LIBRARY_NAME "libbluetooth.so" int hal_util_load_bt_library(const bt_interface_t** interface) { const char* sym = BLUETOOTH_INTERFACE_STRING; bt_interface_t* itf = nullptr; // The library name is not set by default, so the preset library name is used. char path[PROPERTY_VALUE_MAX] = ""; property_get(PROPERTY_BT_LIBRARY_NAME, path, DEFAULT_BT_LIBRARY_NAME); void* handle = dlopen(path, RTLD_NOW); void* handle = dlopen("libbluetooth.so", RTLD_NOW); if (!handle) { const char* err_str = dlerror(); ALOGE("%s: failed to load Bluetooth library, error=%s", __func__, Loading android/app/src/com/android/bluetooth/a2dp/A2dpService.java +0 −34 Original line number Diff line number Diff line Loading @@ -433,19 +433,9 @@ public class A2dpService extends ProfileService { } } private void storeActiveDeviceVolume() { // Make sure volume has been stored before been removed from active. if (mFactory.getAvrcpTargetService() != null && mActiveDevice != null) { mFactory.getAvrcpTargetService().storeVolumeForDevice(mActiveDevice); } } private void removeActiveDevice(boolean forceStopPlayingAudio) { BluetoothDevice previousActiveDevice = mActiveDevice; synchronized (mStateMachines) { // Make sure volume has been store before device been remove from active. storeActiveDeviceVolume(); // This needs to happen before we inform the audio manager that the device // disconnected. Please see comment in updateAndBroadcastActiveDevice() for why. updateAndBroadcastActiveDevice(null); Loading Loading @@ -499,22 +489,6 @@ public class A2dpService extends ProfileService { return true; } /** * Early notification that Hearing Aids will be the active device. This allows the A2DP to save * its volume before the Audio Service starts changing its media stream. */ public void earlyNotifyHearingAidActive() { enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH ADMIN permission"); synchronized (mStateMachines) { // Switch active device from A2DP to Hearing Aids. if (DBG) { Log.d(TAG, "earlyNotifyHearingAidActive: Save volume for " + mActiveDevice); } storeActiveDeviceVolume(); } } /** * Set the active device. * Loading Loading @@ -554,14 +528,6 @@ public class A2dpService extends ProfileService { codecStatus = sm.getCodecStatus(); boolean deviceChanged = !Objects.equals(device, mActiveDevice); if (deviceChanged) { // Switch from one A2DP to another A2DP device if (DBG) { Log.d(TAG, "Switch A2DP devices to " + device + " from " + mActiveDevice); } storeActiveDeviceVolume(); } // This needs to happen before we inform the audio manager that the device // disconnected. Please see comment in updateAndBroadcastActiveDevice() for why. updateAndBroadcastActiveDevice(device); Loading android/app/src/com/android/bluetooth/avrcp/AvrcpTargetService.java +0 −18 Original line number Diff line number Diff line Loading @@ -242,24 +242,6 @@ public class AvrcpTargetService extends ProfileService { mVolumeManager.volumeDeviceSwitched(device); } /** * Store the current system volume for a device in order to be retrieved later. */ public void storeVolumeForDevice(BluetoothDevice device) { if (device == null) return; List<BluetoothDevice> HAActiveDevices = null; if (mFactory.getHearingAidService() != null) { HAActiveDevices = mFactory.getHearingAidService().getActiveDevices(); } if (HAActiveDevices != null && (HAActiveDevices.get(0) != null || HAActiveDevices.get(1) != null)) { Log.d(TAG, "Do not store volume when Hearing Aid devices is active"); return; } mVolumeManager.storeVolumeForDevice(device); } /** * Remove the stored volume for a device. */ Loading android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachine.java +3 −3 Original line number Diff line number Diff line Loading @@ -223,7 +223,6 @@ class AvrcpControllerStateMachine extends StateMachine { mService.sBrowseTree.mRootNode.addChild(mBrowseTree.mRootNode); BluetoothMediaBrowserService.notifyChanged(mService .sBrowseTree.mRootNode); BluetoothMediaBrowserService.notifyChanged(mAddressedPlayer.getPlaybackState()); mBrowsingConnected = true; } Loading @@ -233,12 +232,10 @@ class AvrcpControllerStateMachine extends StateMachine { mAddressedPlayer.updateCurrentTrack(null); mBrowseTree.mNowPlayingNode.setCached(false); BluetoothMediaBrowserService.notifyChanged(mBrowseTree.mNowPlayingNode); BluetoothMediaBrowserService.addressedPlayerChanged(null); mService.sBrowseTree.mRootNode.removeChild( mBrowseTree.mRootNode); BluetoothMediaBrowserService.notifyChanged(mService .sBrowseTree.mRootNode); BluetoothMediaBrowserService.trackChanged(null); mBrowsingConnected = false; } Loading Loading @@ -299,6 +296,7 @@ class AvrcpControllerStateMachine extends StateMachine { @Override public void enter() { if (mMostRecentState == BluetoothProfile.STATE_CONNECTING) { BluetoothMediaBrowserService.notifyChanged(mAddressedPlayer.getPlaybackState()); broadcastConnectionStateChanged(BluetoothProfile.STATE_CONNECTED); BluetoothMediaBrowserService.addressedPlayerChanged(mSessionCallbacks); } else { Loading Loading @@ -712,6 +710,8 @@ class AvrcpControllerStateMachine extends StateMachine { @Override public void enter() { onBrowsingDisconnected(); BluetoothMediaBrowserService.trackChanged(null); BluetoothMediaBrowserService.addressedPlayerChanged(null); broadcastConnectionStateChanged(BluetoothProfile.STATE_DISCONNECTING); transitionTo(mDisconnected); } Loading Loading
android/app/jni/Android.bp +0 −2 Original line number Diff line number Diff line Loading @@ -25,11 +25,9 @@ cc_library_shared { "libchrome", "libnativehelper", "liblog", "libutils", ], static_libs: [ "libbluetooth-types", "libcutils", ], cflags: [ "-Wall", Loading
android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp +1 −7 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ #include "utils/Log.h" #include "utils/misc.h" #include <cutils/properties.h> #include <dlfcn.h> #include <errno.h> #include <pthread.h> Loading Loading @@ -598,17 +597,12 @@ static bt_os_callouts_t sBluetoothOsCallouts = { acquire_wake_lock_callout, release_wake_lock_callout, }; #define PROPERTY_BT_LIBRARY_NAME "ro.bluetooth.library_name" #define DEFAULT_BT_LIBRARY_NAME "libbluetooth.so" int hal_util_load_bt_library(const bt_interface_t** interface) { const char* sym = BLUETOOTH_INTERFACE_STRING; bt_interface_t* itf = nullptr; // The library name is not set by default, so the preset library name is used. char path[PROPERTY_VALUE_MAX] = ""; property_get(PROPERTY_BT_LIBRARY_NAME, path, DEFAULT_BT_LIBRARY_NAME); void* handle = dlopen(path, RTLD_NOW); void* handle = dlopen("libbluetooth.so", RTLD_NOW); if (!handle) { const char* err_str = dlerror(); ALOGE("%s: failed to load Bluetooth library, error=%s", __func__, Loading
android/app/src/com/android/bluetooth/a2dp/A2dpService.java +0 −34 Original line number Diff line number Diff line Loading @@ -433,19 +433,9 @@ public class A2dpService extends ProfileService { } } private void storeActiveDeviceVolume() { // Make sure volume has been stored before been removed from active. if (mFactory.getAvrcpTargetService() != null && mActiveDevice != null) { mFactory.getAvrcpTargetService().storeVolumeForDevice(mActiveDevice); } } private void removeActiveDevice(boolean forceStopPlayingAudio) { BluetoothDevice previousActiveDevice = mActiveDevice; synchronized (mStateMachines) { // Make sure volume has been store before device been remove from active. storeActiveDeviceVolume(); // This needs to happen before we inform the audio manager that the device // disconnected. Please see comment in updateAndBroadcastActiveDevice() for why. updateAndBroadcastActiveDevice(null); Loading Loading @@ -499,22 +489,6 @@ public class A2dpService extends ProfileService { return true; } /** * Early notification that Hearing Aids will be the active device. This allows the A2DP to save * its volume before the Audio Service starts changing its media stream. */ public void earlyNotifyHearingAidActive() { enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH ADMIN permission"); synchronized (mStateMachines) { // Switch active device from A2DP to Hearing Aids. if (DBG) { Log.d(TAG, "earlyNotifyHearingAidActive: Save volume for " + mActiveDevice); } storeActiveDeviceVolume(); } } /** * Set the active device. * Loading Loading @@ -554,14 +528,6 @@ public class A2dpService extends ProfileService { codecStatus = sm.getCodecStatus(); boolean deviceChanged = !Objects.equals(device, mActiveDevice); if (deviceChanged) { // Switch from one A2DP to another A2DP device if (DBG) { Log.d(TAG, "Switch A2DP devices to " + device + " from " + mActiveDevice); } storeActiveDeviceVolume(); } // This needs to happen before we inform the audio manager that the device // disconnected. Please see comment in updateAndBroadcastActiveDevice() for why. updateAndBroadcastActiveDevice(device); Loading
android/app/src/com/android/bluetooth/avrcp/AvrcpTargetService.java +0 −18 Original line number Diff line number Diff line Loading @@ -242,24 +242,6 @@ public class AvrcpTargetService extends ProfileService { mVolumeManager.volumeDeviceSwitched(device); } /** * Store the current system volume for a device in order to be retrieved later. */ public void storeVolumeForDevice(BluetoothDevice device) { if (device == null) return; List<BluetoothDevice> HAActiveDevices = null; if (mFactory.getHearingAidService() != null) { HAActiveDevices = mFactory.getHearingAidService().getActiveDevices(); } if (HAActiveDevices != null && (HAActiveDevices.get(0) != null || HAActiveDevices.get(1) != null)) { Log.d(TAG, "Do not store volume when Hearing Aid devices is active"); return; } mVolumeManager.storeVolumeForDevice(device); } /** * Remove the stored volume for a device. */ Loading
android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachine.java +3 −3 Original line number Diff line number Diff line Loading @@ -223,7 +223,6 @@ class AvrcpControllerStateMachine extends StateMachine { mService.sBrowseTree.mRootNode.addChild(mBrowseTree.mRootNode); BluetoothMediaBrowserService.notifyChanged(mService .sBrowseTree.mRootNode); BluetoothMediaBrowserService.notifyChanged(mAddressedPlayer.getPlaybackState()); mBrowsingConnected = true; } Loading @@ -233,12 +232,10 @@ class AvrcpControllerStateMachine extends StateMachine { mAddressedPlayer.updateCurrentTrack(null); mBrowseTree.mNowPlayingNode.setCached(false); BluetoothMediaBrowserService.notifyChanged(mBrowseTree.mNowPlayingNode); BluetoothMediaBrowserService.addressedPlayerChanged(null); mService.sBrowseTree.mRootNode.removeChild( mBrowseTree.mRootNode); BluetoothMediaBrowserService.notifyChanged(mService .sBrowseTree.mRootNode); BluetoothMediaBrowserService.trackChanged(null); mBrowsingConnected = false; } Loading Loading @@ -299,6 +296,7 @@ class AvrcpControllerStateMachine extends StateMachine { @Override public void enter() { if (mMostRecentState == BluetoothProfile.STATE_CONNECTING) { BluetoothMediaBrowserService.notifyChanged(mAddressedPlayer.getPlaybackState()); broadcastConnectionStateChanged(BluetoothProfile.STATE_CONNECTED); BluetoothMediaBrowserService.addressedPlayerChanged(mSessionCallbacks); } else { Loading Loading @@ -712,6 +710,8 @@ class AvrcpControllerStateMachine extends StateMachine { @Override public void enter() { onBrowsingDisconnected(); BluetoothMediaBrowserService.trackChanged(null); BluetoothMediaBrowserService.addressedPlayerChanged(null); broadcastConnectionStateChanged(BluetoothProfile.STATE_DISCONNECTING); transitionTo(mDisconnected); } Loading