Loading android/app/src/com/android/bluetooth/a2dp/A2dpStateMachine.java +2 −1 Original line number Diff line number Diff line Loading @@ -909,7 +909,8 @@ final class A2dpStateMachine extends StateMachine { intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, prevState); intent.putExtra(BluetoothProfile.EXTRA_STATE, state); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT | Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND); mContext.sendBroadcast(intent, ProfileService.BLUETOOTH_PERM); log("Connection state " + device + ": " + prevState + "->" + state); } Loading android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java +1 −0 Original line number Diff line number Diff line Loading @@ -2389,6 +2389,7 @@ final class HeadsetStateMachine extends StateMachine { intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, prevState); intent.putExtra(BluetoothProfile.EXTRA_STATE, newState); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND); mService.sendBroadcastAsUser(intent, UserHandle.ALL, HeadsetService.BLUETOOTH_PERM); } Loading android/app/tests/src/com/android/bluetooth/btservice/PhonePolicyTest.java +2 −0 Original line number Diff line number Diff line Loading @@ -213,6 +213,7 @@ public class PhonePolicyTest extends AndroidTestCase { intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, BluetoothProfile.STATE_DISCONNECTED); intent.putExtra(BluetoothProfile.EXTRA_STATE, BluetoothProfile.STATE_CONNECTED); intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND); injector.onReceive(null /* context */, intent); // We should see (in CONNECT_OTHER_PROFILES_TIMEOUT) a call to connect A2DP Loading Loading @@ -274,6 +275,7 @@ public class PhonePolicyTest extends AndroidTestCase { intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, BluetoothProfile.STATE_DISCONNECTED); intent.putExtra(BluetoothProfile.EXTRA_STATE, BluetoothProfile.STATE_CONNECTED); intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND); injector.onReceive(null /* context */, intent); // Return an empty list simulating that the above connection successful was nullified Loading Loading
android/app/src/com/android/bluetooth/a2dp/A2dpStateMachine.java +2 −1 Original line number Diff line number Diff line Loading @@ -909,7 +909,8 @@ final class A2dpStateMachine extends StateMachine { intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, prevState); intent.putExtra(BluetoothProfile.EXTRA_STATE, state); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT | Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND); mContext.sendBroadcast(intent, ProfileService.BLUETOOTH_PERM); log("Connection state " + device + ": " + prevState + "->" + state); } Loading
android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java +1 −0 Original line number Diff line number Diff line Loading @@ -2389,6 +2389,7 @@ final class HeadsetStateMachine extends StateMachine { intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, prevState); intent.putExtra(BluetoothProfile.EXTRA_STATE, newState); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND); mService.sendBroadcastAsUser(intent, UserHandle.ALL, HeadsetService.BLUETOOTH_PERM); } Loading
android/app/tests/src/com/android/bluetooth/btservice/PhonePolicyTest.java +2 −0 Original line number Diff line number Diff line Loading @@ -213,6 +213,7 @@ public class PhonePolicyTest extends AndroidTestCase { intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, BluetoothProfile.STATE_DISCONNECTED); intent.putExtra(BluetoothProfile.EXTRA_STATE, BluetoothProfile.STATE_CONNECTED); intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND); injector.onReceive(null /* context */, intent); // We should see (in CONNECT_OTHER_PROFILES_TIMEOUT) a call to connect A2DP Loading Loading @@ -274,6 +275,7 @@ public class PhonePolicyTest extends AndroidTestCase { intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, BluetoothProfile.STATE_DISCONNECTED); intent.putExtra(BluetoothProfile.EXTRA_STATE, BluetoothProfile.STATE_CONNECTED); intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND); injector.onReceive(null /* context */, intent); // Return an empty list simulating that the above connection successful was nullified Loading