Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-99584

Android 12 - Provide apps direct access to tombstone traces

    XMLWordPrintable

Details

    • User Story
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • None
    • Extras: Android
    • None

    Description

      Overview:

      Starting in Android 12 (API level 31), you can access your app's native crash tombstone as a protocol buffer through the ApplicationExitInfo.getTraceInputStream() method. The protocol buffer is serialized using this schema. Previously, the only way to get access to this information was through the Android Debug Bridge (adb).

      Example:

       

       
      ActivityManager activityManager: ActivityManager = getSystemService(Context.ACTIVITY_SERVICE);
      MutableList<ApplicationExitInfo> exitReasons = activityManager.getHistoricalProcessExitReasons(/* packageName = */ null, /* pid = */ 0, /* maxNum = */ 5);
      for ( ApplicationExitInfo aei: exitReasons ) {
          if ( aei.getReason() == REASON_CRASH_NATIVE ) {
              // Get the tombstone input stream.
              InputStream tombstoneInputStream = aei.getTraceInputStream();
              // The tombstone parser built with protoc uses the tombstone schema, then parses the trace.
              Tombstone tombstone = Tombstone.parseFrom(trace);
          }
      }
      

      Proposed Action:

      Research usefulness. Also, check if it is android only.

      Attachments

        Activity

          People

            qtandroidteam Qt Android Team
            samuelmira Samuel Mira
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: