Merge "Fixed AudioMixingRule usage of AudioAttribute#getUsage" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
3582d5cb2d
@@ -267,14 +267,18 @@ public final class AudioPlaybackConfiguration implements Parcelable {
|
|||||||
final AudioPlaybackConfiguration anonymCopy = new AudioPlaybackConfiguration(in.mPlayerIId);
|
final AudioPlaybackConfiguration anonymCopy = new AudioPlaybackConfiguration(in.mPlayerIId);
|
||||||
anonymCopy.mPlayerState = in.mPlayerState;
|
anonymCopy.mPlayerState = in.mPlayerState;
|
||||||
// do not reuse the full attributes: only usage, content type and public flags are allowed
|
// do not reuse the full attributes: only usage, content type and public flags are allowed
|
||||||
anonymCopy.mPlayerAttr = new AudioAttributes.Builder()
|
AudioAttributes.Builder builder = new AudioAttributes.Builder()
|
||||||
.setUsage(in.mPlayerAttr.getUsage())
|
|
||||||
.setContentType(in.mPlayerAttr.getContentType())
|
.setContentType(in.mPlayerAttr.getContentType())
|
||||||
.setFlags(in.mPlayerAttr.getFlags())
|
.setFlags(in.mPlayerAttr.getFlags())
|
||||||
.setAllowedCapturePolicy(
|
.setAllowedCapturePolicy(
|
||||||
in.mPlayerAttr.getAllowedCapturePolicy() == ALLOW_CAPTURE_BY_ALL
|
in.mPlayerAttr.getAllowedCapturePolicy() == ALLOW_CAPTURE_BY_ALL
|
||||||
? ALLOW_CAPTURE_BY_ALL : ALLOW_CAPTURE_BY_NONE)
|
? ALLOW_CAPTURE_BY_ALL : ALLOW_CAPTURE_BY_NONE);
|
||||||
.build();
|
if (AudioAttributes.isSystemUsage(in.mPlayerAttr.getSystemUsage())) {
|
||||||
|
builder.setSystemUsage(in.mPlayerAttr.getSystemUsage());
|
||||||
|
} else {
|
||||||
|
builder.setUsage(in.mPlayerAttr.getUsage());
|
||||||
|
}
|
||||||
|
anonymCopy.mPlayerAttr = builder.build();
|
||||||
anonymCopy.mDeviceId = in.mDeviceId;
|
anonymCopy.mDeviceId = in.mDeviceId;
|
||||||
// anonymized data
|
// anonymized data
|
||||||
anonymCopy.mPlayerType = PLAYER_TYPE_UNKNOWN;
|
anonymCopy.mPlayerType = PLAYER_TYPE_UNKNOWN;
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ public class AudioMixingRule {
|
|||||||
final int match_rule = mRule & ~RULE_EXCLUSION_MASK;
|
final int match_rule = mRule & ~RULE_EXCLUSION_MASK;
|
||||||
switch (match_rule) {
|
switch (match_rule) {
|
||||||
case RULE_MATCH_ATTRIBUTE_USAGE:
|
case RULE_MATCH_ATTRIBUTE_USAGE:
|
||||||
dest.writeInt(mAttr.getUsage());
|
dest.writeInt(mAttr.getSystemUsage());
|
||||||
break;
|
break;
|
||||||
case RULE_MATCH_ATTRIBUTE_CAPTURE_PRESET:
|
case RULE_MATCH_ATTRIBUTE_CAPTURE_PRESET:
|
||||||
dest.writeInt(mAttr.getCapturePreset());
|
dest.writeInt(mAttr.getCapturePreset());
|
||||||
@@ -165,7 +165,7 @@ public class AudioMixingRule {
|
|||||||
for (AudioMixMatchCriterion criterion : mCriteria) {
|
for (AudioMixMatchCriterion criterion : mCriteria) {
|
||||||
if ((criterion.mRule & RULE_MATCH_ATTRIBUTE_USAGE) != 0
|
if ((criterion.mRule & RULE_MATCH_ATTRIBUTE_USAGE) != 0
|
||||||
&& criterion.mAttr != null
|
&& criterion.mAttr != null
|
||||||
&& criterion.mAttr.getUsage() == usage) {
|
&& criterion.mAttr.getSystemUsage() == usage) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -182,7 +182,7 @@ public class AudioMixingRule {
|
|||||||
for (AudioMixMatchCriterion criterion : mCriteria) {
|
for (AudioMixMatchCriterion criterion : mCriteria) {
|
||||||
if (criterion.mRule == RULE_MATCH_ATTRIBUTE_USAGE
|
if (criterion.mRule == RULE_MATCH_ATTRIBUTE_USAGE
|
||||||
&& criterion.mAttr != null
|
&& criterion.mAttr != null
|
||||||
&& criterion.mAttr.getUsage() == usage) {
|
&& criterion.mAttr.getSystemUsage() == usage) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -565,7 +565,7 @@ public class AudioMixingRule {
|
|||||||
switch (match_rule) {
|
switch (match_rule) {
|
||||||
case RULE_MATCH_ATTRIBUTE_USAGE:
|
case RULE_MATCH_ATTRIBUTE_USAGE:
|
||||||
// "usage"-based rule
|
// "usage"-based rule
|
||||||
if (criterion.mAttr.getUsage() == attrToMatch.getUsage()) {
|
if (criterion.mAttr.getSystemUsage() == attrToMatch.getSystemUsage()) {
|
||||||
if (criterion.mRule == rule) {
|
if (criterion.mRule == rule) {
|
||||||
// rule already exists, we're done
|
// rule already exists, we're done
|
||||||
return this;
|
return this;
|
||||||
@@ -646,8 +646,13 @@ public class AudioMixingRule {
|
|||||||
switch (match_rule) {
|
switch (match_rule) {
|
||||||
case RULE_MATCH_ATTRIBUTE_USAGE:
|
case RULE_MATCH_ATTRIBUTE_USAGE:
|
||||||
int usage = in.readInt();
|
int usage = in.readInt();
|
||||||
|
if (AudioAttributes.isSystemUsage(usage)) {
|
||||||
|
attr = new AudioAttributes.Builder()
|
||||||
|
.setSystemUsage(usage).build();
|
||||||
|
} else {
|
||||||
attr = new AudioAttributes.Builder()
|
attr = new AudioAttributes.Builder()
|
||||||
.setUsage(usage).build();
|
.setUsage(usage).build();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case RULE_MATCH_ATTRIBUTE_CAPTURE_PRESET:
|
case RULE_MATCH_ATTRIBUTE_CAPTURE_PRESET:
|
||||||
int preset = in.readInt();
|
int preset = in.readInt();
|
||||||
|
|||||||
Reference in New Issue
Block a user