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

Commit b72a5500 authored by Andy Hung's avatar Andy Hung
Browse files

AudioParameter: Document usage of exiting and closing.

Ensure only privileged access.
Log warning message on setParameters failure
to prevent entering standby silently.

Test: adb shell dumpsys media.audio_flinger
Bug: 73175392
Bug: 270480994
Bug: 279106598
Merged-In: Ie38ee93e98ff2164f9076b8b6b7831cc6b7a8896
Change-Id: Ie38ee93e98ff2164f9076b8b6b7831cc6b7a8896
parent 580a0d55
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -436,8 +436,7 @@ status_t StreamHalAidl::exit() {
    ALOGD("%p %s::%s", this, getClassName().c_str(), __func__);
    TIME_CHECK();
    if (!mStream) return NO_INIT;
    ALOGE("%s not implemented yet", __func__);
    return OK;
    return statusTFromBinderStatus(mStream->prepareToClose());
}

status_t StreamHalAidl::createMmapBuffer(int32_t minSizeFrames __unused,
+4 −3
Original line number Diff line number Diff line
@@ -979,9 +979,10 @@ void StreamOutHalHidl::onRecommendedLatencyModeChanged(
}

status_t StreamOutHalHidl::exit() {
    // FIXME this is using hard-coded strings but in the future, this functionality will be
    //       converted to use audio HAL extensions required to support tunneling
    return setParameters(String8("exiting=1"));
    // Signal exiting to remote_submix HAL.
    AudioParameter param;
    param.addInt(String8(AudioParameter::keyExiting), 1);
    return setParameters(param.toString());
}

StreamInHalHidl::StreamInHalHidl(
+2 −0
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@ const char * const AudioParameter::keyChannels = AUDIO_PARAMETER_STREAM_CHANNELS
const char * const AudioParameter::keyFrameCount = AUDIO_PARAMETER_STREAM_FRAME_COUNT;
const char * const AudioParameter::keyInputSource = AUDIO_PARAMETER_STREAM_INPUT_SOURCE;
const char * const AudioParameter::keyScreenState = AUDIO_PARAMETER_KEY_SCREEN_STATE;
const char * const AudioParameter::keyClosing = AUDIO_PARAMETER_KEY_CLOSING;
const char * const AudioParameter::keyExiting = AUDIO_PARAMETER_KEY_EXITING;
const char * const AudioParameter::keyBtNrec = AUDIO_PARAMETER_KEY_BT_NREC;
const char * const AudioParameter::keyHwAvSync = AUDIO_PARAMETER_HW_AV_SYNC;
const char * const AudioParameter::keyPresentationId = AUDIO_PARAMETER_STREAM_PRESENTATION_ID;
+6 −0
Original line number Diff line number Diff line
@@ -49,6 +49,12 @@ public:
    static const char * const keyInputSource;
    static const char * const keyScreenState;

    // TODO(b/73175392) consider improvement to AIDL StreamOut interface.
    // keyClosing: "true" when AudioOutputDescriptor is closing.  Used by A2DP HAL.
    // keyExiting: "1" on AudioFlinger Thread preExit.  Used by remote_submix and A2DP HAL.
    static const char * const keyClosing;
    static const char * const keyExiting;

    //  keyBtNrec: BT SCO Noise Reduction + Echo Cancellation parameters
    //  keyHwAvSync: get HW synchronization source identifier from a device
    //  keyMonoOutput: Enable mono audio playback
+2 −0
Original line number Diff line number Diff line
@@ -1827,6 +1827,8 @@ void AudioFlinger::filterReservedParameters(String8& keyValuePairs, uid_t callin
        String8(AudioParameter::keyStreamSupportedFormats),
        String8(AudioParameter::keyStreamSupportedChannels),
        String8(AudioParameter::keyStreamSupportedSamplingRates),
        String8(AudioParameter::keyClosing),
        String8(AudioParameter::keyExiting),
    };

    if (isAudioServerUid(callingUid)) {
Loading