Merge "Move CDDL into separate CDDL files" into main
diff --git a/bluetooth/aidl/default/Android.bp b/bluetooth/aidl/default/Android.bp
index 32d1a13..3f4ba99 100644
--- a/bluetooth/aidl/default/Android.bp
+++ b/bluetooth/aidl/default/Android.bp
@@ -30,15 +30,8 @@
defaults: ["android.hardware.bluetooth-service-build-defaults"],
srcs: [
"BluetoothHci.cpp",
- ":BluetoothPacketSources",
"net_bluetooth_mgmt.cpp",
],
- generated_headers: [
- "BluetoothGeneratedPackets_h",
- ],
- include_dirs: [
- "packages/modules/Bluetooth/system/gd",
- ],
}
cc_binary {
diff --git a/bluetooth/aidl/default/BluetoothHci.cpp b/bluetooth/aidl/default/BluetoothHci.cpp
index 013ab7f..9862e9e 100644
--- a/bluetooth/aidl/default/BluetoothHci.cpp
+++ b/bluetooth/aidl/default/BluetoothHci.cpp
@@ -29,11 +29,6 @@
#include "log/log.h"
-// TODO: Remove custom logging defines from PDL packets.
-#undef LOG_INFO
-#undef LOG_DEBUG
-#include "hci/hci_packets.h"
-
namespace {
int SetTerminalRaw(int fd) {
termios terminal_settings;
@@ -140,9 +135,7 @@
void BluetoothHci::reset() {
// Send a reset command and wait until the command complete comes back.
- std::vector<uint8_t> reset;
- ::bluetooth::packet::BitInserter bi{reset};
- ::bluetooth::hci::ResetBuilder::Create()->Serialize(bi);
+ std::vector<uint8_t> reset = {0x03, 0x0c, 0x00};
auto resetPromise = std::make_shared<std::promise<void>>();
auto resetFuture = resetPromise->get_future();
@@ -162,13 +155,15 @@
static_cast<int>(raw_sco.size()));
},
[resetPromise](const std::vector<uint8_t>& raw_event) {
- bool valid = ::bluetooth::hci::ResetCompleteView::Create(
- ::bluetooth::hci::CommandCompleteView::Create(
- ::bluetooth::hci::EventView::Create(
- ::bluetooth::hci::PacketView<true>(
- std::make_shared<std::vector<uint8_t>>(
- raw_event)))))
- .IsValid();
+ std::vector<uint8_t> reset_complete = {0x0e, 0x04, 0x01,
+ 0x03, 0x0c, 0x00};
+ bool valid = raw_event.size() == 6 &&
+ raw_event[0] == reset_complete[0] &&
+ raw_event[1] == reset_complete[1] &&
+ // Don't compare the number of packets field.
+ raw_event[3] == reset_complete[3] &&
+ raw_event[4] == reset_complete[4] &&
+ raw_event[5] == reset_complete[5];
if (valid) {
resetPromise->set_value();
} else {
@@ -306,7 +301,8 @@
{
std::lock_guard<std::mutex> guard(mStateMutex);
if (mState != HalState::ONE_CLIENT) {
- ASSERT(mState != HalState::INITIALIZING);
+ LOG_ALWAYS_FATAL_IF(mState == HalState::INITIALIZING,
+ "mState is INITIALIZING");
ALOGI("Already closed");
return ndk::ScopedAStatus::ok();
}
diff --git a/bluetooth/aidl/vts/Android.bp b/bluetooth/aidl/vts/Android.bp
index 5fc0b2e..ade3bef 100644
--- a/bluetooth/aidl/vts/Android.bp
+++ b/bluetooth/aidl/vts/Android.bp
@@ -16,10 +16,6 @@
srcs: [
"VtsHalBluetoothTargetTest.cpp",
":BluetoothPacketSources",
- ":BluetoothHciPacketSources",
- ],
- generated_headers: [
- "BluetoothGeneratedPackets_h",
],
include_dirs: [
"packages/modules/Bluetooth/system/gd",
@@ -31,7 +27,7 @@
],
static_libs: [
"android.hardware.bluetooth-V1-ndk",
- "libbluetooth-types",
+ "libbluetooth_hci_pdl",
],
test_config: "VtsHalBluetoothTargetTest.xml",
test_suites: [
@@ -57,6 +53,5 @@
],
tidy_disabled_srcs: [
":BluetoothPacketSources",
- ":BluetoothHciPacketSources",
],
}
diff --git a/boot/1.0/vts/functional/OWNERS b/boot/1.0/vts/functional/OWNERS
index 36e79be..5aeb4df 100644
--- a/boot/1.0/vts/functional/OWNERS
+++ b/boot/1.0/vts/functional/OWNERS
@@ -1,2 +1,2 @@
-# Bug component: 30545
+# Bug component: 1014951
dvander@google.com
diff --git a/boot/1.1/vts/functional/OWNERS b/boot/1.1/vts/functional/OWNERS
index 36e79be..5aeb4df 100644
--- a/boot/1.1/vts/functional/OWNERS
+++ b/boot/1.1/vts/functional/OWNERS
@@ -1,2 +1,2 @@
-# Bug component: 30545
+# Bug component: 1014951
dvander@google.com
diff --git a/boot/aidl/vts/functional/OWNERS b/boot/aidl/vts/functional/OWNERS
index bc813d8..c67d246 100644
--- a/boot/aidl/vts/functional/OWNERS
+++ b/boot/aidl/vts/functional/OWNERS
@@ -1,2 +1,2 @@
-# Bug component: 30545
+# Bug component: 1014951
zhangkelvin@google.com
diff --git a/cas/1.0/default/CasImpl.cpp b/cas/1.0/default/CasImpl.cpp
index 178020e..98e7593 100644
--- a/cas/1.0/default/CasImpl.cpp
+++ b/cas/1.0/default/CasImpl.cpp
@@ -103,8 +103,7 @@
Return<Status> CasImpl::setSessionPrivateData(
const HidlCasSessionId &sessionId, const HidlCasData& pvtData) {
- ALOGV("%s: sessionId=%s", __FUNCTION__,
- sessionIdToString(sessionId).string());
+ ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).c_str());
std::shared_ptr<CasPlugin> holder = std::atomic_load(&mPluginHolder);
if (holder.get() == nullptr) {
return toStatus(INVALID_OPERATION);
@@ -113,8 +112,7 @@
}
Return<Status> CasImpl::closeSession(const HidlCasSessionId &sessionId) {
- ALOGV("%s: sessionId=%s", __FUNCTION__,
- sessionIdToString(sessionId).string());
+ ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).c_str());
std::shared_ptr<CasPlugin> holder = std::atomic_load(&mPluginHolder);
if (holder.get() == nullptr) {
return toStatus(INVALID_OPERATION);
@@ -124,8 +122,7 @@
Return<Status> CasImpl::processEcm(
const HidlCasSessionId &sessionId, const HidlCasData& ecm) {
- ALOGV("%s: sessionId=%s", __FUNCTION__,
- sessionIdToString(sessionId).string());
+ ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).c_str());
std::shared_ptr<CasPlugin> holder = std::atomic_load(&mPluginHolder);
if (holder.get() == nullptr) {
return toStatus(INVALID_OPERATION);
diff --git a/cas/1.0/default/DescramblerImpl.cpp b/cas/1.0/default/DescramblerImpl.cpp
index f79b32d..6b730eb 100644
--- a/cas/1.0/default/DescramblerImpl.cpp
+++ b/cas/1.0/default/DescramblerImpl.cpp
@@ -62,8 +62,7 @@
}
Return<Status> DescramblerImpl::setMediaCasSession(const HidlCasSessionId& sessionId) {
- ALOGV("%s: sessionId=%s", __FUNCTION__,
- sessionIdToString(sessionId).string());
+ ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).c_str());
std::shared_ptr<DescramblerPlugin> holder = std::atomic_load(&mPluginHolder);
if (holder.get() == nullptr) {
diff --git a/cas/1.0/default/FactoryLoader.h b/cas/1.0/default/FactoryLoader.h
index 45e515a..3d49d9e 100644
--- a/cas/1.0/default/FactoryLoader.h
+++ b/cas/1.0/default/FactoryLoader.h
@@ -17,6 +17,7 @@
#ifndef ANDROID_HARDWARE_CAS_V1_0_FACTORY_LOADER_H_
#define ANDROID_HARDWARE_CAS_V1_0_FACTORY_LOADER_H_
+#include <android-base/strings.h>
#include <dirent.h>
#include <dlfcn.h>
#include "SharedLibrary.h"
@@ -98,17 +99,17 @@
String8 dirPath("/vendor/lib/mediacas");
#endif
- DIR* pDir = opendir(dirPath.string());
+ DIR* pDir = opendir(dirPath.c_str());
if (pDir == NULL) {
- ALOGE("Failed to open plugin directory %s", dirPath.string());
+ ALOGE("Failed to open plugin directory %s", dirPath.c_str());
return false;
}
struct dirent* pEntry;
while ((pEntry = readdir(pDir))) {
String8 pluginPath = dirPath + "/" + pEntry->d_name;
- if (pluginPath.getPathExtension() == ".so") {
+ if (base::EndsWith(pluginPath.c_str(), ".so")) {
if (loadFactoryForSchemeFromPath(
pluginPath, CA_system_id, library, factory)) {
mCASystemIdToLibraryPathMap.add(CA_system_id, pluginPath);
@@ -138,10 +139,10 @@
String8 dirPath("/vendor/lib/mediacas");
#endif
- DIR* pDir = opendir(dirPath.string());
+ DIR* pDir = opendir(dirPath.c_str());
if (pDir == NULL) {
- ALOGE("Failed to open plugin directory %s", dirPath.string());
+ ALOGE("Failed to open plugin directory %s", dirPath.c_str());
return false;
}
@@ -150,7 +151,7 @@
struct dirent* pEntry;
while ((pEntry = readdir(pDir))) {
String8 pluginPath = dirPath + "/" + pEntry->d_name;
- if (pluginPath.getPathExtension() == ".so") {
+ if (base::EndsWith(pluginPath.c_str(), ".so")) {
queryPluginsFromPath(pluginPath, results);
}
}
diff --git a/cas/1.0/default/SharedLibrary.cpp b/cas/1.0/default/SharedLibrary.cpp
index 9c7f385..90c84b8 100644
--- a/cas/1.0/default/SharedLibrary.cpp
+++ b/cas/1.0/default/SharedLibrary.cpp
@@ -29,7 +29,7 @@
namespace implementation {
SharedLibrary::SharedLibrary(const String8 &path) {
- mLibHandle = dlopen(path.string(), RTLD_NOW);
+ mLibHandle = dlopen(path.c_str(), RTLD_NOW);
}
SharedLibrary::~SharedLibrary() {
diff --git a/cas/1.1/default/CasImpl.cpp b/cas/1.1/default/CasImpl.cpp
index 4cc6017..105e036 100644
--- a/cas/1.1/default/CasImpl.cpp
+++ b/cas/1.1/default/CasImpl.cpp
@@ -125,7 +125,7 @@
Return<Status> CasImpl::setSessionPrivateData(const HidlCasSessionId& sessionId,
const HidlCasData& pvtData) {
- ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).string());
+ ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).c_str());
std::shared_ptr<CasPlugin> holder = std::atomic_load(&mPluginHolder);
if (holder.get() == nullptr) {
return toStatus(INVALID_OPERATION);
@@ -134,7 +134,7 @@
}
Return<Status> CasImpl::closeSession(const HidlCasSessionId& sessionId) {
- ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).string());
+ ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).c_str());
std::shared_ptr<CasPlugin> holder = std::atomic_load(&mPluginHolder);
if (holder.get() == nullptr) {
return toStatus(INVALID_OPERATION);
@@ -143,7 +143,7 @@
}
Return<Status> CasImpl::processEcm(const HidlCasSessionId& sessionId, const HidlCasData& ecm) {
- ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).string());
+ ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).c_str());
std::shared_ptr<CasPlugin> holder = std::atomic_load(&mPluginHolder);
if (holder.get() == nullptr) {
return toStatus(INVALID_OPERATION);
diff --git a/cas/1.1/default/DescramblerImpl.cpp b/cas/1.1/default/DescramblerImpl.cpp
index 309cd3c..9d2ead7 100644
--- a/cas/1.1/default/DescramblerImpl.cpp
+++ b/cas/1.1/default/DescramblerImpl.cpp
@@ -59,7 +59,7 @@
}
Return<Status> DescramblerImpl::setMediaCasSession(const HidlCasSessionId& sessionId) {
- ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).string());
+ ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).c_str());
std::shared_ptr<DescramblerPlugin> holder = std::atomic_load(&mPluginHolder);
if (holder.get() == nullptr) {
diff --git a/cas/1.1/default/FactoryLoader.h b/cas/1.1/default/FactoryLoader.h
index 121f90c..a575df6 100644
--- a/cas/1.1/default/FactoryLoader.h
+++ b/cas/1.1/default/FactoryLoader.h
@@ -17,6 +17,7 @@
#ifndef ANDROID_HARDWARE_CAS_V1_1_FACTORY_LOADER_H_
#define ANDROID_HARDWARE_CAS_V1_1_FACTORY_LOADER_H_
+#include <android-base/strings.h>
#include <dirent.h>
#include <dlfcn.h>
#include <media/cas/CasAPI.h>
@@ -90,17 +91,17 @@
#else
String8 dirPath("/vendor/lib/mediacas");
#endif
- DIR* pDir = opendir(dirPath.string());
+ DIR* pDir = opendir(dirPath.c_str());
if (pDir == NULL) {
- ALOGE("Failed to open plugin directory %s", dirPath.string());
+ ALOGE("Failed to open plugin directory %s", dirPath.c_str());
return false;
}
struct dirent* pEntry;
while ((pEntry = readdir(pDir))) {
String8 pluginPath = dirPath + "/" + pEntry->d_name;
- if (pluginPath.getPathExtension() == ".so") {
+ if (base::EndsWith(pluginPath.c_str(), ".so")) {
if (loadFactoryForSchemeFromPath(pluginPath, CA_system_id, library, factory)) {
mCASystemIdToLibraryPathMap.add(CA_system_id, pluginPath);
closedir(pDir);
@@ -127,10 +128,10 @@
#else
String8 dirPath("/vendor/lib/mediacas");
#endif
- DIR* pDir = opendir(dirPath.string());
+ DIR* pDir = opendir(dirPath.c_str());
if (pDir == NULL) {
- ALOGE("Failed to open plugin directory %s", dirPath.string());
+ ALOGE("Failed to open plugin directory %s", dirPath.c_str());
return false;
}
@@ -139,7 +140,7 @@
struct dirent* pEntry;
while ((pEntry = readdir(pDir))) {
String8 pluginPath = dirPath + "/" + pEntry->d_name;
- if (pluginPath.getPathExtension() == ".so") {
+ if (base::EndsWith(pluginPath.c_str(), ".so")) {
queryPluginsFromPath(pluginPath, results);
}
}
diff --git a/cas/1.1/default/SharedLibrary.cpp b/cas/1.1/default/SharedLibrary.cpp
index ffe4bb9..ac5dbcf 100644
--- a/cas/1.1/default/SharedLibrary.cpp
+++ b/cas/1.1/default/SharedLibrary.cpp
@@ -29,7 +29,7 @@
namespace implementation {
SharedLibrary::SharedLibrary(const String8& path) {
- mLibHandle = dlopen(path.string(), RTLD_NOW);
+ mLibHandle = dlopen(path.c_str(), RTLD_NOW);
}
SharedLibrary::~SharedLibrary() {
diff --git a/cas/1.2/default/CasImpl.cpp b/cas/1.2/default/CasImpl.cpp
index 46dd251..b1038bc 100644
--- a/cas/1.2/default/CasImpl.cpp
+++ b/cas/1.2/default/CasImpl.cpp
@@ -174,7 +174,7 @@
Return<Status> CasImpl::setSessionPrivateData(const HidlCasSessionId& sessionId,
const HidlCasData& pvtData) {
- ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).string());
+ ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).c_str());
std::shared_ptr<CasPlugin> holder = std::atomic_load(&mPluginHolder);
if (holder.get() == nullptr) {
return toStatus(INVALID_OPERATION);
@@ -183,7 +183,7 @@
}
Return<Status> CasImpl::closeSession(const HidlCasSessionId& sessionId) {
- ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).string());
+ ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).c_str());
std::shared_ptr<CasPlugin> holder = std::atomic_load(&mPluginHolder);
if (holder.get() == nullptr) {
return toStatus(INVALID_OPERATION);
@@ -192,7 +192,7 @@
}
Return<Status> CasImpl::processEcm(const HidlCasSessionId& sessionId, const HidlCasData& ecm) {
- ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).string());
+ ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).c_str());
std::shared_ptr<CasPlugin> holder = std::atomic_load(&mPluginHolder);
if (holder.get() == nullptr) {
return toStatus(INVALID_OPERATION);
diff --git a/cas/1.2/default/DescramblerImpl.cpp b/cas/1.2/default/DescramblerImpl.cpp
index 309cd3c..9d2ead7 100644
--- a/cas/1.2/default/DescramblerImpl.cpp
+++ b/cas/1.2/default/DescramblerImpl.cpp
@@ -59,7 +59,7 @@
}
Return<Status> DescramblerImpl::setMediaCasSession(const HidlCasSessionId& sessionId) {
- ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).string());
+ ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).c_str());
std::shared_ptr<DescramblerPlugin> holder = std::atomic_load(&mPluginHolder);
if (holder.get() == nullptr) {
diff --git a/cas/1.2/default/FactoryLoader.h b/cas/1.2/default/FactoryLoader.h
index a374b31..0b05bfc 100644
--- a/cas/1.2/default/FactoryLoader.h
+++ b/cas/1.2/default/FactoryLoader.h
@@ -17,6 +17,7 @@
#ifndef ANDROID_HARDWARE_CAS_V1_1_FACTORY_LOADER_H_
#define ANDROID_HARDWARE_CAS_V1_1_FACTORY_LOADER_H_
+#include <android-base/strings.h>
#include <dirent.h>
#include <dlfcn.h>
#include <media/cas/CasAPI.h>
@@ -90,17 +91,17 @@
#else
String8 dirPath("/vendor/lib/mediacas");
#endif
- DIR* pDir = opendir(dirPath.string());
+ DIR* pDir = opendir(dirPath.c_str());
if (pDir == NULL) {
- ALOGE("Failed to open plugin directory %s", dirPath.string());
+ ALOGE("Failed to open plugin directory %s", dirPath.c_str());
return false;
}
struct dirent* pEntry;
while ((pEntry = readdir(pDir))) {
String8 pluginPath = dirPath + "/" + pEntry->d_name;
- if (pluginPath.getPathExtension() == ".so") {
+ if (base::EndsWith(pluginPath.c_str(), ".so")) {
if (loadFactoryForSchemeFromPath(pluginPath, CA_system_id, library, factory)) {
mCASystemIdToLibraryPathMap.add(CA_system_id, pluginPath);
closedir(pDir);
@@ -127,10 +128,10 @@
#else
String8 dirPath("/vendor/lib/mediacas");
#endif
- DIR* pDir = opendir(dirPath.string());
+ DIR* pDir = opendir(dirPath.c_str());
if (pDir == NULL) {
- ALOGE("Failed to open plugin directory %s", dirPath.string());
+ ALOGE("Failed to open plugin directory %s", dirPath.c_str());
return false;
}
@@ -139,7 +140,7 @@
struct dirent* pEntry;
while ((pEntry = readdir(pDir))) {
String8 pluginPath = dirPath + "/" + pEntry->d_name;
- if (pluginPath.getPathExtension() == ".so") {
+ if (base::EndsWith(pluginPath.c_str(), ".so")) {
queryPluginsFromPath(pluginPath, results);
}
}
diff --git a/cas/1.2/default/SharedLibrary.cpp b/cas/1.2/default/SharedLibrary.cpp
index ffe4bb9..ac5dbcf 100644
--- a/cas/1.2/default/SharedLibrary.cpp
+++ b/cas/1.2/default/SharedLibrary.cpp
@@ -29,7 +29,7 @@
namespace implementation {
SharedLibrary::SharedLibrary(const String8& path) {
- mLibHandle = dlopen(path.string(), RTLD_NOW);
+ mLibHandle = dlopen(path.c_str(), RTLD_NOW);
}
SharedLibrary::~SharedLibrary() {
diff --git a/cas/aidl/OWNERS b/cas/OWNERS
old mode 100755
new mode 100644
similarity index 100%
rename from cas/aidl/OWNERS
rename to cas/OWNERS
diff --git a/cas/aidl/default/Android.bp b/cas/aidl/default/Android.bp
index 6ce5681..576016e 100644
--- a/cas/aidl/default/Android.bp
+++ b/cas/aidl/default/Android.bp
@@ -21,6 +21,7 @@
shared_libs: [
"android.hardware.cas-V1-ndk",
+ "libbase",
"libbinder_ndk",
"liblog",
"libutils",
@@ -48,6 +49,7 @@
],
shared_libs: [
"android.hardware.cas-V1-ndk",
+ "libbase",
"libbinder_ndk",
"liblog",
"libutils",
diff --git a/cas/aidl/default/CasImpl.cpp b/cas/aidl/default/CasImpl.cpp
index f08fcc0..9885e16 100644
--- a/cas/aidl/default/CasImpl.cpp
+++ b/cas/aidl/default/CasImpl.cpp
@@ -158,7 +158,7 @@
ScopedAStatus CasImpl::setSessionPrivateData(const vector<uint8_t>& sessionId,
const vector<uint8_t>& pvtData) {
- ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).string());
+ ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).c_str());
shared_ptr<CasPlugin> holder = atomic_load(&mPluginHolder);
if (holder.get() == nullptr) {
return toStatus(INVALID_OPERATION);
@@ -167,7 +167,7 @@
}
ScopedAStatus CasImpl::closeSession(const vector<uint8_t>& sessionId) {
- ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).string());
+ ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).c_str());
shared_ptr<CasPlugin> holder = atomic_load(&mPluginHolder);
if (holder.get() == nullptr) {
return toStatus(INVALID_OPERATION);
@@ -176,7 +176,7 @@
}
ScopedAStatus CasImpl::processEcm(const vector<uint8_t>& sessionId, const vector<uint8_t>& ecm) {
- ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).string());
+ ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(sessionId).c_str());
shared_ptr<CasPlugin> holder = atomic_load(&mPluginHolder);
if (holder.get() == nullptr) {
return toStatus(INVALID_OPERATION);
diff --git a/cas/aidl/default/DescramblerImpl.cpp b/cas/aidl/default/DescramblerImpl.cpp
index a96fd46..d658887 100644
--- a/cas/aidl/default/DescramblerImpl.cpp
+++ b/cas/aidl/default/DescramblerImpl.cpp
@@ -54,7 +54,7 @@
}
ScopedAStatus DescramblerImpl::setMediaCasSession(const vector<uint8_t>& in_sessionId) {
- ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(in_sessionId).string());
+ ALOGV("%s: sessionId=%s", __FUNCTION__, sessionIdToString(in_sessionId).c_str());
shared_ptr<DescramblerPlugin> holder = atomic_load(&mPluginHolder);
if (holder.get() == nullptr) {
diff --git a/cas/aidl/default/FactoryLoader.h b/cas/aidl/default/FactoryLoader.h
index 6a562f6..bc3d715 100644
--- a/cas/aidl/default/FactoryLoader.h
+++ b/cas/aidl/default/FactoryLoader.h
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <android-base/strings.h>
#include <dirent.h>
#include <dlfcn.h>
#include <media/cas/CasAPI.h>
@@ -86,17 +87,17 @@
#else
String8 dirPath("/vendor/lib/mediacas");
#endif
- DIR* pDir = opendir(dirPath.string());
+ DIR* pDir = opendir(dirPath.c_str());
if (pDir == NULL) {
- ALOGE("Failed to open plugin directory %s", dirPath.string());
+ ALOGE("Failed to open plugin directory %s", dirPath.c_str());
return false;
}
struct dirent* pEntry;
while ((pEntry = readdir(pDir))) {
String8 pluginPath = dirPath + "/" + pEntry->d_name;
- if (pluginPath.getPathExtension() == ".so") {
+ if (base::EndsWith(pluginPath.c_str(), ".so")) {
if (loadFactoryForSchemeFromPath(pluginPath, CA_system_id, library, factory)) {
mCASystemIdToLibraryPathMap.add(CA_system_id, pluginPath);
closedir(pDir);
@@ -123,10 +124,10 @@
#else
String8 dirPath("/vendor/lib/mediacas");
#endif
- DIR* pDir = opendir(dirPath.string());
+ DIR* pDir = opendir(dirPath.c_str());
if (pDir == NULL) {
- ALOGE("Failed to open plugin directory %s", dirPath.string());
+ ALOGE("Failed to open plugin directory %s", dirPath.c_str());
return false;
}
@@ -135,7 +136,7 @@
struct dirent* pEntry;
while ((pEntry = readdir(pDir))) {
String8 pluginPath = dirPath + "/" + pEntry->d_name;
- if (pluginPath.getPathExtension() == ".so") {
+ if (base::EndsWith(pluginPath.c_str(), ".so")) {
queryPluginsFromPath(pluginPath, results);
}
}
diff --git a/cas/aidl/default/SharedLibrary.cpp b/cas/aidl/default/SharedLibrary.cpp
index e79f383..c12d17d 100644
--- a/cas/aidl/default/SharedLibrary.cpp
+++ b/cas/aidl/default/SharedLibrary.cpp
@@ -26,7 +26,7 @@
namespace cas {
SharedLibrary::SharedLibrary(const String8& path) {
- mLibHandle = dlopen(path.string(), RTLD_NOW);
+ mLibHandle = dlopen(path.c_str(), RTLD_NOW);
}
SharedLibrary::~SharedLibrary() {
diff --git a/compatibility_matrices/compatibility_matrix.8.xml b/compatibility_matrices/compatibility_matrix.8.xml
index b7ed648..098270f 100644
--- a/compatibility_matrices/compatibility_matrix.8.xml
+++ b/compatibility_matrices/compatibility_matrix.8.xml
@@ -449,7 +449,7 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl" optional="true" updatable-via-apex="true">
<name>android.hardware.neuralnetworks</name>
<version>1-4</version>
<interface>
diff --git a/compatibility_matrices/compatibility_matrix.9.xml b/compatibility_matrices/compatibility_matrix.9.xml
index 6e2178a..f006c71 100644
--- a/compatibility_matrices/compatibility_matrix.9.xml
+++ b/compatibility_matrices/compatibility_matrix.9.xml
@@ -446,7 +446,7 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl" optional="true" updatable-via-apex="true">
<name>android.hardware.neuralnetworks</name>
<version>1-4</version>
<interface>
@@ -646,6 +646,14 @@
<instance>default</instance>
</interface>
</hal>
+ <hal format="aidl" optional="true" updatable-via-apex="true">
+ <name>android.hardware.threadnetwork</name>
+ <version>1</version>
+ <interface>
+ <name>IThreadChip</name>
+ <regex-instance>chip[0-9]+</regex-instance>
+ </interface>
+ </hal>
<hal format="aidl" optional="true">
<name>android.hardware.tv.hdmi.cec</name>
<version>1</version>
@@ -787,12 +795,4 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="aidl" optional="true" updatable-via-apex="true">
- <name>android.hardware.threadnetwork</name>
- <version>1</version>
- <interface>
- <name>IThreadChip</name>
- <regex-instance>chip[0-9]+</regex-instance>
- </interface>
- </hal>
</compatibility-matrix>
diff --git a/drm/1.0/default/Android.bp b/drm/1.0/default/Android.bp
index cbdab4f..45aba7b 100644
--- a/drm/1.0/default/Android.bp
+++ b/drm/1.0/default/Android.bp
@@ -134,6 +134,7 @@
shared_libs: [
"android.hardware.drm@1.0",
"android.hidl.memory@1.0",
+ "libbase",
"libcutils",
"libhidlbase",
"libhidlmemory",
diff --git a/drm/1.0/default/include/PluginLoader.h b/drm/1.0/default/include/PluginLoader.h
index e243f42..5130b16 100644
--- a/drm/1.0/default/include/PluginLoader.h
+++ b/drm/1.0/default/include/PluginLoader.h
@@ -18,6 +18,8 @@
#define PLUGIN_LOADER_H_
#include "SharedLibrary.h"
+
+#include <android-base/strings.h>
#include <utils/Log.h>
#include <utils/String8.h>
#include <utils/Vector.h>
@@ -46,7 +48,7 @@
struct dirent* pEntry;
while ((pEntry = readdir(pDir))) {
String8 file(pEntry->d_name);
- if (file.getPathExtension() == ".so") {
+ if (base::EndsWith(file.c_str(), ".so")) {
String8 path = pluginDir + "/" + pEntry->d_name;
T *plugin = loadOne(path, entry);
if (plugin) {
diff --git a/health/1.0/default/convert.cpp b/health/1.0/default/convert.cpp
index 3680d4d..31b4679 100644
--- a/health/1.0/default/convert.cpp
+++ b/health/1.0/default/convert.cpp
@@ -26,19 +26,18 @@
config.periodicChoresIntervalFast = hc->periodic_chores_interval_fast;
config.periodicChoresIntervalSlow = hc->periodic_chores_interval_slow;
- config.batteryStatusPath = hc->batteryStatusPath.string();
- config.batteryHealthPath = hc->batteryHealthPath.string();
- config.batteryPresentPath = hc->batteryPresentPath.string();
- config.batteryCapacityPath = hc->batteryCapacityPath.string();
- config.batteryVoltagePath = hc->batteryVoltagePath.string();
- config.batteryTemperaturePath = hc->batteryTemperaturePath.string();
- config.batteryTechnologyPath = hc->batteryTechnologyPath.string();
- config.batteryCurrentNowPath = hc->batteryCurrentNowPath.string();
- config.batteryCurrentAvgPath = hc->batteryCurrentAvgPath.string();
- config.batteryChargeCounterPath = hc->batteryChargeCounterPath.string();
- config.batteryFullChargePath = hc->batteryFullChargePath.string();
- config.batteryCycleCountPath = hc->batteryCycleCountPath.string();
-
+ config.batteryStatusPath = hc->batteryStatusPath.c_str();
+ config.batteryHealthPath = hc->batteryHealthPath.c_str();
+ config.batteryPresentPath = hc->batteryPresentPath.c_str();
+ config.batteryCapacityPath = hc->batteryCapacityPath.c_str();
+ config.batteryVoltagePath = hc->batteryVoltagePath.c_str();
+ config.batteryTemperaturePath = hc->batteryTemperaturePath.c_str();
+ config.batteryTechnologyPath = hc->batteryTechnologyPath.c_str();
+ config.batteryCurrentNowPath = hc->batteryCurrentNowPath.c_str();
+ config.batteryCurrentAvgPath = hc->batteryCurrentAvgPath.c_str();
+ config.batteryChargeCounterPath = hc->batteryChargeCounterPath.c_str();
+ config.batteryFullChargePath = hc->batteryFullChargePath.c_str();
+ config.batteryCycleCountPath = hc->batteryCycleCountPath.c_str();
}
void convertFromHealthConfig(const HealthConfig& c, struct healthd_config *hc) {
diff --git a/health/aidl/OWNERS b/health/OWNERS
similarity index 100%
rename from health/aidl/OWNERS
rename to health/OWNERS
diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl
index 1af66d0..c7d8a97 100644
--- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl
+++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl
@@ -35,7 +35,7 @@
@VintfStability
interface IComponent {
android.hardware.common.NativeHandle configureVideoTunnel(in int avSyncHwId);
- android.hardware.media.c2.IComponent.BlockPool createBlockPool(in int allocatorId);
+ android.hardware.media.c2.IComponent.BlockPool createBlockPool(in android.hardware.media.c2.IComponent.BlockPoolAllocator allocator);
void destroyBlockPool(in long blockPoolId);
void drain(in boolean withEos);
android.hardware.media.c2.WorkBundle flush();
@@ -43,11 +43,14 @@
void queue(in android.hardware.media.c2.WorkBundle workBundle);
void release();
void reset();
- void setDecoderOutputAllocator(in android.hardware.media.c2.IGraphicBufferAllocator allocator);
void start();
void stop();
parcelable BlockPool {
long blockPoolId;
android.hardware.media.c2.IConfigurable configurable;
}
+ union BlockPoolAllocator {
+ int allocatorId;
+ android.hardware.media.c2.IGraphicBufferAllocator igba;
+ }
}
diff --git a/media/c2/aidl/android/hardware/media/c2/IComponent.aidl b/media/c2/aidl/android/hardware/media/c2/IComponent.aidl
index a9fddbb..a330d46 100644
--- a/media/c2/aidl/android/hardware/media/c2/IComponent.aidl
+++ b/media/c2/aidl/android/hardware/media/c2/IComponent.aidl
@@ -43,6 +43,18 @@
long blockPoolId;
IConfigurable configurable;
}
+
+ /**
+ * Allocator for C2BlockPool.
+ *
+ * C2BlockPool will use a C2Allocator which is specified by an id.
+ * or C2AIDL allocator interface directly.
+ */
+ union BlockPoolAllocator {
+ int allocatorId;
+ IGraphicBufferAllocator igba;
+ }
+
/**
* Configures a component for a tunneled playback mode.
*
@@ -86,7 +98,8 @@
* destroyBlockPool(), reset() or release(). reset() and release() must
* destroy all `C2BlockPool` objects that have been created.
*
- * @param allocatorId Id of a `C2Allocator`.
+ * @param allocator AIDL allocator interface or C2Allocator specifier
+ * for C2BlockPool
* @param out configurable Configuration interface for the created pool. This
* must not be null.
* @return Created block pool information. This could be used to config/query and
@@ -97,7 +110,7 @@
* - `Status::TIMED_OUT` - The operation cannot be finished in a timely manner.
* - `Status::CORRUPTED` - Some unknown error occurred.
*/
- BlockPool createBlockPool(in int allocatorId);
+ BlockPool createBlockPool(in BlockPoolAllocator allocator);
/**
* Destroys a local block pool previously created by createBlockPool().
@@ -232,17 +245,6 @@
void reset();
/**
- * Specify an allocator for decoder output buffer from HAL.
- *
- * The method will be used once during the life-cycle of a codec instance.
- * @param allocator Decoder output buffer allocator from the client
- * @throws ServiceSpecificException with one of the following values
- * - `Status::CANNOT_DO` - The component does not support allocating from the client.
- * - `Status::CORRUPTED` - Some unknown error occurred.
- */
- void setDecoderOutputAllocator(in IGraphicBufferAllocator allocator);
-
- /**
* Starts the component.
*
* This method must be supported in stopped state as well as tripped state.
diff --git a/security/keymint/aidl/android/hardware/security/keymint/Tag.aidl b/security/keymint/aidl/android/hardware/security/keymint/Tag.aidl
index d401247..36f0106 100644
--- a/security/keymint/aidl/android/hardware/security/keymint/Tag.aidl
+++ b/security/keymint/aidl/android/hardware/security/keymint/Tag.aidl
@@ -971,7 +971,9 @@
* Tag::CERTIFICATE_NOT_BEFORE the beginning of the validity of the certificate in UNIX epoch
* time in milliseconds. This value is used when generating attestation or self signed
* certificates. ErrorCode::MISSING_NOT_BEFORE must be returned if this tag is not provided if
- * this tag is not provided to generateKey or importKey.
+ * this tag is not provided to generateKey or importKey. For importWrappedKey, there is no way
+ * to specify the value of this tag for the wrapped key, so a value of 0 must be used for
+ * certificate generation.
*/
CERTIFICATE_NOT_BEFORE = TagType.DATE | 1008,
@@ -979,7 +981,8 @@
* Tag::CERTIFICATE_NOT_AFTER the end of the validity of the certificate in UNIX epoch time in
* milliseconds. This value is used when generating attestation or self signed certificates.
* ErrorCode::MISSING_NOT_AFTER must be returned if this tag is not provided to generateKey or
- * importKey.
+ * importKey. For importWrappedKey, there is no way to specify the value of this tag for the
+ * wrapped key, so a value of 253402300799000 is used for certificate generation.
*/
CERTIFICATE_NOT_AFTER = TagType.DATE | 1009,
diff --git a/security/keymint/support/remote_prov_utils.cpp b/security/keymint/support/remote_prov_utils.cpp
index c9c3e4d..780c3d2 100644
--- a/security/keymint/support/remote_prov_utils.cpp
+++ b/security/keymint/support/remote_prov_utils.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <iomanip>
#include <iterator>
#include <memory>
#include <set>
@@ -420,6 +421,36 @@
return entryName + " has an invalid value.\n";
}
+std::string checkMapPatchLevelEntry(bool isFactory, const cppbor::Map& devInfo,
+ const std::string& entryName) {
+ std::string error = checkMapEntry(isFactory, devInfo, cppbor::UINT, entryName);
+ if (!error.empty()) {
+ return error;
+ }
+
+ if (isFactory) {
+ return "";
+ }
+
+ const std::unique_ptr<cppbor::Item>& val = devInfo.get(entryName);
+ std::string dateString = std::to_string(val->asUint()->unsignedValue());
+ if (dateString.size() == 6) {
+ dateString += "01";
+ }
+ if (dateString.size() != 8) {
+ return entryName + " should in the format YYYYMMDD or YYYYMM\n";
+ }
+
+ std::tm t;
+ std::istringstream ss(dateString);
+ ss >> std::get_time(&t, "%Y%m%d");
+ if (!ss) {
+ return entryName + " should in the format YYYYMMDD or YYYYMM\n";
+ }
+
+ return "";
+}
+
bool isTeeDeviceInfo(const cppbor::Map& devInfo) {
return devInfo.get("security_level") && devInfo.get("security_level")->asTstr() &&
devInfo.get("security_level")->asTstr()->value() == "tee";
@@ -520,6 +551,10 @@
error += "Err: Unrecognized key entry: <" + key->asTstr()->value() + ">,\n";
}
}
+ // Checks that only apply to v3.
+ error += checkMapPatchLevelEntry(isFactory, *parsed, "system_patch_level");
+ error += checkMapPatchLevelEntry(isFactory, *parsed, "boot_patch_level");
+ error += checkMapPatchLevelEntry(isFactory, *parsed, "vendor_patch_level");
FALLTHROUGH_INTENDED;
case 2:
for (const auto& entry : kAttestationIdEntrySet) {
diff --git a/tv/tuner/aidl/vts/OWNERS b/tv/tuner/aidl/vts/OWNERS
index bf2b609..5b33bf2 100644
--- a/tv/tuner/aidl/vts/OWNERS
+++ b/tv/tuner/aidl/vts/OWNERS
@@ -1,3 +1,5 @@
+# Bug component: 136752
+
hgchen@google.com
shubang@google.com
quxiangfang@google.com
diff --git a/tv/tuner/aidl/vts/functional/Android.bp b/tv/tuner/aidl/vts/functional/Android.bp
index e5fb1e6..5f04293 100644
--- a/tv/tuner/aidl/vts/functional/Android.bp
+++ b/tv/tuner/aidl/vts/functional/Android.bp
@@ -51,6 +51,7 @@
"android.hardware.cas@1.0",
"android.hardware.cas@1.1",
"android.hardware.cas@1.2",
+ "android.hardware.cas-V1-ndk",
"android.hardware.common-V2-ndk",
"android.hardware.common.fmq-V1-ndk",
"android.hardware.tv.tuner-V1-ndk",
diff --git a/tv/tuner/aidl/vts/functional/DescramblerTests.cpp b/tv/tuner/aidl/vts/functional/DescramblerTests.cpp
index 157fa04..f4855c2 100644
--- a/tv/tuner/aidl/vts/functional/DescramblerTests.cpp
+++ b/tv/tuner/aidl/vts/functional/DescramblerTests.cpp
@@ -19,71 +19,115 @@
using namespace std;
AssertionResult DescramblerTests::createCasPlugin(int32_t caSystemId) {
- auto status = mMediaCasService->isSystemIdSupported(caSystemId);
- if (!status.isOk() || !status) {
- ALOGW("[vts] Failed to check isSystemIdSupported.");
- return failure();
+ mCasListener = ::ndk::SharedRefBase::make<MediaCasListener>();
+
+ if (mMediaCasServiceAidl != nullptr) {
+ bool rst = false;
+ ScopedAStatus status = mMediaCasServiceAidl->isSystemIdSupported(caSystemId, &rst);
+ if (!status.isOk() || !rst) {
+ ALOGW("[vts] Failed to check isSystemIdSupported for AIDL service.");
+ return failure();
+ }
+ status = mMediaCasServiceAidl->createPlugin(caSystemId, mCasListener, &mCasAidl);
+ if (!status.isOk()) {
+ ALOGW("[vts] Failed to createPlugin for AIDL service.");
+ return failure();
+ }
+ } else {
+ auto status = mMediaCasServiceHidl->isSystemIdSupported(caSystemId);
+ if (!status.isOk() || !status) {
+ ALOGW("[vts] Failed to check isSystemIdSupported for HIDL service.");
+ return failure();
+ }
+ auto pluginStatus = mMediaCasServiceHidl->createPluginExt(
+ caSystemId, sp<ICasListenerHidl>(mCasListener.get()));
+ if (!pluginStatus.isOk()) {
+ ALOGW("[vts] Failed to createPluginExt for HIDL service.");
+ return failure();
+ }
+ mCasHidl = ICasHidl::castFrom(pluginStatus);
+ if (mCasHidl == nullptr) {
+ ALOGW("[vts] Failed to get ICas for HIDL service.");
+ return failure();
+ }
}
- mCasListener = new MediaCasListener();
- auto pluginStatus = mMediaCasService->createPluginExt(caSystemId, mCasListener);
- if (!pluginStatus.isOk()) {
- ALOGW("[vts] Failed to createPluginExt.");
- return failure();
- }
- mCas = ICas::castFrom(pluginStatus);
- if (mCas == nullptr) {
- ALOGW("[vts] Failed to get ICas.");
- return failure();
- }
return success();
}
AssertionResult DescramblerTests::openCasSession(vector<uint8_t>& sessionId,
- vector<uint8_t>& hidlPvtData) {
- Status sessionStatus;
- SessionIntent intent = SessionIntent::LIVE;
- ScramblingMode mode = ScramblingMode::RESERVED;
- auto returnVoid =
- mCas->openSession_1_2(intent, mode, [&](Status status, const hidl_vec<uint8_t>& id) {
- sessionStatus = status;
- sessionId = id;
- });
- if (!returnVoid.isOk() || (sessionStatus != Status::OK)) {
- ALOGW("[vts] Failed to open cas session.");
- mCas->closeSession(sessionId);
- return failure();
- }
-
- if (hidlPvtData.size() > 0) {
- auto status = mCas->setSessionPrivateData(sessionId, hidlPvtData);
- if (status != android::hardware::cas::V1_0::Status::OK) {
- ALOGW("[vts] Failed to set session private data");
- mCas->closeSession(sessionId);
+ vector<uint8_t>& pvtData) {
+ if (mMediaCasServiceAidl != nullptr) {
+ SessionIntentAidl intent = SessionIntentAidl::LIVE;
+ ScramblingModeAidl mode = ScramblingModeAidl::RESERVED;
+ std::vector<uint8_t> sessionId;
+ ScopedAStatus status = mCasAidl->openSession(intent, mode, &sessionId);
+ if (!status.isOk()) {
+ ALOGW("[vts] Failed to open cas session for AIDL service.");
+ mCasAidl->closeSession(sessionId);
return failure();
}
+
+ if (pvtData.size() > 0) {
+ ScopedAStatus status = mCasAidl->setSessionPrivateData(sessionId, pvtData);
+ if (!status.isOk()) {
+ ALOGW("[vts] Failed to set session private data for AIDL service.");
+ mCasAidl->closeSession(sessionId);
+ return failure();
+ }
+ }
+ } else {
+ Status sessionStatus;
+ SessionIntentHidl intent = SessionIntentHidl::LIVE;
+ ScramblingModeHidl mode = ScramblingModeHidl::RESERVED;
+ auto returnVoid = mCasHidl->openSession_1_2(
+ intent, mode, [&](Status status, const hidl_vec<uint8_t>& id) {
+ sessionStatus = status;
+ sessionId = id;
+ });
+ if (!returnVoid.isOk() || (sessionStatus != Status::OK)) {
+ ALOGW("[vts] Failed to open cas session for HIDL service.");
+ mCasHidl->closeSession(sessionId);
+ return failure();
+ }
+
+ if (pvtData.size() > 0) {
+ auto status = mCasHidl->setSessionPrivateData(sessionId, pvtData);
+ if (status != android::hardware::cas::V1_0::Status::OK) {
+ ALOGW("[vts] Failed to set session private data for HIDL service.");
+ mCasHidl->closeSession(sessionId);
+ return failure();
+ }
+ }
}
return success();
}
AssertionResult DescramblerTests::getKeyToken(int32_t caSystemId, string& provisonStr,
- vector<uint8_t>& hidlPvtData,
- vector<uint8_t>& token) {
+ vector<uint8_t>& pvtData, vector<uint8_t>& token) {
if (createCasPlugin(caSystemId) != success()) {
ALOGW("[vts] createCasPlugin failed.");
return failure();
}
if (provisonStr.size() > 0) {
- auto returnStatus = mCas->provision(hidl_string(provisonStr));
- if (returnStatus != android::hardware::cas::V1_0::Status::OK) {
- ALOGW("[vts] provision failed.");
- return failure();
+ if (mMediaCasServiceAidl != nullptr) {
+ ScopedAStatus status = mCasAidl->provision(provisonStr);
+ if (!status.isOk()) {
+ ALOGW("[vts] provision failed for AIDL service.");
+ return failure();
+ }
+ } else {
+ auto returnStatus = mCasHidl->provision(hidl_string(provisonStr));
+ if (returnStatus != android::hardware::cas::V1_0::Status::OK) {
+ ALOGW("[vts] provision failed for HIDL service.");
+ return failure();
+ }
}
}
- return openCasSession(token, hidlPvtData);
+ return openCasSession(token, pvtData);
}
AssertionResult DescramblerTests::openDescrambler(int32_t demuxId) {
diff --git a/tv/tuner/aidl/vts/functional/DescramblerTests.h b/tv/tuner/aidl/vts/functional/DescramblerTests.h
index f0b7691..bab1a88 100644
--- a/tv/tuner/aidl/vts/functional/DescramblerTests.h
+++ b/tv/tuner/aidl/vts/functional/DescramblerTests.h
@@ -30,11 +30,17 @@
#include <android/hardware/cas/1.2/IMediaCasService.h>
#include <android/hardware/cas/1.2/types.h>
+#include <aidl/android/hardware/cas/BnCasListener.h>
+#include <aidl/android/hardware/cas/ICas.h>
+#include <aidl/android/hardware/cas/IMediaCasService.h>
+#include <aidl/android/hardware/cas/ScramblingMode.h>
+#include <aidl/android/hardware/cas/SessionIntent.h>
#include <aidl/android/hardware/tv/tuner/IDescrambler.h>
#include <aidl/android/hardware/tv/tuner/IDvr.h>
#include <aidl/android/hardware/tv/tuner/IDvrCallback.h>
#include <aidl/android/hardware/tv/tuner/ITuner.h>
+using ::aidl::android::hardware::cas::BnCasListener;
using android::Condition;
using android::Mutex;
using android::sp;
@@ -42,19 +48,26 @@
using android::hardware::hidl_vec;
using android::hardware::Return;
using android::hardware::Void;
-using android::hardware::cas::V1_2::ICas;
-using android::hardware::cas::V1_2::ICasListener;
-using android::hardware::cas::V1_2::IMediaCasService;
-using android::hardware::cas::V1_2::ScramblingMode;
-using android::hardware::cas::V1_2::SessionIntent;
using android::hardware::cas::V1_2::Status;
using android::hardware::cas::V1_2::StatusEvent;
+using ICasAidl = ::aidl::android::hardware::cas::ICas;
+using ICasHidl = android::hardware::cas::V1_2::ICas;
+using ICasListenerHidl = android::hardware::cas::V1_2::ICasListener;
+using IMediaCasServiceAidl = ::aidl::android::hardware::cas::IMediaCasService;
+using IMediaCasServiceHidl = android::hardware::cas::V1_2::IMediaCasService;
+using ScramblingModeAidl = ::aidl::android::hardware::cas::ScramblingMode;
+using ScramblingModeHidl = android::hardware::cas::V1_2::ScramblingMode;
+using SessionIntentAidl = ::aidl::android::hardware::cas::SessionIntent;
+using SessionIntentHidl = android::hardware::cas::V1_2::SessionIntent;
+using ::ndk::ScopedAStatus;
using ::testing::AssertionResult;
using namespace aidl::android::hardware::tv::tuner;
-class MediaCasListener : public ICasListener {
+const std::string MEDIA_CAS_AIDL_SERVICE_NAME = "android.hardware.cas.IMediaCasService/default";
+
+class MediaCasListener : public ICasListenerHidl, public BnCasListener {
public:
virtual Return<void> onEvent(int32_t /*event*/, int32_t /*arg*/,
const hidl_vec<uint8_t>& /*data*/) override {
@@ -70,12 +83,33 @@
virtual Return<void> onStatusUpdate(StatusEvent /*event*/, int32_t /*arg*/) override {
return Void();
}
+
+ ScopedAStatus onEvent(int32_t /*in_event*/, int32_t /*in_arg*/,
+ const std::vector<uint8_t>& /*in_data*/) override {
+ return ScopedAStatus::ok();
+ }
+
+ ScopedAStatus onSessionEvent(const std::vector<uint8_t>& /*in_sessionId*/, int32_t /*in_event*/,
+ int32_t /*in_arg*/,
+ const std::vector<uint8_t>& /*in_data*/) override {
+ return ScopedAStatus::ok();
+ }
+
+ ScopedAStatus onStatusUpdate(::aidl::android::hardware::cas::StatusEvent /*in_event*/,
+ int32_t /*in_number*/) override {
+ return ScopedAStatus::ok();
+ }
};
class DescramblerTests {
public:
void setService(std::shared_ptr<ITuner> tuner) { mService = tuner; }
- void setCasService(sp<IMediaCasService> casService) { mMediaCasService = casService; }
+ void setCasServiceHidl(sp<IMediaCasServiceHidl> casService) {
+ mMediaCasServiceHidl = casService;
+ }
+ void setCasServiceAidl(std::shared_ptr<IMediaCasServiceAidl> casService) {
+ mMediaCasServiceAidl = casService;
+ }
AssertionResult setKeyToken(std::vector<uint8_t>& token);
AssertionResult openDescrambler(int32_t demuxId);
@@ -95,12 +129,13 @@
std::shared_ptr<ITuner> mService;
std::shared_ptr<IDescrambler> mDescrambler;
- android::sp<ICas> mCas;
- android::sp<IMediaCasService> mMediaCasService;
- android::sp<MediaCasListener> mCasListener;
+ std::shared_ptr<ICasAidl> mCasAidl;
+ android::sp<ICasHidl> mCasHidl;
+ std::shared_ptr<IMediaCasServiceAidl> mMediaCasServiceAidl;
+ android::sp<IMediaCasServiceHidl> mMediaCasServiceHidl;
+ std::shared_ptr<MediaCasListener> mCasListener;
private:
- AssertionResult openCasSession(std::vector<uint8_t>& sessionId,
- std::vector<uint8_t>& hidlPvtData);
+ AssertionResult openCasSession(std::vector<uint8_t>& sessionId, std::vector<uint8_t>& pvtData);
AssertionResult createCasPlugin(int32_t caSystemId);
};
diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h
index 7f80d90..73dc797 100644
--- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h
+++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h
@@ -338,16 +338,31 @@
} else {
mService = nullptr;
}
- mCasService = IMediaCasService::getService();
ASSERT_NE(mService, nullptr);
- ASSERT_NE(mCasService, nullptr);
+
+ // Get IMediaCasService. Try getting AIDL service first, if AIDL does not exist, try HIDL.
+ if (AServiceManager_isDeclared(MEDIA_CAS_AIDL_SERVICE_NAME.c_str())) {
+ ::ndk::SpAIBinder binder(
+ AServiceManager_waitForService(MEDIA_CAS_AIDL_SERVICE_NAME.c_str()));
+ mCasServiceAidl = IMediaCasServiceAidl::fromBinder(binder);
+ } else {
+ mCasServiceAidl = nullptr;
+ }
+ if (mCasServiceAidl == nullptr) {
+ mCasServiceHidl = IMediaCasServiceHidl::getService();
+ }
+ ASSERT_TRUE(mCasServiceAidl != nullptr || mCasServiceHidl != nullptr);
ASSERT_TRUE(initConfiguration());
mFrontendTests.setService(mService);
mDemuxTests.setService(mService);
mDvrTests.setService(mService);
mDescramblerTests.setService(mService);
- mDescramblerTests.setCasService(mCasService);
+ if (mCasServiceAidl != nullptr) {
+ mDescramblerTests.setCasServiceAidl(mCasServiceAidl);
+ } else {
+ mDescramblerTests.setCasServiceHidl(mCasServiceHidl);
+ }
}
protected:
@@ -360,7 +375,8 @@
AssertionResult filterDataOutputTest();
std::shared_ptr<ITuner> mService;
- android::sp<IMediaCasService> mCasService;
+ sp<IMediaCasServiceHidl> mCasServiceHidl;
+ std::shared_ptr<IMediaCasServiceAidl> mCasServiceAidl;
FrontendTests mFrontendTests;
DemuxTests mDemuxTests;
FilterTests mFilterTests;