mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-03 13:44:40 +00:00
Log exit reasons Android 11
This commit is contained in:
parent
2582b55a6e
commit
923c4a26eb
1 changed files with 18 additions and 0 deletions
|
@ -20,6 +20,7 @@ package eu.faircode.email;
|
|||
*/
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ApplicationExitInfo;
|
||||
import android.app.Dialog;
|
||||
import android.app.usage.UsageStatsManager;
|
||||
import android.content.Context;
|
||||
|
@ -1156,6 +1157,23 @@ public class Log {
|
|||
|
||||
sb.append("\r\n");
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
try {
|
||||
// https://developer.android.com/reference/android/app/ApplicationExitInfo
|
||||
List<ApplicationExitInfo> infos = am.getHistoricalProcessExitReasons(
|
||||
context.getPackageName(), 0, 20);
|
||||
for (ApplicationExitInfo info : infos)
|
||||
sb.append(String.format("%s: %s %s/%s reason=%d status=%d importance=%d\r\n",
|
||||
new Date(info.getTimestamp()), info.getDescription(),
|
||||
Helper.humanReadableByteCount(info.getPss() * 1024L),
|
||||
Helper.humanReadableByteCount(info.getRss() * 1024L),
|
||||
info.getReason(), info.getStatus(), info.getReason()));
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
sb.append("\r\n");
|
||||
}
|
||||
|
||||
sb.append(new Date(Helper.getInstallTime(context))).append("\r\n");
|
||||
sb.append(new Date()).append("\r\n");
|
||||
|
||||
|
|
Loading…
Reference in a new issue