Centralize MATERIAL dependency

Remove references to SUPPORT_DESIGN and switch
to the full dependency instead of the previously
used @aar dependency.

Also removes the no longer needed exclude_for_material
exclusion since all libraries are now on AndroidX.

Removed ViewPager2 implementation on AppCompat,
replacing it with an androidTestImplementation since it
is not actually used in the library itself. This fixes
an error when including a ToT implementation dependency
along with the fixed dependency from MATERIAL that
appears when switching to the full dependency.

Test: ./gradlew bOS, ran all affected sample apps
Fixes: 128632612
Change-Id: I44579630cdc3eae58fc23924d8c4d45d2d457f2b
diff --git a/buildSrc/dependencies.gradle b/buildSrc/dependencies.gradle
index 9ddae11..8d8cefa 100644
--- a/buildSrc/dependencies.gradle
+++ b/buildSrc/dependencies.gradle
@@ -30,18 +30,6 @@
     exclude group: 'androidx.annotation'
 }
 
-libs.exclude_for_material = {
-    transitive = true
-    exclude group: 'androidx.annotation'
-    exclude group: 'androidx.core'
-    exclude group: 'androidx.legacy'
-    exclude group: 'androidx.fragment'
-    exclude group: 'androidx.transition'
-    exclude group: 'androidx.appcompat'
-    exclude group: 'androidx.recyclerview'
-    exclude group: 'androidx.cardview'
-}
-
 libs.exclude_for_espresso = {
     exclude group: 'androidx.annotation'
     exclude group: 'androidx.appcompat'
diff --git a/buildSrc/src/main/kotlin/androidx/build/dependencies/Dependencies.kt b/buildSrc/src/main/kotlin/androidx/build/dependencies/Dependencies.kt
index 8d06dd4..232ce99 100644
--- a/buildSrc/src/main/kotlin/androidx/build/dependencies/Dependencies.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/dependencies/Dependencies.kt
@@ -46,6 +46,7 @@
 const val KOTLIN_COROUTINES_TEST = "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.1.1"
 const val LEAKCANARY_INSTRUMENTATION =
         "com.squareup.leakcanary:leakcanary-android-instrumentation:1.6.2"
+const val MATERIAL = "com.google.android.material:material:1.0.0"
 const val MOCKITO_CORE = "org.mockito:mockito-core:2.19.0"
 const val MULTIDEX = "androidx.multidex:multidex:2.0.0"
 const val NULLAWAY = "com.uber.nullaway:nullaway:0.3.7"
@@ -68,14 +69,10 @@
 const val XPP3 = "xpp3:xpp3:1.1.4c"
 const val XMLPULL = "xmlpull:xmlpull:1.1.3.1"
 
-private const val NAV_SUPPORT_VERSION = "1.0.0"
-const val NAV_SUPPORT_DESIGN = "com.google.android.material:material:$NAV_SUPPORT_VERSION"
-
 private const val SUPPORT_VERSION = "1.0.0"
 const val SUPPORT_ANNOTATIONS = "androidx.annotation:annotation:$SUPPORT_VERSION"
 const val SUPPORT_APPCOMPAT = "androidx.appcompat:appcompat:$SUPPORT_VERSION"
 const val SUPPORT_CORE_UTILS = "androidx.legacy:legacy-support-core-utils:$SUPPORT_VERSION"
-const val SUPPORT_DESIGN = "com.google.android.material:material:1.0.0@aar"
 const val SUPPORT_FRAGMENTS = "androidx.fragment:fragment:$SUPPORT_VERSION"
 const val SUPPORT_RECYCLERVIEW = "androidx.recyclerview:recyclerview:$SUPPORT_VERSION"
 
diff --git a/car/core/build.gradle b/car/core/build.gradle
index 9fba2a1..8f4c678 100644
--- a/car/core/build.gradle
+++ b/car/core/build.gradle
@@ -15,7 +15,7 @@
     api("androidx.gridlayout:gridlayout:1.0.0")
     api("androidx.preference:preference:1.0.0")
     api(CONSTRAINT_LAYOUT, { transitive = true })
-    api(SUPPORT_DESIGN, libs.exclude_for_material)
+    api(MATERIAL)
 
     androidTestImplementation(TEST_EXT_JUNIT)
     androidTestImplementation(TEST_CORE)
diff --git a/navigation/ui/build.gradle b/navigation/ui/build.gradle
index 5773283..9f9805c 100644
--- a/navigation/ui/build.gradle
+++ b/navigation/ui/build.gradle
@@ -36,7 +36,7 @@
 
 dependencies {
     api(project(":navigation:navigation-runtime"))
-    api(NAV_SUPPORT_DESIGN)
+    api(MATERIAL)
 
     testImplementation(JUNIT)
     testImplementation(MOCKITO_CORE)
diff --git a/samples/SupportContentDemos/build.gradle b/samples/SupportContentDemos/build.gradle
index f94c0cf..507b0f0 100644
--- a/samples/SupportContentDemos/build.gradle
+++ b/samples/SupportContentDemos/build.gradle
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-import static androidx.build.dependencies.DependenciesKt.SUPPORT_DESIGN
+import static androidx.build.dependencies.DependenciesKt.MATERIAL
 
 plugins {
     id("AndroidXPlugin")
@@ -23,7 +23,7 @@
 }
 
 dependencies {
-    implementation(SUPPORT_DESIGN, libs.exclude_for_material)
+    implementation(MATERIAL)
     implementation(project(":transition"))
     implementation(project(":recyclerview"))
     implementation(project(":appcompat"))
diff --git a/samples/SupportDesignDemos/build.gradle b/samples/SupportDesignDemos/build.gradle
index a075d8d..18884c4 100644
--- a/samples/SupportDesignDemos/build.gradle
+++ b/samples/SupportDesignDemos/build.gradle
@@ -1,4 +1,4 @@
-import static androidx.build.dependencies.DependenciesKt.SUPPORT_DESIGN
+import static androidx.build.dependencies.DependenciesKt.MATERIAL
 
 buildscript {
     ext.kotlin_version = '1.2.0'
@@ -11,7 +11,7 @@
 }
 
 dependencies {
-    implementation(SUPPORT_DESIGN, libs.exclude_for_material)
+    implementation(MATERIAL)
     implementation(project(":transition"))
     implementation(project(":recyclerview"))
     implementation(project(":appcompat"))
diff --git a/viewpager2/build.gradle b/viewpager2/build.gradle
index e068aa8..2b642f0 100644
--- a/viewpager2/build.gradle
+++ b/viewpager2/build.gradle
@@ -26,9 +26,9 @@
 dependencies {
     api(project(":fragment"))
     api(project(":recyclerview"))
-    implementation(project(":appcompat"))
     implementation(project(":collection"))
 
+    androidTestImplementation(project(":appcompat"))
     androidTestImplementation(TEST_EXT_JUNIT)
     androidTestImplementation(TEST_CORE)
     androidTestImplementation(TEST_RUNNER)
diff --git a/viewpager2/integration-tests/testapp/build.gradle b/viewpager2/integration-tests/testapp/build.gradle
index 2b3a756..be2719a 100644
--- a/viewpager2/integration-tests/testapp/build.gradle
+++ b/viewpager2/integration-tests/testapp/build.gradle
@@ -17,7 +17,7 @@
 import static androidx.build.dependencies.DependenciesKt.ARCH_LIFECYCLE_EXTENSIONS
 import static androidx.build.dependencies.DependenciesKt.ESPRESSO_CORE
 import static androidx.build.dependencies.DependenciesKt.KOTLIN_STDLIB
-import static androidx.build.dependencies.DependenciesKt.SUPPORT_DESIGN
+import static androidx.build.dependencies.DependenciesKt.MATERIAL
 import static androidx.build.dependencies.DependenciesKt.TEST_EXT_JUNIT
 import static androidx.build.dependencies.DependenciesKt.TEST_RULES
 
@@ -32,7 +32,7 @@
     api(KOTLIN_STDLIB)
     implementation(project(":viewpager2"))
     implementation(ARCH_LIFECYCLE_EXTENSIONS)
-    implementation(SUPPORT_DESIGN)
+    implementation(MATERIAL)
     implementation(project(":cardview"))
 
     androidTestImplementation(TEST_RULES)
diff --git a/work/integration-tests/testapp/build.gradle b/work/integration-tests/testapp/build.gradle
index 3991ec5..a03c39c 100644
--- a/work/integration-tests/testapp/build.gradle
+++ b/work/integration-tests/testapp/build.gradle
@@ -45,14 +45,12 @@
         implementation(ARCH_ROOM_RUNTIME)
     }
 
-    implementation(CONSTRAINT_LAYOUT)
+    implementation(CONSTRAINT_LAYOUT, { transitive = true })
     implementation project(':work:work-runtime-ktx')
     implementation(ARCH_CORE_RUNTIME)
     implementation(ARCH_LIFECYCLE_EXTENSIONS)
     implementation(ANDROIDX_RECYCLERVIEW)
-    implementation(SUPPORT_APPCOMPAT)
-    // SUPPORT_DESIGN has a @aar. So it needs { transitive = true }
-    implementation(SUPPORT_DESIGN) { transitive = true }
+    implementation(MATERIAL)
 }
 
 tasks['check'].dependsOn(tasks['connectedCheck'])