Merge "Workaround issue with latest version of RecyclerView which is overriding our custom accessibility delegate" into ub-launcher3-qt-dev
diff --git a/iconloaderlib/build.gradle b/iconloaderlib/build.gradle
index 49d427e..8a4d2b7 100644
--- a/iconloaderlib/build.gradle
+++ b/iconloaderlib/build.gradle
@@ -1,13 +1,3 @@
-buildscript {
- repositories {
- mavenCentral()
- google()
- }
- dependencies {
- classpath GRADLE_CLASS_PATH
- }
-}
-
apply plugin: 'com.android.library'
android {
@@ -44,12 +34,6 @@
}
}
-
-repositories {
- mavenCentral()
- google()
-}
-
dependencies {
implementation "androidx.core:core:${ANDROID_X_VERSION}"
}
diff --git a/iconloaderlib/src/com/android/launcher3/icons/DotRenderer.java b/iconloaderlib/src/com/android/launcher3/icons/DotRenderer.java
index af07aa3..97a0fd3 100644
--- a/iconloaderlib/src/com/android/launcher3/icons/DotRenderer.java
+++ b/iconloaderlib/src/com/android/launcher3/icons/DotRenderer.java
@@ -85,6 +85,14 @@
return pos;
}
+ public float[] getLeftDotPosition() {
+ return mLeftDotPosition;
+ }
+
+ public float[] getRightDotPosition() {
+ return mRightDotPosition;
+ }
+
/**
* Draw a circle on top of the canvas according to the given params.
*/
diff --git a/quickstep/src/com/android/quickstep/util/LayoutUtils.java b/quickstep/src/com/android/quickstep/util/LayoutUtils.java
index c8aed81..050bdff 100644
--- a/quickstep/src/com/android/quickstep/util/LayoutUtils.java
+++ b/quickstep/src/com/android/quickstep/util/LayoutUtils.java
@@ -110,7 +110,7 @@
float y = insets.top + Math.max(topIconMargin,
(launcherVisibleHeight - extraVerticalSpace - outHeight) / 2);
outRect.set(Math.round(x), Math.round(y),
- Math.round(x + outWidth), Math.round(y + outHeight));
+ Math.round(x) + Math.round(outWidth), Math.round(y) + Math.round(outHeight));
}
public static int getShelfTrackingDistance(Context context, DeviceProfile dp) {
diff --git a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java
index 90763b8..3b35c86 100644
--- a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java
+++ b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java
@@ -159,13 +159,20 @@
}
for (int i = 0; i != 100; ++i) {
- if (mLauncher.getNavigationModel() == expectedMode) {
- Thread.sleep(5000);
- return;
- }
+ if (mLauncher.getNavigationModel() == expectedMode) break;
Thread.sleep(100);
}
- Assert.fail("Couldn't switch to " + overlayPackage);
+ Assert.assertTrue("Couldn't switch to " + overlayPackage,
+ mLauncher.getNavigationModel() == expectedMode);
+
+ for (int i = 0; i != 100; ++i) {
+ if (mLauncher.getNavigationModeMismatchError() == null) break;
+ Thread.sleep(100);
+ }
+ final String error = mLauncher.getNavigationModeMismatchError();
+ Assert.assertTrue("Switching nav mode: " + error, error == null);
+
+ Thread.sleep(5000);
}
private void setOverlayPackageEnabled(String overlayPackage, boolean enable)
diff --git a/tests/src/com/android/launcher3/ui/PortraitLandscapeRunner.java b/tests/src/com/android/launcher3/ui/PortraitLandscapeRunner.java
index 20cd1e7..d7c1411 100644
--- a/tests/src/com/android/launcher3/ui/PortraitLandscapeRunner.java
+++ b/tests/src/com/android/launcher3/ui/PortraitLandscapeRunner.java
@@ -49,14 +49,12 @@
mTest.mDevice.setOrientationNatural();
mTest.mLauncher.setExpectedRotation(Surface.ROTATION_0);
base.evaluate();
- mTest.mLauncher.pressHome();
}
private void evaluateInLandscape() throws Throwable {
mTest.mDevice.setOrientationLeft();
mTest.mLauncher.setExpectedRotation(Surface.ROTATION_90);
base.evaluate();
- mTest.mLauncher.pressHome();
}
};
}
diff --git a/tests/src/com/android/launcher3/ui/TestViewHelpers.java b/tests/src/com/android/launcher3/ui/TestViewHelpers.java
index a73bde0..d13d319 100644
--- a/tests/src/com/android/launcher3/ui/TestViewHelpers.java
+++ b/tests/src/com/android/launcher3/ui/TestViewHelpers.java
@@ -54,21 +54,6 @@
return UiDevice.getInstance(getInstrumentation());
}
- /**
- * Opens all apps and returns the recycler view
- */
- public static UiObject2 openAllApps() {
- final UiDevice device = getDevice();
- device.waitForIdle();
- UiObject2 hotseat = device.wait(
- Until.findObject(getSelectorForId(R.id.hotseat)), 2500);
- Point start = hotseat.getVisibleCenter();
- int endY = (int) (device.getDisplayHeight() * 0.1f);
- // 100 px/step
- device.swipe(start.x, start.y, start.x, endY, (start.y - endY) / 100);
- return findViewById(R.id.apps_list_view);
- }
-
public static UiObject2 findViewById(int id) {
return getDevice().wait(Until.findObject(getSelectorForId(id)),
AbstractLauncherUiTest.DEFAULT_UI_TIMEOUT);
diff --git a/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java b/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java
index be27a66..2766a3e 100644
--- a/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java
+++ b/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java
@@ -15,6 +15,8 @@
*/
package com.android.launcher3.ui.widget;
+import static com.android.launcher3.ui.TaplTestsLauncher3.getAppPackageName;
+
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
@@ -41,7 +43,6 @@
import com.android.launcher3.testcomponent.AppWidgetWithConfig;
import com.android.launcher3.testcomponent.RequestPinItemActivity;
import com.android.launcher3.ui.AbstractLauncherUiTest;
-import com.android.launcher3.ui.TestViewHelpers;
import com.android.launcher3.util.Condition;
import com.android.launcher3.util.Wait;
import com.android.launcher3.util.rule.ShellCommandRule;
@@ -149,14 +150,14 @@
clearHomescreen();
mActivityMonitor.startLauncher();
- // Open all apps and wait for load complete
- final UiObject2 appsContainer = TestViewHelpers.openAllApps();
- Wait.atMost(null, Condition.minChildCount(appsContainer, 2), DEFAULT_UI_TIMEOUT);
-
// Open Pin item activity
BlockingBroadcastReceiver openMonitor = new BlockingBroadcastReceiver(
RequestPinItemActivity.class.getName());
- scrollAndFind(appsContainer, By.text("Test Pin Item")).click();
+ mLauncher.
+ getWorkspace().
+ switchToAllApps().
+ getAppIcon("Test Pin Item").
+ launch(getAppPackageName());
assertNotNull(openMonitor.blockingGetExtraIntent());
// Set callback
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index ffb42fb..7171bf9 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -315,18 +315,26 @@
mExpectedRotation = expectedRotation;
}
- private UiObject2 verifyContainerType(ContainerType containerType) {
- assertEquals("Unexpected display rotation",
- mExpectedRotation, mDevice.getDisplayRotation());
+ public String getNavigationModeMismatchError() {
final NavigationModel navigationModel = getNavigationModel();
final boolean hasRecentsButton = hasSystemUiObject("recent_apps");
final boolean hasHomeButton = hasSystemUiObject("home");
- assertTrue("Presence of recents button doesn't match the interaction mode, mode="
- + navigationModel.name() + ", hasRecents=" + hasRecentsButton,
- (navigationModel == NavigationModel.THREE_BUTTON) == hasRecentsButton);
- assertTrue("Presence of home button doesn't match the interaction mode, mode="
- + navigationModel.name() + ", hasHome=" + hasHomeButton,
- (navigationModel != NavigationModel.ZERO_BUTTON) == hasHomeButton);
+ if ((navigationModel == NavigationModel.THREE_BUTTON) != hasRecentsButton) {
+ return "Presence of recents button doesn't match the interaction mode, mode="
+ + navigationModel.name() + ", hasRecents=" + hasRecentsButton;
+ }
+ if ((navigationModel != NavigationModel.ZERO_BUTTON) != hasHomeButton) {
+ return "Presence of home button doesn't match the interaction mode, mode="
+ + navigationModel.name() + ", hasHome=" + hasHomeButton;
+ }
+ return null;
+ }
+
+ private UiObject2 verifyContainerType(ContainerType containerType) {
+ assertEquals("Unexpected display rotation",
+ mExpectedRotation, mDevice.getDisplayRotation());
+ final String error = getNavigationModeMismatchError();
+ assertTrue(error, error == null);
log("verifyContainerType: " + containerType);
try (Closable c = addContextLayer(