mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 05:49:27 +00:00
Merge "Add status for license starting in the future" into qt-dev
am: a51399ef5f
Change-Id: I2178215a3cbb44a830690081f008c3053282fe65
This commit is contained in:
@@ -459,9 +459,9 @@ dffacdbe0bcf8443013de5bdc56a83479ad979d4919ed15a5585539f46091f07 android.hardwar
|
||||
5b1f4a4fb88c239e07d76026467a1f2ee0d08f4d52c1805bd93bd7c05e3fe69c android.hardware.drm@1.2::ICryptoFactory
|
||||
4895f98e9ef210e9acb01982f5d07b654538377e1404b8db5e19e7858835e9d8 android.hardware.drm@1.2::ICryptoPlugin
|
||||
976116b9033b2c222b940109fdf0ffcc29b77cbe631ef6b4fcc2ad5ce8e605f7 android.hardware.drm@1.2::IDrmFactory
|
||||
b2efccc6425085f84795a2ca15a09d9a81ffd02f9dc3d30ba21d1a59bdfa253f android.hardware.drm@1.2::IDrmPlugin
|
||||
39ca9e88404b6c090f7650455a7ed3fdee9cce4e3a356c9d547f8ff02f2e7fc8 android.hardware.drm@1.2::IDrmPluginListener
|
||||
f27baaa587bc3dd9b740cb6928ab812b9b7d105b5187663938aee578105f3c39 android.hardware.drm@1.2::types
|
||||
8ef1caf921c3e83a00180f770e3b8e8ff65d8a5c806482e51aa45e6d55f1aec1 android.hardware.drm@1.2::IDrmPlugin
|
||||
b778fcce93eb6294446a940e1bae0200da7bd97b91b91977be2dcd31ca58374f android.hardware.drm@1.2::IDrmPluginListener
|
||||
564732cbfe5c0895cfbd2bdf84c3f2b0f760ea20f2237c0d388aaeeaef2dd0a9 android.hardware.drm@1.2::types
|
||||
44480c912e4ab90b9ed17e56569cd5ca98413a8a2372efb028f4181204b6b73e android.hardware.fastboot@1.0::IFastboot
|
||||
7b2989744e3c555292d4b5b829acd09a7b40f96ead62ce54174cd959503b64bb android.hardware.fastboot@1.0::types
|
||||
7f460e795f5d1ed5e378935f98c6db4d39497de988aef1b4c2a4a07a6c400392 android.hardware.gnss@2.0::IAGnss
|
||||
|
||||
@@ -226,4 +226,22 @@ interface IDrmPlugin extends @1.1::IDrmPlugin {
|
||||
* @param sessionId identifies the session the event originated from
|
||||
*/
|
||||
sendSessionLostState(SessionId sessionId);
|
||||
|
||||
/**
|
||||
* Send a keys change event to the listener. The keys change event
|
||||
* indicates the status of each key in the session. Keys can be
|
||||
* indicated as being usable, expired, outputnotallowed or statuspending.
|
||||
*
|
||||
* This method only differs from @1.0 version by the addition of new
|
||||
* KeyStatusType(s) in keyStatusList.
|
||||
*
|
||||
* @param sessionId identifies the session the event originated from
|
||||
* @param keyStatusList indicates the status for each key ID in the
|
||||
* session.
|
||||
* @param hasNewUsableKey indicates if the event includes at least one
|
||||
* key that has become usable.
|
||||
*/
|
||||
sendKeysChange_1_2(SessionId sessionId, vec<KeyStatus> keyStatusList,
|
||||
bool hasNewUsableKey);
|
||||
|
||||
};
|
||||
|
||||
@@ -36,4 +36,22 @@ interface IDrmPluginListener extends @1.0::IDrmPluginListener {
|
||||
* @param sessionId identifies the session that has been invalidated
|
||||
*/
|
||||
oneway sendSessionLostState(SessionId sessionId);
|
||||
|
||||
/**
|
||||
* Send a keys change event to the listener. The keys change event
|
||||
* indicates the status of each key in the session. Keys can be
|
||||
* indicated as being usable, expired, outputnotallowed or statuspending.
|
||||
*
|
||||
* This method only differs from @1.0 version by the addition of new
|
||||
* KeyStatusType(s) in keyStatusList.
|
||||
*
|
||||
* @param sessionId identifies the session the event originated from
|
||||
* @param keyStatusList indicates the status for each key ID in the
|
||||
* session.
|
||||
* @param hasNewUsableKey indicates if the event includes at least one
|
||||
* key that has become usable.
|
||||
*/
|
||||
oneway sendKeysChange_1_2(SessionId sessionId, vec<KeyStatus> keyStatusList,
|
||||
bool hasNewUsableKey);
|
||||
|
||||
};
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package android.hardware.drm@1.2;
|
||||
|
||||
import @1.0::KeyStatusType;
|
||||
import @1.0::Status;
|
||||
import @1.1::HdcpLevel;
|
||||
|
||||
@@ -93,3 +94,25 @@ enum HdcpLevel : @1.1::HdcpLevel {
|
||||
* set in methods that take a KeySetId as an input parameter.
|
||||
*/
|
||||
typedef vec<uint8_t> KeySetId;
|
||||
|
||||
enum KeyStatusType : @1.0::KeyStatusType {
|
||||
/**
|
||||
* The key is not yet usable to decrypt media because the start
|
||||
* time is in the future. The key must become usable when
|
||||
* its start time is reached.
|
||||
*/
|
||||
USABLEINFUTURE
|
||||
};
|
||||
|
||||
/**
|
||||
* Used by sendKeysChange_1_2 to report the usability status of each key to the
|
||||
* app.
|
||||
*
|
||||
* This struct only differs from @1.0 version by the addition of new
|
||||
* KeyStatusType(s).
|
||||
*
|
||||
*/
|
||||
struct KeyStatus {
|
||||
KeySetId keyId;
|
||||
KeyStatusType type;
|
||||
};
|
||||
|
||||
@@ -56,6 +56,7 @@ namespace V1_2 {
|
||||
namespace vts {
|
||||
|
||||
const char *kCallbackLostState = "LostState";
|
||||
const char *kCallbackKeysChange = "KeysChange";
|
||||
|
||||
drm_vts::VendorModules *DrmHalTest::gVendorModules = nullptr;
|
||||
|
||||
@@ -64,7 +65,19 @@ drm_vts::VendorModules *DrmHalTest::gVendorModules = nullptr;
|
||||
*/
|
||||
|
||||
Return<void> DrmHalPluginListener::sendSessionLostState(const hidl_vec<uint8_t>& sessionId) {
|
||||
NotifyFromCallback(kCallbackLostState, sessionId);
|
||||
ListenerEventArgs args;
|
||||
args.sessionId = sessionId;
|
||||
NotifyFromCallback(kCallbackLostState, args);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> DrmHalPluginListener::sendKeysChange_1_2(const hidl_vec<uint8_t>& sessionId,
|
||||
const hidl_vec<KeyStatus>& keyStatusList, bool hasNewUsableKey) {
|
||||
ListenerEventArgs args;
|
||||
args.sessionId = sessionId;
|
||||
args.keyStatusList = keyStatusList;
|
||||
args.hasNewUsableKey = hasNewUsableKey;
|
||||
NotifyFromCallback(kCallbackKeysChange, args);
|
||||
return Void();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
using ::android::hardware::drm::V1_0::EventType;
|
||||
using ::android::hardware::drm::V1_0::KeyedVector;
|
||||
using ::android::hardware::drm::V1_0::KeyStatus;
|
||||
using KeyStatusV1_0 = ::android::hardware::drm::V1_0::KeyStatus;
|
||||
using ::android::hardware::drm::V1_0::KeyType;
|
||||
using ::android::hardware::drm::V1_0::Mode;
|
||||
using ::android::hardware::drm::V1_0::Pattern;
|
||||
@@ -46,10 +46,6 @@ using ::android::hardware::drm::V1_0::SubSample;
|
||||
|
||||
using ::android::hardware::drm::V1_1::ICryptoFactory;
|
||||
|
||||
using ::android::hardware::drm::V1_2::ICryptoPlugin;
|
||||
using ::android::hardware::drm::V1_2::IDrmFactory;
|
||||
using ::android::hardware::drm::V1_2::IDrmPlugin;
|
||||
using ::android::hardware::drm::V1_2::IDrmPluginListener;
|
||||
using StatusV1_2 = ::android::hardware::drm::V1_2::Status;
|
||||
|
||||
using ::android::hardware::hidl_array;
|
||||
@@ -166,9 +162,16 @@ class DrmHalClearkeyTest : public DrmHalTest {
|
||||
* Event Handling tests
|
||||
*/
|
||||
extern const char *kCallbackLostState;
|
||||
extern const char *kCallbackKeysChange;
|
||||
|
||||
struct ListenerEventArgs {
|
||||
SessionId sessionId;
|
||||
hidl_vec<KeyStatus> keyStatusList;
|
||||
bool hasNewUsableKey;
|
||||
};
|
||||
|
||||
class DrmHalPluginListener
|
||||
: public ::testing::VtsHalHidlTargetCallbackBase<SessionId>,
|
||||
: public ::testing::VtsHalHidlTargetCallbackBase<ListenerEventArgs>,
|
||||
public IDrmPluginListener {
|
||||
public:
|
||||
DrmHalPluginListener() {
|
||||
@@ -183,10 +186,13 @@ public:
|
||||
int64_t) override { return Void(); }
|
||||
|
||||
virtual Return<void> sendKeysChange(const hidl_vec<uint8_t>&,
|
||||
const hidl_vec<KeyStatus>&, bool) override { return Void(); }
|
||||
const hidl_vec<KeyStatusV1_0>&, bool) override { return Void(); }
|
||||
|
||||
virtual Return<void> sendSessionLostState(const hidl_vec<uint8_t>& sessionId) override;
|
||||
|
||||
virtual Return<void> sendKeysChange_1_2(const hidl_vec<uint8_t>&,
|
||||
const hidl_vec<KeyStatus>&, bool) override;
|
||||
|
||||
};
|
||||
|
||||
} // namespace vts
|
||||
|
||||
@@ -28,6 +28,8 @@ using ::android::hardware::drm::V1_1::KeyRequestType;
|
||||
using ::android::hardware::drm::V1_1::SecurityLevel;
|
||||
using ::android::hardware::drm::V1_2::HdcpLevel;
|
||||
using ::android::hardware::drm::V1_2::KeySetId;
|
||||
using ::android::hardware::drm::V1_2::KeyStatus;
|
||||
using ::android::hardware::drm::V1_2::KeyStatusType;
|
||||
using ::android::hardware::drm::V1_2::OfflineLicenseState;
|
||||
|
||||
using ::android::hardware::drm::V1_2::vts::DrmHalClearkeyTest;
|
||||
@@ -35,6 +37,7 @@ using ::android::hardware::drm::V1_2::vts::DrmHalPluginListener;
|
||||
using ::android::hardware::drm::V1_2::vts::DrmHalTest;
|
||||
using ::android::hardware::drm::V1_2::vts::DrmHidlEnvironment;
|
||||
using ::android::hardware::drm::V1_2::vts::kCallbackLostState;
|
||||
using ::android::hardware::drm::V1_2::vts::kCallbackKeysChange;
|
||||
|
||||
using ::android::hardware::hidl_string;
|
||||
|
||||
@@ -274,6 +277,35 @@ TEST_P(DrmHalTest, GetHdcpLevels) {
|
||||
EXPECT_OK(res);
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulate the plugin sending keys change and make sure
|
||||
* the listener gets them.
|
||||
*/
|
||||
TEST_P(DrmHalTest, ListenerKeysChange) {
|
||||
RETURN_IF_SKIPPED;
|
||||
sp<DrmHalPluginListener> listener = new DrmHalPluginListener();
|
||||
auto res = drmPlugin->setListener(listener);
|
||||
EXPECT_OK(res);
|
||||
|
||||
auto sessionId = openSession();
|
||||
const hidl_vec<KeyStatus> keyStatusList = {
|
||||
{{1}, KeyStatusType::USABLE},
|
||||
{{2}, KeyStatusType::EXPIRED},
|
||||
{{3}, KeyStatusType::OUTPUTNOTALLOWED},
|
||||
{{4}, KeyStatusType::STATUSPENDING},
|
||||
{{5}, KeyStatusType::INTERNALERROR},
|
||||
{{6}, KeyStatusType::USABLEINFUTURE},
|
||||
};
|
||||
|
||||
drmPlugin->sendKeysChange_1_2(sessionId, keyStatusList, true);
|
||||
auto result = listener->WaitForCallback(kCallbackKeysChange);
|
||||
EXPECT_TRUE(result.no_timeout);
|
||||
EXPECT_TRUE(result.args);
|
||||
EXPECT_EQ(sessionId, result.args->sessionId);
|
||||
EXPECT_EQ(keyStatusList, result.args->keyStatusList);
|
||||
closeSession(sessionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* CryptoPlugin Decrypt tests
|
||||
*/
|
||||
@@ -452,7 +484,7 @@ TEST_P(DrmHalClearkeyTest, SessionLostState) {
|
||||
auto result = listener->WaitForCallback(kCallbackLostState);
|
||||
EXPECT_TRUE(result.no_timeout);
|
||||
EXPECT_TRUE(result.args);
|
||||
EXPECT_EQ(sessionId, *(result.args));
|
||||
EXPECT_EQ(sessionId, result.args->sessionId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user