From c4df6bc4dd654385f7cbd3a0f459cfec8050839a Mon Sep 17 00:00:00 2001 From: Adam Powell Date: Wed, 9 Mar 2016 15:11:37 -0800 Subject: [PATCH] Un-deprecate Activity#onRetainNonConfigurationInstance This is still useful in some situations, FragmentActivity in the support lib uses it to implement retained instance fragments, and it really irks some people's linters. Hi, Jake! Bug 27642432 Change-Id: Id59f4895bdb09f7d629d081c16219e037e71bf33 --- api/current.txt | 4 ++-- api/system-current.txt | 4 ++-- api/test-current.txt | 4 ++-- core/java/android/app/Activity.java | 20 +++++++++----------- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/api/current.txt b/api/current.txt index 6b10a17a1cc15..d794708bddfee 100644 --- a/api/current.txt +++ b/api/current.txt @@ -3442,7 +3442,7 @@ package android.app { method public android.view.View getCurrentFocus(); method public android.app.FragmentManager getFragmentManager(); method public android.content.Intent getIntent(); - method public deprecated java.lang.Object getLastNonConfigurationInstance(); + method public java.lang.Object getLastNonConfigurationInstance(); method public android.view.LayoutInflater getLayoutInflater(); method public android.app.LoaderManager getLoaderManager(); method public java.lang.String getLocalClassName(); @@ -3543,7 +3543,7 @@ package android.app { method protected void onRestoreInstanceState(android.os.Bundle); method public void onRestoreInstanceState(android.os.Bundle, android.os.PersistableBundle); method protected void onResume(); - method public deprecated java.lang.Object onRetainNonConfigurationInstance(); + method public java.lang.Object onRetainNonConfigurationInstance(); method protected void onSaveInstanceState(android.os.Bundle); method public void onSaveInstanceState(android.os.Bundle, android.os.PersistableBundle); method public boolean onSearchRequested(android.view.SearchEvent); diff --git a/api/system-current.txt b/api/system-current.txt index 0461368c43e0e..e0a7effd260b2 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -3557,7 +3557,7 @@ package android.app { method public android.view.View getCurrentFocus(); method public android.app.FragmentManager getFragmentManager(); method public android.content.Intent getIntent(); - method public deprecated java.lang.Object getLastNonConfigurationInstance(); + method public java.lang.Object getLastNonConfigurationInstance(); method public android.view.LayoutInflater getLayoutInflater(); method public android.app.LoaderManager getLoaderManager(); method public java.lang.String getLocalClassName(); @@ -3660,7 +3660,7 @@ package android.app { method protected void onRestoreInstanceState(android.os.Bundle); method public void onRestoreInstanceState(android.os.Bundle, android.os.PersistableBundle); method protected void onResume(); - method public deprecated java.lang.Object onRetainNonConfigurationInstance(); + method public java.lang.Object onRetainNonConfigurationInstance(); method protected void onSaveInstanceState(android.os.Bundle); method public void onSaveInstanceState(android.os.Bundle, android.os.PersistableBundle); method public boolean onSearchRequested(android.view.SearchEvent); diff --git a/api/test-current.txt b/api/test-current.txt index f94bb2e285a59..9b4f2fc54e169 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -3442,7 +3442,7 @@ package android.app { method public android.view.View getCurrentFocus(); method public android.app.FragmentManager getFragmentManager(); method public android.content.Intent getIntent(); - method public deprecated java.lang.Object getLastNonConfigurationInstance(); + method public java.lang.Object getLastNonConfigurationInstance(); method public android.view.LayoutInflater getLayoutInflater(); method public android.app.LoaderManager getLoaderManager(); method public java.lang.String getLocalClassName(); @@ -3543,7 +3543,7 @@ package android.app { method protected void onRestoreInstanceState(android.os.Bundle); method public void onRestoreInstanceState(android.os.Bundle, android.os.PersistableBundle); method protected void onResume(); - method public deprecated java.lang.Object onRetainNonConfigurationInstance(); + method public java.lang.Object onRetainNonConfigurationInstance(); method protected void onSaveInstanceState(android.os.Bundle); method public void onSaveInstanceState(android.os.Bundle, android.os.PersistableBundle); method public boolean onSearchRequested(android.view.SearchEvent); diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 6b67b959064e3..a0a599e6c2210 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -1976,15 +1976,13 @@ public class Activity extends ContextThemeWrapper * normal {@link #onSaveInstanceState(Bundle)} mechanism) even if this * function returns null. * - * @return Returns the object previously returned by - * {@link #onRetainNonConfigurationInstance()}. - * - * @deprecated Use the new {@link Fragment} API + *

Note: For most cases you should use the {@link Fragment} API * {@link Fragment#setRetainInstance(boolean)} instead; this is also - * available on older platforms through the Android compatibility package. + * available on older platforms through the Android support libraries. + * + * @return the object previously returned by {@link #onRetainNonConfigurationInstance()} */ @Nullable - @Deprecated public Object getLastNonConfigurationInstance() { return mLastNonConfigurationInstances != null ? mLastNonConfigurationInstances.activity : null; @@ -2035,12 +2033,12 @@ public class Activity extends ContextThemeWrapper * guarantee for {@link android.os.AsyncTask#doInBackground} since that is * running in a separate thread.) * - * @return Return any Object holding the desired state to propagate to the - * next activity instance. - * - * @deprecated Use the new {@link Fragment} API + *

Note: For most cases you should use the {@link Fragment} API * {@link Fragment#setRetainInstance(boolean)} instead; this is also - * available on older platforms through the Android compatibility package. + * available on older platforms through the Android support libraries. + * + * @return any Object holding the desired state to propagate to the + * next activity instance */ public Object onRetainNonConfigurationInstance() { return null;