Check if service is ready before query status

Bug: 425974655
Change-Id: I8707b844d65865d409780e1861385d840525390b
This commit is contained in:
Kyle Zhang
2025-06-26 22:52:39 -07:00
parent da542e6219
commit 573fa0b628

View File

@@ -11,6 +11,7 @@
#include "log.h"
#include <json/json.h>
#include <sys/stat.h>
namespace {
// Please keep the order stable.
@@ -200,6 +201,20 @@ bool matchesSocModelPattern(const std::string& socModel) {
}
bool checkIfEnableMultiThreadBinder() {
// On first boot, the /data/vendor/mediadrm path may not have been created
// by init yet. Calling QueryStatus at this stage would fail because the L3
// service cannot initialize its filesystem, leading to a persistent error
// state. This check defers enabling multi-threading until the basic DRM
// filesystem is ready. b/425974655.
const char* kMediaDrmPath = "/data/vendor/mediadrm";
struct stat sb;
// check if the MediaDRM path exists and is a directory
if (stat(kMediaDrmPath, &sb) != 0 || !S_ISDIR(sb.st_mode)) {
LOGW("MediaDRM path does not exist, deferring multi-thread binder check.");
return false;
}
android::sp<wvcdm::WvContentDecryptionModule> cdm = wvdrm::getCDM();
if (cdm == nullptr) {
LOGW("Failed to get CDM when checking if multi-thread binder is enabled.");