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

Commit c8dd9765 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Only consider flags that affect strategy when matching attributes." into main

parents a2e7f86e 0b31cbcc
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -60,9 +60,13 @@ aidl2legacy_AudioProductStrategy(const media::AudioProductStrategy& aidl) {
}
}


// Keep in sync with android/media/audiopolicy/AudioProductStrategy#attributeMatches
// Keep in sync with android/media/audiopolicy/AudioProductStrategy#attributeMatches
int AudioProductStrategy::attributesMatchesScore(const audio_attributes_t refAttributes,
int AudioProductStrategy::attributesMatchesScore(audio_attributes_t refAttributes,
                                                 const audio_attributes_t clientAttritubes)
                                                 audio_attributes_t clientAttritubes)
{
{
    refAttributes.flags = static_cast<audio_flags_mask_t>(
            refAttributes.flags & AUDIO_FLAGS_AFFECT_STRATEGY_SELECTION);
    clientAttritubes.flags = static_cast<audio_flags_mask_t>(
            clientAttritubes.flags & AUDIO_FLAGS_AFFECT_STRATEGY_SELECTION);
    if (refAttributes == clientAttritubes) {
    if (refAttributes == clientAttritubes) {
        return MATCH_EQUALS;
        return MATCH_EQUALS;
    }
    }
+4 −4
Original line number Original line Diff line number Diff line
@@ -58,11 +58,11 @@ public:
     * @return {@code INVALID_SCORE} if not matching, {@code MATCH_ON_DEFAULT_SCORE} if matching
     * @return {@code INVALID_SCORE} if not matching, {@code MATCH_ON_DEFAULT_SCORE} if matching
     * to default strategy, non zero positive score if matching a strategy.
     * to default strategy, non zero positive score if matching a strategy.
     */
     */
    static int attributesMatchesScore(const audio_attributes_t refAttributes,
    static int attributesMatchesScore(audio_attributes_t refAttributes,
                                      const audio_attributes_t clientAttritubes);
                                      audio_attributes_t clientAttritubes);


    static bool attributesMatches(const audio_attributes_t refAttributes,
    static bool attributesMatches(audio_attributes_t refAttributes,
                                      const audio_attributes_t clientAttritubes) {
                                  audio_attributes_t clientAttritubes) {
        return attributesMatchesScore(refAttributes, clientAttritubes) > 0;
        return attributesMatchesScore(refAttributes, clientAttritubes) > 0;
    }
    }