Loading android/app/src/com/android/bluetooth/hfp/HeadsetService.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -179,6 +179,7 @@ public class HeadsetService extends ProfileService { // Step 3: Initialize system interface // Step 3: Initialize system interface mSystemInterface = HeadsetObjectsFactory.getInstance().makeSystemInterface(this); mSystemInterface = HeadsetObjectsFactory.getInstance().makeSystemInterface(this); // Step 4: Initialize native interface // Step 4: Initialize native interface setHeadsetService(this); mMaxHeadsetConnections = mAdapterService.getMaxConnectedAudioDevices(); mMaxHeadsetConnections = mAdapterService.getMaxConnectedAudioDevices(); mNativeInterface = HeadsetObjectsFactory.getInstance().getNativeInterface(); mNativeInterface = HeadsetObjectsFactory.getInstance().getNativeInterface(); // Add 1 to allow a pending device to be connecting or disconnecting // Add 1 to allow a pending device to be connecting or disconnecting Loading @@ -197,7 +198,6 @@ public class HeadsetService extends ProfileService { filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED); filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED); registerReceiver(mHeadsetReceiver, filter); registerReceiver(mHeadsetReceiver, filter); // Step 7: Mark service as started // Step 7: Mark service as started setHeadsetService(this); mStarted = true; mStarted = true; BluetoothDevice activeDevice = getActiveDevice(); BluetoothDevice activeDevice = getActiveDevice(); String deviceAddress = activeDevice != null ? String deviceAddress = activeDevice != null ? Loading @@ -223,7 +223,6 @@ public class HeadsetService extends ProfileService { AdapterService.ACTIVITY_ATTRIBUTION_NO_ACTIVE_DEVICE_ADDRESS; AdapterService.ACTIVITY_ATTRIBUTION_NO_ACTIVE_DEVICE_ADDRESS; mAdapterService.notifyActivityAttributionInfo(getAttributionSource(), deviceAddress); mAdapterService.notifyActivityAttributionInfo(getAttributionSource(), deviceAddress); mStarted = false; mStarted = false; setHeadsetService(null); // Step 6: Tear down broadcast receivers // Step 6: Tear down broadcast receivers unregisterReceiver(mHeadsetReceiver); unregisterReceiver(mHeadsetReceiver); synchronized (mStateMachines) { synchronized (mStateMachines) { Loading Loading @@ -256,6 +255,7 @@ public class HeadsetService extends ProfileService { } } // Step 4: Destroy native interface // Step 4: Destroy native interface mNativeInterface.cleanup(); mNativeInterface.cleanup(); setHeadsetService(null); // Step 3: Destroy system interface // Step 3: Destroy system interface mSystemInterface.stop(); mSystemInterface.stop(); // Step 2: Stop handler thread // Step 2: Stop handler thread Loading Loading
android/app/src/com/android/bluetooth/hfp/HeadsetService.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -179,6 +179,7 @@ public class HeadsetService extends ProfileService { // Step 3: Initialize system interface // Step 3: Initialize system interface mSystemInterface = HeadsetObjectsFactory.getInstance().makeSystemInterface(this); mSystemInterface = HeadsetObjectsFactory.getInstance().makeSystemInterface(this); // Step 4: Initialize native interface // Step 4: Initialize native interface setHeadsetService(this); mMaxHeadsetConnections = mAdapterService.getMaxConnectedAudioDevices(); mMaxHeadsetConnections = mAdapterService.getMaxConnectedAudioDevices(); mNativeInterface = HeadsetObjectsFactory.getInstance().getNativeInterface(); mNativeInterface = HeadsetObjectsFactory.getInstance().getNativeInterface(); // Add 1 to allow a pending device to be connecting or disconnecting // Add 1 to allow a pending device to be connecting or disconnecting Loading @@ -197,7 +198,6 @@ public class HeadsetService extends ProfileService { filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED); filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED); registerReceiver(mHeadsetReceiver, filter); registerReceiver(mHeadsetReceiver, filter); // Step 7: Mark service as started // Step 7: Mark service as started setHeadsetService(this); mStarted = true; mStarted = true; BluetoothDevice activeDevice = getActiveDevice(); BluetoothDevice activeDevice = getActiveDevice(); String deviceAddress = activeDevice != null ? String deviceAddress = activeDevice != null ? Loading @@ -223,7 +223,6 @@ public class HeadsetService extends ProfileService { AdapterService.ACTIVITY_ATTRIBUTION_NO_ACTIVE_DEVICE_ADDRESS; AdapterService.ACTIVITY_ATTRIBUTION_NO_ACTIVE_DEVICE_ADDRESS; mAdapterService.notifyActivityAttributionInfo(getAttributionSource(), deviceAddress); mAdapterService.notifyActivityAttributionInfo(getAttributionSource(), deviceAddress); mStarted = false; mStarted = false; setHeadsetService(null); // Step 6: Tear down broadcast receivers // Step 6: Tear down broadcast receivers unregisterReceiver(mHeadsetReceiver); unregisterReceiver(mHeadsetReceiver); synchronized (mStateMachines) { synchronized (mStateMachines) { Loading Loading @@ -256,6 +255,7 @@ public class HeadsetService extends ProfileService { } } // Step 4: Destroy native interface // Step 4: Destroy native interface mNativeInterface.cleanup(); mNativeInterface.cleanup(); setHeadsetService(null); // Step 3: Destroy system interface // Step 3: Destroy system interface mSystemInterface.stop(); mSystemInterface.stop(); // Step 2: Stop handler thread // Step 2: Stop handler thread Loading