Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3582d5cb authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fixed AudioMixingRule usage of AudioAttribute#getUsage" into sc-dev

parents 7b526955 b4cca57b
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -267,14 +267,18 @@ public final class AudioPlaybackConfiguration implements Parcelable {
        final AudioPlaybackConfiguration anonymCopy = new AudioPlaybackConfiguration(in.mPlayerIId);
        anonymCopy.mPlayerState = in.mPlayerState;
        // do not reuse the full attributes: only usage, content type and public flags are allowed
        anonymCopy.mPlayerAttr = new AudioAttributes.Builder()
                .setUsage(in.mPlayerAttr.getUsage())
        AudioAttributes.Builder builder = new AudioAttributes.Builder()
                .setContentType(in.mPlayerAttr.getContentType())
                .setFlags(in.mPlayerAttr.getFlags())
                .setAllowedCapturePolicy(
                        in.mPlayerAttr.getAllowedCapturePolicy() == ALLOW_CAPTURE_BY_ALL
                        ? ALLOW_CAPTURE_BY_ALL : ALLOW_CAPTURE_BY_NONE)
                .build();
                                ? ALLOW_CAPTURE_BY_ALL : ALLOW_CAPTURE_BY_NONE);
        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;
        // anonymized data
        anonymCopy.mPlayerType = PLAYER_TYPE_UNKNOWN;
+11 −6
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@ public class AudioMixingRule {
            final int match_rule = mRule & ~RULE_EXCLUSION_MASK;
            switch (match_rule) {
                case RULE_MATCH_ATTRIBUTE_USAGE:
                    dest.writeInt(mAttr.getUsage());
                    dest.writeInt(mAttr.getSystemUsage());
                    break;
                case RULE_MATCH_ATTRIBUTE_CAPTURE_PRESET:
                    dest.writeInt(mAttr.getCapturePreset());
@@ -165,7 +165,7 @@ public class AudioMixingRule {
        for (AudioMixMatchCriterion criterion : mCriteria) {
            if ((criterion.mRule & RULE_MATCH_ATTRIBUTE_USAGE) != 0
                    && criterion.mAttr != null
                    && criterion.mAttr.getUsage() == usage) {
                    && criterion.mAttr.getSystemUsage() == usage) {
                return true;
            }
        }
@@ -182,7 +182,7 @@ public class AudioMixingRule {
        for (AudioMixMatchCriterion criterion : mCriteria) {
            if (criterion.mRule == RULE_MATCH_ATTRIBUTE_USAGE
                    && criterion.mAttr != null
                    && criterion.mAttr.getUsage() == usage) {
                    && criterion.mAttr.getSystemUsage() == usage) {
                return true;
            }
        }
@@ -565,7 +565,7 @@ public class AudioMixingRule {
                    switch (match_rule) {
                        case RULE_MATCH_ATTRIBUTE_USAGE:
                            // "usage"-based rule
                            if (criterion.mAttr.getUsage() == attrToMatch.getUsage()) {
                            if (criterion.mAttr.getSystemUsage() == attrToMatch.getSystemUsage()) {
                                if (criterion.mRule == rule) {
                                    // rule already exists, we're done
                                    return this;
@@ -646,8 +646,13 @@ public class AudioMixingRule {
            switch (match_rule) {
                case RULE_MATCH_ATTRIBUTE_USAGE:
                    int usage = in.readInt();
                    if (AudioAttributes.isSystemUsage(usage)) {
                        attr = new AudioAttributes.Builder()
                                .setSystemUsage(usage).build();
                    } else {
                        attr = new AudioAttributes.Builder()
                                .setUsage(usage).build();
                    }
                    break;
                case RULE_MATCH_ATTRIBUTE_CAPTURE_PRESET:
                    int preset = in.readInt();