Clarify restore dialog, prevent spam
Bug: 4599646
State that it is the browser's windows/tabs to be restored and
show the browser's app icon in the dialog.
Also cut down on the frequency this prompt will appear by
ignoring tabs that haven't loaded anything except the home page.
Change-Id: I2c2cc03aa92da3199c47b455256145d392548930
diff --git a/src/com/android/browser/CrashRecoveryHandler.java b/src/com/android/browser/CrashRecoveryHandler.java
index 7ee9cee..acc2a30 100644
--- a/src/com/android/browser/CrashRecoveryHandler.java
+++ b/src/com/android/browser/CrashRecoveryHandler.java
@@ -103,6 +103,10 @@
@Override
public void run() {
+ if (mState.isEmpty()) {
+ clearState(mContext);
+ return;
+ }
Parcel p = Parcel.obtain();
try {
mState.writeToParcel(p, 0);
@@ -119,8 +123,7 @@
}
- private void clearState() {
- Context context = mController.getActivity();
+ private static void clearState(Context context) {
context.deleteFile(STATE_FILE);
}
@@ -128,6 +131,7 @@
new AlertDialog.Builder(mController.getActivity())
.setTitle(R.string.recover_title)
.setMessage(R.string.recover_prompt)
+ .setIcon(R.mipmap.ic_launcher_browser)
.setPositiveButton(R.string.recover_yes, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
@@ -137,7 +141,7 @@
.setNegativeButton(R.string.recover_no, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- clearState();
+ clearState(mController.getActivity());
mController.doStart(null, intent);
}
})