Properly close plugins on SIGTERM and exit

test: adb reboot while playing netflix and check logcat
  to make sure session are closed.

[ Merge of http://go/wvgerrit/133063 ]

bug: 193099676
Change-Id: I375695673b0c366e09fb857f5ae7a9cb6b946779
This commit is contained in:
Jeff Tinker
2021-09-04 01:31:02 -07:00
parent 18be093969
commit e28f98cc82
2 changed files with 54 additions and 1 deletions

View File

@@ -196,10 +196,17 @@ WVDrmPlugin::WVDrmPlugin(const sp<WvContentDecryptionModule>& cdm,
mCDM(cdm),
mCrypto(crypto),
mCryptoSessions(),
mAppPackageName(appPackageName) {}
mAppPackageName(appPackageName) {
Terminator::Register(this);
}
WVDrmPlugin::~WVDrmPlugin() {
wvcdm::SetLoggingUid(mCdmIdentifierBuilder.user_id());
Terminator::Forget(this);
Close();
}
void WVDrmPlugin::Close() {
typedef map<CdmSessionId, CryptoSession>::iterator mapIterator;
for (mapIterator iter = mCryptoSessions.begin();
iter != mCryptoSessions.end();