Skip to content

Commit

Permalink
policy: add dumpsys.
Browse files Browse the repository at this point in the history
- add dumpsys support.
- usage dumpsys media.audio_policy

Change-Id: Ic3a80d0d06278f83fd30b103b69bec9f13f5bba9
  • Loading branch information
Jaideep Sharma committed Apr 7, 2020
1 parent 1ceb195 commit 379e5e6
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 4 deletions.
32 changes: 31 additions & 1 deletion policy_hal/APMConfigHelper.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
Expand Down Expand Up @@ -37,6 +37,36 @@

namespace android {

void APMConfigHelper::dump(String8 *dst) const
{
// apmconfig struct dump
dst->appendFormat("\nAudioPolicyManagerCustom Dump: %p\n", this);
dst->appendFormat("audio_offload_video: %d \n", mConfigs.audio_offload_video);
dst->appendFormat("audio_offload_disable: %d \n", mConfigs.audio_offload_disable);
dst->appendFormat("audio_deepbuffer_media: %d \n", mConfigs.audio_deepbuffer_media);
dst->appendFormat("audio_av_streaming_offload_enable: %d \n", mConfigs.audio_av_streaming_offload_enable);
dst->appendFormat("audio_offload_track_enable: %d \n", mConfigs.audio_offload_track_enable);
dst->appendFormat("audio_offload_multiple_enabled: %d \n", mConfigs.audio_offload_multiple_enabled);
dst->appendFormat("voice_dsd_playback_conc_disabled: %d \n", mConfigs.voice_dsd_playback_conc_disabled);
dst->appendFormat("audio_sva_conc_enabled: %d \n", mConfigs.audio_sva_conc_enabled);
dst->appendFormat("audio_va_concurrency_enabled: %d \n", mConfigs.audio_va_concurrency_enabled);
dst->appendFormat("audio_rec_playback_conc_disabled: %d \n", mConfigs.audio_rec_playback_conc_disabled);
dst->appendFormat("voice_path_for_pcm_voip: %d \n", mConfigs.voice_path_for_pcm_voip);
dst->appendFormat("voice_playback_conc_disabled: %d \n", mConfigs.voice_playback_conc_disabled);
dst->appendFormat("voice_record_conc_disabled: %d \n", mConfigs.voice_record_conc_disabled);
dst->appendFormat("voice_voip_conc_disabled: %d \n", mConfigs.voice_voip_conc_disabled);
dst->appendFormat("audio_offload_min_duration_secs: %u \n", mConfigs.audio_offload_min_duration_secs);
dst->appendFormat("voice_conc_fallbackpath: %s \n", mConfigs.voice_conc_fallbackpath.c_str());
dst->appendFormat("audio_extn_hdmi_spk_enabled: %d \n", mConfigs.audio_extn_hdmi_spk_enabled);
dst->appendFormat("audio_extn_formats_enabled: %d \n", mConfigs.audio_extn_formats_enabled);
dst->appendFormat("audio_extn_afe_proxy_enabled: %d \n", mConfigs.audio_extn_afe_proxy_enabled);
dst->appendFormat("compress_voip_enabled: %d \n", mConfigs.compress_voip_enabled);
dst->appendFormat("fm_power_opt: %d \n", mConfigs.fm_power_opt);
dst->appendFormat("voice_concurrency: %d \n", mConfigs.voice_concurrency);
dst->appendFormat("record_play_concurrency: %d \n", mConfigs.record_play_concurrency);
dst->appendFormat("use_xml_audio_policy_conf: %d \n", mConfigs.use_xml_audio_policy_conf);
}

void APMConfigHelper::retrieveConfigs()
{
#ifdef AHAL_EXT_ENABLED
Expand Down
5 changes: 3 additions & 2 deletions policy_hal/APMConfigHelper.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
Expand Down Expand Up @@ -31,6 +31,7 @@
#define _APM_CONFIG_HELPER_H_

#include <string>
#include <utils/String8.h>
#include <media/stagefright/foundation/ABase.h>
#include <utils/RefBase.h>

Expand Down Expand Up @@ -109,7 +110,7 @@ class APMConfigHelper : public RefBase {
bool isVoiceConcEnabled();
bool isRecPlayConcEnabled();
bool useXMLAudioPolicyConf();

void dump(String8 *dst) const;
private:
inline void retrieveConfigs();

Expand Down
9 changes: 9 additions & 0 deletions policy_hal/AudioPolicyManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2171,4 +2171,13 @@ AudioPolicyManagerCustom::AudioPolicyManagerCustom(AudioPolicyClientInterface *c
mFallBackflag = getFallBackPath();
}

status_t AudioPolicyManagerCustom::dump(int fd)
{
AudioPolicyManager::dump(fd);
String8 result;
mApmConfigs->dump(&result);
write(fd, result.string(), result.size());
return NO_ERROR;
}

}
3 changes: 2 additions & 1 deletion policy_hal/AudioPolicyManager.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2019 The Linux Foundation. All rights reserved.
* Copyright (c) 2013-2020 The Linux Foundation. All rights reserved.
* Not a contribution.
*
* Copyright (C) 2009 The Android Open Source Project
Expand Down Expand Up @@ -112,6 +112,7 @@ class AudioPolicyManagerCustom: public AudioPolicyManager
// indicates to the audio policy manager that the input stops being used.
virtual status_t stopInput(audio_port_handle_t portId);

status_t dump(int fd) override;
static sp<APMConfigHelper> mApmConfigs;

protected:
Expand Down

0 comments on commit 379e5e6

Please sign in to comment.