diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java index 7e9e8645e6..ee72c222eb 100644 --- a/src/com/android/launcher3/CellLayout.java +++ b/src/com/android/launcher3/CellLayout.java @@ -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(); diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 6c706bec09..c2df1a2d98 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -2701,6 +2701,20 @@ public class Launcher extends StatefulActivity 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); diff --git a/src/com/android/launcher3/ShortcutAndWidgetContainer.java b/src/com/android/launcher3/ShortcutAndWidgetContainer.java index d2c3c78367..a8733f2e69 100644 --- a/src/com/android/launcher3/ShortcutAndWidgetContainer.java +++ b/src/com/android/launcher3/ShortcutAndWidgetContainer.java @@ -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); diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 2995e8a3ee..255260e8af 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -235,6 +235,7 @@ public class Workspace extends PagedView boolean mChildrenLayersEnabled = true; private boolean mStripScreensOnPageStopMoving = false; + public boolean mHasOnLayoutBeenCalled = false; private boolean mWorkspaceFadeInAdjacentScreens; @@ -1445,6 +1446,7 @@ public class Workspace extends PagedView @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;