prohibit toggling setAudioModeIsVoip(false) for SM connection

For context, there was a report of a VoIP app experiencing audio
issues in call when switching between a self-managed and PSTN call.
The root cause was from calling setAudioModeIsVoip(false)
on a self-managed connection.

To prevent misuse of the API, prevent toggling of
setAudioModeIsVoIP(false) on a self-managed connection.

Additionally, 2 CTS tests and 1 CtsVerifier test are put in place to
assert there isnt manipulation of this API.

Test: 2 cts,
      1 CtsVerifier called "Telecom Call Audio test"

bug: 236018173

Change-Id: I9161f9369f7bb37c1c2e3f9342e63693cb4f10cc
This commit is contained in:
Thomas Stuart
2022-07-06 10:59:41 -07:00
parent 70c84d90c7
commit b83cc19fc0

View File

@@ -2763,6 +2763,12 @@ public abstract class Connection extends Conferenceable {
* @param isVoip True if the audio mode is VOIP.
*/
public final void setAudioModeIsVoip(boolean isVoip) {
if (!isVoip && (mConnectionProperties & PROPERTY_SELF_MANAGED) == PROPERTY_SELF_MANAGED) {
Log.i(this,
"setAudioModeIsVoip: Ignored request to set a self-managed connection's"
+ " audioModeIsVoip to false. Doing so can cause unwanted behavior.");
return;
}
checkImmutable();
mAudioModeIsVoip = isVoip;
for (Listener l : mListeners) {