From b4f3697ef8b3f272e5fbb3b6a0d9b63825532299 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Wed, 2 Aug 2017 14:33:04 -0600 Subject: [PATCH] Don't show scary UI when rescue party kicks in. We're not actually doing a factory reset yet; we're rebooting to ask the user if they'd like to reset, so give them a less scary message. Test: builds, boots Bug: 63000721 Change-Id: Ibbf5eeb6e21d25dee2d6723b4ba4e42d9ff5c2fd --- .../android/server/power/ShutdownThread.java | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/services/core/java/com/android/server/power/ShutdownThread.java b/services/core/java/com/android/server/power/ShutdownThread.java index e894275fe2b67..92f1c83c892e5 100644 --- a/services/core/java/com/android/server/power/ShutdownThread.java +++ b/services/core/java/com/android/server/power/ShutdownThread.java @@ -57,6 +57,7 @@ import android.widget.ProgressBar; import android.widget.TextView; import com.android.internal.telephony.ITelephony; +import com.android.server.RescueParty; import com.android.server.pm.PackageManagerService; import java.io.File; @@ -293,11 +294,20 @@ public final class ShutdownThread extends Thread { com.android.internal.R.string.reboot_to_update_reboot)); } } else if (mReason != null && mReason.equals(PowerManager.REBOOT_RECOVERY)) { - // Factory reset path. Set the dialog message accordingly. - pd.setTitle(context.getText(com.android.internal.R.string.reboot_to_reset_title)); - pd.setMessage(context.getText( - com.android.internal.R.string.reboot_to_reset_message)); - pd.setIndeterminate(true); + if (RescueParty.isAttemptingFactoryReset()) { + // We're not actually doing a factory reset yet; we're rebooting + // to ask the user if they'd like to reset, so give them a less + // scary dialog message. + pd.setTitle(context.getText(com.android.internal.R.string.power_off)); + pd.setMessage(context.getText(com.android.internal.R.string.shutdown_progress)); + pd.setIndeterminate(true); + } else { + // Factory reset path. Set the dialog message accordingly. + pd.setTitle(context.getText(com.android.internal.R.string.reboot_to_reset_title)); + pd.setMessage(context.getText( + com.android.internal.R.string.reboot_to_reset_message)); + pd.setIndeterminate(true); + } } else if (mReason != null && mReason.equals(PowerManager.SHUTDOWN_USER_REQUESTED)) { Dialog d = new Dialog(context); d.setContentView(com.android.internal.R.layout.shutdown_dialog);