DrmHal: add key status usable_in_future

Bug:116738851
Test: DrmMetrics_test
Change-Id: Ifdd63ce94d3e145840b155a982612ba980cc456d
gugelfrei
Robert Shih 5 years ago
parent 3aa95defac
commit a503326e7a

@ -59,6 +59,7 @@ cc_library_shared {
shared_libs: [
"android.hardware.drm@1.0",
"android.hardware.drm@1.1",
"android.hardware.drm@1.2",
"libbinder",
"libhidlbase",
"liblog",
@ -89,6 +90,7 @@ cc_library_shared {
shared_libs: [
"android.hardware.drm@1.0",
"android.hardware.drm@1.1",
"android.hardware.drm@1.2",
"libbase",
"libbinder",
"libhidlbase",

@ -40,7 +40,6 @@
#include <mediadrm/DrmSessionManager.h>
using drm::V1_0::KeyedVector;
using drm::V1_0::KeyStatusType;
using drm::V1_0::KeyRequestType;
using drm::V1_0::KeyType;
using drm::V1_0::KeyValue;
@ -51,6 +50,7 @@ using drm::V1_1::HdcpLevel;
using drm::V1_1::SecureStopRelease;
using drm::V1_1::SecurityLevel;
using drm::V1_2::KeySetId;
using drm::V1_2::KeyStatusType;
using ::android::hardware::drm::V1_1::DrmMetricGroup;
using ::android::hardware::hidl_array;
using ::android::hardware::hidl_string;
@ -517,6 +517,17 @@ Return<void> DrmHal::sendExpirationUpdate(const hidl_vec<uint8_t>& sessionId,
}
Return<void> DrmHal::sendKeysChange(const hidl_vec<uint8_t>& sessionId,
const hidl_vec<KeyStatus_V1_0>& keyStatusList_V1_0, bool hasNewUsableKey) {
std::vector<KeyStatus> keyStatusVec;
for (const auto &keyStatus_V1_0 : keyStatusList_V1_0) {
keyStatusVec.push_back({keyStatus_V1_0.keyId,
static_cast<KeyStatusType>(keyStatus_V1_0.type)});
}
hidl_vec<KeyStatus> keyStatusList_V1_2(keyStatusVec);
return sendKeysChange_1_2(sessionId, keyStatusList_V1_2, hasNewUsableKey);
}
Return<void> DrmHal::sendKeysChange_1_2(const hidl_vec<uint8_t>& sessionId,
const hidl_vec<KeyStatus>& keyStatusList, bool hasNewUsableKey) {
mEventLock.lock();
@ -546,6 +557,9 @@ Return<void> DrmHal::sendKeysChange(const hidl_vec<uint8_t>& sessionId,
case KeyStatusType::STATUSPENDING:
type = DrmPlugin::kKeyStatusType_StatusPending;
break;
case KeyStatusType::USABLEINFUTURE:
type = DrmPlugin::kKeyStatusType_UsableInFuture;
break;
case KeyStatusType::INTERNALERROR:
default:
type = DrmPlugin::kKeyStatusType_InternalError;

@ -32,7 +32,7 @@ using ::android::drm_metrics::DrmFrameworkMetrics;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::drm::V1_0::EventType;
using ::android::hardware::drm::V1_0::KeyStatusType;
using ::android::hardware::drm::V1_2::KeyStatusType;
using ::android::hardware::drm::V1_1::DrmMetricGroup;
using ::android::os::PersistableBundle;

@ -30,7 +30,7 @@
using ::android::drm_metrics::DrmFrameworkMetrics;
using ::android::hardware::hidl_vec;
using ::android::hardware::drm::V1_0::EventType;
using ::android::hardware::drm::V1_0::KeyStatusType;
using ::android::hardware::drm::V1_2::KeyStatusType;
using ::android::hardware::drm::V1_0::Status;
using ::android::hardware::drm::V1_1::DrmMetricGroup;
using ::android::os::PersistableBundle;

@ -51,16 +51,16 @@ Status InitDataParser::parse(const std::vector<uint8_t>& initData,
// Build a list of the key IDs
std::vector<const uint8_t*> keyIds;
if (mimeType == kIsoBmffVideoMimeType ||
mimeType == kIsoBmffAudioMimeType ||
mimeType == kCencInitDataFormat) {
if (mimeType == kIsoBmffVideoMimeType.c_str() ||
mimeType == kIsoBmffAudioMimeType.c_str() ||
mimeType == kCencInitDataFormat.c_str()) {
Status res = parsePssh(initData, &keyIds);
if (res != Status::OK) {
return res;
}
} else if (mimeType == kWebmVideoMimeType ||
mimeType == kWebmAudioMimeType ||
mimeType == kWebmInitDataFormat) {
} else if (mimeType == kWebmVideoMimeType.c_str() ||
mimeType == kWebmAudioMimeType.c_str() ||
mimeType == kWebmInitDataFormat.c_str()) {
// WebM "init data" is just a single key ID
if (initData.size() != kKeyIdSize) {
return Status::ERROR_DRM_CANNOT_HANDLE;

@ -62,6 +62,7 @@ using ::android::sp;
typedef drm::V1_1::KeyRequestType KeyRequestType_V1_1;
typedef drm::V1_2::IDrmPluginListener IDrmPluginListener_V1_2;
typedef drm::V1_2::KeyStatus KeyStatus_V1_2;
typedef drm::V1_2::Status Status_V1_2;
typedef drm::V1_2::HdcpLevel HdcpLevel_V1_2;
@ -335,6 +336,15 @@ struct DrmPlugin : public IDrmPlugin {
return Void();
}
Return<void> sendKeysChange_1_2(
const hidl_vec<uint8_t>& sessionId,
const hidl_vec<KeyStatus_V1_2>& keyStatusList, bool hasNewUsableKey) {
if (mListenerV1_2 != NULL) {
mListenerV1_2->sendKeysChange_1_2(sessionId, keyStatusList, hasNewUsableKey);
}
return Void();
}
Return<void> sendSessionLostState(
const hidl_vec<uint8_t>& sessionId) {
if (mListenerV1_2 != NULL) {

@ -37,14 +37,15 @@ using drm::V1_0::EventType;
using drm::V1_0::IDrmFactory;
using drm::V1_0::IDrmPlugin;
using drm::V1_0::IDrmPluginListener;
using drm::V1_0::KeyStatus;
using drm::V1_1::SecurityLevel;
using drm::V1_2::KeyStatus;
using drm::V1_2::OfflineLicenseState;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
typedef drm::V1_2::IDrmPluginListener IDrmPluginListener_V1_2;
typedef drm::V1_0::KeyStatus KeyStatus_V1_0;
namespace android {
@ -56,7 +57,7 @@ inline bool operator==(const Vector<uint8_t> &l, const Vector<uint8_t> &r) {
}
struct DrmHal : public BnDrm,
public IBinder::DeathRecipient,
public IBinder::DeathRecipient,
public IDrmPluginListener_V1_2 {
DrmHal();
virtual ~DrmHal();
@ -180,6 +181,9 @@ struct DrmHal : public BnDrm,
int64_t expiryTimeInMS);
Return<void> sendKeysChange(const hidl_vec<uint8_t>& sessionId,
const hidl_vec<KeyStatus_V1_0>& keyStatusList, bool hasNewUsableKey);
Return<void> sendKeysChange_1_2(const hidl_vec<uint8_t>& sessionId,
const hidl_vec<KeyStatus>& keyStatusList, bool hasNewUsableKey);
Return<void> sendSessionLostState(const hidl_vec<uint8_t>& sessionId);

@ -21,6 +21,7 @@
#include <android/hardware/drm/1.0/types.h>
#include <android/hardware/drm/1.1/types.h>
#include <android/hardware/drm/1.2/types.h>
#include <binder/PersistableBundle.h>
#include <media/CounterMetric.h>
#include <media/EventMetric.h>
@ -50,7 +51,7 @@ class MediaDrmMetrics {
CounterMetric<status_t> mProvideProvisionResponseCounter;
// Count of key status events broken out by status type.
CounterMetric<::android::hardware::drm::V1_0::KeyStatusType>
CounterMetric<::android::hardware::drm::V1_2::KeyStatusType>
mKeyStatusChangeCounter;
// Count of events broken out by event type
CounterMetric<::android::hardware::drm::V1_0::EventType> mEventCounter;

Loading…
Cancel
Save