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

Bug: 123613447
Test: manual run
Change-Id: I11367b9a3c8e01326a9685a31bd2b494e42da5a1
Merged-In: I11367b9a3c8e01326a9685a31bd2b494e42da5a1
diff --git a/tests/JobScheduler/src/android/jobscheduler/cts/BatteryConstraintTest.java b/tests/JobScheduler/src/android/jobscheduler/cts/BatteryConstraintTest.java
index cf9ec4c..2cfa3bb 100644
--- a/tests/JobScheduler/src/android/jobscheduler/cts/BatteryConstraintTest.java
+++ b/tests/JobScheduler/src/android/jobscheduler/cts/BatteryConstraintTest.java
@@ -46,6 +46,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();
 
@@ -299,6 +302,13 @@
         }
 
         setBatteryState(false, mLowBatteryWarningLevel);
+
+        if(getInstrumentation().getContext().getPackageManager().hasSystemFeature(FEATURE_WATCH) &&
+               getInstrumentation().getContext().getPackageManager().hasSystemFeature(
+               TWM_HARDWARE_FEATURE)) {
+            return;
+        }
+
         // 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
         // before proceeding.