Merge "Refactor repeated WIFI bringup code in ConnectivityManagerTest" into oc-dev
diff --git a/tests/tests/media/src/android/media/cts/RingtoneManagerTest.java b/tests/tests/media/src/android/media/cts/RingtoneManagerTest.java
index 96b33da..3dff5bf 100644
--- a/tests/tests/media/src/android/media/cts/RingtoneManagerTest.java
+++ b/tests/tests/media/src/android/media/cts/RingtoneManagerTest.java
@@ -99,12 +99,19 @@
         return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUDIO_OUTPUT);
     }
 
+    private boolean isTV() {
+        return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK_ONLY);
+    }
+
     public void testConstructors() {
         new RingtoneManager(mActivity);
         new RingtoneManager(mContext);
     }
 
     public void testAccessMethods() {
+        if (isTV()) {
+            return;
+        }
         if (!hasAudioOutput()) {
             Log.i(TAG, "Skipping testAccessMethods(): device doesn't have audio output.");
             return;
@@ -145,6 +152,9 @@
     }
 
     public void testStopPreviousRingtone() {
+        if (isTV()) {
+            return;
+        }
         if (!hasAudioOutput()) {
             Log.i(TAG, "Skipping testStopPreviousRingtone(): device doesn't have audio output.");
             return;
diff --git a/tests/tests/media/src/android/media/cts/RingtoneTest.java b/tests/tests/media/src/android/media/cts/RingtoneTest.java
index 1477f3f..31ae5bb 100644
--- a/tests/tests/media/src/android/media/cts/RingtoneTest.java
+++ b/tests/tests/media/src/android/media/cts/RingtoneTest.java
@@ -107,10 +107,18 @@
 
     private boolean hasAudioOutput() {
         return getInstrumentation().getContext().getPackageManager()
-            .hasSystemFeature(PackageManager.FEATURE_AUDIO_OUTPUT);
+                .hasSystemFeature(PackageManager.FEATURE_AUDIO_OUTPUT);
+    }
+
+    private boolean isTV() {
+        return getInstrumentation().getContext().getPackageManager()
+                .hasSystemFeature(PackageManager.FEATURE_LEANBACK_ONLY);
     }
 
     public void testRingtone() {
+        if (isTV()) {
+            return;
+        }
         if (!hasAudioOutput()) {
             Log.i(TAG, "Skipping testRingtone(): device doesn't have audio output.");
             return;
diff --git a/tests/tests/view/res/drawable/scrollbar_no_size.xml b/tests/tests/view/res/drawable/scrollbar_no_size.xml
deleted file mode 100644
index 88a59f0..0000000
--- a/tests/tests/view/res/drawable/scrollbar_no_size.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
-       android:shape="rectangle">
-    <solid android:color="@android:color/white" />
-</shape>
diff --git a/tests/tests/view/res/drawable/scrollbar_thumb.xml b/tests/tests/view/res/drawable/scrollbar_thumb.xml
deleted file mode 100644
index d7612ac..0000000
--- a/tests/tests/view/res/drawable/scrollbar_thumb.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
-       android:shape="rectangle">
-    <solid android:color="@android:color/white" />
-    <size
-        android:width="@dimen/scrollbar_thumb_width"
-        android:height="@dimen/scrollbar_thumb_height"/>
-</shape>
diff --git a/tests/tests/view/res/drawable/scrollbar_track.xml b/tests/tests/view/res/drawable/scrollbar_track.xml
deleted file mode 100644
index a184569..0000000
--- a/tests/tests/view/res/drawable/scrollbar_track.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
-       android:shape="rectangle">
-    <solid android:color="@android:color/white" />
-    <size
-        android:width="@dimen/scrollbar_track_width"
-        android:height="@dimen/scrollbar_track_height"/>
-</shape>
diff --git a/tests/tests/view/res/layout/view_layout.xml b/tests/tests/view/res/layout/view_layout.xml
index 3cfaafa..920da83 100644
--- a/tests/tests/view/res/layout/view_layout.xml
+++ b/tests/tests/view/res/layout/view_layout.xml
@@ -46,42 +46,6 @@
         android:requiresFadingEdge="horizontal|vertical"
         android:fadingEdgeLength="20px"/>
 
-    <android.view.cts.MockView
-        android:id="@+id/scroll_view_3"
-        android:layout_width="100px"
-        android:layout_height="200px"
-        android:scrollbars="horizontal|vertical"
-        android:scrollbarThumbVertical="@drawable/scrollbar_no_size"
-        android:scrollbarThumbHorizontal="@drawable/scrollbar_no_size"/>
-
-    <android.view.cts.MockView
-        android:id="@+id/scroll_view_4"
-        android:layout_width="100px"
-        android:layout_height="200px"
-        android:scrollbars="horizontal|vertical"
-        android:scrollbarThumbVertical="@drawable/scrollbar_thumb"
-        android:scrollbarThumbHorizontal="@drawable/scrollbar_thumb"/>
-
-    <android.view.cts.MockView
-        android:id="@+id/scroll_view_5"
-        android:layout_width="100px"
-        android:layout_height="200px"
-        android:scrollbars="horizontal|vertical"
-        android:scrollbarThumbVertical="@drawable/scrollbar_thumb"
-        android:scrollbarTrackVertical="@drawable/scrollbar_track"
-        android:scrollbarThumbHorizontal="@drawable/scrollbar_thumb"
-        android:scrollbarTrackHorizontal="@drawable/scrollbar_track"/>
-
-    <android.view.cts.MockView
-        android:id="@+id/scroll_view_6"
-        android:layout_width="100px"
-        android:layout_height="200px"
-        android:scrollbars="horizontal|vertical"
-        android:scrollbarThumbVertical="@drawable/scrollbar_thumb"
-        android:scrollbarTrackVertical="@drawable/scrollbar_no_size"
-        android:scrollbarThumbHorizontal="@drawable/scrollbar_thumb"
-        android:scrollbarTrackHorizontal="@drawable/scrollbar_no_size"/>
-
     <View
         android:id="@+id/fit_windows"
         android:fitsSystemWindows="true"
diff --git a/tests/tests/view/res/values/dimens.xml b/tests/tests/view/res/values/dimens.xml
index a1d66f9..59369a7 100644
--- a/tests/tests/view/res/values/dimens.xml
+++ b/tests/tests/view/res/values/dimens.xml
@@ -30,8 +30,4 @@
     <dimen name="hover_target_margin">4dp</dimen>
     <dimen name="hover_target_size">8dp</dimen>
     <dimen name="hover_target_size_double">16dp</dimen>
-    <dimen name="scrollbar_thumb_width">11dp</dimen>
-    <dimen name="scrollbar_thumb_height">12dp</dimen>
-    <dimen name="scrollbar_track_width">13dp</dimen>
-    <dimen name="scrollbar_track_height">14dp</dimen>
 </resources>
\ No newline at end of file
diff --git a/tests/tests/view/src/android/view/cts/ViewTest.java b/tests/tests/view/src/android/view/cts/ViewTest.java
index ca39aab..2550915 100644
--- a/tests/tests/view/src/android/view/cts/ViewTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewTest.java
@@ -3661,67 +3661,6 @@
     }
 
     @Test
-    public void testScrollbarSize() {
-        final int configScrollbarSize = ViewConfiguration.get(mActivity).getScaledScrollBarSize();
-        final int customScrollbarSize = configScrollbarSize * 2;
-
-        // No explicit scrollbarSize or custom drawables, ViewConfiguration applies.
-        final MockView view = (MockView) mActivity.findViewById(R.id.scroll_view);
-        assertEquals(configScrollbarSize, view.getScrollBarSize());
-        assertEquals(configScrollbarSize, view.getVerticalScrollbarWidth());
-        assertEquals(configScrollbarSize, view.getHorizontalScrollbarHeight());
-
-        // No custom drawables, explicit scrollbarSize takes precedence.
-        final MockView view2 = (MockView) mActivity.findViewById(R.id.scroll_view_2);
-        view2.setScrollBarSize(customScrollbarSize);
-        assertEquals(customScrollbarSize, view2.getScrollBarSize());
-        assertEquals(customScrollbarSize, view2.getVerticalScrollbarWidth());
-        assertEquals(customScrollbarSize, view2.getHorizontalScrollbarHeight());
-
-        // Custom drawables with no intrinsic size, ViewConfiguration applies.
-        final MockView view3 = (MockView) mActivity.findViewById(R.id.scroll_view_3);
-        assertEquals(configScrollbarSize, view3.getVerticalScrollbarWidth());
-        assertEquals(configScrollbarSize, view3.getHorizontalScrollbarHeight());
-        // Explicit scrollbarSize takes precedence.
-        view3.setScrollBarSize(customScrollbarSize);
-        assertEquals(view3.getScrollBarSize(), view3.getVerticalScrollbarWidth());
-        assertEquals(view3.getScrollBarSize(), view3.getHorizontalScrollbarHeight());
-
-        // Custom thumb drawables with intrinsic sizes define the scrollbars' dimensions.
-        final MockView view4 = (MockView) mActivity.findViewById(R.id.scroll_view_4);
-        final Resources res = mActivity.getResources();
-        final int thumbWidth = res.getDimensionPixelOffset(R.dimen.scrollbar_thumb_width);
-        final int thumbHeight = res.getDimensionPixelOffset(R.dimen.scrollbar_thumb_height);
-        assertEquals(thumbWidth, view4.getVerticalScrollbarWidth());
-        assertEquals(thumbHeight, view4.getHorizontalScrollbarHeight());
-        // Explicit scrollbarSize has no effect.
-        view4.setScrollBarSize(customScrollbarSize);
-        assertEquals(thumbWidth, view4.getVerticalScrollbarWidth());
-        assertEquals(thumbHeight, view4.getHorizontalScrollbarHeight());
-
-        // Custom thumb and track drawables with intrinsic sizes. Track size take precedence.
-        final MockView view5 = (MockView) mActivity.findViewById(R.id.scroll_view_5);
-        final int trackWidth = res.getDimensionPixelOffset(R.dimen.scrollbar_track_width);
-        final int trackHeight = res.getDimensionPixelOffset(R.dimen.scrollbar_track_height);
-        assertEquals(trackWidth, view5.getVerticalScrollbarWidth());
-        assertEquals(trackHeight, view5.getHorizontalScrollbarHeight());
-        // Explicit scrollbarSize has no effect.
-        view5.setScrollBarSize(customScrollbarSize);
-        assertEquals(trackWidth, view5.getVerticalScrollbarWidth());
-        assertEquals(trackHeight, view5.getHorizontalScrollbarHeight());
-
-        // Custom thumb and track, track with no intrinsic size, ViewConfiguration applies
-        // regardless of the thumb drawable dimensions.
-        final MockView view6 = (MockView) mActivity.findViewById(R.id.scroll_view_6);
-        assertEquals(configScrollbarSize, view6.getVerticalScrollbarWidth());
-        assertEquals(configScrollbarSize, view6.getHorizontalScrollbarHeight());
-        // Explicit scrollbarSize takes precedence.
-        view6.setScrollBarSize(customScrollbarSize);
-        assertEquals(customScrollbarSize, view6.getVerticalScrollbarWidth());
-        assertEquals(customScrollbarSize, view6.getHorizontalScrollbarHeight());
-    }
-
-    @Test
     public void testOnStartAndFinishTemporaryDetach() throws Throwable {
         final AtomicBoolean exitedDispatchStartTemporaryDetach = new AtomicBoolean(false);
         final AtomicBoolean exitedDispatchFinishTemporaryDetach = new AtomicBoolean(false);
diff --git a/tools/cts-tradefed/res/config/cts-known-failures.xml b/tools/cts-tradefed/res/config/cts-known-failures.xml
index 769336d..a3ae2e2 100644
--- a/tools/cts-tradefed/res/config/cts-known-failures.xml
+++ b/tools/cts-tradefed/res/config/cts-known-failures.xml
@@ -191,4 +191,8 @@
 
     <!-- b/37108688 -->
     <option name="compatibility:exclude-filter" value="CtsHardwareTestCases android.hardware.cts.HardwareBufferTest#testCreate" />
+
+    <!-- b/36686383 -->
+    <option name="compatibility:exclude-filter" value="CtsIncidentHostTestCases com.android.server.cts.ErrorsTest#testANR" />
+
 </configuration>