Hard-code mm-qcamera-daemon SDK version to Android M
Commit 11859d467c ("Be more strict about using invalid `pthread_t`s.")
causes Qualcomm's proprietary mm-qcamera-daemon to crash, because the
version available for the FP2 is designed for Android 6 and still
contains the "invalid use of pthread_t`s". Handle this service as target
SDK version Android 6.0, so that the strict checking is not applied to
it.
A proper solution would require fixing the proprietary service itself
though.
Issue: FP2P-343
Change-Id: Ifba96a9ecbd3f40232b80008823843b2157c80fa
(cherry picked from commit 271bee72bb1059504935bb377b2d0cc0dff91cd7)
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 324f3ef..ffbef43 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -4224,7 +4224,15 @@
// somain and ld_preloads are added to these namespaces after LD_PRELOAD libs are linked
}
- set_application_target_sdk_version(config->target_sdk_version());
+ uint32_t target_sdk = config->target_sdk_version();
+ // The Qualcomm camera deamon is a legacy service written for Android 6 and
+ // causes a check in __pthread_internal_find to fail. It has the generic
+ // __ANDROID_API__ ("future API") SDK version here. Hard-code it to M instead.
+ if (std::string(executable_path) == "/system/vendor/bin/mm-qcamera-daemon") {
+ target_sdk = __ANDROID_API_M__;
+ DEBUG("Forcing target SDK version of %s to %d", executable_path, target_sdk);
+ }
+ set_application_target_sdk_version(target_sdk);
std::vector<android_namespace_t*> created_namespaces;
created_namespaces.reserve(namespaces.size());