diff options
author | Dianne Hackborn <hackbod@google.com> | 2015-08-05 15:01:28 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2015-08-05 15:01:28 -0700 |
commit | 6bdd3a155fe380735d4108ddcc50b156c62406d0 (patch) | |
tree | 55457cd3918e67f2885e2d4af16fcdb9c78e788f | |
parent | 6bdc4637d7ac1df86e9d745ac483987107a71282 (diff) | |
download | frameworks_base-6bdd3a155fe380735d4108ddcc50b156c62406d0.zip frameworks_base-6bdd3a155fe380735d4108ddcc50b156c62406d0.tar.gz frameworks_base-6bdd3a155fe380735d4108ddcc50b156c62406d0.tar.bz2 |
Fix issue #22843150: fragment transaction crash from onRequestPermisssionResult
Add new Activity callback to tell it when its saved state has
been invalidated.
The problem is that delivering the permission result does not go
through a path where the compatibility code can see it first to
mark its fragment manager as no longer having saved state. So this
new callback gives it a place to do that.
Change-Id: I5a4a185d9c746bae1afb5c588aba82c8daccf079
-rw-r--r-- | api/current.txt | 1 | ||||
-rw-r--r-- | api/system-current.txt | 1 | ||||
-rw-r--r-- | core/java/android/app/Activity.java | 10 | ||||
-rw-r--r-- | core/java/android/app/ActivityThread.java | 1 |
4 files changed, 13 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt index e16294e..44bcfed 100644 --- a/api/current.txt +++ b/api/current.txt @@ -3412,6 +3412,7 @@ package android.app { method public boolean onSearchRequested(android.view.SearchEvent); method public boolean onSearchRequested(); method protected void onStart(); + method public void onStateNotSaved(); method protected void onStop(); method protected void onTitleChanged(java.lang.CharSequence, int); method public boolean onTouchEvent(android.view.MotionEvent); diff --git a/api/system-current.txt b/api/system-current.txt index a784378..d99dd10 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -3516,6 +3516,7 @@ package android.app { method public boolean onSearchRequested(android.view.SearchEvent); method public boolean onSearchRequested(); method protected void onStart(); + method public void onStateNotSaved(); method protected void onStop(); method protected void onTitleChanged(java.lang.CharSequence, int); method public boolean onTouchEvent(android.view.MotionEvent); diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 3c8af0d..2cb3f39 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -1172,6 +1172,16 @@ public class Activity extends ContextThemeWrapper } /** + * Called when an {@link #onResume} is coming up, prior to other pre-resume callbacks + * such as {@link #onNewIntent} and {@link #onActivityResult}. This is primarily intended + * to give the activity a hint that its state is no longer saved -- it will generally + * be called after {@link #onSaveInstanceState} and prior to the activity being + * resumed/started again. + */ + public void onStateNotSaved() { + } + + /** * Called after {@link #onRestoreInstanceState}, {@link #onRestart}, or * {@link #onPause}, for your activity to start interacting with the user. * This is a good place to begin animations, open exclusive-access devices diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 2b4d03b..fd88a05 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -3079,6 +3079,7 @@ public final class ActivityThread { r.activity.mStartedActivity = false; } try { + r.activity.onStateNotSaved(); r.activity.mFragments.noteStateNotSaved(); if (r.pendingIntents != null) { deliverNewIntents(r, r.pendingIntents); |