summaryrefslogtreecommitdiffstats
path: root/drm/drmserver
diff options
context:
space:
mode:
Diffstat (limited to 'drm/drmserver')
-rw-r--r--drm/drmserver/Android.mk1
-rw-r--r--drm/drmserver/DrmManagerService.cpp29
2 files changed, 30 insertions, 0 deletions
diff --git a/drm/drmserver/Android.mk b/drm/drmserver/Android.mk
index f94f9a3..e3cd44f 100644
--- a/drm/drmserver/Android.mk
+++ b/drm/drmserver/Android.mk
@@ -22,6 +22,7 @@ LOCAL_SRC_FILES:= \
DrmManagerService.cpp
LOCAL_SHARED_LIBRARIES := \
+ libmedia \
libutils \
libbinder
diff --git a/drm/drmserver/DrmManagerService.cpp b/drm/drmserver/DrmManagerService.cpp
index 0901a44..583669e 100644
--- a/drm/drmserver/DrmManagerService.cpp
+++ b/drm/drmserver/DrmManagerService.cpp
@@ -19,6 +19,7 @@
#include <utils/Log.h>
#include <private/android_filesystem_config.h>
+#include <media/MemoryLeakTrackUtil.h>
#include <errno.h>
#include <utils/threads.h>
@@ -256,3 +257,31 @@ ssize_t DrmManagerService::pread(int uniqueId, DecryptHandle* decryptHandle,
return mDrmManager->pread(uniqueId, decryptHandle, buffer, numBytes, offset);
}
+status_t DrmManagerService::dump(int fd, const Vector<String16>& args)
+{
+ const size_t SIZE = 256;
+ char buffer[SIZE];
+ String8 result;
+ if (checkCallingPermission(String16("android.permission.DUMP")) == false) {
+ snprintf(buffer, SIZE, "Permission Denial: "
+ "can't dump DrmManagerService from pid=%d, uid=%d\n",
+ IPCThreadState::self()->getCallingPid(),
+ IPCThreadState::self()->getCallingUid());
+ result.append(buffer);
+ } else {
+#if DRM_MEMORY_LEAK_TRACK
+ bool dumpMem = false;
+ for (size_t i = 0; i < args.size(); i++) {
+ if (args[i] == String16("-m")) {
+ dumpMem = true;
+ }
+ }
+ if (dumpMem) {
+ dumpMemoryAddresses(fd);
+ }
+#endif
+ }
+ write(fd, result.string(), result.size());
+ return NO_ERROR;
+}
+