Stop android.print tests from executing if the device does not support print.

Bug: 24856532
Change-Id: Ia3a01043782f81a6605a79a68f0f943d4d051f6a

# Conflicts:
#	tests/tests/print/src/android/print/cts/BasePrintTest.java
diff --git a/tests/tests/print/src/android/print/cts/BasePrintTest.java b/tests/tests/print/src/android/print/cts/BasePrintTest.java
index c4dd026..8a59c14 100644
--- a/tests/tests/print/src/android/print/cts/BasePrintTest.java
+++ b/tests/tests/print/src/android/print/cts/BasePrintTest.java
@@ -139,6 +139,14 @@
     }
 
     @Override
+    protected void runTest() throws Throwable {
+        // Do nothing if the device does not support printing.
+        if (supportsPrinting()) {
+            super.runTest();
+        }
+    }
+
+    @Override
     public void setUp() throws Exception {
         super.setUp();
         if (!supportsPrinting()) {
@@ -181,25 +189,28 @@
 
     @Override
     public void tearDown() throws Exception {
-        if (supportsPrinting()) {
-            // Done with the activity.
-            getActivity().finish();
-            enableImes();
-
-            // Restore the locale if needed.
-            if (mOldLocale != null) {
-                Resources resources = getInstrumentation().getTargetContext().getResources();
-                DisplayMetrics displayMetrics = resources.getDisplayMetrics();
-                Configuration newConfiguration = new Configuration(resources.getConfiguration());
-                newConfiguration.locale = mOldLocale;
-                mOldLocale = null;
-                resources.updateConfiguration(newConfiguration, displayMetrics);
-            }
-
-            disablePrintServices();
-            // Make sure the spooler is cleaned.
-            clearPrintSpoolerData();
+        if (!supportsPrinting()) {
+            return;
         }
+
+        // Done with the activity.
+        getActivity().finish();
+        enableImes();
+
+        // Restore the locale if needed.
+        if (mOldLocale != null) {
+            Resources resources = getInstrumentation().getTargetContext().getResources();
+            DisplayMetrics displayMetrics = resources.getDisplayMetrics();
+            Configuration newConfiguration = new Configuration(resources.getConfiguration());
+            newConfiguration.locale = mOldLocale;
+            mOldLocale = null;
+            resources.updateConfiguration(newConfiguration, displayMetrics);
+        }
+
+        disablePrintServices();
+        // Make sure the spooler is cleaned.
+        clearPrintSpoolerData();
+
         super.tearDown();
     }