diff options
| -rw-r--r-- | core/java/android/os/RecoverySystem.java | 8 | ||||
| -rw-r--r-- | services/core/java/com/android/server/power/ShutdownThread.java | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java index 90bd11fe83bc..0b3abaaf33e8 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 8ce2fd9c2a83..44894ed99bb2 100644 --- a/services/core/java/com/android/server/power/ShutdownThread.java +++ b/services/core/java/com/android/server/power/ShutdownThread.java @@ -717,6 +717,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); + } } } } |