Merge "Fixing Taskbar not initialized properly on recreate" into sc-v2-dev
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index f5c1efa..96e8222 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -39,6 +39,7 @@
import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
+import android.os.DeadObjectException;
import android.os.Parcelable;
import android.os.RemoteException;
import android.os.SystemClock;
@@ -269,6 +270,9 @@
try (ContentProviderClient client = getContext().getContentResolver()
.acquireContentProviderClient(mTestProviderUri)) {
return client.call(request, null, null);
+ } catch (DeadObjectException e) {
+ fail("Launcher crashed");
+ return null;
} catch (RemoteException e) {
throw new RuntimeException(e);
}
diff --git a/tests/tapl/com/android/launcher3/tapl/Widgets.java b/tests/tapl/com/android/launcher3/tapl/Widgets.java
index 51e331d..99d9889 100644
--- a/tests/tapl/com/android/launcher3/tapl/Widgets.java
+++ b/tests/tapl/com/android/launcher3/tapl/Widgets.java
@@ -185,8 +185,12 @@
targetAppSelector);
if (headerTitle != null) {
// If we find the header and it has not been expanded, let's click it to see the
- // widgets list.
- if (!hasHeaderExpanded) {
+ // widgets list. Note that we wait until the header is out of the gesture region at
+ // the bottom of the screen, because tapping there in Launcher3 causes NexusLauncher
+ // to briefly appear to handle the gesture, which can break our test.
+ boolean isHeaderOutOfGestureRegion = headerTitle.getVisibleCenter().y
+ < mLauncher.getBottomGestureStartOnScreen();
+ if (!hasHeaderExpanded && isHeaderOutOfGestureRegion) {
log("Header has not been expanded. Click to expand.");
hasHeaderExpanded = true;
mLauncher.clickLauncherObject(headerTitle);