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

Commit d5c3961b authored by Robert Shih's avatar Robert Shih
Browse files

libmediadrm: visually highlight exception log msg

Bug: 183578226
Test: MediaDrmTest#testExceptionMessage
Change-Id: I1b82dca0243661369484af11a931a09128f9826c
parent 16291cc0
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -304,6 +304,9 @@ char logPriorityToChar(::V1_4::LogPriority priority) {

std::string GetExceptionMessage(status_t err, const char *msg,
                                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");
    String8 msg8;
    if (msg) {
        msg8 += msg;
@@ -311,6 +314,7 @@ std::string GetExceptionMessage(status_t err, const char *msg,
    }
    auto errStr = StrCryptoError(err);
    msg8 += errStr.c_str();
    msg8 += String8::format("\n%s %s %s", ruler.c_str(), header.c_str(), ruler.c_str());

    for (auto log : logs) {
        time_t seconds = log.timeMs / 1000;
@@ -325,6 +329,7 @@ std::string GetExceptionMessage(status_t err, const char *msg,
        msg8 += String8::format("\n  %s.%03d %c %s", timeStr.c_str(), ms, p, log.message.c_str());
    }

    msg8 += String8::format("\n%s %s %s", ruler.c_str(), footer.c_str(), ruler.c_str());
    return msg8.c_str();
}