#include <mm.h>
#include "CAudioIODef.h"
#ifdef ENABLE_DPM
-#include <dpm/context.h>
#include <dpm/restriction.h>
#endif
static bool __is_microphone_restricted(void) {
int state = 1;
#ifdef ENABLE_DPM
- dpm_context_h dpm_ctx_h;
- dpm_restriction_policy_h dpm_policy_h;
+ device_policy_manager_h dpm_h = NULL;
int ret = 0;
- if ((dpm_ctx_h = dpm_context_create())) {
- if ((dpm_policy_h = dpm_context_acquire_restriction_policy(dpm_ctx_h))) {
- /* state: 0(disallowed), 1(allowed) */
- if ((ret = dpm_restriction_get_microphone_state(dpm_policy_h, &state)))
- AUDIO_IO_LOGE("Failed to dpm_restriction_get_microphone_state(), ret(0x%x)", ret);
- dpm_context_release_restriction_policy(dpm_ctx_h, dpm_policy_h);
- } else {
- AUDIO_IO_LOGE("Failed to dpm_context_acquire_restriction_policy()");
- }
- dpm_context_destroy(dpm_ctx_h);
+ if ((dpm_h = dpm_manager_create())) {
+ /* state: 0(disallowed), 1(allowed) */
+ if ((ret = dpm_restriction_get_microphone_state(dpm_h, &state)))
+ AUDIO_IO_LOGE("Failed to dpm_restriction_get_microphone_state(), ret(0x%x)", ret);
+ dpm_manager_destroy(dpm_h);
+ AUDIO_IO_LOGD("microphone restriction state: %d(1:allowed, 0:disallowed)", state);
} else {
- AUDIO_IO_LOGE("Failed to dpm_context_create()");
+ AUDIO_IO_LOGE("Failed to dpm_manager_create()");
}
#endif
return (state ? false : true);