Only use libbinder_ndk for aidl service.

[ Merged from http://go/wvgerrit/151169 ]

Test: Netflix and Google TV streaming and downloaded playback
Test: unit tests
Test: atest VtsAidlHalDrmTargetTest
Test: adb shell readelf -d /vendor/bin/hw/android.hardware.drm-service.widevine
Test: adb shell readelf -d /vendor/lib64/libwvaidl.so

Bug: 230791937
Change-Id: Ia60d9fc838bf228b40d99b076a837ae789fa2d03
This commit is contained in:
Edwin Wong
2022-04-29 20:31:18 +00:00
parent da1e3c5de2
commit af5f57a46c
13 changed files with 31 additions and 26 deletions

View File

@@ -49,8 +49,7 @@ bool WVDrmFactory::isCryptoSchemeSupported(const Uuid& in_uuid) {
const std::vector<uint8_t>& in_initData,
std::shared_ptr<::aidl::android::hardware::drm::ICryptoPlugin>*
_aidl_return) {
const auto& self = android::IPCThreadState::self();
const char* sid = self->getCallingSid();
const char* sid = AIBinder_getCallingSid();
sid = sid ? (std::strstr(sid, "mediadrmserver") ? sid : "app") : "nullptr";
ALOGI("[%s] calling %s", sid, __PRETTY_FUNCTION__);
@@ -73,8 +72,7 @@ bool WVDrmFactory::isCryptoSchemeSupported(const Uuid& in_uuid) {
::ndk::ScopedAStatus WVDrmFactory::createDrmPlugin(
const Uuid& in_uuid, const string& in_appPackageName,
std::shared_ptr<::aidl::android::hardware::drm::IDrmPlugin>* _aidl_return) {
const auto& self = ::android::IPCThreadState::self();
const char* sid = self->getCallingSid();
const char* sid = AIBinder_getCallingSid();
sid = sid ? (std::strstr(sid, "mediadrmserver") ? sid : "app") : "nullptr";
ALOGI("[%s][%s] calling %s", sid, in_appPackageName.c_str(),
__PRETTY_FUNCTION__);

View File

@@ -19,7 +19,6 @@
#include <android/binder_ibinder_platform.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <binder/ProcessState.h>
#include "WVCreatePluginFactories.h"
#include "WVDrmFactory.h"
@@ -31,6 +30,8 @@ int main(int /* argc */, char** /* argv */) {
ABinderProcess_setThreadPoolMaxThreadCount(8);
std::shared_ptr<WVDrmFactory> drmFactory = createDrmFactory();
AIBinder_setRequestingSid(drmFactory->asBinder().get(), true);
const std::string drmInstance =
std::string(WVDrmFactory::descriptor) + "/widevine";
binder_status_t status = AServiceManager_addService(

View File

@@ -19,7 +19,6 @@
#include <android/binder_ibinder_platform.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <binder/ProcessState.h>
#include "WVCreatePluginFactories.h"
#include "WVDrmFactory.h"
@@ -31,6 +30,8 @@ int main(int /* argc */, char** /* argv */) {
ABinderProcess_setThreadPoolMaxThreadCount(8);
std::shared_ptr<WVDrmFactory> drmFactory = createDrmFactory();
AIBinder_setRequestingSid(drmFactory->asBinder().get(), true);
const std::string drmInstance =
std::string(WVDrmFactory::descriptor) + "/widevine";
binder_status_t status = AServiceManager_registerLazyService(