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

Commit 161b64fc authored by jiabin's avatar jiabin
Browse files

Cache routed device in case returning null when switching device.

Bug: 69366408
Test: runtest --path cts/tests/tests/media/src/android/media/cts/RoutingTest.java
Change-Id: I270fe60abdf22eada927bf0c5fc594de294c8428
parent 45145a39
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -1622,6 +1622,7 @@ MediaPlayerService::AudioOutput::AudioOutput(audio_session_t sessionId, uid_t ui
      mFlags(AUDIO_OUTPUT_FLAG_NONE),
      mVolumeHandler(new media::VolumeHandler()),
      mSelectedDeviceId(AUDIO_PORT_HANDLE_NONE),
      mRoutedDeviceId(AUDIO_PORT_HANDLE_NONE),
      mDeviceCallbackEnabled(false),
      mDeviceCallback(deviceCallback)
{
@@ -2368,10 +2369,10 @@ status_t MediaPlayerService::AudioOutput::getRoutedDeviceId(audio_port_handle_t*
    ALOGV("getRoutedDeviceId");
    Mutex::Autolock lock(mLock);
    if (mTrack != 0) {
        *deviceId = mTrack->getRoutedDeviceId();
        return NO_ERROR;
        mRoutedDeviceId = mTrack->getRoutedDeviceId();
    }
    return NO_INIT;
    *deviceId = mRoutedDeviceId;
    return NO_ERROR;
}

status_t MediaPlayerService::AudioOutput::enableAudioDeviceCallback(bool enabled)
+1 −0
Original line number Diff line number Diff line
@@ -176,6 +176,7 @@ class MediaPlayerService : public BnMediaPlayerService
        audio_output_flags_t    mFlags;
        sp<media::VolumeHandler>       mVolumeHandler;
        audio_port_handle_t     mSelectedDeviceId;
        audio_port_handle_t     mRoutedDeviceId;
        bool                    mDeviceCallbackEnabled;
        wp<AudioSystem::AudioDeviceCallback>        mDeviceCallback;
        mutable Mutex           mLock;