Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c7a1a9eb authored by Robert Shih's avatar Robert Shih Committed by Automerger Merge Worker
Browse files

Merge "libmediadrm: add details to exception message" am: 031923a0 am: 3fe225e5 am: 6b9d2976

parents 20abae2a 6b9d2976
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -363,18 +363,23 @@ char logPriorityToChar(::V1_4::LogPriority priority) {
}
}  // namespace

std::string GetExceptionMessage(status_t err, const char* msg,
std::string GetExceptionMessage(const DrmStatus &err, const char* defaultMsg,
                                const Vector<::V1_4::LogMessage>& logs) {
    std::string ruler("==============================");
    std::string header("Beginning of DRM Plugin Log");
    std::string footer("End of DRM Plugin Log");
    std::string msg(err.getErrorMessage());
    String8 msg8;
    if (msg) {
        msg8 += msg;
    if (!msg.empty()) {
        msg8 += msg.c_str();
        msg8 += ": ";
    } else if (defaultMsg) {
        msg8 += defaultMsg;
        msg8 += ": ";
    }
    auto errStr = StrCryptoError(err);
    msg8 += errStr.c_str();
    msg8 += StrCryptoError(err).c_str();
    msg8 += String8::format("\ncdm err: %d, oem err: %d, ctx: %d",
                            err.getCdmErr(), err.getOemErr(), err.getContext());
    msg8 += String8::format("\n%s %s %s", ruler.c_str(), header.c_str(), ruler.c_str());

    for (auto log : logs) {
+3 −3
Original line number Diff line number Diff line
@@ -283,14 +283,14 @@ status_t GetLogMessages(const sp<U> &obj, Vector<::V1_4::LogMessage> &logs) {
    return toStatusT(err);
}

std::string GetExceptionMessage(status_t err, const char *msg,
std::string GetExceptionMessage(const DrmStatus & err, const char *defaultMsg,
                                const Vector<::V1_4::LogMessage> &logs);

template<typename T>
std::string GetExceptionMessage(status_t err, const char *msg, const sp<T> &iface) {
std::string GetExceptionMessage(const DrmStatus &err, const char *defaultMsg, const sp<T> &iface) {
    Vector<::V1_4::LogMessage> logs;
    iface->getLogMessages(logs);
    return GetExceptionMessage(err, msg, logs);
    return GetExceptionMessage(err, defaultMsg, logs);
}

} // namespace DrmUtils