diff options
| author | Andrii Kulian <akulian@google.com> | 2017-08-23 18:06:50 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-08-23 18:06:50 +0000 |
| commit | 0d008e32047f009d37bf6185a958a451df822e2c (patch) | |
| tree | 31fe45e54f627da771821e88ff2edaaabbdd3a21 /core/java/android | |
| parent | 07168bf44b97f3d9d6b80b615d983f0eba84254b (diff) | |
| parent | 74b561a1fcc7e0b350dfa59f3e0f928168e16fd8 (diff) | |
Merge "Track app visibility updates on the client" into oc-mr1-dev
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 6bf48450fc71..22faeed72a0f 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -259,6 +259,9 @@ public final class ViewRootImpl implements ViewParent, // visibility to control drawing. The decor view visibility will get adjusted when the app get // stopped and that's when the app will stop drawing further frames. private boolean mForceDecorViewVisibility = false; + // Used for tracking app visibility updates separately in case we get double change. This will + // make sure that we always call relayout for the corresponding window. + private boolean mAppVisibilityChanged; int mOrigWindowType = -1; /** Whether the window had focus during the most recent traversal. */ @@ -1058,6 +1061,7 @@ public final class ViewRootImpl implements ViewParent, void handleAppVisibility(boolean visible) { if (mAppVisible != visible) { mAppVisible = visible; + mAppVisibilityChanged = true; scheduleTraversals(); if (!mAppVisible) { WindowManagerGlobal.trimForeground(); @@ -1600,7 +1604,11 @@ public final class ViewRootImpl implements ViewParent, final int viewVisibility = getHostVisibility(); final boolean viewVisibilityChanged = !mFirst - && (mViewVisibility != viewVisibility || mNewSurfaceNeeded); + && (mViewVisibility != viewVisibility || mNewSurfaceNeeded + // Also check for possible double visibility update, which will make current + // viewVisibility value equal to mViewVisibility and we may miss it. + || mAppVisibilityChanged); + mAppVisibilityChanged = false; final boolean viewUserVisibilityChanged = !mFirst && ((mViewVisibility == View.VISIBLE) != (viewVisibility == View.VISIBLE)); |
