Sync up to v304

This commit is contained in:
Andy CrossGate Yan
2021-04-12 14:55:10 +00:00
parent cacd8b0430
commit 93d0ea8243
18 changed files with 761 additions and 8706 deletions

View File

@@ -1,44 +0,0 @@
From 9a240b125c01838dcd7be395354cd8d740b0923b Mon Sep 17 00:00:00 2001
From: Taehwan Kim <t_h.kim@samsung.com>
Date: Thu, 26 Nov 2020 22:40:40 +0900
Subject: [PATCH 30/30] CCodec: GraphicBufferSourceWrapper: fix to apply
nBufferCountActual for deciding number of inputs
Bug: 169398817
Change-Id: I58cd7da35a3ddc4abdb58df954307acf329c7ee7
Signed-off-by: Taehwan Kim <t_h.kim@samsung.com>
(cherry picked from commit 8b3bcddbc98af38d64a1ffefd5932b498f9d4c36)
---
media/codec2/sfplugin/CCodec.cpp | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/media/codec2/sfplugin/CCodec.cpp b/media/codec2/sfplugin/CCodec.cpp
index 54107bd852..2f16ca1104 100644
--- a/media/codec2/sfplugin/CCodec.cpp
+++ b/media/codec2/sfplugin/CCodec.cpp
@@ -246,8 +246,19 @@ public:
if (source == nullptr) {
return NO_INIT;
}
- constexpr size_t kNumSlots = 16;
- for (size_t i = 0; i < kNumSlots; ++i) {
+
+ size_t numSlots = 4;
+ constexpr OMX_U32 kPortIndexInput = 0;
+
+ OMX_PARAM_PORTDEFINITIONTYPE param;
+ param.nPortIndex = kPortIndexInput;
+ status_t err = mNode->getParameter(OMX_IndexParamPortDefinition,
+ &param, sizeof(param));
+ if (err == OK) {
+ numSlots = param.nBufferCountActual;
+ }
+
+ for (size_t i = 0; i < numSlots; ++i) {
source->onInputBufferAdded(i);
}
--
2.25.1

View File

@@ -0,0 +1,66 @@
From ecab6fe48819adeafaceec1a33e7e1d380caec75 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sat, 13 Mar 2021 14:20:03 -0500
Subject: [PATCH 33/38] Support Samsung R multi-cams
---
services/camera/libcameraservice/Android.bp | 1 +
.../libcameraservice/common/CameraProviderManager.cpp | 8 +++++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/services/camera/libcameraservice/Android.bp b/services/camera/libcameraservice/Android.bp
index be275e9346..bede98bfdc 100644
--- a/services/camera/libcameraservice/Android.bp
+++ b/services/camera/libcameraservice/Android.bp
@@ -129,6 +129,7 @@ cc_library_shared {
"android.hardware.camera.device@3.5",
"android.hardware.camera.device@3.6",
"vendor.samsung.hardware.camera.provider@3.0",
+ "vendor.samsung.hardware.camera.provider@4.0",
],
static_libs: [
diff --git a/services/camera/libcameraservice/common/CameraProviderManager.cpp b/services/camera/libcameraservice/common/CameraProviderManager.cpp
index 3e6ad1ef52..b7d1a57567 100644
--- a/services/camera/libcameraservice/common/CameraProviderManager.cpp
+++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp
@@ -22,6 +22,7 @@
#include <android/hardware/camera/device/3.5/ICameraDevice.h>
#include <vendor/samsung/hardware/camera/provider/3.0/ISehCameraProvider.h>
+#include <vendor/samsung/hardware/camera/provider/4.0/ISehCameraProvider.h>
#include <algorithm>
#include <chrono>
@@ -1363,7 +1364,9 @@ status_t CameraProviderManager::ProviderInfo::initialize(
}
auto samsungCast = vendor::samsung::hardware::camera::provider::V3_0::ISehCameraProvider::castFrom(interface);
+ auto samsung40Cast = vendor::samsung::hardware::camera::provider::V4_0::ISehCameraProvider::castFrom(interface);
auto samsungProvider = samsungCast.isOk() ? static_cast<sp<vendor::samsung::hardware::camera::provider::V3_0::ISehCameraProvider>>(samsungCast) : nullptr;
+ auto samsung40Provider = samsung40Cast.isOk() ? static_cast<sp<vendor::samsung::hardware::camera::provider::V4_0::ISehCameraProvider>>(samsung40Cast) : nullptr;
hardware::Return<bool> linked = interface->linkToDeath(this, /*cookie*/ mId);
if (!linked.isOk()) {
@@ -1401,6 +1404,7 @@ status_t CameraProviderManager::ProviderInfo::initialize(
status = idStatus;
if (status == Status::OK) {
for (auto& name : cameraDeviceNames) {
+ ALOGE("Listing camera ID %s", name.c_str());
uint16_t major, minor;
std::string type, id;
status_t res = parseDeviceName(name, &major, &minor, &type, &id);
@@ -1414,7 +1418,9 @@ status_t CameraProviderManager::ProviderInfo::initialize(
}
} };
hardware::Return<void> ret;
- if(samsungProvider != nullptr && property_get_bool("persist.sys.phh.samsung.camera_ids", false))
+ if(samsung40Provider != nullptr && property_get_bool("persist.sys.phh.samsung.camera_ids", false))
+ ret = samsung40Provider->sehGetCameraIdList(cb);
+ else if(samsungProvider != nullptr && property_get_bool("persist.sys.phh.samsung.camera_ids", false))
ret = samsungProvider->sehGetCameraIdList(cb);
else
ret = interface->getCameraIdList(cb);
--
2.25.1

View File

@@ -0,0 +1,30 @@
From 347755b3b0d26b557ac0775433ccdbabe23ac6ed Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 23 Mar 2021 00:16:42 +0100
Subject: [PATCH 34/38] [audiopolicy] Don't crash on unknown audio devices
---
.../common/managerdefinitions/src/Serializer.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
index 73e4a3e096..1f200ad850 100644
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
@@ -951,7 +951,12 @@ Return<ModuleTraits::Element> ModuleTraits::deserialize(const xmlNode *cur, PtrS
sp<DeviceDescriptor> device = module->getDeclaredDevices().
getDeviceFromTagName(std::string(reinterpret_cast<const char*>(
attachedDevice.get())));
- ctx->addDevice(device);
+ if(device != nullptr) {
+ ctx->addDevice(device);
+ } else {
+ ALOGE("NULL DEVICE %s: %s %s=%s", __func__, tag, childAttachedDeviceTag,
+ reinterpret_cast<const char*>(attachedDevice.get()));
+ }
}
}
}
--
2.25.1

View File

@@ -0,0 +1,99 @@
From 0b8723c62a0d5b63f8afd46fddc3c38123b49d04 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net>
Date: Sun, 28 Mar 2021 16:17:36 +0800
Subject: [PATCH 35/38] AudioPolicyManager: retry with SW bridge if hardware
audio patch fails
* On two of my MT6771 Q vendor devices, in-call audio is broken due to
the audio HAL claiming to support HW audio patch between the Rx / Tx
devices but failing when called with `createAudioPatch`.
> 03-28 11:56:42.300 1345 1345 W AudioALSAHardware: sinks[0].type ==
AUDIO_PORT_TYPE_DEVICE
> 03-28 11:56:42.300 1345 1345 W AudioALSAHardware: [createAudioPatch]
[5082]
> 03-28 11:56:42.300 1345 1345 E AudioALSAHardware: Fail status -38
> 03-28 11:56:42.300 1345 1345 W DeviceHAL: Error from HAL Device in
function create_audio_patch: Function not implemented
> 03-28 11:56:42.301 1358 1374 W APM_AudioPolicyManager:
createAudioPatchInternal patch panel could not connect device patch,
error -38
> 03-28 11:56:42.301 1358 1374 W APM_AudioPolicyManager:
createTelephonyPatch() error -38 creating RX audio patch
* This was not broken on Q because
`AudioPolicyManager::updateCallRouting` bypasses `createAudioPatch` by
directly calling the legacy `setOutputDevice` when `supportsPatch` is
true, i.e. `createAudioPatch` was *only* used for SW bridge for
in-call audio before R.
* As a workaround, re-try by forcing the creation of a SW bridge after
`createAudioPatch` fails. We could also restore the old behavior of
`updateCallRouting`, but that would probably break in-call audio on
newer HALs that may or may not work properly with `setOutputDevice`.
---
.../managerdefault/AudioPolicyManager.cpp | 13 ++++++++++---
.../audiopolicy/managerdefault/AudioPolicyManager.h | 4 +++-
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 63dcd538b1..6d2c38811e 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -3490,7 +3490,8 @@ status_t AudioPolicyManager::getAudioPort(struct audio_port *port)
status_t AudioPolicyManager::createAudioPatchInternal(const struct audio_patch *patch,
audio_patch_handle_t *handle,
uid_t uid, uint32_t delayMs,
- const sp<SourceClientDescriptor>& sourceDesc)
+ const sp<SourceClientDescriptor>& sourceDesc,
+ bool forceSwBridge)
{
ALOGV("%s", __func__);
if (handle == NULL || patch == NULL) {
@@ -3694,7 +3695,8 @@ status_t AudioPolicyManager::createAudioPatchInternal(const struct audio_patch *
// - audio HAL version is >= 3.0 but no route has been declared between devices
// - called from startAudioSource (aka sourceDesc != nullptr) and source device does
// not have a gain controller
- if (!srcDevice->hasSameHwModuleAs(sinkDevice) ||
+ // - a previous attempt at using HW bridge failed (forceSwBridge)
+ if (forceSwBridge || !srcDevice->hasSameHwModuleAs(sinkDevice) ||
(srcDevice->getModuleVersionMajor() < 3) ||
!srcDevice->getModule()->supportsPatch(srcDevice, sinkDevice) ||
(sourceDesc != nullptr &&
@@ -3759,7 +3761,12 @@ status_t AudioPolicyManager::createAudioPatchInternal(const struct audio_patch *
__func__, index, handle, patchBuilder.patch(), delayMs, uid, &patchDesc);
if (status != NO_ERROR) {
ALOGW("%s patch panel could not connect device patch, error %d", __func__, status);
- return INVALID_OPERATION;
+ if (forceSwBridge || patch->sinks[0].type != AUDIO_PORT_TYPE_DEVICE) {
+ return INVALID_OPERATION;
+ } else {
+ ALOGW("Retrying with software bridging.");
+ return createAudioPatchInternal(patch, handle, uid, delayMs, sourceDesc, true);
+ }
}
} else {
return BAD_VALUE;
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.h b/services/audiopolicy/managerdefault/AudioPolicyManager.h
index b588f898d4..60cbd7175e 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.h
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.h
@@ -910,12 +910,14 @@ private:
* @param[in] delayMs if required
* @param[in] sourceDesc [optional] in case of external source, source client to be
* configured by the patch, i.e. assigning an Output (HW or SW)
+ * @param[in] forceSwBridge [optional] force the creation of a SW bridge (internal use only)
* @return NO_ERROR if patch installed correctly, error code otherwise.
*/
status_t createAudioPatchInternal(const struct audio_patch *patch,
audio_patch_handle_t *handle,
uid_t uid, uint32_t delayMs = 0,
- const sp<SourceClientDescriptor>& sourceDesc = nullptr);
+ const sp<SourceClientDescriptor>& sourceDesc = nullptr,
+ bool forceSwBridge = false);
/**
* @brief releaseAudioPatchInternal internal function to remove an audio patch
* @param[in] handle of the patch to be removed
--
2.25.1

View File

@@ -0,0 +1,26 @@
From c8a6af6fd0f3134b96fc291910cfc0380bc0dc31 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sun, 28 Mar 2021 14:47:52 +0200
Subject: [PATCH 36/38] Reenable STRATEGY_ROUTING. This is a leftover of tries
of 587b198, wrongly commited in 20f869
---
services/audiopolicy/enginedefault/src/Engine.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/services/audiopolicy/enginedefault/src/Engine.cpp b/services/audiopolicy/enginedefault/src/Engine.cpp
index 16a7a4bbac..b14d2bbb0b 100755
--- a/services/audiopolicy/enginedefault/src/Engine.cpp
+++ b/services/audiopolicy/enginedefault/src/Engine.cpp
@@ -52,7 +52,7 @@ static const std::vector<legacy_strategy_map>& getLegacyStrategy() {
{ "STRATEGY_ENFORCED_AUDIBLE", STRATEGY_ENFORCED_AUDIBLE },
{ "STRATEGY_TRANSMITTED_THROUGH_SPEAKER", STRATEGY_TRANSMITTED_THROUGH_SPEAKER },
{ "STRATEGY_ACCESSIBILITY", STRATEGY_ACCESSIBILITY },
- //{ "STRATEGY_REROUTING", STRATEGY_REROUTING },
+ { "STRATEGY_REROUTING", STRATEGY_REROUTING },
{ "STRATEGY_PATCH", STRATEGY_REROUTING }, // boiler to manage stream patch volume
{ "STRATEGY_CALL_ASSISTANT", STRATEGY_CALL_ASSISTANT },
};
--
2.25.1

View File

@@ -0,0 +1,40 @@
From c3bd3dc63c34de7c688b24999769f7eb504784a3 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 37/38] 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)
---
services/audiopolicy/engine/config/src/EngineConfig.cpp | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/services/audiopolicy/engine/config/src/EngineConfig.cpp b/services/audiopolicy/engine/config/src/EngineConfig.cpp
index 4842cb282f..e8d6917754 100644
--- a/services/audiopolicy/engine/config/src/EngineConfig.cpp
+++ b/services/audiopolicy/engine/config/src/EngineConfig.cpp
@@ -717,11 +717,17 @@ android::status_t parseLegacyVolumes(VolumeGroups &volumeGroups) {
snprintf(audioPolicyXmlConfigFile, sizeof(audioPolicyXmlConfigFile),
"%s/%s", path.c_str(), fileName);
ret = parseLegacyVolumeFile(audioPolicyXmlConfigFile, volumeGroups);
- if (ret == NO_ERROR) {
+ ALOGE("Parsing volume for %s gave %zu", audioPolicyXmlConfigFile, volumeGroups.size());
+ if (ret == NO_ERROR && volumeGroups.size() > 0) {
return ret;
}
}
}
+ 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());
+ if (ret == NO_ERROR && volumeGroups.size() == 0) {
+ return ret;
+ }
return BAD_VALUE;
}
--
2.25.1

View File

@@ -0,0 +1,31 @@
From 23f277e7a6afee9d256582204099c4c645606b98 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sun, 28 Mar 2021 18:54:47 +0200
Subject: [PATCH 38/38] Not all sources in a route are valid. Dont ignore the
whole route because of one broken source
---
.../audiopolicy/common/managerdefinitions/src/Serializer.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
index 1f200ad850..e57bd24724 100644
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
@@ -609,10 +609,11 @@ Return<RouteTraits::Element> RouteTraits::deserialize(const xmlNode *cur, PtrSer
source = ctx->findPortByTagName(trim(devTag));
if (source == NULL) {
ALOGE("%s: no source found with name=%s", __func__, devTag);
- return Status::fromStatusT(BAD_VALUE);
}
}
- sources.add(source);
+ if(source != nullptr) {
+ sources.add(source);
+ }
}
devTag = strtok(NULL, ",");
}
--
2.25.1