diff options
author | John Reck <jreck@google.com> | 2011-06-29 14:41:59 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2011-06-29 14:41:59 -0700 |
commit | a4816530199095b8e7ad0ebd6ac9f22dff32ea2a (patch) | |
tree | 8e81d172d07032d97be1a6da50682377e91ccb07 | |
parent | 253b8553264dd3da9c7688d8c04d7f1f1b2bd399 (diff) | |
download | packages_apps_Browser-a4816530199095b8e7ad0ebd6ac9f22dff32ea2a.zip packages_apps_Browser-a4816530199095b8e7ad0ebd6ac9f22dff32ea2a.tar.gz packages_apps_Browser-a4816530199095b8e7ad0ebd6ac9f22dff32ea2a.tar.bz2 |
Always automatically restore
Bug: 4904409
Change-Id: I07406481e3870c09546b0264ed10e5a7bd6cae68
-rw-r--r-- | src/com/android/browser/CrashRecoveryHandler.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/com/android/browser/CrashRecoveryHandler.java b/src/com/android/browser/CrashRecoveryHandler.java index 5140952..ca538bd 100644 --- a/src/com/android/browser/CrashRecoveryHandler.java +++ b/src/com/android/browser/CrashRecoveryHandler.java @@ -31,6 +31,7 @@ import android.os.Process; import android.util.Log; import java.io.ByteArrayOutputStream; +import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; @@ -120,8 +121,8 @@ public class CrashRecoveryHandler { Parcel p = Parcel.obtain(); try { mState.writeToParcel(p, 0); - FileOutputStream fout = mContext.openFileOutput(STATE_FILE, - Context.MODE_PRIVATE); + File state = new File(mContext.getCacheDir(), STATE_FILE); + FileOutputStream fout = new FileOutputStream(state); fout.write(p.marshall()); fout.close(); } catch (Throwable e) { @@ -134,7 +135,10 @@ public class CrashRecoveryHandler { } private static void clearState(Context context) { - context.deleteFile(STATE_FILE); + File state = new File(context.getCacheDir(), STATE_FILE); + if (state.exists()) { + state.delete(); + } } public void promptToRecover(final Bundle state, final Intent intent) { @@ -166,6 +170,8 @@ public class CrashRecoveryHandler { } private boolean shouldPrompt() { + // STOPSHIP TODO: Remove once b/4971724 is fixed + if (true) return false; Context context = mController.getActivity(); SharedPreferences prefs = context.getSharedPreferences( RECOVERY_PREFERENCES, Context.MODE_PRIVATE); @@ -192,7 +198,8 @@ public class CrashRecoveryHandler { Parcel parcel = Parcel.obtain(); try { Context context = mController.getActivity(); - FileInputStream fin = context.openFileInput(STATE_FILE); + File stateFile = new File(context.getCacheDir(), STATE_FILE); + FileInputStream fin = new FileInputStream(stateFile); ByteArrayOutputStream dataStream = new ByteArrayOutputStream(); byte[] buffer = new byte[BUFFER_SIZE]; int read; |