am 173e6031: am 8961cd24: Fix for zero-sized corrupted license files

* commit '173e6031f3441bb04195ae7be4f959da6dee693d':
  Fix for zero-sized corrupted license files
This commit is contained in:
Jeff Tinker
2015-01-23 10:26:58 +00:00
committed by Android Git Automerger
2 changed files with 6 additions and 5 deletions

View File

@@ -568,12 +568,11 @@ void CdmSession::OnTimerEvent(bool update_usage) {
if (update_usage && has_decrypted_recently_) { if (update_usage && has_decrypted_recently_) {
policy_engine_->DecryptionEvent(); policy_engine_->DecryptionEvent();
has_decrypted_recently_ = false; has_decrypted_recently_ = false;
}
policy_engine_->OnTimerEvent(&event_occurred, &event);
if (is_offline_ && !is_release_) { if (is_offline_ && !is_release_) {
StoreLicense(DeviceFiles::kLicenseStateActive); StoreLicense(DeviceFiles::kLicenseStateActive);
} }
}
policy_engine_->OnTimerEvent(&event_occurred, &event);
if (event_occurred) { if (event_occurred) {
for (CdmEventListenerIter iter = listeners_.begin(); for (CdmEventListenerIter iter = listeners_.begin();

View File

@@ -72,6 +72,8 @@ bool File::Open(const std::string& name, int flags) {
void File::Close() { void File::Close() {
if (impl_->file_){ if (impl_->file_){
fflush(impl_->file_);
fsync(fileno(impl_->file_));
fclose(impl_->file_); fclose(impl_->file_);
impl_->file_ = NULL; impl_->file_ = NULL;
} }