Don't show cling dialogs when test harness is active.

Bug 5204219

Change-Id: I651b8d8c16a203f0e0fdeed97435a841de15dabf
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 44dbc15..2fade8f 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -24,6 +24,7 @@
 import android.animation.PropertyValuesHolder;
 import android.animation.ValueAnimator;
 import android.app.Activity;
+import android.app.ActivityManager;
 import android.app.AlertDialog;
 import android.app.Dialog;
 import android.app.SearchManager;
@@ -2978,6 +2979,9 @@
         // TEMPORARY: DISABLE CLINGS ON LARGE UI
         if (LauncherApplication.isScreenLarge()) return;
 
+        // disable clings when running in a test harness
+        if(ActivityManager.isRunningInTestHarness()) return;
+
         // Enable the clings only if they have not been dismissed before
         SharedPreferences prefs =
             getSharedPreferences("com.android.launcher2.prefs", Context.MODE_PRIVATE);