Add logs to check if onLayout is ever not called.

Bug: 349929393
Test: Verified locally that the logs are shown in a bugreport.
Flag: EXEMPT logs
Change-Id: Ie5b759a2616456db9e232efcb0cfd21fdd4cc291
This commit is contained in:
Stefan Andonian
2024-08-14 22:51:32 +00:00
parent ecb9ecd770
commit fb34891ba6
4 changed files with 21 additions and 1 deletions
+3 -1
View File
@@ -86,7 +86,7 @@ import java.util.Stack;
public class CellLayout extends ViewGroup {
private static final String TAG = "CellLayout";
private static final boolean LOGD = false;
private static final boolean LOGD = true;
/** The color of the "leave-behind" shape when a folder is opened from Hotseat. */
private static final int FOLDER_LEAVE_BEHIND_COLOR = Color.argb(160, 245, 245, 245);
@@ -166,6 +166,7 @@ public class CellLayout extends ViewGroup {
private final int[] mDragCellSpan = new int[2];
private boolean mDragging = false;
public boolean mHasOnLayoutBeenCalled = false;
private final TimeInterpolator mEaseOutInterpolator;
protected final ShortcutAndWidgetContainer mShortcutsAndWidgets;
@@ -1009,6 +1010,7 @@ public class CellLayout extends ViewGroup {
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
mHasOnLayoutBeenCalled = true; // b/349929393 - is the required call to onLayout not done?
int left = getPaddingLeft();
left += (int) Math.ceil(getUnusedHorizontalSpace() / 2f);
int right = r - l - getPaddingRight();
+14
View File
@@ -2701,6 +2701,20 @@ public class Launcher extends StatefulActivity<LauncherState>
writer.println(prefix + "\tmAppWidgetHolder.isListening: "
+ mAppWidgetHolder.isListening());
// b/349929393
// The only way to reproduce this bug is to ensure that onLayout never gets called. This
// theoretically is impossible, so these logs are being added to test if that actually is
// what is happening.
writer.println(prefix + "\tmWorkspace.mHasOnLayoutBeenCalled="
+ mWorkspace.mHasOnLayoutBeenCalled);
for (int i = 0; i < mWorkspace.getPageCount(); i++) {
CellLayout cellLayout = (CellLayout) mWorkspace.getPageAt(i);
writer.println(prefix + "\tcellLayout." + i + ".mHasOnLayoutBeenCalled="
+ cellLayout.mHasOnLayoutBeenCalled);
writer.println(prefix + "\tshortcutAndWidgetContainer." + i + ".mHasOnLayoutBeenCalled="
+ cellLayout.getShortcutsAndWidgets().mHasOnLayoutBeenCalled);
}
// Extra logging for general debugging
mDragLayer.dump(prefix, writer);
mStateManager.dump(prefix, writer);
@@ -64,6 +64,7 @@ public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon.
private final ActivityContext mActivity;
private boolean mInvertIfRtl = false;
public boolean mHasOnLayoutBeenCalled = false;
@Nullable
private TranslationProvider mTranslationProvider = null;
@@ -201,6 +202,7 @@ public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon.
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
Trace.beginSection("ShortcutAndWidgetConteiner#onLayout");
mHasOnLayoutBeenCalled = true; // b/349929393 - is the required call to onLayout not done?
int count = getChildCount();
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
+2
View File
@@ -235,6 +235,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
boolean mChildrenLayersEnabled = true;
private boolean mStripScreensOnPageStopMoving = false;
public boolean mHasOnLayoutBeenCalled = false;
private boolean mWorkspaceFadeInAdjacentScreens;
@@ -1445,6 +1446,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
mHasOnLayoutBeenCalled = true; // b/349929393 - is the required call to onLayout not done?
if (mUnlockWallpaperFromDefaultPageOnLayout) {
mWallpaperOffset.setLockToDefaultPage(false);
mUnlockWallpaperFromDefaultPageOnLayout = false;