wv hidl: setRequestingSid to true
HALs need to getCallingSid to verify clients. [ Merge of http://go/wvgerrit/89123 ] Bug: 134787536 Test: log calling sid Change-Id: I9cfbddfc274457a6802d9c8f37470d656771acc6
This commit is contained in:
@@ -31,7 +31,7 @@ Return<void> WVCryptoFactory::createPlugin(
|
|||||||
const hidl_vec<uint8_t>& initData,
|
const hidl_vec<uint8_t>& initData,
|
||||||
createPlugin_cb _hidl_cb) {
|
createPlugin_cb _hidl_cb) {
|
||||||
|
|
||||||
WVCryptoPlugin *plugin = NULL;
|
sp<ICryptoPlugin> plugin;
|
||||||
if (!isCryptoSchemeSupported(uuid.data())) {
|
if (!isCryptoSchemeSupported(uuid.data())) {
|
||||||
ALOGE("Widevine Drm HAL: failed to create crypto plugin, " \
|
ALOGE("Widevine Drm HAL: failed to create crypto plugin, " \
|
||||||
"invalid crypto scheme");
|
"invalid crypto scheme");
|
||||||
@@ -40,6 +40,7 @@ Return<void> WVCryptoFactory::createPlugin(
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugin = new WVCryptoPlugin(initData.data(), initData.size(), getCDM());
|
plugin = new WVCryptoPlugin(initData.data(), initData.size(), getCDM());
|
||||||
|
android::hardware::setRequestingSid(plugin, true);
|
||||||
_hidl_cb(Status::OK, plugin);
|
_hidl_cb(Status::OK, plugin);
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ Return<void> WVDrmFactory::createPlugin(
|
|||||||
const hidl_string& appPackageName,
|
const hidl_string& appPackageName,
|
||||||
createPlugin_cb _hidl_cb) {
|
createPlugin_cb _hidl_cb) {
|
||||||
|
|
||||||
WVDrmPlugin *plugin = NULL;
|
sp<IDrmPlugin> plugin;
|
||||||
if (!isCryptoSchemeSupported(uuid.data())) {
|
if (!isCryptoSchemeSupported(uuid.data())) {
|
||||||
ALOGE("Widevine Drm HAL: failed to create drm plugin, " \
|
ALOGE("Widevine Drm HAL: failed to create drm plugin, " \
|
||||||
"invalid crypto scheme");
|
"invalid crypto scheme");
|
||||||
@@ -80,6 +80,7 @@ Return<void> WVDrmFactory::createPlugin(
|
|||||||
|
|
||||||
plugin = new WVDrmPlugin(getCDM(), appPackageName.c_str(),
|
plugin = new WVDrmPlugin(getCDM(), appPackageName.c_str(),
|
||||||
&sOemCryptoInterface, areSpoidsEnabled());
|
&sOemCryptoInterface, areSpoidsEnabled());
|
||||||
|
android::hardware::setRequestingSid(plugin, true);
|
||||||
_hidl_cb(Status::OK, plugin);
|
_hidl_cb(Status::OK, plugin);
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ int main(int /* argc */, char** /* argv */) {
|
|||||||
|
|
||||||
configureRpcThreadpool(8, true /* callerWillJoin */);
|
configureRpcThreadpool(8, true /* callerWillJoin */);
|
||||||
|
|
||||||
|
android::hardware::setRequestingSid(drmFactory, true);
|
||||||
|
android::hardware::setRequestingSid(cryptoFactory, true);
|
||||||
|
|
||||||
// Setup hwbinder service
|
// Setup hwbinder service
|
||||||
CHECK_EQ(drmFactory->registerAsService("widevine"), android::NO_ERROR)
|
CHECK_EQ(drmFactory->registerAsService("widevine"), android::NO_ERROR)
|
||||||
<< "Failed to register Widevine Factory HAL";
|
<< "Failed to register Widevine Factory HAL";
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ int main(int /* argc */, char** /* argv */) {
|
|||||||
|
|
||||||
configureRpcThreadpool(8, true /* callerWillJoin */);
|
configureRpcThreadpool(8, true /* callerWillJoin */);
|
||||||
|
|
||||||
|
android::hardware::setRequestingSid(drmFactory, true);
|
||||||
|
android::hardware::setRequestingSid(cryptoFactory, true);
|
||||||
|
|
||||||
// Setup hwbinder service
|
// Setup hwbinder service
|
||||||
auto serviceRegistrar = LazyServiceRegistrar::getInstance();
|
auto serviceRegistrar = LazyServiceRegistrar::getInstance();
|
||||||
CHECK_EQ(serviceRegistrar.registerService(drmFactory, "widevine"), android::NO_ERROR)
|
CHECK_EQ(serviceRegistrar.registerService(drmFactory, "widevine"), android::NO_ERROR)
|
||||||
|
|||||||
Reference in New Issue
Block a user