Merge "Remove clock mode time picker when only testing spinner mode" into oreo-mr1-cts-dev
diff --git a/tests/tests/widget/src/android/widget/cts/TimePickerTest.java b/tests/tests/widget/src/android/widget/cts/TimePickerTest.java
index ce093e7..0886aa3 100644
--- a/tests/tests/widget/src/android/widget/cts/TimePickerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TimePickerTest.java
@@ -553,6 +553,12 @@
         prepareForKeyboardInput(initialHour, initialMinute, false /* is24hFormat */,
                 false /* isClockMode */);
 
+        // when testing on device with lower resolution, the Spinner mode time picker may not show
+        // completely, which will cause case fail, so in this case remove the clock time picker to
+        // focus on the test of Spinner mode
+        final TimePicker clock = mActivity.findViewById(R.id.timepicker_clock);
+        mActivityRule.runOnUiThread(() -> clock.setVisibility(View.GONE));
+
         assertEquals(initialHour, mTimePicker.getHour());
         mActivityRule.runOnUiThread(() -> mTimePicker.getHourView().requestFocus());
         mInstrumentation.waitForIdleSync();
@@ -665,6 +671,12 @@
         prepareForKeyboardInput(initialHour, initialMinute, true /* is24hFormat */,
                 false /* isClockMode */);
 
+        // when testing on device with lower resolution, the Spinner mode time picker may not show
+        // completely, which will cause case fail, so in this case remove the clock time picker to
+        // focus on the test of Spinner mode
+        final TimePicker clock = mActivity.findViewById(R.id.timepicker_clock);
+        mActivityRule.runOnUiThread(() -> clock.setVisibility(View.GONE));
+
         assertEquals(initialHour, mTimePicker.getHour());
         mActivityRule.runOnUiThread(() -> mTimePicker.getHourView().requestFocus());
         mInstrumentation.waitForIdleSync();