summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tianjie Xu <xunchang@google.com> 2016-09-28 19:59:12 +0000
committer android-build-merger <android-build-merger@google.com> 2016-09-28 19:59:12 +0000
commit3aeade44a9175ebea3170aced45db15d0d448b14 (patch)
tree4ef235650a1d1f61e029b0458165cf01793e0c0f
parent6b32f3801ffc26d03e1bc3765b94512dc58d6c2e (diff)
parentc68e6d6708879d5e6137a0c876b01e8260bd02d6 (diff)
Merge "Log the error when uncrypt timeouts" am: c1973ecbd2
am: c68e6d6708 Change-Id: I23ee644fb2f73fc3cece4faf59eb63417cfe3ea6
-rw-r--r--core/java/android/os/RecoverySystem.java8
-rw-r--r--services/core/java/com/android/server/power/ShutdownThread.java8
2 files changed, 16 insertions, 0 deletions
diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java
index 028e30ab93f0..2d5a144bdfc1 100644
--- a/core/java/android/os/RecoverySystem.java
+++ b/core/java/android/os/RecoverySystem.java
@@ -93,6 +93,14 @@ public class RecoverySystem {
*/
public static final File UNCRYPT_PACKAGE_FILE = new File(RECOVERY_DIR, "uncrypt_file");
+ /**
+ * UNCRYPT_STATUS_FILE stores the time cost (and error code in the case of a failure)
+ * of uncrypt.
+ *
+ * @hide
+ */
+ public static final File UNCRYPT_STATUS_FILE = new File(RECOVERY_DIR, "uncrypt_status");
+
// Length limits for reading files.
private static final int LOG_FILE_MAX_LENGTH = 64 * 1024;
diff --git a/services/core/java/com/android/server/power/ShutdownThread.java b/services/core/java/com/android/server/power/ShutdownThread.java
index 5b9d139a3e0e..f7f79f324ecc 100644
--- a/services/core/java/com/android/server/power/ShutdownThread.java
+++ b/services/core/java/com/android/server/power/ShutdownThread.java
@@ -716,6 +716,14 @@ public final class ShutdownThread extends Thread {
}
if (!done[0]) {
Log.w(TAG, "Timed out waiting for uncrypt.");
+ final int uncryptTimeoutError = 100;
+ String timeoutMessage = String.format("uncrypt_time: %d\n" + "uncrypt_error: %d\n",
+ MAX_UNCRYPT_WAIT_TIME / 1000, uncryptTimeoutError);
+ try {
+ FileUtils.stringToFile(RecoverySystem.UNCRYPT_STATUS_FILE, timeoutMessage);
+ } catch (IOException e) {
+ Log.e(TAG, "Failed to write timeout message to uncrypt status", e);
+ }
}
}
}