Merge "Expose status, add backward compat in tests and remove unused code"
This commit is contained in:
@@ -104,12 +104,14 @@ class CdmEngine {
|
|||||||
// Query session information
|
// Query session information
|
||||||
virtual CdmResponseType QuerySessionStatus(const CdmSessionId& session_id,
|
virtual CdmResponseType QuerySessionStatus(const CdmSessionId& session_id,
|
||||||
CdmQueryMap* key_info);
|
CdmQueryMap* key_info);
|
||||||
|
virtual bool IsReleaseSession(const CdmSessionId& session_id);
|
||||||
|
virtual bool IsOfflineSession(const CdmSessionId& session_id);
|
||||||
|
|
||||||
// Query license information
|
// Query license information
|
||||||
virtual CdmResponseType QueryKeyStatus(const CdmSessionId& session_id,
|
virtual CdmResponseType QueryKeyStatus(const CdmSessionId& session_id,
|
||||||
CdmQueryMap* key_info);
|
CdmQueryMap* key_info);
|
||||||
|
|
||||||
// Query seesion control information
|
// Query session control information
|
||||||
virtual CdmResponseType QueryKeyControlInfo(const CdmSessionId& session_id,
|
virtual CdmResponseType QueryKeyControlInfo(const CdmSessionId& session_id,
|
||||||
CdmQueryMap* key_info);
|
CdmQueryMap* key_info);
|
||||||
|
|
||||||
|
|||||||
@@ -102,6 +102,9 @@ class CdmSession {
|
|||||||
is_usage_update_needed_ = false;
|
is_usage_update_needed_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual bool is_release() { return is_release_; }
|
||||||
|
virtual bool is_offline() { return is_offline_; }
|
||||||
|
|
||||||
// ReleaseCrypto() - Closes the underlying crypto session but leaves this
|
// ReleaseCrypto() - Closes the underlying crypto session but leaves this
|
||||||
// object alive. It is invalid to call any method that requires a crypto
|
// object alive. It is invalid to call any method that requires a crypto
|
||||||
// session after calling this. Since calling this renders this object mostly
|
// session after calling this. Since calling this renders this object mostly
|
||||||
|
|||||||
@@ -21,10 +21,6 @@ class Lock {
|
|||||||
void Acquire();
|
void Acquire();
|
||||||
void Release();
|
void Release();
|
||||||
|
|
||||||
// Acquires a lock if not held and returns true.
|
|
||||||
// Returns false if the lock is held by another thread.
|
|
||||||
bool Try();
|
|
||||||
|
|
||||||
friend class AutoLock;
|
friend class AutoLock;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -504,6 +504,28 @@ CdmResponseType CdmEngine::QuerySessionStatus(const CdmSessionId& session_id,
|
|||||||
return iter->second->QueryStatus(key_info);
|
return iter->second->QueryStatus(key_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CdmEngine::IsReleaseSession(const CdmSessionId& session_id) {
|
||||||
|
LOGI("CdmEngine::IsReleaseSession");
|
||||||
|
CdmSessionMap::iterator iter = sessions_.find(session_id);
|
||||||
|
if (iter == sessions_.end()) {
|
||||||
|
LOGE("CdmEngine::IsReleaseSession: session_id not found = %s",
|
||||||
|
session_id.c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return iter->second->is_release();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CdmEngine::IsOfflineSession(const CdmSessionId& session_id) {
|
||||||
|
LOGI("CdmEngine::IsOfflineSession");
|
||||||
|
CdmSessionMap::iterator iter = sessions_.find(session_id);
|
||||||
|
if (iter == sessions_.end()) {
|
||||||
|
LOGE("CdmEngine::IsOfflineSession: session_id not found = %s",
|
||||||
|
session_id.c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return iter->second->is_offline();
|
||||||
|
}
|
||||||
|
|
||||||
CdmResponseType CdmEngine::QueryKeyStatus(const CdmSessionId& session_id,
|
CdmResponseType CdmEngine::QueryKeyStatus(const CdmSessionId& session_id,
|
||||||
CdmQueryMap* key_info) {
|
CdmQueryMap* key_info) {
|
||||||
LOGI("CdmEngine::QueryKeyStatus");
|
LOGI("CdmEngine::QueryKeyStatus");
|
||||||
|
|||||||
@@ -1634,7 +1634,9 @@ TEST_P(DeviceCertificateTest, ReadCertificate) {
|
|||||||
Return(data.size())));
|
Return(data.size())));
|
||||||
EXPECT_CALL(file, Close()).Times(1);
|
EXPECT_CALL(file, Close()).Times(1);
|
||||||
EXPECT_CALL(file, Write(_, _)).Times(0);
|
EXPECT_CALL(file, Write(_, _)).Times(0);
|
||||||
EXPECT_CALL(file, List(_, NotNull())).WillOnce(Return(false));
|
if (Properties::security_level_path_backward_compatibility_support()) {
|
||||||
|
EXPECT_CALL(file, List(_, NotNull())).WillOnce(Return(false));
|
||||||
|
}
|
||||||
|
|
||||||
DeviceFiles device_files;
|
DeviceFiles device_files;
|
||||||
EXPECT_TRUE(device_files.Init(kSecurityLevelL1));
|
EXPECT_TRUE(device_files.Init(kSecurityLevelL1));
|
||||||
@@ -1926,6 +1928,10 @@ TEST_F(DeviceFilesTest, AppParametersBackwardCompatibility) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DeviceFilesTest, SecurityLevelPathBackwardCompatibility) {
|
TEST_F(DeviceFilesTest, SecurityLevelPathBackwardCompatibility) {
|
||||||
|
if (!Properties::security_level_path_backward_compatibility_support()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MockFile file;
|
MockFile file;
|
||||||
std::vector<std::string> security_dirs;
|
std::vector<std::string> security_dirs;
|
||||||
EXPECT_TRUE(Properties::GetSecurityLevelDirectories(&security_dirs));
|
EXPECT_TRUE(Properties::GetSecurityLevelDirectories(&security_dirs));
|
||||||
|
|||||||
@@ -27,10 +27,6 @@ void Lock::Release() {
|
|||||||
impl_->lock_.unlock();
|
impl_->lock_.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Lock::Try() {
|
|
||||||
return (impl_->lock_.tryLock() == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user