More logging for the widgets scroll bug

Bug: 160238801
Change-Id: I198aea39ccbb3b4ab6d8696cccc868cf6465b9d2
This commit is contained in:
vadimt
2020-07-10 12:31:21 -07:00
parent c146d0c38c
commit b35bdbc8ac
2 changed files with 11 additions and 2 deletions
@@ -20,8 +20,10 @@ import android.util.Log;
import androidx.recyclerview.widget.RecyclerView;
import com.android.launcher3.Utilities;
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.model.data.PackageItemInfo;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.widget.WidgetsListAdapter.WidgetListRowEntryComparator;
import java.util.ArrayList;
@@ -32,8 +34,8 @@ import java.util.Iterator;
* methods accordingly.
*/
public class WidgetsDiffReporter {
private static final boolean DEBUG = false;
private static final String TAG = "WidgetsDiffReporter";
private static final boolean DEBUG = Utilities.IS_RUNNING_IN_TEST_HARNESS; // b/160238801
private static final String TAG = TestProtocol.NO_SCROLL_END_WIDGETS;
private final IconCache mIconCache;
private final RecyclerView.Adapter mListener;
@@ -120,6 +120,9 @@ public class WidgetsRecyclerView extends BaseRecyclerView implements OnItemTouch
public int getCurrentScrollY() {
// Skip early if widgets are not bound.
if (isModelNotReady() || getChildCount() == 0) {
if (Utilities.IS_RUNNING_IN_TEST_HARNESS) {
Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "getCurrentScrollY: -1");
}
return -1;
}
@@ -128,6 +131,10 @@ public class WidgetsRecyclerView extends BaseRecyclerView implements OnItemTouch
int y = (child.getMeasuredHeight() * rowIndex);
int offset = getLayoutManager().getDecoratedTop(child);
if (Utilities.IS_RUNNING_IN_TEST_HARNESS) {
Log.d(TestProtocol.NO_SCROLL_END_WIDGETS,
"getCurrentScrollY: " + (getPaddingTop() + y - offset));
}
return getPaddingTop() + y - offset;
}