From 98e579c7badb3aa9f0abcbdc1baedd224dc225e5 Mon Sep 17 00:00:00 2001 From: karthik bharadwaj Date: Wed, 24 Mar 2021 01:39:55 -0700 Subject: [PATCH] Rename the global mic disable setting The current implementation of the user microphone disable privacy setting has led to some confusion and readability issues. Originally meant to denote meaning along the lines of 'the user's microphone disable switch is enabled', the logic (and reviews) have turned out slightly cumbersome. Refactoring it to simply mean 'microphone access', would be easier to implement, review and maintain. This CL renames the enum, the reworked logic will be in an accompanying CL. Bug: 183416485 Test: atest VtsHalContexthubV1_2TargetTest Change-Id: I85c95f4a6ee5cb0db7547c318d30b72f740e6d9b --- contexthub/1.2/types.hal | 8 +++++--- .../1.2/vts/functional/VtsHalContexthubV1_2TargetTest.cpp | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/contexthub/1.2/types.hal b/contexthub/1.2/types.hal index 5033ce84c6..75122bc898 100644 --- a/contexthub/1.2/types.hal +++ b/contexthub/1.2/types.hal @@ -35,10 +35,12 @@ enum Setting : @1.1::Setting { AIRPLANE_MODE, /** - * Indicates if the microphone access was turned off globally by the user, - * in which case audio data cannot be used and propagated by CHRE. + * Indicates if the microphone access is available for CHRE. Microphone + * access is disabled if the user has turned off the microphone as a + * privacy setting, in which case audio data cannot be used and propagated + * by CHRE. */ - GLOBAL_MIC_DISABLE, + MICROPHONE, }; struct ContextHubMsg { diff --git a/contexthub/1.2/vts/functional/VtsHalContexthubV1_2TargetTest.cpp b/contexthub/1.2/vts/functional/VtsHalContexthubV1_2TargetTest.cpp index 3510c2379f..9ee40ede01 100644 --- a/contexthub/1.2/vts/functional/VtsHalContexthubV1_2TargetTest.cpp +++ b/contexthub/1.2/vts/functional/VtsHalContexthubV1_2TargetTest.cpp @@ -131,10 +131,10 @@ TEST_P(ContexthubHidlTest, TestOnAirplaneModeSettingChanged) { ASSERT_OK(registerCallback_1_2(nullptr)); } -TEST_P(ContexthubHidlTest, TestOnGlobalMicDisableSettingChanged) { +TEST_P(ContexthubHidlTest, TestOnMicrophoneSettingChanged) { ASSERT_OK(registerCallback_1_2(new ContexthubCallbackV1_2())); - hubApi->onSettingChanged_1_2(Setting::GLOBAL_MIC_DISABLE, SettingValue::DISABLED); - hubApi->onSettingChanged_1_2(Setting::GLOBAL_MIC_DISABLE, SettingValue::ENABLED); + hubApi->onSettingChanged_1_2(Setting::MICROPHONE, SettingValue::DISABLED); + hubApi->onSettingChanged_1_2(Setting::MICROPHONE, SettingValue::ENABLED); ASSERT_OK(registerCallback_1_2(nullptr)); }