diff --git a/drm/mediadrm/plugins/clearkey/hidl/DrmFactory.cpp b/drm/mediadrm/plugins/clearkey/hidl/DrmFactory.cpp index ccc73b686f..1ce8269787 100644 --- a/drm/mediadrm/plugins/clearkey/hidl/DrmFactory.cpp +++ b/drm/mediadrm/plugins/clearkey/hidl/DrmFactory.cpp @@ -91,6 +91,19 @@ Return DrmFactory::getSupportedCryptoSchemes( return Void(); } +Return DrmFactory::debug(const hidl_handle& fd, const hidl_vec& /*args*/) { + if (fd.getNativeHandle() == nullptr || fd->numFds < 1) { + ALOGE("%s: missing fd for writing", __FUNCTION__); + return Void(); + } + + FILE* out = fdopen(dup(fd->data[0]), "w"); + uint32_t currentSessions = SessionLibrary::get()->numOpenSessions(); + fprintf(out, "current open sessions: %u\n", currentSessions); + fclose(out); + return Void(); +} + } // namespace clearkey } // namespace V1_3 } // namespace drm diff --git a/drm/mediadrm/plugins/clearkey/hidl/include/DrmFactory.h b/drm/mediadrm/plugins/clearkey/hidl/include/DrmFactory.h index 403a8ecb7d..63234cffa9 100644 --- a/drm/mediadrm/plugins/clearkey/hidl/include/DrmFactory.h +++ b/drm/mediadrm/plugins/clearkey/hidl/include/DrmFactory.h @@ -30,6 +30,7 @@ namespace clearkey { using ::android::hardware::drm::V1_1::SecurityLevel; using ::android::hardware::hidl_array; +using ::android::hardware::hidl_handle; using ::android::hardware::hidl_string; using ::android::hardware::Return; @@ -55,6 +56,8 @@ struct DrmFactory : public IDrmFactory { Return getSupportedCryptoSchemes( getSupportedCryptoSchemes_cb _hidl_cb) override; + Return debug(const hidl_handle& fd, const hidl_vec& args); + private: CLEARKEY_DISALLOW_COPY_AND_ASSIGN(DrmFactory); };