Merge "Fix flaky widget tapl tests" into sc-dev am: b9649edefe
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14255145 Change-Id: Ifad881ec7f80f337dd2d7ab518cddcd6e0065cc3
This commit is contained in:
@@ -50,6 +50,7 @@ import com.android.launcher3.Insettable;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.launcher3.compat.AccessibilityManagerCompat;
|
||||
import com.android.launcher3.model.WidgetItem;
|
||||
@@ -649,7 +650,8 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
||||
}
|
||||
|
||||
private boolean hasSeenEducationTip() {
|
||||
return mLauncher.getSharedPrefs().getBoolean(WIDGETS_EDUCATION_TIP_SEEN, false);
|
||||
return mLauncher.getSharedPrefs().getBoolean(WIDGETS_EDUCATION_TIP_SEEN, false)
|
||||
|| Utilities.IS_RUNNING_IN_TEST_HARNESS;
|
||||
}
|
||||
|
||||
/** A holder class for holding adapters & their corresponding recycler view. */
|
||||
|
||||
@@ -169,12 +169,16 @@ public final class Widgets extends LauncherInstrumentation.VisibleContainer {
|
||||
"widgets_table");
|
||||
|
||||
boolean hasHeaderExpanded = false;
|
||||
int scrollDistance = 0;
|
||||
for (int i = 0; i < SCROLL_ATTEMPTS; i++) {
|
||||
UiObject2 fullWidgetsPicker = verifyActiveContainer();
|
||||
|
||||
UiObject2 header = mLauncher.waitForObjectInContainer(fullWidgetsPicker,
|
||||
headerSelector);
|
||||
int headerHeight = header.getVisibleBounds().height();
|
||||
// If a header is barely visible in the bottom edge of the screen, its height could be
|
||||
// too small for a scroll gesture. Since all header should have roughly the same height,
|
||||
// let's pick the max height we have seen so far.
|
||||
scrollDistance = Math.max(scrollDistance, header.getVisibleBounds().height());
|
||||
|
||||
// Look for a header that has the test app name.
|
||||
UiObject2 headerTitle = mLauncher.findObjectInContainer(fullWidgetsPicker,
|
||||
@@ -196,7 +200,8 @@ public final class Widgets extends LauncherInstrumentation.VisibleContainer {
|
||||
return widgetsContainer;
|
||||
}
|
||||
}
|
||||
mLauncher.scrollDownByDistance(fullWidgetsPicker, headerHeight);
|
||||
log("Finding test widget package - scroll with distance: " + scrollDistance);
|
||||
mLauncher.scrollDownByDistance(fullWidgetsPicker, scrollDistance);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user