google / mobly-bundled-snippets

Snippets to allow Mobly tests to control Android devices by exposing a simplified Android API.
Apache License 2.0
48 stars 51 forks source link

Disconnect/Connect with A2DP & Call profiles #123

Open vamaring opened 4 years ago

vamaring commented 4 years ago

Hello,

Currently there is an A2DP snippet, which controls whether media playback(Media audio in BT settings) is connected/disconnected. But in my device BT settings (Samsung Galaxy S9), there is also a setting to connect/disconnect Call audio. Is there a profile that we can use to connect/disconnect all profiles (A2DP & calls) through snippet? That would be very useful.

xpconanfan commented 4 years ago

Not sure what exactly that would look like. Do you want to propose a design?

vamaring commented 4 years ago

Under my Paired Devices section of phones Bluetooth, If I tap on settings icon, I see the connected device name, Unpair option & I see a section USE FOR with two toggle buttons (Call audio & Media audio). If I use btA2dpDisconnect api from https://github.com/google/mobly-bundled-snippets/blob/master/src/main/java/com/google/android/mobly/snippet/bundled/bluetooth/profiles/BluetoothA2dpSnippet.java , it only disconnects Media audio toggle button on the phone, but Call audio setting remains connected.

xpconanfan commented 4 years ago

Seems like you can simply create a python util to call disconnect all the profiles you want to disconnect? MBS is meant to more or less mirror the Android APIs. Is there an Android API that does what you want?

vamaring commented 4 years ago

I just started exploring mobly-bundled-snippets to see if it serves my purpose of disconnecting all profiles, but currently is only disconnecting A2DP(Media). I dont know any other way of disconnecting other profiles on Android yet. I will have to find more details about this. Just wanted to check here, if someone had requested similar requirement.