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

Commit 11eb356c authored by ELIYAZ MOMIN (xWF)'s avatar ELIYAZ MOMIN (xWF) Committed by Android (Google) Code Review
Browse files

Revert "audio policy: improve sharing input logic to prevent tem..."

Revert submission 31539765-cherrypicker-L70300030009242895:N43100030156877762

Reason for revert: <Potential culprit for b/394241864    - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted>

Reverted changes: /q/submissionid:31539765-cherrypicker-L70300030009242895:N43100030156877762

Change-Id: I9a4c4b367935691e97a5650816feb53f647c2d73
parent 0e73a8c9
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -3230,8 +3230,7 @@ audio_io_handle_t AudioPolicyManager::getInputForDevice(const sp<DeviceDescripto
            //  - Preempt and input if:
            //     - It has only strictly lower priority use cases than the new client
            //     - It has equal priority use cases than the new client, was not
            //     opened thanks to preemption, is not routed to the same device than the device to
            //     consider or has been active since opened.
            //     opened thanks to preemption or has been active since opened.
            //  - Order the preemption candidates by inactive first and priority second
            sp<AudioInputDescriptor> closeCandidate;
            int leastCloseRank = INT_MAX;
@@ -3249,7 +3248,7 @@ audio_io_handle_t AudioPolicyManager::getInputForDevice(const sp<DeviceDescripto
                int topPrio = source_priority(topPrioClient->source());
                if (topPrio < source_priority(attributes.source)
                      || (topPrio == source_priority(attributes.source)
                          && !(desc->isPreemptor() || desc->getDevice() == device))) {
                          && !desc->isPreemptor())) {
                    int closeRank = (desc->isActive() ? sCloseActive : 0) + topPrio;
                    if (closeRank < leastCloseRank) {
                        leastCloseRank = closeRank;
+0 −28
Original line number Diff line number Diff line
@@ -4684,34 +4684,6 @@ TEST_F_WITH_FLAGS(
    EXPECT_EQ(input1, input2);
}

TEST_F_WITH_FLAGS(
        AudioPolicyManagerInputPreemptionTest,
        SameDeviceAndSourceReusesInput,
        REQUIRES_FLAGS_ENABLED(
        ACONFIG_FLAG(com::android::media::audioserver, fix_input_sharing_logic))
) {
    mClient->resetInputApiCallsCounters();

    audio_attributes_t attr = AUDIO_ATTRIBUTES_INITIALIZER;
    attr.source = AUDIO_SOURCE_VOICE_RECOGNITION;
    audio_port_handle_t selectedDeviceId = AUDIO_PORT_HANDLE_NONE;
    audio_io_handle_t input1 = AUDIO_PORT_HANDLE_NONE;
    ASSERT_NO_FATAL_FAILURE(getInputForAttr(attr, &input1, TEST_SESSION_ID, 1, &selectedDeviceId,
                                            AUDIO_FORMAT_PCM_16_BIT, AUDIO_CHANNEL_IN_STEREO,
                                            k48000SamplingRate));

    EXPECT_EQ(1, mClient->getOpenInputCallsCount());

    audio_io_handle_t input2 = AUDIO_PORT_HANDLE_NONE;
    ASSERT_NO_FATAL_FAILURE(getInputForAttr(attr, &input2, OTHER_SESSION_ID, 1, &selectedDeviceId,
                                            AUDIO_FORMAT_PCM_16_BIT, AUDIO_CHANNEL_IN_STEREO,
                                            k48000SamplingRate));

    EXPECT_EQ(1, mClient->getOpenInputCallsCount());
    EXPECT_EQ(0, mClient->getCloseInputCallsCount());
    EXPECT_EQ(input1, input2);
}

TEST_F_WITH_FLAGS(
        AudioPolicyManagerInputPreemptionTest,
        LesserPriorityReusesInput,