Loading core/java/android/app/ActivityThread.java +6 −0 Original line number Diff line number Diff line Loading @@ -3474,6 +3474,12 @@ public final class ActivityThread { if (r.mPreserveWindow) { a.mWindowAdded = true; r.mPreserveWindow = false; // Normally the ViewRoot sets up callbacks with the Activity // in addView->ViewRootImpl#setView. If we are instead reusing // the decor view we have to notify the view root that the // callbacks may have changed. ViewRootImpl impl = decor.getViewRootImpl(); impl.notifyChildRebuilt(); } if (a.mVisibleFromClient && !a.mWindowAdded) { a.mWindowAdded = true; Loading core/java/android/view/ViewRootImpl.java +31 −2 Original line number Diff line number Diff line Loading @@ -513,6 +513,34 @@ public final class ViewRootImpl implements ViewParent, return false; } /** * Notifies us that our child has been rebuilt, following * a window preservation operation. In these cases we * keep the same DecorView, but the activity controlling it * is a different instance, and we need to update our * callbacks. * * @hide */ public void notifyChildRebuilt() { if (mView instanceof RootViewSurfaceTaker) { mSurfaceHolderCallback = ((RootViewSurfaceTaker)mView).willYouTakeTheSurface(); if (mSurfaceHolderCallback != null) { mSurfaceHolder = new TakenSurfaceHolder(); mSurfaceHolder.setFormat(PixelFormat.UNKNOWN); } else { mSurfaceHolder = null; } mInputQueueCallback = ((RootViewSurfaceTaker)mView).willYouTakeTheInputQueue(); if (mInputQueueCallback != null) { mInputQueueCallback.onInputQueueCreated(mInputQueue); } } } /** * We have one child */ Loading Loading @@ -1645,6 +1673,8 @@ public final class ViewRootImpl implements ViewParent, boolean insetsPending = false; int relayoutResult = 0; final int surfaceGenerationId = mSurface.getGenerationId(); final boolean isViewVisible = viewVisibility == View.VISIBLE; if (mFirst || windowShouldResize || insetsChanged || viewVisibilityChanged || params != null || mForceNextWindowRelayout) { Loading Loading @@ -1689,7 +1719,6 @@ public final class ViewRootImpl implements ViewParent, } mChoreographer.mFrameInfo.addFlags(FrameInfo.FLAG_WINDOW_LAYOUT_CHANGED); } final int surfaceGenerationId = mSurface.getGenerationId(); relayoutResult = relayoutWindow(params, viewVisibility, insetsPending); if (DEBUG_LAYOUT) Log.v(mTag, "relayout: frame=" + frame.toShortString() Loading Loading @@ -1883,7 +1912,7 @@ public final class ViewRootImpl implements ViewParent, mSurfaceHolder.setSurfaceFrameSize(mWidth, mHeight); mSurfaceHolder.mSurfaceLock.unlock(); if (mSurface.isValid()) { if (!hadSurface) { if (!hadSurface || surfaceGenerationId != mSurface.getGenerationId()) { mSurfaceHolder.ungetCallbacks(); mIsCreating = true; Loading Loading
core/java/android/app/ActivityThread.java +6 −0 Original line number Diff line number Diff line Loading @@ -3474,6 +3474,12 @@ public final class ActivityThread { if (r.mPreserveWindow) { a.mWindowAdded = true; r.mPreserveWindow = false; // Normally the ViewRoot sets up callbacks with the Activity // in addView->ViewRootImpl#setView. If we are instead reusing // the decor view we have to notify the view root that the // callbacks may have changed. ViewRootImpl impl = decor.getViewRootImpl(); impl.notifyChildRebuilt(); } if (a.mVisibleFromClient && !a.mWindowAdded) { a.mWindowAdded = true; Loading
core/java/android/view/ViewRootImpl.java +31 −2 Original line number Diff line number Diff line Loading @@ -513,6 +513,34 @@ public final class ViewRootImpl implements ViewParent, return false; } /** * Notifies us that our child has been rebuilt, following * a window preservation operation. In these cases we * keep the same DecorView, but the activity controlling it * is a different instance, and we need to update our * callbacks. * * @hide */ public void notifyChildRebuilt() { if (mView instanceof RootViewSurfaceTaker) { mSurfaceHolderCallback = ((RootViewSurfaceTaker)mView).willYouTakeTheSurface(); if (mSurfaceHolderCallback != null) { mSurfaceHolder = new TakenSurfaceHolder(); mSurfaceHolder.setFormat(PixelFormat.UNKNOWN); } else { mSurfaceHolder = null; } mInputQueueCallback = ((RootViewSurfaceTaker)mView).willYouTakeTheInputQueue(); if (mInputQueueCallback != null) { mInputQueueCallback.onInputQueueCreated(mInputQueue); } } } /** * We have one child */ Loading Loading @@ -1645,6 +1673,8 @@ public final class ViewRootImpl implements ViewParent, boolean insetsPending = false; int relayoutResult = 0; final int surfaceGenerationId = mSurface.getGenerationId(); final boolean isViewVisible = viewVisibility == View.VISIBLE; if (mFirst || windowShouldResize || insetsChanged || viewVisibilityChanged || params != null || mForceNextWindowRelayout) { Loading Loading @@ -1689,7 +1719,6 @@ public final class ViewRootImpl implements ViewParent, } mChoreographer.mFrameInfo.addFlags(FrameInfo.FLAG_WINDOW_LAYOUT_CHANGED); } final int surfaceGenerationId = mSurface.getGenerationId(); relayoutResult = relayoutWindow(params, viewVisibility, insetsPending); if (DEBUG_LAYOUT) Log.v(mTag, "relayout: frame=" + frame.toShortString() Loading Loading @@ -1883,7 +1912,7 @@ public final class ViewRootImpl implements ViewParent, mSurfaceHolder.setSurfaceFrameSize(mWidth, mHeight); mSurfaceHolder.mSurfaceLock.unlock(); if (mSurface.isValid()) { if (!hadSurface) { if (!hadSurface || surfaceGenerationId != mSurface.getGenerationId()) { mSurfaceHolder.ungetCallbacks(); mIsCreating = true; Loading