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

Commit 5b022de9 authored by Ramjee Singh's avatar Ramjee Singh
Browse files

policy_hal: Function prototype correction for custom policy

- Ringtone is not heard when BT is connected because mute count
  for stream type ring is always greater then zero. The reason
  is when BT is connected duplicate output is created. Base policy
  does not handle mute count for duplicate output in stopSource
  properly. Custom policy stopSource handles this scenario but it
  is not called as signature does not match with base class
  stopSource

- Fix is to correct function signature for custom policy to make
  sure stopSource is called.

Change-Id: I8c0a99dbaae860a261ce2f15b6056d3d9c545568
parent 25f1d85f
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -39,6 +39,7 @@ ifeq ($(strip $(AUDIO_FEATURE_ENABLED_PROXY_DEVICE)),true)
LOCAL_CFLAGS += -DAUDIO_EXTN_AFE_PROXY_ENABLED
LOCAL_CFLAGS += -DAUDIO_EXTN_AFE_PROXY_ENABLED
endif
endif


LOCAL_CFLAGS += -Wno-error -fpermissive
LOCAL_MODULE := libaudiopolicymanager
LOCAL_MODULE := libaudiopolicymanager


include $(BUILD_SHARED_LIBRARY)
include $(BUILD_SHARED_LIBRARY)
+4 −2
Original line number Original line Diff line number Diff line
@@ -618,11 +618,12 @@ void AudioPolicyManagerCustom::setPhoneState(audio_mode_t state)
        mLimitRingtoneVolume = false;
        mLimitRingtoneVolume = false;
    }
    }
}
}
status_t AudioPolicyManagerCustom::stopSource(sp<SwAudioOutputDescriptor> outputDesc,
status_t AudioPolicyManagerCustom::stopSource(sp<AudioOutputDescriptor> outputDesc1,
                                            audio_stream_type_t stream,
                                            audio_stream_type_t stream,
                                            bool forceDeviceUpdate)
                                            bool forceDeviceUpdate)
{
{
    // always handle stream stop, check which stream type is stopping
    // always handle stream stop, check which stream type is stopping
    sp<SwAudioOutputDescriptor> outputDesc = (sp<SwAudioOutputDescriptor>) outputDesc1;
    handleEventForBeacon(stream == AUDIO_STREAM_TTS ? STOPPING_BEACON : STOPPING_OUTPUT);
    handleEventForBeacon(stream == AUDIO_STREAM_TTS ? STOPPING_BEACON : STOPPING_OUTPUT);


    // handle special case for sonification while in call
    // handle special case for sonification while in call
@@ -675,13 +676,14 @@ status_t AudioPolicyManagerCustom::stopSource(sp<SwAudioOutputDescriptor> output
        return INVALID_OPERATION;
        return INVALID_OPERATION;
    }
    }
}
}
status_t AudioPolicyManagerCustom::startSource(sp<SwAudioOutputDescriptor> outputDesc,
status_t AudioPolicyManagerCustom::startSource(sp<AudioOutputDescriptor> outputDesc1,
                                             audio_stream_type_t stream,
                                             audio_stream_type_t stream,
                                             audio_devices_t device,
                                             audio_devices_t device,
                                             uint32_t *delayMs)
                                             uint32_t *delayMs)
{
{
    // cannot start playback of STREAM_TTS if any other output is being used
    // cannot start playback of STREAM_TTS if any other output is being used
    uint32_t beaconMuteLatency = 0;
    uint32_t beaconMuteLatency = 0;
    sp<SwAudioOutputDescriptor> outputDesc = (sp<SwAudioOutputDescriptor>) outputDesc1;


    *delayMs = 0;
    *delayMs = 0;
    if (stream == AUDIO_STREAM_TTS) {
    if (stream == AUDIO_STREAM_TTS) {
+2 −2
Original line number Original line Diff line number Diff line
@@ -85,11 +85,11 @@ protected:


        // if argument "device" is different from AUDIO_DEVICE_NONE,  startSource() will force
        // if argument "device" is different from AUDIO_DEVICE_NONE,  startSource() will force
        // the re-evaluation of the output device.
        // the re-evaluation of the output device.
        status_t startSource(sp<SwAudioOutputDescriptor> outputDesc,
        status_t startSource(sp<AudioOutputDescriptor> outputDesc,
                             audio_stream_type_t stream,
                             audio_stream_type_t stream,
                             audio_devices_t device,
                             audio_devices_t device,
                             uint32_t *delayMs);
                             uint32_t *delayMs);
         status_t stopSource(sp<SwAudioOutputDescriptor> outputDesc,
        status_t stopSource(sp<AudioOutputDescriptor> outputDesc,
                            audio_stream_type_t stream,
                            audio_stream_type_t stream,
                            bool forceDeviceUpdate);
                            bool forceDeviceUpdate);
        // event is one of STARTING_OUTPUT, STARTING_BEACON, STOPPING_OUTPUT, STOPPING_BEACON   313
        // event is one of STARTING_OUTPUT, STARTING_BEACON, STOPPING_OUTPUT, STOPPING_BEACON   313