Loading core/java/android/app/Activity.java +11 −2 Original line number Diff line number Diff line Loading @@ -425,6 +425,12 @@ import java.util.List; * safely called after {@link #onPause()} and allows and application to safely * wait until {@link #onStop()} to save persistent state.</p> * * <p class="note">For applications targeting platforms starting with * {@link android.os.Build.VERSION_CODES#P} {@link #onSaveInstanceState(Bundle)} * will always be called after {@link #onStop}, so an application may safely * perform fragment transactions in {@link #onStop} and will be able to save * persistent state later.</p> * * <p>For those methods that are not marked as being killable, the activity's * process will not be killed by the system starting from the time the method * is called and continuing after it returns. Thus an activity is in the killable Loading Loading @@ -1577,8 +1583,11 @@ public class Activity extends ContextThemeWrapper * call through to the default implementation, otherwise be prepared to save * all of the state of each view yourself. * * <p>If called, this method will occur before {@link #onStop}. There are * no guarantees about whether it will occur before or after {@link #onPause}. * <p>If called, this method will occur after {@link #onStop} for applications * targeting platforms starting with {@link android.os.Build.VERSION_CODES#P}. * For applications targeting earlier platform versions this method will occur * before {@link #onStop} and there are no guarantees about whether it will * occur before or after {@link #onPause}. * * @param outState Bundle in which to place your saved state. * Loading core/java/android/app/ActivityThread.java +16 −7 Original line number Diff line number Diff line Loading @@ -488,12 +488,14 @@ public final class ActivityThread extends ClientTransactionHandler { } } public boolean isPreHoneycomb() { if (activity != null) { return activity.getApplicationInfo().targetSdkVersion private boolean isPreHoneycomb() { return activity != null && activity.getApplicationInfo().targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB; } return false; private boolean isPreP() { return activity != null && activity.getApplicationInfo().targetSdkVersion < android.os.Build.VERSION_CODES.P; } public boolean isPersistable() { Loading Loading @@ -4165,9 +4167,12 @@ public final class ActivityThread extends ClientTransactionHandler { * {@link Activity#onSaveInstanceState(Bundle)} is also executed in the same call. */ private void callActivityOnStop(ActivityClientRecord r, boolean saveState, String reason) { // Before P onSaveInstanceState was called before onStop, starting with P it's // called after. Before Honeycomb state was always saved before onPause. final boolean shouldSaveState = saveState && !r.activity.mFinished && r.state == null && !r.isPreHoneycomb(); if (shouldSaveState) { final boolean isPreP = r.isPreP(); if (shouldSaveState && isPreP) { callActivityOnSaveInstanceState(r); } Loading @@ -4186,6 +4191,10 @@ public final class ActivityThread extends ClientTransactionHandler { r.setState(ON_STOP); EventLog.writeEvent(LOG_AM_ON_STOP_CALLED, UserHandle.myUserId(), r.activity.getComponentName().getClassName(), reason); if (shouldSaveState && !isPreP) { callActivityOnSaveInstanceState(r); } } private void updateVisibility(ActivityClientRecord r, boolean show) { Loading Loading
core/java/android/app/Activity.java +11 −2 Original line number Diff line number Diff line Loading @@ -425,6 +425,12 @@ import java.util.List; * safely called after {@link #onPause()} and allows and application to safely * wait until {@link #onStop()} to save persistent state.</p> * * <p class="note">For applications targeting platforms starting with * {@link android.os.Build.VERSION_CODES#P} {@link #onSaveInstanceState(Bundle)} * will always be called after {@link #onStop}, so an application may safely * perform fragment transactions in {@link #onStop} and will be able to save * persistent state later.</p> * * <p>For those methods that are not marked as being killable, the activity's * process will not be killed by the system starting from the time the method * is called and continuing after it returns. Thus an activity is in the killable Loading Loading @@ -1577,8 +1583,11 @@ public class Activity extends ContextThemeWrapper * call through to the default implementation, otherwise be prepared to save * all of the state of each view yourself. * * <p>If called, this method will occur before {@link #onStop}. There are * no guarantees about whether it will occur before or after {@link #onPause}. * <p>If called, this method will occur after {@link #onStop} for applications * targeting platforms starting with {@link android.os.Build.VERSION_CODES#P}. * For applications targeting earlier platform versions this method will occur * before {@link #onStop} and there are no guarantees about whether it will * occur before or after {@link #onPause}. * * @param outState Bundle in which to place your saved state. * Loading
core/java/android/app/ActivityThread.java +16 −7 Original line number Diff line number Diff line Loading @@ -488,12 +488,14 @@ public final class ActivityThread extends ClientTransactionHandler { } } public boolean isPreHoneycomb() { if (activity != null) { return activity.getApplicationInfo().targetSdkVersion private boolean isPreHoneycomb() { return activity != null && activity.getApplicationInfo().targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB; } return false; private boolean isPreP() { return activity != null && activity.getApplicationInfo().targetSdkVersion < android.os.Build.VERSION_CODES.P; } public boolean isPersistable() { Loading Loading @@ -4165,9 +4167,12 @@ public final class ActivityThread extends ClientTransactionHandler { * {@link Activity#onSaveInstanceState(Bundle)} is also executed in the same call. */ private void callActivityOnStop(ActivityClientRecord r, boolean saveState, String reason) { // Before P onSaveInstanceState was called before onStop, starting with P it's // called after. Before Honeycomb state was always saved before onPause. final boolean shouldSaveState = saveState && !r.activity.mFinished && r.state == null && !r.isPreHoneycomb(); if (shouldSaveState) { final boolean isPreP = r.isPreP(); if (shouldSaveState && isPreP) { callActivityOnSaveInstanceState(r); } Loading @@ -4186,6 +4191,10 @@ public final class ActivityThread extends ClientTransactionHandler { r.setState(ON_STOP); EventLog.writeEvent(LOG_AM_ON_STOP_CALLED, UserHandle.myUserId(), r.activity.getComponentName().getClassName(), reason); if (shouldSaveState && !isPreP) { callActivityOnSaveInstanceState(r); } } private void updateVisibility(ActivityClientRecord r, boolean show) { Loading