1
0
mirror of https://github.com/yurisieucuti/treble_evolution.git synced 2024-11-24 10:56:22 +00:00
treble_evolution/patches/trebledroid/platform_frameworks_av/0017-Use-a-fake-volume-policy-when-none-has-been-found.patch
2024-03-10 06:48:11 +00:00

38 lines
1.8 KiB
Diff

From 085d5b0ec334f2e9199a9dcf4bb9dccbf33ce0d0 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 17/25] 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.25.1