AudioService: fix AudioProductStrategy matching rule
Strategies use rules on attributes, and use public getter to compare usages. However, some usage are system only and now filtered by public getter. This CL fixes this issue by adding a hidden get for usage that return whatever public or system usage. Test: adb shell am instrument -w -e class com.android.audiopolicytest.AudioManagerTest#testAudioAttributesToStreamTypes com.android.audiopolicytest Signed-off-by: Francois Gaffie <francois.gaffie@renault.com> Change-Id: Iddd55af8f230cb063dcaa9ba950b890cbbb81643 Merged-In: I377e840b18443c33fb0b562b27fbc706aaeb8055
This commit is contained in:
committed by
Eric Laurent
parent
2f46cd181a
commit
05672e534e
@@ -505,6 +505,16 @@ public final class AudioAttributes implements Parcelable {
|
||||
return (mFlags & FLAG_ALL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* Return usage, even the non-public ones.
|
||||
* Internal use only
|
||||
* @return one of the values that can be set in {@link Builder#setUsage(int)}
|
||||
*/
|
||||
public int getSystemUsage() {
|
||||
return mUsage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* Return the Bundle of data.
|
||||
|
||||
@@ -336,8 +336,8 @@ public final class AudioProductStrategy implements Parcelable {
|
||||
if (refAttr.equals(sDefaultAttributes)) {
|
||||
return false;
|
||||
}
|
||||
return ((refAttr.getUsage() == AudioAttributes.USAGE_UNKNOWN)
|
||||
|| (attr.getUsage() == refAttr.getUsage()))
|
||||
return ((refAttr.getSystemUsage() == AudioAttributes.USAGE_UNKNOWN)
|
||||
|| (attr.getSystemUsage() == refAttr.getSystemUsage()))
|
||||
&& ((refAttr.getContentType() == AudioAttributes.CONTENT_TYPE_UNKNOWN)
|
||||
|| (attr.getContentType() == refAttr.getContentType()))
|
||||
&& ((refAttr.getAllFlags() == 0)
|
||||
|
||||
Reference in New Issue
Block a user