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

Commit 78d5ba9d authored by Dan Egnor's avatar Dan Egnor Committed by Android (Google) Code Review
Browse files

Merge changes Iea11654e,I2242da5a,I66c40e73

* changes:
  Use six dashes instead of five.
  Include more verbose device information with kernel dumps (hardware, bootloader, etc.), and separate the device info headers from the actual dump with a blank line.
  Add package information to dropbox reports for ANR, crash, etc. (Notably including package version codes, to help when we're shipping out-of-cycle unbundled app updates.)
parents c597b188 ea11654e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ static void dumpstate() {
    dump_file("LAST PANIC CONSOLE", "/data/dontpanic/apanic_console");
    dump_file("LAST PANIC THREADS", "/data/dontpanic/apanic_threads");

    printf("----- BACKLIGHTS -----\n");
    printf("------ BACKLIGHTS ------\n");
    printf("LCD brightness=");
    dump_file(NULL, "/sys/class/leds/lcd-backlight/brightness");
    printf("Button brightness=");
+6 −6
Original line number Diff line number Diff line
@@ -43,13 +43,13 @@ int dump_file(const char *title, const char* path) {
    int fd = open(path, O_RDONLY);
    if (fd < 0) {
        int err = errno;
        if (title) printf("----- %s (%s) -----\n", title, path);
        if (title) printf("------ %s (%s) ------\n", title, path);
        printf("*** %s: %s\n", path, strerror(err));
        if (title) printf("\n");
        return -1;
    }

    if (title) printf("----- %s (%s", title, path);
    if (title) printf("------ %s (%s", title, path);

    if (title) {
        struct stat st;
@@ -59,7 +59,7 @@ int dump_file(const char *title, const char* path) {
            strftime(stamp, sizeof(stamp), "%Y-%m-%d %H:%M:%S", localtime(&mtime));
            printf(": %s", stamp);
        }
        printf(") -----\n");
        printf(") ------\n");
    }

    int newline = 0;
@@ -97,13 +97,13 @@ int run_command(const char *title, int timeout_seconds, const char *command, ...

        va_list ap;
        va_start(ap, command);
        if (title) printf("----- %s (%s", title, command);
        if (title) printf("------ %s (%s", title, command);
        for (arg = 1; arg < sizeof(args) / sizeof(args[0]); ++arg) {
            args[arg] = va_arg(ap, const char *);
            if (args[arg] == NULL) break;
            if (title) printf(" %s", args[arg]);
        }
        if (title) printf(") -----\n");
        if (title) printf(") ------\n");
        fflush(stdout);

        execvp(command, (char**) args);
@@ -159,7 +159,7 @@ void print_properties() {
    property_list(print_prop, NULL);
    qsort(&props, num_props, sizeof(props[0]), compare_prop);

    printf("----- SYSTEM PROPERTIES -----\n");
    printf("------ SYSTEM PROPERTIES ------\n");
    for (i = 0; i < num_props; ++i) {
        fputs(props[i], stdout);
        free(props[i]);
+8 −10
Original line number Diff line number Diff line
@@ -89,14 +89,14 @@ public class BootReceiver extends BroadcastReceiver {
        }

        ContentResolver cr = context.getContentResolver();
        logBootFile(cr, db, "/cache/recovery/log", "SYSTEM_RECOVERY_LOG");
        logBootFile(cr, db, "/proc/last_kmsg", "SYSTEM_LAST_KMSG");
        logBootFile(cr, db, "/data/dontpanic/apanic_console", "APANIC_CONSOLE");
        logBootFile(cr, db, "/data/dontpanic/apanic_threads", "APANIC_THREADS");
        logBootFile(cr, db, props, "/cache/recovery/log", "SYSTEM_RECOVERY_LOG");
        logBootFile(cr, db, props, "/proc/last_kmsg", "SYSTEM_LAST_KMSG");
        logBootFile(cr, db, props, "/data/dontpanic/apanic_console", "APANIC_CONSOLE");
        logBootFile(cr, db, props, "/data/dontpanic/apanic_threads", "APANIC_THREADS");
    }

    private void logBootFile(ContentResolver cr, DropBoxManager db, String filename, String tag)
            throws IOException {
    private void logBootFile(ContentResolver cr, DropBoxManager db,
            CharSequence headers, String filename, String tag) throws IOException {
        if (cr == null || db == null || !db.isTagEnabled(tag)) return;  // Logging disabled

        File file = new File(filename);
@@ -108,10 +108,8 @@ public class BootReceiver extends BroadcastReceiver {
        if (lastTime == fileTime) return;  // Already logged this particular file
        Settings.Secure.putLong(cr, setting, fileTime);

        StringBuilder report = new StringBuilder();
        report.append("Build: ").append(Build.FINGERPRINT).append("\n");
        report.append("Kernel: ");
        report.append(FileUtils.readTextFile(new File("/proc/version"), 1024, "...\n"));
        StringBuilder report = new StringBuilder(headers);
        report.append("\n");
        report.append(FileUtils.readTextFile(new File(filename), LOG_SIZE, "[[TRUNCATED]]\n"));
        db.addText(tag, report.toString());
    }
+21 −1
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ import android.content.pm.ConfigurationInfo;
import android.content.pm.IPackageDataObserver;
import android.content.pm.IPackageManager;
import android.content.pm.InstrumentationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PathPermission;
import android.content.pm.ProviderInfo;
@@ -8845,7 +8846,26 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
                sb.append("Process: system_server\n");
            } else {
                sb.append("Process: ").append(process.processName).append("\n");
                sb.append("Flags: 0x").append(Integer.toString(process.info.flags, 16)).append("\n");
            }
            if (process != null) {
                int flags = process.info.flags;
                IPackageManager pm = ActivityThread.getPackageManager();
                sb.append("Flags: 0x").append(Integer.toString(flags, 16)).append("\n");
                for (String pkg : process.pkgList) {
                    sb.append("Package: ").append(pkg);
                    try {
                        PackageInfo pi = pm.getPackageInfo(pkg, 0);
                        if (pi != null) {
                            sb.append(" v").append(pi.versionCode);
                            if (pi.versionName != null) {
                                sb.append(" (").append(pi.versionName).append(")");
                            }
                        }
                    } catch (RemoteException e) {
                        Log.e(TAG, "Error getting package info: " + pkg, e);
                    }
                    sb.append("\n");
                }
            }
            if (activity != null) {
                sb.append("Activity: ").append(activity.shortComponentName).append("\n");