audioservice: fix hasMediaDynamicPolicy() for loopback and render policies
Exclude mixes with LOOPBACK + RENDER flags when looking for dynamic policies matching media usage. As this is only used in the context of sending becoming noisy intent we want to send the intent when playback capture is active. Bug: 137055231 Test: enable live caption and disconnect headset while music is playing Change-Id: Ib3cd38f58c2ff78a2f2f13c5c22b637f9701e345
This commit is contained in:
@@ -5577,6 +5577,7 @@ public class AudioService extends IAudioService.Stub
|
||||
|
||||
/**
|
||||
* @return true if there is currently a registered dynamic mixing policy that affects media
|
||||
* and is not a render + loopback policy
|
||||
*/
|
||||
/*package*/ boolean hasMediaDynamicPolicy() {
|
||||
synchronized (mAudioPolicies) {
|
||||
@@ -5585,7 +5586,8 @@ public class AudioService extends IAudioService.Stub
|
||||
}
|
||||
final Collection<AudioPolicyProxy> appColl = mAudioPolicies.values();
|
||||
for (AudioPolicyProxy app : appColl) {
|
||||
if (app.hasMixAffectingUsage(AudioAttributes.USAGE_MEDIA)) {
|
||||
if (app.hasMixAffectingUsage(AudioAttributes.USAGE_MEDIA,
|
||||
AudioMix.ROUTE_FLAG_LOOP_BACK_RENDER)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -7348,9 +7350,10 @@ public class AudioService extends IAudioService.Stub
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
}
|
||||
|
||||
boolean hasMixAffectingUsage(int usage) {
|
||||
boolean hasMixAffectingUsage(int usage, int excludedFlags) {
|
||||
for (AudioMix mix : mMixes) {
|
||||
if (mix.isAffectingUsage(usage)) {
|
||||
if (mix.isAffectingUsage(usage)
|
||||
&& ((mix.getRouteFlags() & excludedFlags) != excludedFlags)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user