summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorSimon Wilson <simonwilson@google.com>2014-05-12 19:49:00 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-05-12 19:49:00 +0000
commit728614e42e70bec63f7e95ab4f97a4aa2518e234 (patch)
treeca5517bb98a29ba53d9c52d46d93d09c71b2d91d /services
parent82c93357d0b61a6e12dcfc5eee1101968b8cba22 (diff)
parentc5df4d0e7d43d39072dfbab5f37d8b170de4617b (diff)
downloadframeworks_base-728614e42e70bec63f7e95ab4f97a4aa2518e234.zip
frameworks_base-728614e42e70bec63f7e95ab4f97a4aa2518e234.tar.gz
frameworks_base-728614e42e70bec63f7e95ab4f97a4aa2518e234.tar.bz2
am c5df4d0e: Merge "BootReceiver: add ro.boot.bootreason property to SYSTEM_LAST_KMSG" into klp-modular-dev
* commit 'c5df4d0e7d43d39072dfbab5f37d8b170de4617b': BootReceiver: add ro.boot.bootreason property to SYSTEM_LAST_KMSG
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/BootReceiver.java29
1 files changed, 24 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/BootReceiver.java b/services/core/java/com/android/server/BootReceiver.java
index bce85ce..7249985 100644
--- a/services/core/java/com/android/server/BootReceiver.java
+++ b/services/core/java/com/android/server/BootReceiver.java
@@ -106,22 +106,33 @@ public class BootReceiver extends BroadcastReceiver {
.append("Kernel: ")
.append(FileUtils.readTextFile(new File("/proc/version"), 1024, "...\n"))
.append("\n").toString();
+ final String bootReason = SystemProperties.get("ro.boot.bootreason", null);
String recovery = RecoverySystem.handleAftermath();
if (recovery != null && db != null) {
db.addText("SYSTEM_RECOVERY_LOG", headers + recovery);
}
+ String lastKmsgFooter = "";
+ if (bootReason != null) {
+ lastKmsgFooter = new StringBuilder(512)
+ .append("\n")
+ .append("Boot info:\n")
+ .append("Last boot reason: ").append(bootReason).append("\n")
+ .toString();
+ }
+
if (SystemProperties.getLong("ro.runtime.firstboot", 0) == 0) {
String now = Long.toString(System.currentTimeMillis());
SystemProperties.set("ro.runtime.firstboot", now);
if (db != null) db.addText("SYSTEM_BOOT", headers);
// Negative sizes mean to take the *tail* of the file (see FileUtils.readTextFile())
- addFileToDropBox(db, prefs, headers, "/proc/last_kmsg",
- -LOG_SIZE, "SYSTEM_LAST_KMSG");
- addFileToDropBox(db, prefs, headers, "/sys/fs/pstore/console-ramoops",
- -LOG_SIZE, "SYSTEM_LAST_KMSG");
+ addFileWithFootersToDropBox(db, prefs, headers, lastKmsgFooter,
+ "/proc/last_kmsg", -LOG_SIZE, "SYSTEM_LAST_KMSG");
+ addFileWithFootersToDropBox(db, prefs, headers, lastKmsgFooter,
+ "/sys/fs/pstore/console-ramoops", -LOG_SIZE,
+ "SYSTEM_LAST_KMSG");
addFileToDropBox(db, prefs, headers, "/cache/recovery/log",
-LOG_SIZE, "SYSTEM_RECOVERY_LOG");
addFileToDropBox(db, prefs, headers, "/data/dontpanic/apanic_console",
@@ -161,6 +172,14 @@ public class BootReceiver extends BroadcastReceiver {
private static void addFileToDropBox(
DropBoxManager db, SharedPreferences prefs,
String headers, String filename, int maxSize, String tag) throws IOException {
+ addFileWithFootersToDropBox(db, prefs, headers, "", filename, maxSize,
+ tag);
+ }
+
+ private static void addFileWithFootersToDropBox(
+ DropBoxManager db, SharedPreferences prefs,
+ String headers, String footers, String filename, int maxSize,
+ String tag) throws IOException {
if (db == null || !db.isTagEnabled(tag)) return; // Logging disabled
File file = new File(filename);
@@ -176,7 +195,7 @@ public class BootReceiver extends BroadcastReceiver {
}
Slog.i(TAG, "Copying " + filename + " to DropBox (" + tag + ")");
- db.addText(tag, headers + FileUtils.readTextFile(file, maxSize, "[[TRUNCATED]]\n"));
+ db.addText(tag, headers + FileUtils.readTextFile(file, maxSize, "[[TRUNCATED]]\n") + footers);
}
private static void addAuditErrorsToDropBox(DropBoxManager db, SharedPreferences prefs,