Gate test to skip on watches when in traditional watch mode.

Bug: 123613447
Test: manual run
Change-Id: I11367b9a3c8e01326a9685a31bd2b494e42da5a1
diff --git a/tests/JobScheduler/src/android/jobscheduler/cts/BatteryConstraintTest.java b/tests/JobScheduler/src/android/jobscheduler/cts/BatteryConstraintTest.java
index f8a4228..f1dca8b 100644
--- a/tests/JobScheduler/src/android/jobscheduler/cts/BatteryConstraintTest.java
+++ b/tests/JobScheduler/src/android/jobscheduler/cts/BatteryConstraintTest.java
@@ -45,6 +45,9 @@
 public class BatteryConstraintTest extends ConstraintTest {
     private static final String TAG = "BatteryConstraintTest";
 
+    private String FEATURE_WATCH = "android.hardware.type.watch";
+    private String TWM_HARDWARE_FEATURE = "com.google.clockwork.hardware.traditional_watch_mode";
+
     /** Unique identifier for the job scheduled by this suite of tests. */
     public static final int BATTERY_JOB_ID = BatteryConstraintTest.class.hashCode();
 
@@ -268,6 +271,12 @@
      * the battery level is critical and not on power.
      */
     public void testBatteryNotLowConstraintFails_withoutPower() throws Exception {
+        if(getInstrumentation().getContext().getPackageManager().hasSystemFeature(FEATURE_WATCH) &&
+               getInstrumentation().getContext().getPackageManager().hasSystemFeature(
+               TWM_HARDWARE_FEATURE)) {
+            return;
+        }
+
         setBatteryState(false, 5);
         // setBatteryState() waited for the charging/not-charging state to formally settle,
         // but battery level reporting lags behind that.  wait a moment to let that happen