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

Commit a0ffafff authored by George Mount's avatar George Mount
Browse files

Address API council feedback.

Bug 37636027

Change FragmentTransaction#setAllowOptimization() to
FragmentTransaction#setReorderingAllowed().

Test: I729dc05bde1f6eba6ff8d38eb15f65de777c14bb
Change-Id: I24c35aad95ffa14d2e2fa092ae71d3d459e6d648
parent 7e44951b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4852,7 +4852,6 @@ package android.app {
    method public abstract android.app.FragmentTransaction remove(android.app.Fragment);
    method public abstract android.app.FragmentTransaction replace(int, android.app.Fragment);
    method public abstract android.app.FragmentTransaction replace(int, android.app.Fragment, java.lang.String);
    method public abstract android.app.FragmentTransaction setAllowOptimization(boolean);
    method public abstract android.app.FragmentTransaction setBreadCrumbShortTitle(int);
    method public abstract android.app.FragmentTransaction setBreadCrumbShortTitle(java.lang.CharSequence);
    method public abstract android.app.FragmentTransaction setBreadCrumbTitle(int);
@@ -4860,6 +4859,7 @@ package android.app {
    method public abstract android.app.FragmentTransaction setCustomAnimations(int, int);
    method public abstract android.app.FragmentTransaction setCustomAnimations(int, int, int, int);
    method public abstract android.app.FragmentTransaction setPrimaryNavigationFragment(android.app.Fragment);
    method public abstract android.app.FragmentTransaction setReorderingAllowed(boolean);
    method public abstract android.app.FragmentTransaction setTransition(int);
    method public abstract android.app.FragmentTransaction setTransitionStyle(int);
    method public abstract android.app.FragmentTransaction show(android.app.Fragment);
+1 −1
Original line number Diff line number Diff line
@@ -5020,7 +5020,6 @@ package android.app {
    method public abstract android.app.FragmentTransaction remove(android.app.Fragment);
    method public abstract android.app.FragmentTransaction replace(int, android.app.Fragment);
    method public abstract android.app.FragmentTransaction replace(int, android.app.Fragment, java.lang.String);
    method public abstract android.app.FragmentTransaction setAllowOptimization(boolean);
    method public abstract android.app.FragmentTransaction setBreadCrumbShortTitle(int);
    method public abstract android.app.FragmentTransaction setBreadCrumbShortTitle(java.lang.CharSequence);
    method public abstract android.app.FragmentTransaction setBreadCrumbTitle(int);
@@ -5028,6 +5027,7 @@ package android.app {
    method public abstract android.app.FragmentTransaction setCustomAnimations(int, int);
    method public abstract android.app.FragmentTransaction setCustomAnimations(int, int, int, int);
    method public abstract android.app.FragmentTransaction setPrimaryNavigationFragment(android.app.Fragment);
    method public abstract android.app.FragmentTransaction setReorderingAllowed(boolean);
    method public abstract android.app.FragmentTransaction setTransition(int);
    method public abstract android.app.FragmentTransaction setTransitionStyle(int);
    method public abstract android.app.FragmentTransaction show(android.app.Fragment);
+1 −1
Original line number Diff line number Diff line
@@ -4865,7 +4865,6 @@ package android.app {
    method public abstract android.app.FragmentTransaction remove(android.app.Fragment);
    method public abstract android.app.FragmentTransaction replace(int, android.app.Fragment);
    method public abstract android.app.FragmentTransaction replace(int, android.app.Fragment, java.lang.String);
    method public abstract android.app.FragmentTransaction setAllowOptimization(boolean);
    method public abstract android.app.FragmentTransaction setBreadCrumbShortTitle(int);
    method public abstract android.app.FragmentTransaction setBreadCrumbShortTitle(java.lang.CharSequence);
    method public abstract android.app.FragmentTransaction setBreadCrumbTitle(int);
@@ -4873,6 +4872,7 @@ package android.app {
    method public abstract android.app.FragmentTransaction setCustomAnimations(int, int);
    method public abstract android.app.FragmentTransaction setCustomAnimations(int, int, int, int);
    method public abstract android.app.FragmentTransaction setPrimaryNavigationFragment(android.app.Fragment);
    method public abstract android.app.FragmentTransaction setReorderingAllowed(boolean);
    method public abstract android.app.FragmentTransaction setTransition(int);
    method public abstract android.app.FragmentTransaction setTransitionStyle(int);
    method public abstract android.app.FragmentTransaction show(android.app.Fragment);
+13 −15
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package android.app;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
@@ -45,7 +43,7 @@ final class BackStackState implements Parcelable {
    final CharSequence mBreadCrumbShortTitleText;
    final ArrayList<String> mSharedElementSourceNames;
    final ArrayList<String> mSharedElementTargetNames;
    final boolean mAllowOptimization;
    final boolean mReorderingAllowed;

    public BackStackState(FragmentManagerImpl fm, BackStackRecord bse) {
        final int numOps = bse.mOps.size();
@@ -75,7 +73,7 @@ final class BackStackState implements Parcelable {
        mBreadCrumbShortTitleText = bse.mBreadCrumbShortTitleText;
        mSharedElementSourceNames = bse.mSharedElementSourceNames;
        mSharedElementTargetNames = bse.mSharedElementTargetNames;
        mAllowOptimization = bse.mAllowOptimization;
        mReorderingAllowed = bse.mReorderingAllowed;
    }

    public BackStackState(Parcel in) {
@@ -90,7 +88,7 @@ final class BackStackState implements Parcelable {
        mBreadCrumbShortTitleText = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
        mSharedElementSourceNames = in.createStringArrayList();
        mSharedElementTargetNames = in.createStringArrayList();
        mAllowOptimization = in.readInt() != 0;
        mReorderingAllowed = in.readInt() != 0;
    }

    public BackStackRecord instantiate(FragmentManagerImpl fm) {
@@ -133,7 +131,7 @@ final class BackStackState implements Parcelable {
        bse.mBreadCrumbShortTitleText = mBreadCrumbShortTitleText;
        bse.mSharedElementSourceNames = mSharedElementSourceNames;
        bse.mSharedElementTargetNames = mSharedElementTargetNames;
        bse.mAllowOptimization = mAllowOptimization;
        bse.mReorderingAllowed = mReorderingAllowed;
        bse.bumpBackStackNesting(1);
        return bse;
    }
@@ -154,7 +152,7 @@ final class BackStackState implements Parcelable {
        TextUtils.writeToParcel(mBreadCrumbShortTitleText, dest, 0);
        dest.writeStringList(mSharedElementSourceNames);
        dest.writeStringList(mSharedElementTargetNames);
        dest.writeInt(mAllowOptimization ? 1 : 0);
        dest.writeInt(mReorderingAllowed ? 1 : 0);
    }

    public static final Parcelable.Creator<BackStackState> CREATOR
@@ -218,7 +216,7 @@ final class BackStackRecord extends FragmentTransaction implements
    String mName;
    boolean mCommitted;
    int mIndex = -1;
    boolean mAllowOptimization;
    boolean mReorderingAllowed;

    ArrayList<Runnable> mCommitRunnables;

@@ -370,7 +368,7 @@ final class BackStackRecord extends FragmentTransaction implements

    public BackStackRecord(FragmentManagerImpl manager) {
        mManager = manager;
        mAllowOptimization = mManager.getTargetSdk() > Build.VERSION_CODES.N_MR1;
        mReorderingAllowed = mManager.getTargetSdk() > Build.VERSION_CODES.N_MR1;
    }

    public int getId() {
@@ -665,8 +663,8 @@ final class BackStackRecord extends FragmentTransaction implements
    }

    @Override
    public FragmentTransaction setAllowOptimization(boolean allowOptimization) {
        mAllowOptimization = allowOptimization;
    public FragmentTransaction setReorderingAllowed(boolean reorderingAllowed) {
        mReorderingAllowed = reorderingAllowed;
        return this;
    }

@@ -800,11 +798,11 @@ final class BackStackRecord extends FragmentTransaction implements
                default:
                    throw new IllegalArgumentException("Unknown cmd: " + op.cmd);
            }
            if (!mAllowOptimization && op.cmd != OP_ADD && f != null) {
            if (!mReorderingAllowed && op.cmd != OP_ADD && f != null) {
                mManager.moveFragmentToExpectedState(f);
            }
        }
        if (!mAllowOptimization) {
        if (!mReorderingAllowed) {
            // Added fragments are added at the end to comply with prior behavior.
            mManager.moveToState(mManager.mCurState, true);
        }
@@ -859,11 +857,11 @@ final class BackStackRecord extends FragmentTransaction implements
                default:
                    throw new IllegalArgumentException("Unknown cmd: " + op.cmd);
            }
            if (!mAllowOptimization && op.cmd != OP_REMOVE && f != null) {
            if (!mReorderingAllowed && op.cmd != OP_REMOVE && f != null) {
                mManager.moveFragmentToExpectedState(f);
            }
        }
        if (!mAllowOptimization && moveToState) {
        if (!mReorderingAllowed && moveToState) {
            mManager.moveToState(mManager.mCurState, true);
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -2417,7 +2417,7 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
     * enabled.
     *
     * @see Activity#postponeEnterTransition()
     * @see FragmentTransaction#setAllowOptimization(boolean)
     * @see FragmentTransaction#setReorderingAllowed(boolean)
     */
    public void postponeEnterTransition() {
        ensureAnimationInfo().mEnterTransitionPostponed = true;
Loading