Snap for 6534259 from 86e773636c to sc-release
Change-Id: Ie79f91e01f3e64893874b19fed8bfb82893137c8
This commit is contained in:
@@ -5652,7 +5652,7 @@ TEST(VersionNumberTest, VersionNumberChangeCanary) {
|
||||
android::base::GetProperty("ro.build.version.release", "");
|
||||
ASSERT_TRUE(release_number.size() > 0);
|
||||
// Reminder to change the Widevine CDM version number.
|
||||
EXPECT_STREQ("R", release_number.c_str())
|
||||
EXPECT_STREQ("11", release_number.c_str())
|
||||
<< "The Android version number has changed. You need to update this test "
|
||||
"and also possibly update the Widevine version number in "
|
||||
"wv_android_constants.h";
|
||||
@@ -6233,6 +6233,9 @@ TEST_F(WvCdmRequestLicenseRollbackTest, Streaming_ExpireBeforeRollback) {
|
||||
GenerateKeyRequest(init_data_with_expiry_, kLicenseTypeStreaming);
|
||||
VerifyKeyRequestResponse(config_.license_server(), config_.client_auth());
|
||||
|
||||
// Start playback timer.
|
||||
EXPECT_EQ(NO_ERROR, Decrypt(session_id_));
|
||||
|
||||
// Elapse time so that the key should now be considered expired.
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(kExpirationWithWindowMs_));
|
||||
@@ -6319,6 +6322,9 @@ TEST_F(WvCdmRequestLicenseRollbackTest,
|
||||
nullptr, &session_id_);
|
||||
EXPECT_EQ(wvcdm::KEY_ADDED, decryptor_->RestoreKey(session_id_, key_set_id));
|
||||
|
||||
// Start playback timer.
|
||||
EXPECT_EQ(NO_ERROR, Decrypt(session_id_));
|
||||
|
||||
RollbackSystemTime(kExpirationWithWindowMs_);
|
||||
|
||||
// Elapse time so that the key should now be considered expired.
|
||||
@@ -6357,6 +6363,9 @@ TEST_F(WvCdmRequestLicenseRollbackTest,
|
||||
nullptr, &session_id_);
|
||||
EXPECT_EQ(wvcdm::KEY_ADDED, decryptor_->RestoreKey(session_id_, key_set_id));
|
||||
|
||||
// Start playback timer.
|
||||
EXPECT_EQ(NO_ERROR, Decrypt(session_id_));
|
||||
|
||||
// Elapse time so that the key should now be considered expired.
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(kExpirationWithWindowMs_));
|
||||
|
||||
@@ -11,17 +11,9 @@
|
||||
|
||||
namespace wvoec_ref {
|
||||
|
||||
SessionKeyTable::~SessionKeyTable() {
|
||||
for (KeyMap::iterator i = keys_.begin(); i != keys_.end(); ++i) {
|
||||
if (nullptr != i->second) {
|
||||
delete i->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool SessionKeyTable::Insert(const KeyId key_id, const Key& key_data) {
|
||||
if (keys_.find(key_id) != keys_.end()) return false;
|
||||
keys_[key_id] = new Key(key_data);
|
||||
keys_[key_id] = std::unique_ptr<Key>(new Key(key_data));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -29,12 +21,11 @@ Key* SessionKeyTable::Find(const KeyId key_id) {
|
||||
if (keys_.find(key_id) == keys_.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
return keys_[key_id];
|
||||
return keys_[key_id].get();
|
||||
}
|
||||
|
||||
void SessionKeyTable::Remove(const KeyId key_id) {
|
||||
if (keys_.find(key_id) != keys_.end()) {
|
||||
delete keys_[key_id];
|
||||
keys_.erase(key_id);
|
||||
}
|
||||
}
|
||||
@@ -49,7 +40,7 @@ bool EntitlementKeyTable::Insert(const KeyId key_id, const Key& key_data) {
|
||||
// |key_id| and |key_data| are for an entitlement key. Insert a new
|
||||
// entitlement key entry.
|
||||
if (keys_.find(key_id) != keys_.end()) return false;
|
||||
keys_[key_id] = new EntitlementKey(key_data);
|
||||
keys_[key_id] = std::unique_ptr<EntitlementKey>(new EntitlementKey(key_data));
|
||||
// If this is a new insertion, we don't have a content key assigned yet.
|
||||
return true;
|
||||
}
|
||||
@@ -65,7 +56,7 @@ Key* EntitlementKeyTable::Find(const KeyId key_id) {
|
||||
if (keys_.find(it->second) == keys_.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
return keys_[it->second];
|
||||
return keys_[it->second].get();
|
||||
}
|
||||
|
||||
void EntitlementKeyTable::Remove(const KeyId key_id) {
|
||||
@@ -108,7 +99,7 @@ EntitlementKey* EntitlementKeyTable::GetEntitlementKey(
|
||||
if (it == keys_.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
return it->second;
|
||||
return it->second.get();
|
||||
}
|
||||
|
||||
} // namespace wvoec_ref
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "disallow_copy_and_assign.h"
|
||||
@@ -23,18 +24,18 @@ class UsageTable;
|
||||
class UsageTableEntry;
|
||||
|
||||
typedef std::vector<uint8_t> KeyId;
|
||||
typedef std::map<KeyId, Key*> KeyMap;
|
||||
typedef std::map<KeyId, EntitlementKey*> EntitlementKeyMap;
|
||||
typedef std::map<KeyId, std::unique_ptr<Key>> KeyMap;
|
||||
typedef std::map<KeyId, std::unique_ptr<EntitlementKey>> EntitlementKeyMap;
|
||||
|
||||
// SessionKeyTable holds the keys for the current session
|
||||
class SessionKeyTable {
|
||||
public:
|
||||
SessionKeyTable() {}
|
||||
~SessionKeyTable();
|
||||
~SessionKeyTable() {}
|
||||
|
||||
bool Insert(const KeyId key_id, const Key& key_data);
|
||||
Key* Find(const KeyId key_id);
|
||||
Key* FirstKey() { return keys_.begin()->second; }
|
||||
Key* FirstKey() { return keys_.begin()->second.get(); }
|
||||
void Remove(const KeyId key_id);
|
||||
void UpdateDuration(const KeyControlBlock& control);
|
||||
size_t size() const { return keys_.size(); }
|
||||
@@ -53,7 +54,7 @@ class EntitlementKeyTable {
|
||||
~EntitlementKeyTable() {}
|
||||
bool Insert(const KeyId key_id, const Key& key_data);
|
||||
Key* Find(const KeyId key_id);
|
||||
Key* FirstKey() { return keys_.begin()->second; }
|
||||
Key* FirstKey() { return keys_.begin()->second.get(); }
|
||||
void Remove(const KeyId key_id);
|
||||
void UpdateDuration(const KeyControlBlock& control);
|
||||
size_t size() const { return contentid_to_entitlementid_.size(); }
|
||||
|
||||
Reference in New Issue
Block a user