Merge "Skip traversal of invisible visibility change"
This commit is contained in:
committed by
Android (Google) Code Review
commit
b75ab6270c
@@ -1554,9 +1554,14 @@ public final class ViewRootImpl implements ViewParent,
|
||||
|
||||
void handleAppVisibility(boolean visible) {
|
||||
if (mAppVisible != visible) {
|
||||
final boolean previousVisible = getHostVisibility() == View.VISIBLE;
|
||||
mAppVisible = visible;
|
||||
mAppVisibilityChanged = true;
|
||||
scheduleTraversals();
|
||||
final boolean currentVisible = getHostVisibility() == View.VISIBLE;
|
||||
// Root view only cares about whether it is visible or not.
|
||||
if (previousVisible != currentVisible) {
|
||||
mAppVisibilityChanged = true;
|
||||
scheduleTraversals();
|
||||
}
|
||||
if (!mAppVisible) {
|
||||
WindowManagerGlobal.trimForeground();
|
||||
}
|
||||
@@ -1846,8 +1851,13 @@ public final class ViewRootImpl implements ViewParent,
|
||||
renderer.setStopped(mStopped);
|
||||
}
|
||||
if (!mStopped) {
|
||||
mNewSurfaceNeeded = true;
|
||||
scheduleTraversals();
|
||||
// Unnecessary to traverse if the window is not yet visible.
|
||||
if (getHostVisibility() == View.VISIBLE) {
|
||||
// Make sure that relayoutWindow will be called to get valid surface because
|
||||
// the previous surface may have been released.
|
||||
mAppVisibilityChanged = true;
|
||||
scheduleTraversals();
|
||||
}
|
||||
} else {
|
||||
if (renderer != null) {
|
||||
renderer.destroyHardwareResources(mView);
|
||||
@@ -2028,7 +2038,8 @@ public final class ViewRootImpl implements ViewParent,
|
||||
}
|
||||
|
||||
int getHostVisibility() {
|
||||
return (mAppVisible || mForceDecorViewVisibility) ? mView.getVisibility() : View.GONE;
|
||||
return mView != null && (mAppVisible || mForceDecorViewVisibility)
|
||||
? mView.getVisibility() : View.GONE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user