1
0
mirror of https://github.com/ponces/treble_aosp.git synced 2024-11-25 06:46:24 +00:00
treble_aosp/patches/trebledroid/platform_frameworks_av/0016-Use-a-fake-volume-policy-when-none-has-been-found.patch
2024-06-18 10:56:01 +01:00

38 lines
1.8 KiB
Diff

From 8d0bf8d33e27a676c86281d7c093f867af92209b Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sun, 28 Mar 2021 14:48:49 +0200
Subject: [PATCH 16/24] Use a fake volume policy when none has been found
This is useful, because on Samsung devices, the "real"
(=non-gsi-cheating) audio policy doesn't have any volume policy.
This requires actually adding the fake audio policy xml file (done in
device/phh/treble)
Change-Id: I461a3f22893ab2b1d96d67f22397369b2cae41e5
---
services/audiopolicy/engine/config/src/EngineConfig.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/services/audiopolicy/engine/config/src/EngineConfig.cpp b/services/audiopolicy/engine/config/src/EngineConfig.cpp
index ca78ce7213..59211577c4 100644
--- a/services/audiopolicy/engine/config/src/EngineConfig.cpp
+++ b/services/audiopolicy/engine/config/src/EngineConfig.cpp
@@ -800,7 +800,12 @@ android::status_t parseLegacyVolumeFile(const char* path, VolumeGroups &volumeGr
android::status_t parseLegacyVolumes(VolumeGroups &volumeGroups) {
if (std::string audioPolicyXmlConfigFile = audio_get_audio_policy_config_file();
!audioPolicyXmlConfigFile.empty()) {
- return parseLegacyVolumeFile(audioPolicyXmlConfigFile.c_str(), volumeGroups);
+ int ret = parseLegacyVolumeFile(audioPolicyXmlConfigFile.c_str(), volumeGroups);
+ if (ret == NO_ERROR && volumeGroups.size() == 0) {
+ ret = parseLegacyVolumeFile("/system/etc/fake_audio_policy_volume.xml", volumeGroups);
+ ALOGE("Parsing volume for /system/etc/fake_audio_policy_volume.xml gave %zu", volumeGroups.size());
+ }
+ return ret;
} else {
ALOGE("No readable audio policy config file found");
return BAD_VALUE;
--
2.34.1