Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3d32f6e5 authored by Jeff Hamilton's avatar Jeff Hamilton
Browse files

Add Activity.isChangingConfiguration().

This allows activities to know if they're being
torn down due to a configuration change.

Bug: 2557550
Change-Id: Ibd9bf5a06c92dbe3789049b84133cf4754381873
parent 7819e1d7
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -19677,6 +19677,17 @@
 visibility="public"
>
</method>
<method name="isChangingConfigurations"
 return="boolean"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="isChild"
 return="boolean"
 abstract="false"
+15 −0
Original line number Diff line number Diff line
@@ -637,6 +637,8 @@ public class Activity extends ContextThemeWrapper
    private boolean mStopped;
    boolean mFinished;
    boolean mStartedActivity;
    /** true if the activity is being destroyed in order to recreate it with a new configuration */
    /*package*/ boolean mChangingConfigurations = false;
    /*package*/ int mConfigChangeFlags;
    /*package*/ Configuration mCurrentConfig;
    private SearchManager mSearchManager;
@@ -3401,6 +3403,19 @@ public class Activity extends ContextThemeWrapper
        return mFinished;
    }

    /**
     * Check to see whether this activity is in the process of being destroyed in order to be
     * recreated with a new configuration. This is often used in
     * {@link #onStop} to determine whether the state needs to be cleaned up or will be passed
     * on to the next instance of the activity via {@link #onRetainNonConfigurationInstance()}.
     * 
     * @return If the activity is being torn down in order to be recreated with a new configuration,
     * returns true; else returns false.
     */
    public boolean isChangingConfigurations() {
        return mChangingConfigurations;
    }

    /**
     * Call this when your activity is done and should be closed.  The
     * ActivityResult is propagated back to whoever launched you via
+3 −0
Original line number Diff line number Diff line
@@ -3575,6 +3575,9 @@ public final class ActivityThread {
            if (finishing) {
                r.activity.mFinished = true;
            }
            if (getNonConfigInstance) {
                r.activity.mChangingConfigurations = true;
            }
            if (!r.paused) {
                try {
                    r.activity.mCalled = false;