policy_hal: Avoid invalidation of music stream if not required.
-APM tries to open output for all profiles supported on headphone
device During insertion of headphone and invalidate music stream
if number of output doesn't matches with outputs on previous device.
Since DSD profile is supported on headphone device only, APM opens
DSD output on headphone insertion and invalidate music stream.
-Check if any of the new output is for DSD profile if number of output
doesn't match on new device and prev device. Avoid invalidation if
difference in outputs is because of DSD output.
Change-Id: I97092f620851b22a66a6f9cbfc9337db3828c5d6
diff --git a/policy_hal/AudioPolicyManager.h b/policy_hal/AudioPolicyManager.h
index deef57d..00da599 100644
--- a/policy_hal/AudioPolicyManager.h
+++ b/policy_hal/AudioPolicyManager.h
@@ -96,6 +96,14 @@
// see getDeviceForStrategy() for the use of fromCache parameter
audio_devices_t getNewOutputDevice(const sp<AudioOutputDescriptor>& outputDesc,
bool fromCache);
+
+ // avoid invalidation for active music stream on previous outputs
+ // which is supported on the new device.
+ bool isInvalidationOfMusicStreamNeeded(routing_strategy strategy);
+
+ // Must be called before updateDevicesAndOutputs()
+ void checkOutputForStrategy(routing_strategy strategy);
+
// returns true if given output is direct output
bool isDirectOutput(audio_io_handle_t output);