summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVadim Tryshev <vadimt@google.com>2018-06-18 19:14:44 -0700
committerVadim Tryshev <vadimt@google.com>2018-07-20 14:43:05 -0700
commit2ce6a13f6096ed5e08b252e7e53255ef1027f65e (patch)
tree40030752744b5a3f170f1dea3cab149aa5c13ab7 /src
parent32f91ab991dd2a1c6c0054c86b8700f2b966fd36 (diff)
downloadandroid_packages_apps_Trebuchet-2ce6a13f6096ed5e08b252e7e53255ef1027f65e.tar.gz
android_packages_apps_Trebuchet-2ce6a13f6096ed5e08b252e7e53255ef1027f65e.tar.bz2
android_packages_apps_Trebuchet-2ce6a13f6096ed5e08b252e7e53255ef1027f65e.zip
Tapl library
The public API of the library has finalized; flakiness has been removed; code polished. Bug: 110103162 Test: TaplTests suite Change-Id: Ic156bbfeedb1cb9c4a48ef907f97e396e8e81936
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/Utilities.java4
-rw-r--r--src/com/android/launcher3/Workspace.java2
-rw-r--r--src/com/android/launcher3/compat/AccessibilityManagerCompat.java18
-rw-r--r--src/com/android/launcher3/touch/AbstractStateChangeTouchController.java3
-rw-r--r--src/com/android/launcher3/views/OptionsPopupView.java6
-rw-r--r--src/com/android/launcher3/widget/WidgetsFullSheet.java6
6 files changed, 38 insertions, 1 deletions
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 8683b2103..7c5bb1af8 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -16,6 +16,7 @@
package com.android.launcher3;
+import android.app.ActivityManager;
import android.app.WallpaperManager;
import android.content.ComponentName;
import android.content.Context;
@@ -130,6 +131,9 @@ public final class Utilities {
CORE_POOL_SIZE, MAXIMUM_POOL_SIZE, KEEP_ALIVE,
TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
+ public static final boolean IS_RUNNING_IN_TEST_HARNESS =
+ ActivityManager.isRunningInTestHarness();
+
public static boolean isPropertyEnabled(String propertyName) {
return Log.isLoggable(propertyName, Log.VERBOSE);
}
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 67bdd3bdd..00527018a 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -1034,7 +1034,7 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
}
protected void onScrollInteractionBegin() {
- super.onScrollInteractionEnd();
+ super.onScrollInteractionBegin();
mScrollInteractionBegan = true;
}
diff --git a/src/com/android/launcher3/compat/AccessibilityManagerCompat.java b/src/com/android/launcher3/compat/AccessibilityManagerCompat.java
index 0c78381ea..29fc2bc60 100644
--- a/src/com/android/launcher3/compat/AccessibilityManagerCompat.java
+++ b/src/com/android/launcher3/compat/AccessibilityManagerCompat.java
@@ -16,11 +16,14 @@
package com.android.launcher3.compat;
+import android.accessibilityservice.AccessibilityServiceInfo;
import android.content.Context;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
+import com.android.launcher3.Utilities;
+
public class AccessibilityManagerCompat {
public static boolean isAccessibilityEnabled(Context context) {
@@ -44,4 +47,19 @@ public class AccessibilityManagerCompat {
private static AccessibilityManager getManager(Context context) {
return (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
}
+
+ public static void sendEventToTest(Context context, String eventTag) {
+ if (!Utilities.IS_RUNNING_IN_TEST_HARNESS) return;
+
+ final AccessibilityManager accessibilityManager = getManager(context);
+ if (accessibilityManager.isEnabled() &&
+ accessibilityManager.getEnabledAccessibilityServiceList(
+ AccessibilityServiceInfo.FEEDBACK_ALL_MASK).size() == 0) {
+
+ final AccessibilityEvent e = AccessibilityEvent.obtain(
+ AccessibilityEvent.TYPE_ANNOUNCEMENT);
+ e.setClassName(eventTag);
+ accessibilityManager.sendAccessibilityEvent(e);
+ }
+ }
}
diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
index 55f850c8d..0e277eabc 100644
--- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
+++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
@@ -43,6 +43,7 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.AnimatorSetBuilder;
+import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
@@ -515,6 +516,8 @@ public abstract class AbstractStateChangeTouchController
logReachedState(logAction, targetState);
}
mLauncher.getStateManager().goToState(targetState, false /* animated */);
+
+ AccessibilityManagerCompat.sendEventToTest(mLauncher, "TAPL_WENT_TO_STATE");
}
}
diff --git a/src/com/android/launcher3/views/OptionsPopupView.java b/src/com/android/launcher3/views/OptionsPopupView.java
index 504663936..dc6d2ff09 100644
--- a/src/com/android/launcher3/views/OptionsPopupView.java
+++ b/src/com/android/launcher3/views/OptionsPopupView.java
@@ -22,6 +22,7 @@ import android.content.Context;
import android.content.Intent;
import android.graphics.Rect;
import android.graphics.RectF;
+import android.support.annotation.VisibleForTesting;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.AttributeSet;
@@ -133,6 +134,11 @@ public class OptionsPopupView extends ArrowPopup
popup.reorderAndShow(popup.getChildCount());
}
+ @VisibleForTesting
+ public static OptionsPopupView getOptionsPopup(Launcher launcher) {
+ return launcher.findViewById(R.id.deep_shortcuts_container);
+ }
+
public static void showDefaultOptions(Launcher launcher, float x, float y) {
float halfSize = launcher.getResources().getDimension(R.dimen.options_menu_thumb_size) / 2;
if (x < 0 || y < 0) {
diff --git a/src/com/android/launcher3/widget/WidgetsFullSheet.java b/src/com/android/launcher3/widget/WidgetsFullSheet.java
index e94d81d75..b49322832 100644
--- a/src/com/android/launcher3/widget/WidgetsFullSheet.java
+++ b/src/com/android/launcher3/widget/WidgetsFullSheet.java
@@ -20,6 +20,7 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.PropertyValuesHolder;
import android.content.Context;
import android.graphics.Rect;
+import android.support.annotation.VisibleForTesting;
import android.util.AttributeSet;
import android.util.Pair;
import android.view.LayoutInflater;
@@ -224,6 +225,11 @@ public class WidgetsFullSheet extends BaseWidgetSheet
return sheet;
}
+ @VisibleForTesting
+ public static WidgetsRecyclerView getWidgetsView(Launcher launcher) {
+ return launcher.findViewById(R.id.widgets_list_view);
+ }
+
@Override
protected int getElementsRowCount() {
return mAdapter.getItemCount();