Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

frameworks-av: Commit

frameworks/av


Commit MetaInfo

Revisionca592c22512d0f822fd3779c72b46a174dd54854 (tree)
Time2018-12-21 17:58:56
AuthorChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

Android 8.1.0 release 53
-----BEGIN PGP SIGNATURE-----

iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCXAVsoQAKCRDorT+BmrEO
eN6OAJ9uQZ8SUrYgH2gt24gA63EqetvkjACfSmM617xrprG+uawB7xiOOU/kHI8=
=TxJe
-----END PGP SIGNATURE-----

Merge tag 'android-8.1.0_r53' into oreo-x86

Android 8.1.0 release 53

Change Summary

Incremental Difference

--- a/drm/mediacas/plugins/clearkey/ClearKeyCasPlugin.cpp
+++ b/drm/mediacas/plugins/clearkey/ClearKeyCasPlugin.cpp
@@ -118,9 +118,9 @@ status_t ClearKeyCasPlugin::openSession(CasSessionId* sessionId) {
118118
119119 status_t ClearKeyCasPlugin::closeSession(const CasSessionId &sessionId) {
120120 ALOGV("closeSession: sessionId=%s", sessionIdToString(sessionId).string());
121- sp<ClearKeyCasSession> session =
121+ std::shared_ptr<ClearKeyCasSession> session =
122122 ClearKeySessionLibrary::get()->findSession(sessionId);
123- if (session == NULL) {
123+ if (session.get() == nullptr) {
124124 return ERROR_CAS_SESSION_NOT_OPENED;
125125 }
126126
@@ -132,9 +132,9 @@ status_t ClearKeyCasPlugin::setSessionPrivateData(
132132 const CasSessionId &sessionId, const CasData & /*data*/) {
133133 ALOGV("setSessionPrivateData: sessionId=%s",
134134 sessionIdToString(sessionId).string());
135- sp<ClearKeyCasSession> session =
135+ std::shared_ptr<ClearKeyCasSession> session =
136136 ClearKeySessionLibrary::get()->findSession(sessionId);
137- if (session == NULL) {
137+ if (session.get() == nullptr) {
138138 return ERROR_CAS_SESSION_NOT_OPENED;
139139 }
140140 return OK;
@@ -143,9 +143,9 @@ status_t ClearKeyCasPlugin::setSessionPrivateData(
143143 status_t ClearKeyCasPlugin::processEcm(
144144 const CasSessionId &sessionId, const CasEcm& ecm) {
145145 ALOGV("processEcm: sessionId=%s", sessionIdToString(sessionId).string());
146- sp<ClearKeyCasSession> session =
146+ std::shared_ptr<ClearKeyCasSession> session =
147147 ClearKeySessionLibrary::get()->findSession(sessionId);
148- if (session == NULL) {
148+ if (session.get() == nullptr) {
149149 return ERROR_CAS_SESSION_NOT_OPENED;
150150 }
151151
@@ -415,15 +415,15 @@ status_t ClearKeyDescramblerPlugin::setMediaCasSession(
415415 const CasSessionId &sessionId) {
416416 ALOGV("setMediaCasSession: sessionId=%s", sessionIdToString(sessionId).string());
417417
418- sp<ClearKeyCasSession> session =
418+ std::shared_ptr<ClearKeyCasSession> session =
419419 ClearKeySessionLibrary::get()->findSession(sessionId);
420420
421- if (session == NULL) {
421+ if (session.get() == nullptr) {
422422 ALOGE("ClearKeyDescramblerPlugin: session not found");
423423 return ERROR_CAS_SESSION_NOT_OPENED;
424424 }
425425
426- mCASSession = session;
426+ std::atomic_store(&mCASSession, session);
427427 return OK;
428428 }
429429
@@ -444,12 +444,14 @@ ssize_t ClearKeyDescramblerPlugin::descramble(
444444 subSamplesToString(subSamples, numSubSamples).string(),
445445 srcPtr, dstPtr, srcOffset, dstOffset);
446446
447- if (mCASSession == NULL) {
447+ std::shared_ptr<ClearKeyCasSession> session = std::atomic_load(&mCASSession);
448+
449+ if (session.get() == nullptr) {
448450 ALOGE("Uninitialized CAS session!");
449451 return ERROR_CAS_DECRYPT_UNIT_NOT_INITIALIZED;
450452 }
451453
452- return mCASSession->decrypt(
454+ return session->decrypt(
453455 secure, scramblingControl,
454456 numSubSamples, subSamples,
455457 (uint8_t*)srcPtr + srcOffset,
--- a/drm/mediacas/plugins/clearkey/ClearKeyCasPlugin.h
+++ b/drm/mediacas/plugins/clearkey/ClearKeyCasPlugin.h
@@ -120,7 +120,7 @@ public:
120120 AString *errorDetailMsg) override;
121121
122122 private:
123- sp<ClearKeyCasSession> mCASSession;
123+ std::shared_ptr<ClearKeyCasSession> mCASSession;
124124
125125 String8 subSamplesToString(
126126 SubSample const *subSamples,
--- a/drm/mediacas/plugins/clearkey/ClearKeySessionLibrary.cpp
+++ b/drm/mediacas/plugins/clearkey/ClearKeySessionLibrary.cpp
@@ -56,7 +56,7 @@ status_t ClearKeySessionLibrary::addSession(
5656
5757 Mutex::Autolock lock(mSessionsLock);
5858
59- sp<ClearKeyCasSession> session = new ClearKeyCasSession(plugin);
59+ std::shared_ptr<ClearKeyCasSession> session(new ClearKeyCasSession(plugin));
6060
6161 uint8_t *byteArray = (uint8_t *) &mNextSessionId;
6262 sessionId->push_back(byteArray[3]);
@@ -69,7 +69,7 @@ status_t ClearKeySessionLibrary::addSession(
6969 return OK;
7070 }
7171
72-sp<ClearKeyCasSession> ClearKeySessionLibrary::findSession(
72+std::shared_ptr<ClearKeyCasSession> ClearKeySessionLibrary::findSession(
7373 const CasSessionId& sessionId) {
7474 Mutex::Autolock lock(mSessionsLock);
7575
@@ -88,7 +88,7 @@ void ClearKeySessionLibrary::destroySession(const CasSessionId& sessionId) {
8888 return;
8989 }
9090
91- sp<ClearKeyCasSession> session = mIDToSessionMap.valueAt(index);
91+ std::shared_ptr<ClearKeyCasSession> session = mIDToSessionMap.valueAt(index);
9292 mIDToSessionMap.removeItemsAt(index);
9393 }
9494
@@ -96,7 +96,7 @@ void ClearKeySessionLibrary::destroyPlugin(CasPlugin *plugin) {
9696 Mutex::Autolock lock(mSessionsLock);
9797
9898 for (ssize_t index = mIDToSessionMap.size() - 1; index >= 0; index--) {
99- sp<ClearKeyCasSession> session = mIDToSessionMap.valueAt(index);
99+ std::shared_ptr<ClearKeyCasSession> session = mIDToSessionMap.valueAt(index);
100100 if (session->getPlugin() == plugin) {
101101 mIDToSessionMap.removeItemsAt(index);
102102 }
--- a/drm/mediacas/plugins/clearkey/ClearKeySessionLibrary.h
+++ b/drm/mediacas/plugins/clearkey/ClearKeySessionLibrary.h
@@ -32,6 +32,10 @@ class KeyFetcher;
3232
3333 class ClearKeyCasSession : public RefBase {
3434 public:
35+ explicit ClearKeyCasSession(CasPlugin *plugin);
36+
37+ virtual ~ClearKeyCasSession();
38+
3539 ssize_t decrypt(
3640 bool secure,
3741 DescramblerPlugin::ScramblingControl scramblingControl,
@@ -58,8 +62,6 @@ private:
5862
5963 friend class ClearKeySessionLibrary;
6064
61- explicit ClearKeyCasSession(CasPlugin *plugin);
62- virtual ~ClearKeyCasSession();
6365 CasPlugin* getPlugin() const { return mPlugin; }
6466 status_t decryptPayload(
6567 const AES_KEY& key, size_t length, size_t offset, char* buffer) const;
@@ -73,7 +75,7 @@ public:
7375
7476 status_t addSession(CasPlugin *plugin, CasSessionId *sessionId);
7577
76- sp<ClearKeyCasSession> findSession(const CasSessionId& sessionId);
78+ std::shared_ptr<ClearKeyCasSession> findSession(const CasSessionId& sessionId);
7779
7880 void destroySession(const CasSessionId& sessionId);
7981
@@ -85,7 +87,7 @@ private:
8587
8688 Mutex mSessionsLock;
8789 uint32_t mNextSessionId;
88- KeyedVector<CasSessionId, sp<ClearKeyCasSession>> mIDToSessionMap;
90+ KeyedVector<CasSessionId, std::shared_ptr<ClearKeyCasSession>> mIDToSessionMap;
8991
9092 ClearKeySessionLibrary();
9193 DISALLOW_EVIL_CONSTRUCTORS(ClearKeySessionLibrary);
--- a/media/libmedia/IMediaExtractor.cpp
+++ b/media/libmedia/IMediaExtractor.cpp
@@ -23,6 +23,7 @@
2323
2424 #include <binder/IPCThreadState.h>
2525 #include <binder/Parcel.h>
26+#include <binder/PermissionCache.h>
2627 #include <media/IMediaExtractor.h>
2728 #include <media/stagefright/MetaData.h>
2829
@@ -323,13 +324,21 @@ void registerMediaExtractor(
323324
324325 status_t dumpExtractors(int fd, const Vector<String16>&) {
325326 String8 out;
326- out.append("Recent extractors, most recent first:\n");
327- {
328- Mutex::Autolock lock(sExtractorsLock);
329- for (size_t i = 0; i < sExtractors.size(); i++) {
330- const ExtractorInstance &instance = sExtractors.itemAt(i);
331- out.append(" ");
332- out.append(instance.toString());
327+ const IPCThreadState* ipc = IPCThreadState::self();
328+ const int pid = ipc->getCallingPid();
329+ const int uid = ipc->getCallingUid();
330+ if (!PermissionCache::checkPermission(String16("android.permission.DUMP"), pid, uid)) {
331+ out.appendFormat("Permission Denial: "
332+ "can't dump MediaExtractor from pid=%d, uid=%d\n", pid, uid);
333+ } else {
334+ out.append("Recent extractors, most recent first:\n");
335+ {
336+ Mutex::Autolock lock(sExtractorsLock);
337+ for (size_t i = 0; i < sExtractors.size(); i++) {
338+ const ExtractorInstance &instance = sExtractors.itemAt(i);
339+ out.append(" ");
340+ out.append(instance.toString());
341+ }
333342 }
334343 }
335344 write(fd, out.string(), out.size());
Show on old repository browser