Initial commit for Android 10, syncing up to v201
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
From 5286da2b7f598de0566d1ad1a5e070bdb5d698d1 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Tue, 24 Apr 2018 00:14:28 +0200
|
||||
Subject: [PATCH 01/11] FIH devices: Fix "Earpiece" audio output
|
||||
|
||||
On some FIH devices (confirmed on Razer, and probably on Aquos SS2),
|
||||
Earpiece is not listed in attachedDevices, and devicePort's profile
|
||||
mentions it is AUDIO_CHANNEL_IN_MONO, instead of AUDIO_CHANNEL_OUT_MONO.
|
||||
|
||||
Detect such cases (output device, but got only AUDIO_CHANNEL_IN_MONO),
|
||||
and fix both channelMasks and attachedDevices
|
||||
|
||||
Change-Id: I4a88ba6d34d0fcd346eeea2ca903772f0271040a
|
||||
---
|
||||
.../managerdefinitions/src/Serializer.cpp | 27 ++++++++++++++++---
|
||||
1 file changed, 24 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
index 5f820c214..0b561320b 100644
|
||||
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
@@ -395,14 +395,22 @@ Return<AudioGainTraits::Element> AudioGainTraits::deserialize(const xmlNode *cur
|
||||
}
|
||||
|
||||
Return<AudioProfileTraits::Element> AudioProfileTraits::deserialize(const xmlNode *cur,
|
||||
- PtrSerializingCtx /*serializingContext*/)
|
||||
+ PtrSerializingCtx serializingContext)
|
||||
{
|
||||
+ bool isOutput = serializingContext != nullptr;
|
||||
std::string samplingRates = getXmlAttribute(cur, Attributes::samplingRates);
|
||||
std::string format = getXmlAttribute(cur, Attributes::format);
|
||||
std::string channels = getXmlAttribute(cur, Attributes::channelMasks);
|
||||
+ ChannelTraits::Collection channelsMask = channelMasksFromString(channels, ",");
|
||||
+
|
||||
+ //Some Foxconn devices have wrong earpiece channel mask, leading to no channel mask
|
||||
+ if(channelsMask.size() == 1 && channelsMask[0] == AUDIO_CHANNEL_IN_MONO && isOutput) {
|
||||
+ fixedEarpieceChannels = true;
|
||||
+ channelsMask = channelMasksFromString("AUDIO_CHANNEL_OUT_MONO", ",");
|
||||
+ }
|
||||
|
||||
Element profile = new AudioProfile(formatFromString(format, gDynamicFormat),
|
||||
- channelMasksFromString(channels, ","),
|
||||
+ channelsMask,
|
||||
samplingRatesFromString(samplingRates, ","));
|
||||
|
||||
profile->setDynamicFormat(profile->getFormat() == gDynamicFormat);
|
||||
@@ -517,10 +525,15 @@ Return<DevicePortTraits::Element> DevicePortTraits::deserialize(const xmlNode *c
|
||||
}
|
||||
|
||||
AudioProfileTraits::Collection profiles;
|
||||
- status_t status = deserializeCollection<AudioProfileTraits>(cur, &profiles, NULL);
|
||||
+ status_t status;
|
||||
+ if(audio_is_output_devices(type))
|
||||
+ status = deserializeCollection<AudioProfileTraits>(doc, root, profiles, (PtrSerializingCtx)1);
|
||||
+ else
|
||||
+ status = deserializeCollection<AudioProfileTraits>(cur, &profiles, NULL);
|
||||
if (status != NO_ERROR) {
|
||||
return Status::fromStatusT(status);
|
||||
}
|
||||
+
|
||||
if (profiles.isEmpty()) {
|
||||
profiles.add(AudioProfile::createFullDynamic());
|
||||
}
|
||||
@@ -672,6 +685,14 @@ Return<ModuleTraits::Element> ModuleTraits::deserialize(const xmlNode *cur, PtrS
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+ if(fixedEarpieceChannels) {
|
||||
+ sp<DeviceDescriptor> device =
|
||||
+ module->getDeclaredDevices().getDeviceFromTagName(String8("Earpiece"));
|
||||
+ if(device != 0)
|
||||
+ ctx->addAvailableDevice(device);
|
||||
+ fixedEarpieceChannels = false;
|
||||
+ }
|
||||
return module;
|
||||
}
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
From ddf773c1e301c5bc37fe156676ad6deb55fb7e8e Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Pohl <pohl199885@gmail.com>
|
||||
Date: Fri, 15 Jun 2018 19:58:07 +0200
|
||||
Subject: [PATCH 02/11] Fix WiFi-Display on Huawei devices (EMUI 8.0)
|
||||
|
||||
Huaweis media stack doesn't handle intra-refresh-mode, so skip the error instead.
|
||||
|
||||
Thanks to Chris Vandomelen for pointing that out.
|
||||
---
|
||||
media/libstagefright/ACodec.cpp | 5 ++---
|
||||
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
|
||||
index 3d67c911a..007b84cea 100644
|
||||
--- a/media/libstagefright/ACodec.cpp
|
||||
+++ b/media/libstagefright/ACodec.cpp
|
||||
@@ -4358,9 +4358,8 @@ status_t ACodec::setupAVCEncoderParameters(const sp<AMessage> &msg) {
|
||||
if (msg->findInt32("intra-refresh-mode", &intraRefreshMode)) {
|
||||
err = setCyclicIntraMacroblockRefresh(msg, intraRefreshMode);
|
||||
if (err != OK) {
|
||||
- ALOGE("Setting intra macroblock refresh mode (%d) failed: 0x%x",
|
||||
- err, intraRefreshMode);
|
||||
- return err;
|
||||
+ ALOGE("setupAVCEncoderParameters(): set intra-refresh-mode failed, ignoring..");
|
||||
+ //return err;
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
From 6e5e5dbc804ef1aa686731d588bdb959919de29e Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sun, 19 Aug 2018 22:59:06 +0200
|
||||
Subject: [PATCH 03/11] ::Kirin:: Remove lock to prevent self-lock
|
||||
|
||||
With Huawei Camera HAL, we get the following call order:
|
||||
cameraserver CameraService::enumerateProviders (*)
|
||||
=> HAL ICameraProvider::getVendorTags
|
||||
=> HAL ICameraProviderCallback::cameraDeviceStatusChange
|
||||
=> cameraserver CameraService::addState
|
||||
=> cameraserver CameraService::updateCameraNumAndIds (*)
|
||||
|
||||
The two functions marked with (*) take mServiceLock
|
||||
Hence the safe-lock
|
||||
---
|
||||
services/camera/libcameraservice/CameraService.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
|
||||
index 3e6210294..3736a9e24 100644
|
||||
--- a/services/camera/libcameraservice/CameraService.cpp
|
||||
+++ b/services/camera/libcameraservice/CameraService.cpp
|
||||
@@ -254,7 +254,7 @@ void CameraService::onNewProviderRegistered() {
|
||||
}
|
||||
|
||||
void CameraService::updateCameraNumAndIds() {
|
||||
- Mutex::Autolock l(mServiceLock);
|
||||
+ //Mutex::Autolock l(mServiceLock);
|
||||
mNumberOfCameras = mCameraProviderManager->getCameraCount();
|
||||
mNormalDeviceIds =
|
||||
mCameraProviderManager->getAPI1CompatibleCameraDeviceIds();
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From d76a1c23cb4a61bac8e1cdc33bca4201b5c1972f Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sun, 19 Aug 2018 23:05:26 +0200
|
||||
Subject: [PATCH 04/11] We might not have a mFlashlight at this state, but
|
||||
that's ok
|
||||
|
||||
---
|
||||
services/camera/libcameraservice/CameraService.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
|
||||
index 3736a9e24..12ab2f47e 100644
|
||||
--- a/services/camera/libcameraservice/CameraService.cpp
|
||||
+++ b/services/camera/libcameraservice/CameraService.cpp
|
||||
@@ -279,7 +279,7 @@ void CameraService::addStates(const String8 id) {
|
||||
conflicting));
|
||||
}
|
||||
|
||||
- if (mFlashlight->hasFlashUnit(id)) {
|
||||
+ if (mFlashlight != nullptr && mFlashlight->hasFlashUnit(id)) {
|
||||
Mutex::Autolock al(mTorchStatusMutex);
|
||||
mTorchStatusMap.add(id, TorchModeStatus::AVAILABLE_OFF);
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
From a5bc47c2602ae78b0471e8f55538a4cca083decf Mon Sep 17 00:00:00 2001
|
||||
From: Artem Borisov <dedsa2002@gmail.com>
|
||||
Date: Tue, 25 Sep 2018 12:39:22 +0300
|
||||
Subject: [PATCH 05/11] CameraService: Support calling addStates in
|
||||
enumerateProviders
|
||||
|
||||
Some pre-P camera HALs trigger onDeviceStatusChange callback during HAL init.
|
||||
This is horribly wrong and causes a race condition between enumerateProviders
|
||||
and onDeviceStatusChange. While it wasn't really harmful in O, in P call sequence
|
||||
was changed and now this race condition leads to two problems: null pointer dereference
|
||||
in addStates because mFlashlight is not initialized at a proper timing; mServiceLock
|
||||
deadlock because updateCameraNumAndIds and enumerateProviders are called at the same time.
|
||||
Moving addStates back to enumerateProviders makes the sequence more similar to O, and doesn't
|
||||
let these two issues to happen.
|
||||
Enable TARGET_CAMERA_NEEDS_ADD_STATES_IN_ENUMERATE when it is necessary.
|
||||
|
||||
@Dil3mm4 edit: Instead of TARGET_CAMERA_NEEDS_ADD_STATES_IN_ENUMERATE let's use a system property to make it more generic and suitable for GSI use.
|
||||
|
||||
Change-Id: Ife25b9753fdb679ab0c77f385e1b8527551a4711
|
||||
---
|
||||
.../camera/libcameraservice/CameraService.cpp | 16 ++++++++++++++++
|
||||
1 file changed, 16 insertions(+)
|
||||
|
||||
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
|
||||
index 12ab2f47e..d208a36a9 100644
|
||||
--- a/services/camera/libcameraservice/CameraService.cpp
|
||||
+++ b/services/camera/libcameraservice/CameraService.cpp
|
||||
@@ -204,6 +204,20 @@ status_t CameraService::enumerateProviders() {
|
||||
|
||||
for (auto& cameraId : deviceIds) {
|
||||
String8 id8 = String8(cameraId.c_str());
|
||||
+ if (property_get_bool("persist.sys.camera.huawei", false)) {
|
||||
+ bool cameraFound = false;
|
||||
+ {
|
||||
+ Mutex::Autolock lock(mCameraStatesLock);
|
||||
+ auto iter = mCameraStates.find(id8);
|
||||
+ if (iter != mCameraStates.end()) {
|
||||
+ cameraFound = true;
|
||||
+ }
|
||||
+ }
|
||||
+ if (!cameraFound) {
|
||||
+ addStates(id8);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (getCameraState(id8) == nullptr) {
|
||||
onDeviceStatusChanged(id8, CameraDeviceStatus::PRESENT);
|
||||
}
|
||||
@@ -317,8 +331,10 @@ void CameraService::onDeviceStatusChanged(const String8& id,
|
||||
ALOGI("%s: Unknown camera ID %s, a new camera is added",
|
||||
__FUNCTION__, id.string());
|
||||
|
||||
+ if (!property_get_bool("persist.sys.camera.huawei", false)) {
|
||||
// First add as absent to make sure clients are notified below
|
||||
addStates(id);
|
||||
+ }
|
||||
|
||||
updateStatus(newStatus, id);
|
||||
} else {
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
From 04e7317ef801f4124f4a074519d7a077dac14702 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sun, 9 Dec 2018 15:56:59 +0100
|
||||
Subject: [PATCH 06/11] Revert "Set rlimit rtprio for cameraserver"
|
||||
|
||||
This reverts commit 4ae244cab4fe715fc2729e906b7dda3075fbbac3.
|
||||
|
||||
We need to revert this because some init/systems (Moto E5, G6) doesn't
|
||||
like this instruction at all (read: this prevents boot)
|
||||
---
|
||||
camera/cameraserver/cameraserver.rc | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/camera/cameraserver/cameraserver.rc b/camera/cameraserver/cameraserver.rc
|
||||
index a9aae0b15..fea5a1d5c 100644
|
||||
--- a/camera/cameraserver/cameraserver.rc
|
||||
+++ b/camera/cameraserver/cameraserver.rc
|
||||
@@ -4,4 +4,3 @@ service cameraserver /system/bin/cameraserver
|
||||
group audio camera input drmrpc
|
||||
ioprio rt 4
|
||||
writepid /dev/cpuset/camera-daemon/tasks /dev/stune/top-app/tasks
|
||||
- rlimit rtprio 10 10
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
From bb6f508a514d09fdab79583886f7953dd42bfa0c Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Wed, 4 Sep 2019 22:28:56 +0200
|
||||
Subject: [PATCH 07/11] fixup! FIH devices: Fix "Earpiece" audio output
|
||||
|
||||
---
|
||||
.../audiopolicy/common/managerdefinitions/src/Serializer.cpp | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
index 0b561320b..c8cb54b5f 100644
|
||||
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
@@ -394,6 +394,7 @@ Return<AudioGainTraits::Element> AudioGainTraits::deserialize(const xmlNode *cur
|
||||
}
|
||||
}
|
||||
|
||||
+static bool fixedEarpieceChannels = false;
|
||||
Return<AudioProfileTraits::Element> AudioProfileTraits::deserialize(const xmlNode *cur,
|
||||
PtrSerializingCtx serializingContext)
|
||||
{
|
||||
@@ -527,7 +528,7 @@ Return<DevicePortTraits::Element> DevicePortTraits::deserialize(const xmlNode *c
|
||||
AudioProfileTraits::Collection profiles;
|
||||
status_t status;
|
||||
if(audio_is_output_devices(type))
|
||||
- status = deserializeCollection<AudioProfileTraits>(doc, root, profiles, (PtrSerializingCtx)1);
|
||||
+ status = deserializeCollection<AudioProfileTraits>(cur, &profiles, (PtrSerializingCtx)1);
|
||||
else
|
||||
status = deserializeCollection<AudioProfileTraits>(cur, &profiles, NULL);
|
||||
if (status != NO_ERROR) {
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From 582695245e6ce2bafaf3b11b9d3b69dcf88d0037 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 5 Aug 2019 17:27:47 +0200
|
||||
Subject: [PATCH 08/11] Fix use-after-free (object on stack)
|
||||
|
||||
Change-Id: I9ae666b10873eac4e7a55032071e7b15b0de058a
|
||||
---
|
||||
.../audiopolicy/common/managerdefinitions/src/Serializer.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
index c8cb54b5f..9f2bdc4b3 100644
|
||||
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
@@ -517,7 +517,7 @@ Return<DevicePortTraits::Element> DevicePortTraits::deserialize(const xmlNode *c
|
||||
if (!encodedFormatsLiteral.empty()) {
|
||||
encodedFormats = formatsFromString(encodedFormatsLiteral, " ");
|
||||
}
|
||||
- Element deviceDesc = new DeviceDescriptor(type, encodedFormats, String8(name.c_str()));
|
||||
+ Element deviceDesc = new DeviceDescriptor(type, encodedFormats, String8(strdup(name.c_str())));
|
||||
|
||||
std::string address = getXmlAttribute(cur, Attributes::address);
|
||||
if (!address.empty()) {
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
From c02350cbd42543fdfac9bd61b630182a0da1ecf9 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 5 Aug 2019 18:09:50 +0200
|
||||
Subject: [PATCH 09/11] Fix BT in-call on CAF devices
|
||||
|
||||
See https://github.com/phhusson/treble_experimentations/issues/374
|
||||
|
||||
In Qualcomm's BSP audio_policy_configuration.xml, one route is missing,
|
||||
from primary output and telephony to BT SCO.
|
||||
|
||||
Add it if we detect telephony and bt sco, but no such route.
|
||||
|
||||
Change-Id: Ifea0f88276ec9a0811f3cb1973c4b06f2c82077b
|
||||
---
|
||||
.../managerdefinitions/src/Serializer.cpp | 91 +++++++++++++++++++
|
||||
1 file changed, 91 insertions(+)
|
||||
|
||||
diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
index 9f2bdc4b3..9c7e5c49d 100644
|
||||
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
@@ -607,6 +607,96 @@ Return<RouteTraits::Element> RouteTraits::deserialize(const xmlNode *cur, PtrSer
|
||||
return route;
|
||||
}
|
||||
|
||||
+static void fixupQualcommBtScoRoute(RouteTraits::Collection& routes, DevicePortTraits::Collection& devicePorts, HwModule* ctx) {
|
||||
+ // On many Qualcomm devices, there is a BT SCO Headset Mic => primary input mix
|
||||
+ // But Telephony Rx => BT SCO Headset route is missing
|
||||
+ // When we detect such case, add the missing route
|
||||
+
|
||||
+ // If we have:
|
||||
+ // <route type="mix" sink="Telephony Tx" sources="voice_tx"/>
|
||||
+ // <route type="mix" sink="primary input" sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic"/>
|
||||
+ // <devicePort tagName="BT SCO Headset" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET" role="sink" />
|
||||
+ // And no <route type="mix" sink="BT SCO Headset" />
|
||||
+
|
||||
+ // Add:
|
||||
+ // <route type="mix" sink="BT SCO Headset" sources="primary output,deep_buffer,compressed_offload,Telephony Rx"/>
|
||||
+ bool foundBtScoHeadsetDevice = false;
|
||||
+ for(const auto& device: devicePorts) {
|
||||
+ if(device->getTagName() == String8("BT SCO Headset")) {
|
||||
+ foundBtScoHeadsetDevice = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ if(!foundBtScoHeadsetDevice) {
|
||||
+ ALOGE("No BT SCO Headset device found, don't patch policy");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ bool foundTelephony = false;
|
||||
+ bool foundBtScoInput = false;
|
||||
+ bool foundScoHeadsetRoute = false;
|
||||
+ for(const auto& route: routes) {
|
||||
+ ALOGE("Looking at route %d\n", route->getType());
|
||||
+ if(route->getType() != AUDIO_ROUTE_MIX)
|
||||
+ continue;
|
||||
+ auto sink = route->getSink();
|
||||
+ ALOGE("... With sink %s\n", sink->getTagName().c_str());
|
||||
+ if(sink->getTagName() == String8("Telephony Tx")) {
|
||||
+ foundTelephony = true;
|
||||
+ continue;
|
||||
+ }
|
||||
+ if(sink->getTagName() == String8("BT SCO Headset")) {
|
||||
+ foundScoHeadsetRoute = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ for(const auto& source: route->getSources()) {
|
||||
+ ALOGE("... With source %s\n", source->getTagName().c_str());
|
||||
+ if(source->getTagName() == String8("BT SCO Headset Mic")) {
|
||||
+ foundBtScoInput = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ //The route we want to add is already there
|
||||
+ ALOGE("Done looking for existing routes");
|
||||
+ if(foundScoHeadsetRoute)
|
||||
+ return;
|
||||
+
|
||||
+ ALOGE("No existing route found... %d %d", foundTelephony ? 1 : 0, foundBtScoInput ? 1 : 0);
|
||||
+ //We couldn't find the routes we assume are required for the function we want to add
|
||||
+ if(!foundTelephony || !foundBtScoInput)
|
||||
+ return;
|
||||
+ ALOGE("Adding our own.");
|
||||
+
|
||||
+ // Add:
|
||||
+ // <route type="mix" sink="BT SCO Headset" sources="primary output,deep_buffer,compressed_offload,Telephony Rx"/>
|
||||
+ AudioRoute *newRoute = new AudioRoute(AUDIO_ROUTE_MIX);
|
||||
+
|
||||
+ auto sink = ctx->findPortByTagName(String8("BT SCO Headset"));
|
||||
+ ALOGE("Got sink %p\n", sink.get());
|
||||
+ newRoute->setSink(sink);
|
||||
+
|
||||
+ AudioPortVector sources;
|
||||
+ for(const auto& sourceName: {
|
||||
+ "primary output",
|
||||
+ "deep_buffer",
|
||||
+ "compressed_offload",
|
||||
+ "Telephony Rx"
|
||||
+ }) {
|
||||
+ auto source = ctx->findPortByTagName(String8(sourceName));
|
||||
+ ALOGE("Got source %p\n", source.get());
|
||||
+ sources.add(source);
|
||||
+ source->addRoute(newRoute);
|
||||
+ }
|
||||
+
|
||||
+ newRoute->setSources(sources);
|
||||
+
|
||||
+ sink->addRoute(newRoute);
|
||||
+
|
||||
+ auto ret = routes.add(newRoute);
|
||||
+ ALOGE("route add returned %zd", ret);
|
||||
+}
|
||||
+
|
||||
Return<ModuleTraits::Element> ModuleTraits::deserialize(const xmlNode *cur, PtrSerializingCtx ctx)
|
||||
{
|
||||
std::string name = getXmlAttribute(cur, Attributes::name);
|
||||
@@ -646,6 +736,7 @@ Return<ModuleTraits::Element> ModuleTraits::deserialize(const xmlNode *cur, PtrS
|
||||
if (status != NO_ERROR) {
|
||||
return Status::fromStatusT(status);
|
||||
}
|
||||
+ fixupQualcommBtScoRoute(routes, devicePorts, module.get());
|
||||
module->setRoutes(routes);
|
||||
|
||||
for (const xmlNode *children = cur->xmlChildrenNode; children != NULL;
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
From a71fbad371842877a92190204450b5c6753b3509 Mon Sep 17 00:00:00 2001
|
||||
From: Vincent Vidal <vincent.vidal@onera.fr>
|
||||
Date: Thu, 12 Sep 2019 14:17:14 +0200
|
||||
Subject: [PATCH 10/11] Fix null pointer for unknown audio sources in "Fix BT
|
||||
in-call on CAF devices"
|
||||
|
||||
Some audio sources may not exist on some devices (e.g. Axon 7), leading to a segmentation fault.
|
||||
---
|
||||
.../common/managerdefinitions/src/Serializer.cpp | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
index 9c7e5c49d..8bfdb5b0a 100644
|
||||
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
||||
@@ -685,8 +685,10 @@ static void fixupQualcommBtScoRoute(RouteTraits::Collection& routes, DevicePortT
|
||||
}) {
|
||||
auto source = ctx->findPortByTagName(String8(sourceName));
|
||||
ALOGE("Got source %p\n", source.get());
|
||||
- sources.add(source);
|
||||
- source->addRoute(newRoute);
|
||||
+ if (source.get() != nullptr) {
|
||||
+ sources.add(source);
|
||||
+ source->addRoute(newRoute);
|
||||
+ }
|
||||
}
|
||||
|
||||
newRoute->setSources(sources);
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
From 92aac43c368e3123ac419ad2c293de3abf0f0b3b Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Tue, 1 Oct 2019 13:35:49 +0200
|
||||
Subject: [PATCH 11/11] Add (partial, cam id is hardcoded) support for Asus ZF6
|
||||
motor camera
|
||||
|
||||
Change-Id: Iea6e1370780a1d16f728748d1d948d092532d8fe
|
||||
---
|
||||
.../camera/libcameraservice/CameraService.cpp | 26 +++++++++++++++++++
|
||||
.../camera/libcameraservice/CameraService.h | 3 +++
|
||||
2 files changed, 29 insertions(+)
|
||||
|
||||
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
|
||||
index d208a36a9..37752becd 100644
|
||||
--- a/services/camera/libcameraservice/CameraService.cpp
|
||||
+++ b/services/camera/libcameraservice/CameraService.cpp
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <ctime>
|
||||
#include <string>
|
||||
#include <sys/types.h>
|
||||
+#include <sys/wait.h>
|
||||
#include <inttypes.h>
|
||||
#include <pthread.h>
|
||||
|
||||
@@ -128,6 +129,7 @@ Mutex CameraService::sProxyMutex;
|
||||
sp<hardware::ICameraServiceProxy> CameraService::sCameraServiceProxy;
|
||||
|
||||
CameraService::CameraService() :
|
||||
+ mPhysicalFrontCamStatus(false),
|
||||
mEventLog(DEFAULT_EVENT_LOG_LENGTH),
|
||||
mNumberOfCameras(0),
|
||||
mSoundRef(0), mInitialized(false) {
|
||||
@@ -1538,6 +1540,7 @@ Status CameraService::connectHelper(const sp<CALLBACK>& cameraCb, const String8&
|
||||
mServiceLock.lock();
|
||||
} else {
|
||||
// Otherwise, add client to active clients list
|
||||
+ physicalFrontCam(cameraId == "1");
|
||||
finishConnectLocked(client, partial);
|
||||
}
|
||||
} // lock is destroyed, allow further connect calls
|
||||
@@ -1548,6 +1551,27 @@ Status CameraService::connectHelper(const sp<CALLBACK>& cameraCb, const String8&
|
||||
return ret;
|
||||
}
|
||||
|
||||
+void CameraService::physicalFrontCam(bool on) {
|
||||
+ if(on == mPhysicalFrontCamStatus) return;
|
||||
+ mPhysicalFrontCamStatus = on;
|
||||
+
|
||||
+ if(access("/dev/asusMotoDrv", F_OK) == 0) {
|
||||
+ int pid = fork();
|
||||
+ if(pid == 0) {
|
||||
+ const char* cmd[] = {
|
||||
+ "/system/bin/asus-motor",
|
||||
+ "0",
|
||||
+ NULL
|
||||
+ };
|
||||
+ cmd[1] = on ? "0" : "1";
|
||||
+ execve("/system/bin/asus-motor", (char**)cmd, environ);
|
||||
+ _exit(1);
|
||||
+ } else {
|
||||
+ waitpid(pid, NULL, 0);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
Status CameraService::setTorchMode(const String16& cameraId, bool enabled,
|
||||
const sp<IBinder>& clientBinder) {
|
||||
Mutex::Autolock lock(mServiceLock);
|
||||
@@ -2405,6 +2429,8 @@ binder::Status CameraService::BasicClient::disconnect() {
|
||||
}
|
||||
mDisconnected = true;
|
||||
|
||||
+ sCameraService->physicalFrontCam(false);
|
||||
+
|
||||
sCameraService->removeByClient(this);
|
||||
sCameraService->logDisconnected(mCameraIdStr, mClientPid, String8(mClientPackageName));
|
||||
sCameraService->mCameraProviderManager->removeRef(CameraProviderManager::DeviceMode::CAMERA,
|
||||
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
|
||||
index 065157dad..6d22da619 100644
|
||||
--- a/services/camera/libcameraservice/CameraService.h
|
||||
+++ b/services/camera/libcameraservice/CameraService.h
|
||||
@@ -182,6 +182,9 @@ public:
|
||||
// Monitored UIDs availability notification
|
||||
void notifyMonitoredUids();
|
||||
|
||||
+ bool mPhysicalFrontCamStatus;
|
||||
+ void physicalFrontCam(bool on);
|
||||
+
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// Client functionality
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
||||
Reference in New Issue
Block a user