Loading core/java/android/app/Activity.java +8 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.WindowManagerImpl; import android.view.View.OnCreateContextMenuListener; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; Loading Loading @@ -4402,6 +4403,9 @@ public class Activity extends ContextThemeWrapper if (mStopped) { mStopped = false; mCalled = false; if (mToken != null && mParent == null) { WindowManagerImpl.getDefault().setStoppedState(mToken, false); } mInstrumentation.callActivityOnRestart(this); if (!mCalled) { throw new SuperNotCalledException( Loading Loading @@ -4478,6 +4482,10 @@ public class Activity extends ContextThemeWrapper mWindow.closeAllPanels(); } if (mToken != null && mParent == null) { WindowManagerImpl.getDefault().setStoppedState(mToken, true); } mFragments.dispatchStop(); mCalled = false; Loading core/java/android/view/ViewRoot.java +59 −44 Original line number Diff line number Diff line Loading @@ -155,6 +155,10 @@ public final class ViewRoot extends Handler implements ViewParent, int mViewVisibility; boolean mAppVisible = true; // Set to true if the owner of this window is in the stopped state, // so the window should no longer be active. boolean mStopped = false; SurfaceHolder.Callback2 mSurfaceHolderCallback; BaseSurfaceHolder mSurfaceHolder; boolean mIsCreating; Loading Loading @@ -618,6 +622,15 @@ public final class ViewRoot extends Handler implements ViewParent, scheduleTraversals(); } void setStopped(boolean stopped) { if (mStopped != stopped) { mStopped = stopped; if (!stopped) { scheduleTraversals(); } } } public ViewParent getParent() { return null; } Loading Loading @@ -760,7 +773,7 @@ public final class ViewRoot extends Handler implements ViewParent, boolean insetsChanged = false; if (mLayoutRequested) { if (mLayoutRequested && !mStopped) { // Execute enqueued actions on every layout in case a view that was detached // enqueued an action after being detached getRunQueue().executeActions(attachInfo.mHandler); Loading Loading @@ -1143,6 +1156,7 @@ public final class ViewRoot extends Handler implements ViewParent, mAttachInfo.mHardwareRenderer.setup(mWidth, mHeight); } if (!mStopped) { boolean focusChangedDueToTouchMode = ensureTouchModeLocally( (relayoutResult&WindowManagerImpl.RELAYOUT_IN_TOUCH_MODE) != 0); if (focusChangedDueToTouchMode || mWidth != host.getMeasuredWidth() Loading Loading @@ -1189,8 +1203,9 @@ public final class ViewRoot extends Handler implements ViewParent, mLayoutRequested = true; } } } final boolean didLayout = mLayoutRequested; final boolean didLayout = mLayoutRequested && !mStopped; boolean triggerGlobalLayoutListener = didLayout || attachInfo.mRecomputeGlobalAttributes; if (didLayout) { Loading core/java/android/view/WindowManagerImpl.java +14 −0 Original line number Diff line number Diff line Loading @@ -302,6 +302,20 @@ public class WindowManagerImpl implements WindowManager { } } public void setStoppedState(IBinder token, boolean stopped) { synchronized (this) { if (mViews == null) return; int count = mViews.length; for (int i=0; i<count; i++) { if (token == null || mParams[i].token == token) { ViewRoot root = mRoots[i]; root.setStopped(stopped); } } } } public WindowManager.LayoutParams getRootViewLayoutParameter(View view) { ViewParent vp = view.getParent(); while (vp != null && !(vp instanceof ViewRoot)) { Loading Loading
core/java/android/app/Activity.java +8 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.WindowManagerImpl; import android.view.View.OnCreateContextMenuListener; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; Loading Loading @@ -4402,6 +4403,9 @@ public class Activity extends ContextThemeWrapper if (mStopped) { mStopped = false; mCalled = false; if (mToken != null && mParent == null) { WindowManagerImpl.getDefault().setStoppedState(mToken, false); } mInstrumentation.callActivityOnRestart(this); if (!mCalled) { throw new SuperNotCalledException( Loading Loading @@ -4478,6 +4482,10 @@ public class Activity extends ContextThemeWrapper mWindow.closeAllPanels(); } if (mToken != null && mParent == null) { WindowManagerImpl.getDefault().setStoppedState(mToken, true); } mFragments.dispatchStop(); mCalled = false; Loading
core/java/android/view/ViewRoot.java +59 −44 Original line number Diff line number Diff line Loading @@ -155,6 +155,10 @@ public final class ViewRoot extends Handler implements ViewParent, int mViewVisibility; boolean mAppVisible = true; // Set to true if the owner of this window is in the stopped state, // so the window should no longer be active. boolean mStopped = false; SurfaceHolder.Callback2 mSurfaceHolderCallback; BaseSurfaceHolder mSurfaceHolder; boolean mIsCreating; Loading Loading @@ -618,6 +622,15 @@ public final class ViewRoot extends Handler implements ViewParent, scheduleTraversals(); } void setStopped(boolean stopped) { if (mStopped != stopped) { mStopped = stopped; if (!stopped) { scheduleTraversals(); } } } public ViewParent getParent() { return null; } Loading Loading @@ -760,7 +773,7 @@ public final class ViewRoot extends Handler implements ViewParent, boolean insetsChanged = false; if (mLayoutRequested) { if (mLayoutRequested && !mStopped) { // Execute enqueued actions on every layout in case a view that was detached // enqueued an action after being detached getRunQueue().executeActions(attachInfo.mHandler); Loading Loading @@ -1143,6 +1156,7 @@ public final class ViewRoot extends Handler implements ViewParent, mAttachInfo.mHardwareRenderer.setup(mWidth, mHeight); } if (!mStopped) { boolean focusChangedDueToTouchMode = ensureTouchModeLocally( (relayoutResult&WindowManagerImpl.RELAYOUT_IN_TOUCH_MODE) != 0); if (focusChangedDueToTouchMode || mWidth != host.getMeasuredWidth() Loading Loading @@ -1189,8 +1203,9 @@ public final class ViewRoot extends Handler implements ViewParent, mLayoutRequested = true; } } } final boolean didLayout = mLayoutRequested; final boolean didLayout = mLayoutRequested && !mStopped; boolean triggerGlobalLayoutListener = didLayout || attachInfo.mRecomputeGlobalAttributes; if (didLayout) { Loading
core/java/android/view/WindowManagerImpl.java +14 −0 Original line number Diff line number Diff line Loading @@ -302,6 +302,20 @@ public class WindowManagerImpl implements WindowManager { } } public void setStoppedState(IBinder token, boolean stopped) { synchronized (this) { if (mViews == null) return; int count = mViews.length; for (int i=0; i<count; i++) { if (token == null || mParams[i].token == token) { ViewRoot root = mRoots[i]; root.setStopped(stopped); } } } } public WindowManager.LayoutParams getRootViewLayoutParameter(View view) { ViewParent vp = view.getParent(); while (vp != null && !(vp instanceof ViewRoot)) { Loading