Fix TaplTestsNexus#testSearchForApp
This cl is 1/2 part change We are currently getting StaleObjectException when running this test. We want to implment a synchoronized event beetween test and launcher, so we know that search result adapter is done updating and page will get no more updates of search results. Test: Presubmit Bug: 232008758 Flag: not needed Change-Id: I40cf9b83d231a2487220aabc8f8e8c3ca71f255c
This commit is contained in:
1 parent
0940399f72
commit
311d519292
8 files changed
+27
-35
No files matched your search
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.launcher3;
|
||||
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.SCROLL_FINISHED_MESSAGE;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
@@ -170,7 +172,8 @@ public abstract class FastScrollRecyclerView extends RecyclerView {
|
||||
super.onScrollStateChanged(state);
|
||||
|
||||
if (state == SCROLL_STATE_IDLE) {
|
||||
AccessibilityManagerCompat.sendScrollFinishedEventToTest(getContext());
|
||||
AccessibilityManagerCompat.sendTestProtocolEventToTest(getContext(),
|
||||
SCROLL_FINISHED_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.android.launcher3;
|
||||
import static com.android.app.animation.Interpolators.SCROLL;
|
||||
import static com.android.launcher3.compat.AccessibilityManagerCompat.isAccessibilityEnabled;
|
||||
import static com.android.launcher3.compat.AccessibilityManagerCompat.isObservedEventType;
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.SCROLL_FINISHED_MESSAGE;
|
||||
import static com.android.launcher3.touch.OverScroll.OVERSCROLL_DAMP_FACTOR;
|
||||
import static com.android.launcher3.touch.PagedOrientationHandler.VIEW_SCROLL_BY;
|
||||
import static com.android.launcher3.touch.PagedOrientationHandler.VIEW_SCROLL_TO;
|
||||
@@ -492,7 +493,8 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
*/
|
||||
protected void onPageEndTransition() {
|
||||
mCurrentPageScrollDiff = 0;
|
||||
AccessibilityManagerCompat.sendScrollFinishedEventToTest(getContext());
|
||||
AccessibilityManagerCompat.sendTestProtocolEventToTest(getContext(),
|
||||
SCROLL_FINISHED_MESSAGE);
|
||||
AccessibilityManagerCompat.sendCustomAccessibilityEvent(getPageAt(mCurrentPage),
|
||||
AccessibilityEvent.TYPE_VIEW_FOCUSED, null);
|
||||
if (mOnPageTransitionEndCallback != null) {
|
||||
|
||||
@@ -74,38 +74,12 @@ public class AccessibilityManagerCompat {
|
||||
Log.d(TestProtocol.PERMANENT_DIAG_TAG, "sendStateEventToTest: " + stateOrdinal);
|
||||
}
|
||||
|
||||
public static void sendScrollFinishedEventToTest(Context context) {
|
||||
public static void sendTestProtocolEventToTest(Context context, String testProtocolEvent) {
|
||||
final AccessibilityManager accessibilityManager = getAccessibilityManagerForTest(context);
|
||||
if (accessibilityManager == null) return;
|
||||
|
||||
sendEventToTest(accessibilityManager, context, TestProtocol.SCROLL_FINISHED_MESSAGE, null);
|
||||
sendEventToTest(accessibilityManager, context, testProtocolEvent, null);
|
||||
}
|
||||
|
||||
public static void sendPauseDetectedEventToTest(Context context) {
|
||||
final AccessibilityManager accessibilityManager = getAccessibilityManagerForTest(context);
|
||||
if (accessibilityManager == null) return;
|
||||
|
||||
sendEventToTest(accessibilityManager, context, TestProtocol.PAUSE_DETECTED_MESSAGE, null);
|
||||
}
|
||||
|
||||
public static void sendDismissAnimationEndsEventToTest(Context context) {
|
||||
final AccessibilityManager accessibilityManager = getAccessibilityManagerForTest(context);
|
||||
if (accessibilityManager == null) return;
|
||||
|
||||
sendEventToTest(accessibilityManager, context, TestProtocol.DISMISS_ANIMATION_ENDS_MESSAGE,
|
||||
null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify running tests of a folder opened.
|
||||
*/
|
||||
public static void sendFolderOpenedEventToTest(Context context) {
|
||||
final AccessibilityManager accessibilityManager = getAccessibilityManagerForTest(context);
|
||||
if (accessibilityManager == null) return;
|
||||
|
||||
sendEventToTest(accessibilityManager, context, TestProtocol.FOLDER_OPENED_MESSAGE, null);
|
||||
}
|
||||
|
||||
private static void sendEventToTest(
|
||||
AccessibilityManager accessibilityManager,
|
||||
Context context, String eventTag, Bundle data) {
|
||||
|
||||
@@ -25,6 +25,7 @@ import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustom
|
||||
import static com.android.launcher3.config.FeatureFlags.ALWAYS_USE_HARDWARE_OPTIMIZATION_FOR_FOLDER_ANIMATIONS;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_LABEL_UPDATED;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ITEM_DROP_COMPLETED;
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.FOLDER_OPENED_MESSAGE;
|
||||
import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs;
|
||||
|
||||
import android.animation.Animator;
|
||||
@@ -692,7 +693,8 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
setState(STATE_OPEN);
|
||||
announceAccessibilityChanges();
|
||||
AccessibilityManagerCompat.sendFolderOpenedEventToTest(getContext());
|
||||
AccessibilityManagerCompat.sendTestProtocolEventToTest(getContext(),
|
||||
FOLDER_OPENED_MESSAGE);
|
||||
|
||||
mContent.setFocusOnFirstChild();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user