Skip to content
Snippets Groups Projects
Commit 711055aa authored by Vishnu Nair's avatar Vishnu Nair
Browse files

Add visibility reason to ViewRootImpl draw logs

Help root cause issues where the window does not draw because it
thinks its invisible.

Bug: 342257086
Test: presubmit
Change-Id: I40f12eada2e643e9c351814378a05b66a83a92e3
parent 9784b7cc
No related branches found
No related tags found
No related merge requests found
......@@ -2755,11 +2755,27 @@ public final class ViewRootImpl implements ViewParent,
public void bringChildToFront(View child) {
}
 
// keep in sync with getHostVisibilityReason
int getHostVisibility() {
return mView != null && (mAppVisible || mForceDecorViewVisibility)
? mView.getVisibility() : View.GONE;
}
 
String getHostVisibilityReason() {
if (mView == null) {
return "mView is null";
}
if (!mAppVisible && !mForceDecorViewVisibility) {
return "!mAppVisible && !mForceDecorViewVisibility";
}
switch (mView.getVisibility()) {
case View.VISIBLE: return "View.VISIBLE";
case View.GONE: return "View.GONE";
case View.INVISIBLE: return "View.INVISIBLE";
default: return "";
}
}
/**
* Add LayoutTransition to the list of transitions to be started in the next traversal.
* This list will be cleared after the transitions on the list are start()'ed. These
......@@ -3311,6 +3327,7 @@ public final class ViewRootImpl implements ViewParent,
int desiredWindowHeight;
 
final int viewVisibility = getHostVisibility();
final String viewVisibilityReason = getHostVisibilityReason();
final boolean viewVisibilityChanged = !mFirst
&& (mViewVisibility != viewVisibility || mNewSurfaceNeeded
// Also check for possible double visibility update, which will make current
......@@ -4185,7 +4202,7 @@ public final class ViewRootImpl implements ViewParent,
 
if (!isViewVisible) {
if (mLastTraversalWasVisible) {
logAndTrace("Not drawing due to not visible");
logAndTrace("Not drawing due to not visible. Reason=" + viewVisibilityReason);
}
mLastPerformTraversalsSkipDrawReason = "view_not_visible";
if (mPendingTransitions != null && mPendingTransitions.size() > 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment