Opt UI_MODE_TYPE_TELEVISION out of SearchManagerTest

BUG: 33040372
Change-Id: Ica5a1fa3b18eaa2d2564e71c454e2e2e5eb096d9
(cherry picked from commit a8dc7d102944ccb96936715f5a7a08b904db9bb8)
diff --git a/tests/app/src/android/app/cts/SearchManagerTest.java b/tests/app/src/android/app/cts/SearchManagerTest.java
index b1b5623..bf7e2f9 100644
--- a/tests/app/src/android/app/cts/SearchManagerTest.java
+++ b/tests/app/src/android/app/cts/SearchManagerTest.java
@@ -17,10 +17,12 @@
 package android.app.cts;
 
 import android.app.SearchManager;
+import android.app.UiModeManager;
 import android.app.stubs.CTSActivityTestCaseBase;
 import android.app.stubs.SearchManagerStubActivity;
 import android.content.Context;
 import android.content.Intent;
+import android.content.res.Configuration;
 
 public class SearchManagerTest extends CTSActivityTestCaseBase {
 
@@ -61,6 +63,10 @@
 
     private boolean hasGlobalSearchActivity() {
         Context context = getInstrumentation().getTargetContext();
+        UiModeManager uiModeManager = context.getSystemService(UiModeManager.class);
+        if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) {
+            return false;
+        }
         SearchManager searchManager =
                 (SearchManager) context.getSystemService(Context.SEARCH_SERVICE);
         if (searchManager == null) {