Implement clearkey hidl `lshal debug` hook

The output of the hook can viewed using the command:
> adb shell lshal debug android.hardware.drm@1.3::IDrmFactory/clearkey

The hook can be used to emit debug info from the ClearKey hidl process.
Currently only emit the total number of open sessions.

Bug: 153663446
Test: adb shell lshal debug \
  android.hardware.drm@1.3::IDrmFactory/clearkey
Change-Id: Ie5918acbfbbb5cfc2a9bc5e138ab0320f3c6a558
gugelfrei
Robert Shih 4 years ago committed by Jeff Tinker
parent 02ec2d9d9a
commit 452d91d674

@ -91,6 +91,19 @@ Return<void> DrmFactory::getSupportedCryptoSchemes(
return Void();
}
Return<void> DrmFactory::debug(const hidl_handle& fd, const hidl_vec<hidl_string>& /*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

@ -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<void> getSupportedCryptoSchemes(
getSupportedCryptoSchemes_cb _hidl_cb) override;
Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& args);
private:
CLEARKEY_DISALLOW_COPY_AND_ASSIGN(DrmFactory);
};

Loading…
Cancel
Save