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

Commit 6d978d6d authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Few little fragment, wm tweaks."

parents 1ffb1776 352cc98b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ final class FragmentState implements Parcelable {
        }
        mInstance.setIndex(mIndex);
        mInstance.mFromLayout = mFromLayout;
        mInstance.mRestored = true;
        mInstance.mFragmentId = mFragmentId;
        mInstance.mContainerId = mContainerId;
        mInstance.mTag = mTag;
@@ -363,6 +364,9 @@ public class Fragment implements ComponentCallbacks, OnCreateContextMenuListener
    // Set to true when the view has actually been inflated in its layout.
    boolean mInLayout;

    // True if this fragment has been restored from previously saved state.
    boolean mRestored;
    
    // Number of active back stack entries this fragment is in.
    int mBackStackNesting;
    
+1 −1
Original line number Diff line number Diff line
@@ -690,7 +690,7 @@ final class FragmentManagerImpl extends FragmentManager {
                            ViewGroup container = null;
                            if (f.mContainerId != 0) {
                                container = (ViewGroup)mActivity.findViewById(f.mContainerId);
                                if (container == null) {
                                if (container == null && !f.mRestored) {
                                    throw new IllegalArgumentException("No view found for id 0x"
                                            + Integer.toHexString(f.mContainerId)
                                            + " for fragment " + f);
+68 −46
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ class ScreenRotationAnimation {
    final Context mContext;
    final Display mDisplay;
    Surface mSurface;
    Surface mBlackSurface;
    int mWidth, mHeight;

    int mSnapshotRotation;
@@ -84,19 +85,30 @@ class ScreenRotationAnimation {
        mOriginalHeight = mDisplayMetrics.heightPixels;

        Surface.openTransaction();
        if (mSurface != null) {
            mSurface.destroy();
            mSurface = null;
        }
        
        try {
            mSurface = new Surface(session, 0, "FreezeSurface",
                    -1, mWidth, mHeight, PixelFormat.OPAQUE, 0);
            mSurface.setLayer(WindowManagerService.TYPE_LAYER_MULTIPLIER * 200);
        } catch (Surface.OutOfResourcesException e) {
            Slog.w(TAG, "Unable to allocate freeze surface", e);
        }
        mSurface.setLayer(WindowManagerService.TYPE_LAYER_MULTIPLIER * 200);
        
        if (false) {
            try {
                int size = mOriginalWidth > mOriginalHeight ? mOriginalWidth : mOriginalHeight;
                mBlackSurface = new Surface(session, 0, "BlackSurface",
                        -1, size, size, PixelFormat.OPAQUE, Surface.FX_SURFACE_DIM);
                mBlackSurface.setAlpha(1.0f);
                mBlackSurface.setLayer(0);
            } catch (Surface.OutOfResourcesException e) {
                Slog.w(TAG, "Unable to allocate black surface", e);
            }
        }
        
        setRotation(display.getRotation());

        if (mSurface != null) {
            Rect dirty = new Rect(0, 0, mWidth, mHeight);
            Canvas c = null;
            try {
@@ -120,6 +132,8 @@ class ScreenRotationAnimation {
            }
    
            mSurface.unlockCanvasAndPost(c);
        }
        
        Surface.closeTransaction();

        if (screenshot != null) {
@@ -134,6 +148,7 @@ class ScreenRotationAnimation {
    }

    void setSnapshotTransform(Matrix matrix, float alpha) {
        if (mSurface != null) {
            matrix.getValues(mTmpFloats);
            mSurface.setPosition((int)mTmpFloats[Matrix.MTRANS_X],
                    (int)mTmpFloats[Matrix.MTRANS_Y]);
@@ -151,6 +166,7 @@ class ScreenRotationAnimation {
                        + ")-(" + dstPnts[2] + "," + dstPnts[3] + ")");
            }
        }
    }

    public static void createRotationMatrix(int rotation, int width, int height,
            Matrix outMatrix) {
@@ -254,6 +270,10 @@ class ScreenRotationAnimation {
            mSurface.destroy();
            mSurface = null;
        }
        if (mBlackSurface != null) {
            mBlackSurface.destroy();
            mBlackSurface = null;
        }
        if (mExitAnimation != null) {
            mExitAnimation.cancel();
            mExitAnimation = null;
@@ -293,6 +313,10 @@ class ScreenRotationAnimation {
                    mSurface.destroy();
                    mSurface = null;
                }
                if (mBlackSurface != null) {
                    mBlackSurface.destroy();
                    mBlackSurface = null;
                }
            }
        }

@@ -307,10 +331,8 @@ class ScreenRotationAnimation {
            }
        }

        if (mSurface != null) {
        mSnapshotFinalMatrix.setConcat(mExitTransformation.getMatrix(), mSnapshotInitialMatrix);
        setSnapshotTransform(mSnapshotFinalMatrix, mExitTransformation.getAlpha());
        }

        return moreEnter || moreExit;
    }