summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-09-28 23:01:10 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-09-28 23:01:10 +0000
commit50f3a0b5e2533b25bdd8a781ee938b6bff613fc8 (patch)
tree3daa5492038663c8d91a7e2f3d26136652e8f482
parent22091749858f4e00263e167692b3d19752540454 (diff)
parented48aa9359668b97cf97bc6835f20c2a80098962 (diff)
downloadcar-50f3a0b5e2533b25bdd8a781ee938b6bff613fc8.tar.gz
Snap for 7775125 from ed48aa9359668b97cf97bc6835f20c2a80098962 to sc-v2-release
Change-Id: I30b059368799caf707d4a02d95e401c9fd0d69e9
-rw-r--r--emulator/audio/driver/audio_hw.c20
-rw-r--r--emulator/audio/driver/include/audio_hw_control.h4
-rw-r--r--emulator/audio/halservice/Android.bp3
-rw-r--r--emulator/audio/halservice/AudioControl.cpp5
-rw-r--r--emulator/audio/halservice/PowerPolicyClient.cpp70
-rw-r--r--emulator/audio/halservice/PowerPolicyClient.h53
-rw-r--r--emulator/audio/halservice/service.cpp5
7 files changed, 1 insertions, 159 deletions
diff --git a/emulator/audio/driver/audio_hw.c b/emulator/audio/driver/audio_hw.c
index 3ced724..36796c4 100644
--- a/emulator/audio/driver/audio_hw.c
+++ b/emulator/audio/driver/audio_hw.c
@@ -86,8 +86,6 @@ static const char * const AUDIO_ZONE_KEYWORD = "_audio_zone_";
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
-static bool is_audio_enabled = 1; // Protected by lock
-
#define SIZE_OF_PARSE_BUFFER 32
static int adev_get_mic_mute(const struct audio_hw_device *dev, bool *state);
@@ -164,18 +162,6 @@ void set_device_address_is_muted(const char *device_address, bool is_muted){
pthread_mutex_unlock(&out->lock);
}
-void set_audio_enabled(bool is_enabled) {
- pthread_mutex_lock(&lock);
- is_audio_enabled = is_enabled;
- pthread_mutex_unlock(&lock);
-}
-
-bool get_is_audio_enabled() {
- pthread_mutex_lock(&lock);
- bool is_enabled = is_audio_enabled;
- pthread_mutex_unlock(&lock);
- return is_enabled;
-}
static struct pcm_config pcm_config_out = {
.channels = 2,
@@ -257,7 +243,6 @@ static int out_set_format(struct audio_stream *stream, audio_format_t format) {
static int out_dump(const struct audio_stream *stream, int fd) {
struct generic_stream_out *out = (struct generic_stream_out *)stream;
- bool is_enabled = get_is_audio_enabled();
pthread_mutex_lock(&out->lock);
dprintf(fd, "\tout_dump:\n"
@@ -283,7 +268,6 @@ static int out_dump(const struct audio_stream *stream, int fd) {
out->enabled_channels,
_bool_str(out->is_ducked),
_bool_str(out->is_muted),
- _bool_str(is_enabled),
out->dev);
pthread_mutex_unlock(&out->lock);
return 0;
@@ -521,8 +505,6 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer, si
const size_t frame_size = audio_stream_out_frame_size(stream);
const size_t frames = bytes / frame_size;
- bool is_enabled = get_is_audio_enabled();
-
pthread_mutex_lock(&out->lock);
if (out->worker_standby) {
@@ -554,7 +536,7 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer, si
pthread_mutex_lock(&out->lock);
}
- if (out->dev->master_mute || out->is_muted || !is_enabled) {
+ if (out->dev->master_mute || out->is_muted) {
ALOGV("%s: ignored due to mute", __func__);
} else {
out_apply_gain(out, buffer, bytes);
diff --git a/emulator/audio/driver/include/audio_hw_control.h b/emulator/audio/driver/include/audio_hw_control.h
index 21d30d0..75fc92d 100644
--- a/emulator/audio/driver/include/audio_hw_control.h
+++ b/emulator/audio/driver/include/audio_hw_control.h
@@ -39,10 +39,6 @@ void set_device_address_is_ducked(const char *device_address, bool is_ducked);
// audio_policy_configuration.xml
void set_device_address_is_muted(const char *device_address, bool is_muted);
-// Sets whether audio component is enabled or disabled.
-// Results in muting of all audio leaving the HAL if it is disabled
-void set_audio_enabled(bool is_enabled);
-
#ifdef __cplusplus
}
#endif // __cplusplus
diff --git a/emulator/audio/halservice/Android.bp b/emulator/audio/halservice/Android.bp
index 01828af..a3bd5be 100644
--- a/emulator/audio/halservice/Android.bp
+++ b/emulator/audio/halservice/Android.bp
@@ -34,7 +34,6 @@ cc_binary {
compile_multilib: "prefer32",
srcs: [
"service.cpp",
- "PowerPolicyClient.cpp",
],
cflags: [
@@ -48,7 +47,6 @@ cc_binary {
"android.hardware.audio.common@6.0",
"android.hardware.audio.effect@6.0",
"android.hardware.automotive.audiocontrol-V1-ndk_platform",
- "android.frameworks.automotive.powerpolicy-V1-ndk_platform",
"audiocontrol-caremu",
"libbase",
"libbinder",
@@ -56,7 +54,6 @@ cc_binary {
"libhardware",
"libhidlbase",
"liblog",
- "libpowerpolicyclient",
],
header_libs: [
diff --git a/emulator/audio/halservice/AudioControl.cpp b/emulator/audio/halservice/AudioControl.cpp
index 87d77d8..6b2e5a2 100644
--- a/emulator/audio/halservice/AudioControl.cpp
+++ b/emulator/audio/halservice/AudioControl.cpp
@@ -173,11 +173,6 @@ binder_status_t AudioControl::dump(int fd, const char** args, uint32_t numArgs)
}
}
-void AudioControl::setAudioEnabled(bool isEnabled) {
- LOG(DEBUG) << "setAudioEnabled called with value: " << isEnabled;
- set_audio_enabled(isEnabled);
-}
-
binder_status_t AudioControl::dumpsys(int fd) {
dprintf(fd, "*%s*\n", LOG_TAG);
std::shared_ptr<IFocusListener> focusListener = std::atomic_load(&mFocusListener);
diff --git a/emulator/audio/halservice/PowerPolicyClient.cpp b/emulator/audio/halservice/PowerPolicyClient.cpp
deleted file mode 100644
index cc431c6..0000000
--- a/emulator/audio/halservice/PowerPolicyClient.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
- #define LOG_TAG "AudioPowerPolicyClient"
-
-#include "PowerPolicyClient.h"
-#include "AudioControl.h"
-
-#include <android-base/logging.h>
-
-namespace aidl {
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace audiocontrol {
-
-namespace aafap = ::aidl::android::frameworks::automotive::powerpolicy;
-
-using aafap::CarPowerPolicy;
-using aafap::CarPowerPolicyFilter;
-using aafap::PowerComponent;
-using ::android::frameworks::automotive::powerpolicy::hasComponent;
-using ::ndk::ScopedAStatus;
-
-namespace {
-
-constexpr PowerComponent kAudioComponent = PowerComponent::AUDIO;
-
-} // namespace
-
-PowerPolicyClient::PowerPolicyClient(const std::shared_ptr<AudioControl>& audioControl)
- : mAudioControl(audioControl) {}
-
-void PowerPolicyClient::onInitFailed() {
- LOG(ERROR) << "Initializing power policy client failed";
-}
-
-std::vector<PowerComponent> PowerPolicyClient::getComponentsOfInterest() {
- std::vector<PowerComponent> components{kAudioComponent};
- return components;
-}
-
-ScopedAStatus PowerPolicyClient::onPolicyChanged(const CarPowerPolicy& powerPolicy) {
- if (hasComponent(powerPolicy.enabledComponents, kAudioComponent)) {
- mAudioControl->setAudioEnabled(true);
- } else if (hasComponent(powerPolicy.disabledComponents, kAudioComponent)) {
- mAudioControl->setAudioEnabled(false);
- }
-
- return ScopedAStatus::ok();
-}
-
-} // namespace audiocontrol
-} // namespace automotive
-} // namespace hardware
-} // namespace android
-} // namespace aidl
diff --git a/emulator/audio/halservice/PowerPolicyClient.h b/emulator/audio/halservice/PowerPolicyClient.h
deleted file mode 100644
index a4772c6..0000000
--- a/emulator/audio/halservice/PowerPolicyClient.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef AUTOMOTIVE_AUDIOCONTROL_AIDL_DEFAULT_POWERPOLICYCLIENT_H_
-#define AUTOMOTIVE_AUDIOCONTROL_AIDL_DEFAULT_POWERPOLICYCLIENT_H_
-
-#include "PowerPolicyClientBase.h"
-
-#include <memory>
-
-namespace aidl {
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace audiocontrol {
-
-class AudioControl;
-
-class PowerPolicyClient
- : public ::android::frameworks::automotive::powerpolicy::PowerPolicyClientBase {
- public:
- explicit PowerPolicyClient(const std::shared_ptr<AudioControl>& audioControl);
-
- void onInitFailed();
- std::vector<::aidl::android::frameworks::automotive::powerpolicy::PowerComponent>
- getComponentsOfInterest() override;
- ::ndk::ScopedAStatus onPolicyChanged(
- const ::aidl::android::frameworks::automotive::powerpolicy::CarPowerPolicy&) override;
-
- private:
- std::shared_ptr<AudioControl> mAudioControl;
-};
-
-} // namespace audiocontrol
-} // namespace automotive
-} // namespace hardware
-} // namespace android
-} // namespace aidl
-
-#endif // AUTOMOTIVE_AUDIOCONTROL_AIDL_DEFAULT_POWERPOLICYCLIENT_H_
diff --git a/emulator/audio/halservice/service.cpp b/emulator/audio/halservice/service.cpp
index e658cf4..aafff4d 100644
--- a/emulator/audio/halservice/service.cpp
+++ b/emulator/audio/halservice/service.cpp
@@ -17,7 +17,6 @@
#define LOG_TAG "audiohalservice"
#include "AudioControl.h"
-#include "PowerPolicyClient.h"
#include <string>
#include <vector>
@@ -37,7 +36,6 @@
using namespace android::hardware;
using android::OK;
using aidl::android::hardware::automotive::audiocontrol::AudioControl;
-using aidl::android::hardware::automotive::audiocontrol::PowerPolicyClient;
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
@@ -65,9 +63,6 @@ int main(int /* argc */, char* /* argv */ []) {
AServiceManager_addService(audioControl->asBinder().get(), instance.c_str());
CHECK(aidlStatus == STATUS_OK);
- PowerPolicyClient powerPolicyClient = PowerPolicyClient(audioControl);
- powerPolicyClient.init();
-
ABinderProcess_joinThreadPool();
return EXIT_FAILURE; // should not reach
}