frameworks/av
修订版 | 16f9b39c69626093ae9225b458739707c9a3b4e7 (tree) |
---|---|
时间 | 2018-10-20 01:32:54 |
作者 | ray-cy.lee <ray-cy.lee@msta...> |
Commiter | android-build-team Robot |
CTS error while media dump()
MediaExtractor should not dump information. CTS is
checking and failing due to the dump.
Bug: 114770654
Change-Id: Ie5bae5de39545dede6da4198240b4f38c50050b7
(cherry picked from commit c20825bd3b751cffcd8d7e66e97c3b1a91ef21e0)
@@ -23,6 +23,7 @@ | ||
23 | 23 | |
24 | 24 | #include <binder/IPCThreadState.h> |
25 | 25 | #include <binder/Parcel.h> |
26 | +#include <binder/PermissionCache.h> | |
26 | 27 | #include <media/IMediaExtractor.h> |
27 | 28 | #include <media/stagefright/MetaData.h> |
28 | 29 |
@@ -323,13 +324,21 @@ void registerMediaExtractor( | ||
323 | 324 | |
324 | 325 | status_t dumpExtractors(int fd, const Vector<String16>&) { |
325 | 326 | 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 | + } | |
333 | 342 | } |
334 | 343 | } |
335 | 344 | write(fd, out.string(), out.size()); |