Merge "Moving test strings.xml files to donottranslate-strings.xml" into androidx-main
diff --git a/activity/activity/build.gradle b/activity/activity/build.gradle
index 3f497dc..fd9d259 100644
--- a/activity/activity/build.gradle
+++ b/activity/activity/build.gradle
@@ -10,10 +10,6 @@
 }
 
 android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
     defaultConfig {
         testInstrumentationRunnerArgument "listener", "leakcanary.FailTestOnLeakRunListener"
     }
diff --git a/ads/ads-identifier-testing/build.gradle b/ads/ads-identifier-testing/build.gradle
index d8265c7..c54af2d 100644
--- a/ads/ads-identifier-testing/build.gradle
+++ b/ads/ads-identifier-testing/build.gradle
@@ -31,9 +31,4 @@
     lintOptions {
         disable "InvalidPackage" // Lint is unhappy about mockito package
     }
-
-    compileOptions {
-        sourceCompatibility(JavaVersion.VERSION_1_7)
-        targetCompatibility(JavaVersion.VERSION_1_7)
-    }
 }
diff --git a/ads/ads-identifier/build.gradle b/ads/ads-identifier/build.gradle
index e3730f5..c844d83 100644
--- a/ads/ads-identifier/build.gradle
+++ b/ads/ads-identifier/build.gradle
@@ -44,13 +44,6 @@
     androidTestImplementation(DEXMAKER_MOCKITO, excludes.bytebuddy)
 }
 
-android {
-    compileOptions {
-        sourceCompatibility(JavaVersion.VERSION_1_7)
-        targetCompatibility(JavaVersion.VERSION_1_7)
-    }
-}
-
 androidx {
     name = "AndroidX Ads Identifier"
     publish = Publish.SNAPSHOT_AND_RELEASE
diff --git a/annotation/annotation-experimental/build.gradle b/annotation/annotation-experimental/build.gradle
index f2310ec..2ff61bb 100644
--- a/annotation/annotation-experimental/build.gradle
+++ b/annotation/annotation-experimental/build.gradle
@@ -33,11 +33,6 @@
 }
 
 android {
-    compileOptions {
-        sourceCompatibility(JavaVersion.VERSION_1_7)
-        targetCompatibility(JavaVersion.VERSION_1_7)
-    }
-
     buildTypes.all {
         consumerProguardFiles("proguard-rules.pro")
     }
diff --git a/annotation/annotation/build.gradle b/annotation/annotation/build.gradle
index eb13c91..5bd52ea 100644
--- a/annotation/annotation/build.gradle
+++ b/annotation/annotation/build.gradle
@@ -7,9 +7,6 @@
     id("java-library")
 }
 
-targetCompatibility = JavaVersion.VERSION_1_7
-sourceCompatibility = JavaVersion.VERSION_1_7
-
 jar {
     from sourceSets.main.output
     // Strip out typedef classes. For Android libraries, this is done
diff --git a/appcompat/appcompat-resources/build.gradle b/appcompat/appcompat-resources/build.gradle
index 6390db6..0f0972f 100644
--- a/appcompat/appcompat-resources/build.gradle
+++ b/appcompat/appcompat-resources/build.gradle
@@ -45,10 +45,6 @@
 }
 
 android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
     defaultConfig {
         // This disables the builds tools automatic vector -> PNG generation
         generatedDensities = []
diff --git a/appcompat/appcompat/build.gradle b/appcompat/appcompat/build.gradle
index 29f8bf2..ec08aa6 100644
--- a/appcompat/appcompat/build.gradle
+++ b/appcompat/appcompat/build.gradle
@@ -48,10 +48,6 @@
 }
 
 android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
     defaultConfig {
         // This disables the builds tools automatic vector -> PNG generation
         generatedDensities = []
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/NightModeRotateRecreatesActivityWithConfigTestCase.kt b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/NightModeRotateRecreatesActivityWithConfigTestCase.kt
index f3e217c..bafb9b0 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/NightModeRotateRecreatesActivityWithConfigTestCase.kt
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/NightModeRotateRecreatesActivityWithConfigTestCase.kt
@@ -28,11 +28,11 @@
 import androidx.lifecycle.Lifecycle
 import androidx.test.espresso.Espresso.onView
 import androidx.test.espresso.matcher.ViewMatchers
-import androidx.test.filters.FlakyTest
 import androidx.test.filters.LargeTest
 import androidx.testutils.LifecycleOwnerUtils
 import org.junit.After
 import org.junit.Assert.assertNotSame
+import org.junit.Ignore
 import org.junit.Rule
 import org.junit.Test
 import org.junit.runner.RunWith
@@ -60,7 +60,7 @@
         }
     }
 
-    @FlakyTest // b/182209264
+    @Ignore // b/182209264
     @Test
     public fun testRotateRecreatesActivityWithConfig() {
         // Don't run this test on SDK 26 because it has issues with setRequestedOrientation. Also
diff --git a/arch/core/core-common/build.gradle b/arch/core/core-common/build.gradle
index 07d4498..d02da56 100644
--- a/arch/core/core-common/build.gradle
+++ b/arch/core/core-common/build.gradle
@@ -32,9 +32,6 @@
     testImplementation(MOCKITO_CORE)
 }
 
-sourceCompatibility = JavaVersion.VERSION_1_7
-targetCompatibility = JavaVersion.VERSION_1_7
-
 androidx {
     name = "Android Arch-Common"
     publish = Publish.SNAPSHOT_AND_RELEASE
diff --git a/arch/core/core-runtime/build.gradle b/arch/core/core-runtime/build.gradle
index 32c8667..9459162 100644
--- a/arch/core/core-runtime/build.gradle
+++ b/arch/core/core-runtime/build.gradle
@@ -30,13 +30,6 @@
     api(project(":arch:core:core-common"))
 }
 
-android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
-}
-
 androidx {
     name = "Android Arch-Runtime"
     publish = Publish.SNAPSHOT_AND_RELEASE
diff --git a/arch/core/core-testing/build.gradle b/arch/core/core-testing/build.gradle
index bd80e98..af6d38f 100644
--- a/arch/core/core-testing/build.gradle
+++ b/arch/core/core-testing/build.gradle
@@ -40,13 +40,6 @@
     androidTestImplementation(ESPRESSO_CORE)
 }
 
-android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
-}
-
 androidx {
     name = "Android Core-Testing"
     publish = Publish.SNAPSHOT_AND_RELEASE
diff --git a/autofill/autofill/api/current.txt b/autofill/autofill/api/current.txt
index 988cdcf..60d5da5 100644
--- a/autofill/autofill/api/current.txt
+++ b/autofill/autofill/api/current.txt
@@ -3,6 +3,7 @@
 
   public final class HintConstants {
     method public static String generateSmsOtpHintForCharacterPosition(int);
+    field public static final String AUTOFILL_HINT_2FA_APP_OTP = "2faAppOTPCode";
     field public static final String AUTOFILL_HINT_BIRTH_DATE_DAY = "birthDateDay";
     field public static final String AUTOFILL_HINT_BIRTH_DATE_FULL = "birthDateFull";
     field public static final String AUTOFILL_HINT_BIRTH_DATE_MONTH = "birthDateMonth";
@@ -45,7 +46,6 @@
     field public static final String AUTOFILL_HINT_POSTAL_CODE = "postalCode";
     field public static final String AUTOFILL_HINT_PROMO_CODE = "promoCode";
     field public static final String AUTOFILL_HINT_SMS_OTP = "smsOTPCode";
-    field public static final String AUTOFILL_HINT_TFA_APP_OTP = "tfaAppOTPCode";
     field public static final String AUTOFILL_HINT_UPI_VPA = "upiVirtualPaymentAddress";
     field public static final String AUTOFILL_HINT_USERNAME = "username";
     field public static final String AUTOFILL_HINT_WIFI_PASSWORD = "wifiPassword";
diff --git a/autofill/autofill/api/public_plus_experimental_current.txt b/autofill/autofill/api/public_plus_experimental_current.txt
index 988cdcf..60d5da5 100644
--- a/autofill/autofill/api/public_plus_experimental_current.txt
+++ b/autofill/autofill/api/public_plus_experimental_current.txt
@@ -3,6 +3,7 @@
 
   public final class HintConstants {
     method public static String generateSmsOtpHintForCharacterPosition(int);
+    field public static final String AUTOFILL_HINT_2FA_APP_OTP = "2faAppOTPCode";
     field public static final String AUTOFILL_HINT_BIRTH_DATE_DAY = "birthDateDay";
     field public static final String AUTOFILL_HINT_BIRTH_DATE_FULL = "birthDateFull";
     field public static final String AUTOFILL_HINT_BIRTH_DATE_MONTH = "birthDateMonth";
@@ -45,7 +46,6 @@
     field public static final String AUTOFILL_HINT_POSTAL_CODE = "postalCode";
     field public static final String AUTOFILL_HINT_PROMO_CODE = "promoCode";
     field public static final String AUTOFILL_HINT_SMS_OTP = "smsOTPCode";
-    field public static final String AUTOFILL_HINT_TFA_APP_OTP = "tfaAppOTPCode";
     field public static final String AUTOFILL_HINT_UPI_VPA = "upiVirtualPaymentAddress";
     field public static final String AUTOFILL_HINT_USERNAME = "username";
     field public static final String AUTOFILL_HINT_WIFI_PASSWORD = "wifiPassword";
diff --git a/autofill/autofill/api/restricted_current.txt b/autofill/autofill/api/restricted_current.txt
index 60c1d8d..402b80f 100644
--- a/autofill/autofill/api/restricted_current.txt
+++ b/autofill/autofill/api/restricted_current.txt
@@ -3,6 +3,7 @@
 
   public final class HintConstants {
     method public static String generateSmsOtpHintForCharacterPosition(int);
+    field public static final String AUTOFILL_HINT_2FA_APP_OTP = "2faAppOTPCode";
     field public static final String AUTOFILL_HINT_BIRTH_DATE_DAY = "birthDateDay";
     field public static final String AUTOFILL_HINT_BIRTH_DATE_FULL = "birthDateFull";
     field public static final String AUTOFILL_HINT_BIRTH_DATE_MONTH = "birthDateMonth";
@@ -45,7 +46,6 @@
     field public static final String AUTOFILL_HINT_POSTAL_CODE = "postalCode";
     field public static final String AUTOFILL_HINT_PROMO_CODE = "promoCode";
     field public static final String AUTOFILL_HINT_SMS_OTP = "smsOTPCode";
-    field public static final String AUTOFILL_HINT_TFA_APP_OTP = "tfaAppOTPCode";
     field public static final String AUTOFILL_HINT_UPI_VPA = "upiVirtualPaymentAddress";
     field public static final String AUTOFILL_HINT_USERNAME = "username";
     field public static final String AUTOFILL_HINT_WIFI_PASSWORD = "wifiPassword";
diff --git a/autofill/autofill/src/main/java/androidx/autofill/HintConstants.java b/autofill/autofill/src/main/java/androidx/autofill/HintConstants.java
index c72cd28..ebc4328 100644
--- a/autofill/autofill/src/main/java/androidx/autofill/HintConstants.java
+++ b/autofill/autofill/src/main/java/androidx/autofill/HintConstants.java
@@ -637,12 +637,12 @@
      *
      * <p>Can be used with either {@link android.view.View#setAutofillHints(String[])} or <a
      * href="#attr_android:autofillHint">{@code android:autofillHint}</a> (in which case the value
-     * should be <code>{@value #AUTOFILL_HINT_TFA_APP_OTP}</code>).
+     * should be <code>{@value #AUTOFILL_HINT_2FA_APP_OTP}</code>).
      *
      * <p>See {@link android.view.View#setAutofillHints(String...)} for more info about autofill
      * hints.
      */
-    public static final String AUTOFILL_HINT_TFA_APP_OTP = "tfaAppOTPCode";
+    public static final String AUTOFILL_HINT_2FA_APP_OTP = "2faAppOTPCode";
 
     /**
      * Hint indicating that this view is not eligible for autofill.
@@ -669,7 +669,8 @@
     public static final String AUTOFILL_HINT_PROMO_CODE = "promoCode";
 
     /**
-     * Hint indicating that this view can be autofilled with an UPI Virtual Payment Address.
+     * Hint indicating that this view can be autofilled with an Unified Payments Interface (UPI)
+     * Virtual Payment Address.
      *
      * <p>Can be used with either {@link android.view.View#setAutofillHints(String[])} or <a
      * href="#attr_android:autofillHint">{@code android:autofillHint}</a> (in which case the value
diff --git a/biometric/biometric/build.gradle b/biometric/biometric/build.gradle
index 6f12943..cde60f3 100644
--- a/biometric/biometric/build.gradle
+++ b/biometric/biometric/build.gradle
@@ -59,12 +59,6 @@
     buildTypes.all {
         consumerProguardFiles "proguard-rules.pro"
     }
-
-    compileOptions {
-        sourceCompatibility(JavaVersion.VERSION_1_7)
-        targetCompatibility(JavaVersion.VERSION_1_7)
-    }
-
     testOptions.unitTests.includeAndroidResources = true
 }
 
diff --git a/buildSrc/src/main/kotlin/androidx/build/LibraryVersions.kt b/buildSrc/src/main/kotlin/androidx/build/LibraryVersions.kt
index 132a48c..c6c9256 100644
--- a/buildSrc/src/main/kotlin/androidx/build/LibraryVersions.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/LibraryVersions.kt
@@ -30,7 +30,7 @@
     val ARCH_CORE_TESTING = ARCH_CORE
     val ARCH_RUNTIME = Version("2.2.0-alpha01")
     val ASYNCLAYOUTINFLATER = Version("1.1.0-alpha01")
-    val AUTOFILL = Version("1.2.0-alpha01")
+    val AUTOFILL = Version("1.2.0-alpha02")
     val BENCHMARK = Version("1.1.0-alpha02")
     val BIOMETRIC = Version("1.2.0-alpha03")
     val BROWSER = Version("1.4.0-alpha01")
diff --git a/car/app/app-samples/helloworld/automotive/src/main/AndroidManifest.xml b/car/app/app-samples/helloworld/automotive/src/main/AndroidManifest.xml
index edf67d6..023f647 100644
--- a/car/app/app-samples/helloworld/automotive/src/main/AndroidManifest.xml
+++ b/car/app/app-samples/helloworld/automotive/src/main/AndroidManifest.xml
@@ -25,31 +25,39 @@
     <application
       android:label="@string/app_name"
       android:icon="@drawable/ic_launcher">
-    <meta-data android:name="com.google.android.gms.car.application"
-        android:resource="@xml/automotive_app_desc"
-        tools:ignore="MetadataTagInsideApplicationTag" />
-    <service
-        android:name="androidx.car.app.sample.helloworld.common.HelloWorldService"
-        android:exported="true">
-      <intent-filter>
-        <action android:name="androidx.car.app.CarAppService" />
-      </intent-filter>
-      <meta-data android:name="androidx.car.app.CAR_APP_ACTIVITY"
-          android:value="androidx.car.app.sample.helloworld.common.HelloWorld" />
-    </service>
-    <activity-alias
-        android:enabled="true"
-        android:exported="true"
-        android:label="Hello World"
-        android:name="HelloWorld"
-        android:targetActivity="androidx.car.app.activity.CarAppActivity" >
-      <intent-filter>
-        <action android:name="android.intent.action.MAIN" />
-        <category android:name="android.intent.category.LAUNCHER" />
-      </intent-filter>
-      <meta-data android:name="androidx.car.app.CAR_APP_SERVICE"
-          android:value="androidx.car.app.sample.helloworld.common.HelloWorldService" />
-      <meta-data android:name="distractionOptimized" android:value="true"/>
-    </activity-alias>
-  </application>
+
+        <meta-data
+            android:name="com.android.automotive"
+            android:resource="@xml/automotive_app_desc"
+            tools:ignore="MetadataTagInsideApplicationTag" />
+
+        <meta-data android:name="androidx.car.app.minApiLevel"
+            android:value="1"
+            tools:ignore="MetadataTagInsideApplicationTag" />
+
+        <service
+            android:name="androidx.car.app.sample.helloworld.common.HelloWorldService"
+            android:exported="true">
+          <intent-filter>
+            <action android:name="androidx.car.app.CarAppService" />
+          </intent-filter>
+          <meta-data android:name="androidx.car.app.CAR_APP_ACTIVITY"
+              android:value="androidx.car.app.sample.helloworld.common.HelloWorld" />
+        </service>
+
+        <activity-alias
+            android:enabled="true"
+            android:exported="true"
+            android:label="Hello World"
+            android:name="HelloWorld"
+            android:targetActivity="androidx.car.app.activity.CarAppActivity" >
+          <intent-filter>
+            <action android:name="android.intent.action.MAIN" />
+            <category android:name="android.intent.category.LAUNCHER" />
+          </intent-filter>
+          <meta-data android:name="androidx.car.app.CAR_APP_SERVICE"
+              android:value="androidx.car.app.sample.helloworld.common.HelloWorldService" />
+          <meta-data android:name="distractionOptimized" android:value="true"/>
+        </activity-alias>
+    </application>
 </manifest>
diff --git a/car/app/app-samples/helloworld/mobile/src/main/AndroidManifest.xml b/car/app/app-samples/helloworld/mobile/src/main/AndroidManifest.xml
index 023175f..4ad83c7 100644
--- a/car/app/app-samples/helloworld/mobile/src/main/AndroidManifest.xml
+++ b/car/app/app-samples/helloworld/mobile/src/main/AndroidManifest.xml
@@ -25,6 +25,9 @@
     <meta-data android:name="com.google.android.gms.car.application"
         android:resource="@xml/automotive_app_desc"
         tools:ignore="MetadataTagInsideApplicationTag" />
+    <meta-data android:name="androidx.car.app.minApiLevel"
+        android:value="1"
+        tools:ignore="MetadataTagInsideApplicationTag" />
     <service
         android:name="androidx.car.app.sample.helloworld.common.HelloWorldService"
         android:exported="true">
diff --git a/car/app/app-samples/navigation/automotive/src/main/AndroidManifest.xml b/car/app/app-samples/navigation/automotive/src/main/AndroidManifest.xml
index c0f500d1..97f5250 100644
--- a/car/app/app-samples/navigation/automotive/src/main/AndroidManifest.xml
+++ b/car/app/app-samples/navigation/automotive/src/main/AndroidManifest.xml
@@ -30,14 +30,19 @@
 
   <uses-feature android:name="android.software.car.templates_host" />
 
-    <application
-      android:label="@string/app_name"
-      android:icon="@drawable/ic_launcher">
+  <application
+    android:label="@string/app_name"
+    android:icon="@drawable/ic_launcher">
 
-    <meta-data android:name="com.google.android.gms.car.application"
+    <meta-data
+        android:name="com.android.automotive"
         android:resource="@xml/automotive_app_desc"
         tools:ignore="MetadataTagInsideApplicationTag" />
 
+    <meta-data android:name="androidx.car.app.minApiLevel"
+        android:value="1"
+        tools:ignore="MetadataTagInsideApplicationTag" />
+
     <service
         android:name="androidx.car.app.sample.navigation.common.car.NavigationCarAppService"
         android:foregroundServiceType="location"
diff --git a/car/app/app-samples/navigation/mobile/src/main/AndroidManifest.xml b/car/app/app-samples/navigation/mobile/src/main/AndroidManifest.xml
index be5f6d1..d0e6d5b 100644
--- a/car/app/app-samples/navigation/mobile/src/main/AndroidManifest.xml
+++ b/car/app/app-samples/navigation/mobile/src/main/AndroidManifest.xml
@@ -45,6 +45,10 @@
         android:resource="@xml/automotive_app_desc"
         tools:ignore="MetadataTagInsideApplicationTag" />
 
+    <meta-data android:name="androidx.car.app.minApiLevel"
+        android:value="1"
+        tools:ignore="MetadataTagInsideApplicationTag" />
+
     <service
         android:name="androidx.car.app.sample.navigation.common.car.NavigationCarAppService"
         android:foregroundServiceType="location"
diff --git a/car/app/app-samples/places/automotive/src/main/AndroidManifest.xml b/car/app/app-samples/places/automotive/src/main/AndroidManifest.xml
index 341b3fa..5a2330d 100644
--- a/car/app/app-samples/places/automotive/src/main/AndroidManifest.xml
+++ b/car/app/app-samples/places/automotive/src/main/AndroidManifest.xml
@@ -33,14 +33,20 @@
       android:label="@string/app_name"
       android:icon="@drawable/ic_launcher">
 
-    <meta-data android:name="com.google.android.gms.car.application"
+    <meta-data
+        android:name="com.android.automotive"
         android:resource="@xml/automotive_app_desc"
         tools:ignore="MetadataTagInsideApplicationTag" />
+
     <meta-data
         android:name="androidx.car.app.theme"
         android:resource="@style/CarAppTheme"
         tools:ignore="MetadataTagInsideApplicationTag"/>
 
+    <meta-data android:name="androidx.car.app.minApiLevel"
+        android:value="1"
+        tools:ignore="MetadataTagInsideApplicationTag" />
+
     <service
         android:name="androidx.car.app.sample.places.common.PlacesCarAppService"
         android:exported="true">
diff --git a/car/app/app-samples/places/mobile/src/main/AndroidManifest.xml b/car/app/app-samples/places/mobile/src/main/AndroidManifest.xml
index 3fba8b8..4a95aff 100644
--- a/car/app/app-samples/places/mobile/src/main/AndroidManifest.xml
+++ b/car/app/app-samples/places/mobile/src/main/AndroidManifest.xml
@@ -35,14 +35,18 @@
       android:resource="@xml/automotive_app_desc"
         tools:ignore="MetadataTagInsideApplicationTag" />
 
+    <meta-data
+        android:name="androidx.car.app.theme"
+        android:resource= "@style/CarAppTheme"
+        tools:ignore="MetadataTagInsideApplicationTag" />
+
+    <meta-data android:name="androidx.car.app.minApiLevel"
+        android:value="1"
+        tools:ignore="MetadataTagInsideApplicationTag" />
+
     <service
         android:name="androidx.car.app.sample.places.common.PlacesCarAppService"
         android:exported="true">
-
-      <meta-data
-          android:name="androidx.car.app.theme"
-          android:resource= "@style/CarAppTheme" />
-
       <intent-filter>
         <action android:name="androidx.car.app.CarAppService" />
       </intent-filter>
diff --git a/car/app/app-samples/showcase/automotive/src/main/AndroidManifest.xml b/car/app/app-samples/showcase/automotive/src/main/AndroidManifest.xml
index a9b6af6..a7770fa 100644
--- a/car/app/app-samples/showcase/automotive/src/main/AndroidManifest.xml
+++ b/car/app/app-samples/showcase/automotive/src/main/AndroidManifest.xml
@@ -40,7 +40,7 @@
       android:icon="@drawable/ic_launcher">
 
     <meta-data
-        android:name="com.google.android.gms.car.application"
+        android:name="com.android.automotive"
         android:resource="@xml/automotive_app_desc"
         tools:ignore="MetadataTagInsideApplicationTag" />
 
diff --git a/car/app/app-samples/showcase/mobile/src/main/AndroidManifest.xml b/car/app/app-samples/showcase/mobile/src/main/AndroidManifest.xml
index 110f1ef..9956fb8 100644
--- a/car/app/app-samples/showcase/mobile/src/main/AndroidManifest.xml
+++ b/car/app/app-samples/showcase/mobile/src/main/AndroidManifest.xml
@@ -47,6 +47,10 @@
         android:resource="@style/CarAppTheme"
         tools:ignore="MetadataTagInsideApplicationTag" />
 
+    <meta-data android:name="androidx.car.app.minApiLevel"
+        android:value="1"
+        tools:ignore="MetadataTagInsideApplicationTag" />
+
     <service
         android:name=".common.ShowcaseService"
         android:exported="true">
diff --git a/collection/collection/build.gradle b/collection/collection/build.gradle
index 3bf83ce..e8acec8 100644
--- a/collection/collection/build.gradle
+++ b/collection/collection/build.gradle
@@ -25,9 +25,6 @@
     id("kotlin")
 }
 
-targetCompatibility = JavaVersion.VERSION_1_7
-sourceCompatibility = JavaVersion.VERSION_1_7
-
 dependencies {
     api("androidx.annotation:annotation:1.1.0")
     annotationProcessor(NULLAWAY)
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposeCallLoweringTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposeCallLoweringTests.kt
index 4f6b12d..b32e4ce 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposeCallLoweringTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposeCallLoweringTests.kt
@@ -25,10 +25,11 @@
 import org.junit.Ignore
 import org.junit.Test
 import org.junit.runner.RunWith
+import org.robolectric.RobolectricTestRunner
 import org.robolectric.annotation.Config
 import kotlin.reflect.KClass
 
-@RunWith(ComposeRobolectricTestRunner::class)
+@RunWith(RobolectricTestRunner::class)
 @Config(
     manifest = Config.NONE,
     minSdk = 23,
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposeRobolectricTestRunner.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposeRobolectricTestRunner.kt
deleted file mode 100644
index b27ef4f..0000000
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposeRobolectricTestRunner.kt
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2019 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.
- */
-
-package androidx.compose.compiler.plugins.kotlin
-
-import org.junit.runners.model.FrameworkMethod
-import org.robolectric.RobolectricTestRunner
-import org.robolectric.internal.bytecode.InstrumentationConfiguration
-
-class ComposeRobolectricTestRunner(testClass: Class<*>) : RobolectricTestRunner(testClass) {
-    override fun createClassLoaderConfig(method: FrameworkMethod?): InstrumentationConfiguration {
-        val builder = InstrumentationConfiguration.Builder(super.createClassLoaderConfig(method))
-        builder.doNotInstrumentPackage("androidx.compose")
-        builder.doNotInstrumentPackage("androidx.ui")
-        return builder.build()
-    }
-}
\ No newline at end of file
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposerParamSignatureTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposerParamSignatureTests.kt
index e36dde9..db49fa0 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposerParamSignatureTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposerParamSignatureTests.kt
@@ -19,10 +19,11 @@
 import org.junit.Ignore
 import org.junit.Test
 import org.junit.runner.RunWith
+import org.robolectric.RobolectricTestRunner
 import org.robolectric.annotation.Config
 
 /* ktlint-disable max-line-length */
-@RunWith(ComposeRobolectricTestRunner::class)
+@RunWith(RobolectricTestRunner::class)
 @Config(
     manifest = Config.NONE,
     minSdk = 23,
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/KtxCrossModuleTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/KtxCrossModuleTests.kt
index 3e79f10..665aaa3 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/KtxCrossModuleTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/KtxCrossModuleTests.kt
@@ -26,11 +26,12 @@
 import org.junit.Ignore
 import org.junit.Test
 import org.junit.runner.RunWith
+import org.robolectric.RobolectricTestRunner
 import org.robolectric.annotation.Config
 import java.io.File
 import java.net.URLClassLoader
 
-@RunWith(ComposeRobolectricTestRunner::class)
+@RunWith(RobolectricTestRunner::class)
 @Config(
     manifest = Config.NONE,
     minSdk = 23,
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LambdaMemoizationTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LambdaMemoizationTests.kt
index f7f1072..8905d89 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LambdaMemoizationTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LambdaMemoizationTests.kt
@@ -22,10 +22,11 @@
 import org.junit.Ignore
 import org.junit.Test
 import org.junit.runner.RunWith
+import org.robolectric.RobolectricTestRunner
 import org.robolectric.Shadows.shadowOf
 import org.robolectric.annotation.Config
 
-@RunWith(ComposeRobolectricTestRunner::class)
+@RunWith(RobolectricTestRunner::class)
 @Config(
     manifest = Config.NONE,
     minSdk = 23,
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LiveLiteralCodegenTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LiveLiteralCodegenTests.kt
index 9e9ab11..3d406f2 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LiveLiteralCodegenTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LiveLiteralCodegenTests.kt
@@ -23,9 +23,10 @@
 import org.junit.Ignore
 import org.junit.Test
 import org.junit.runner.RunWith
+import org.robolectric.RobolectricTestRunner
 import org.robolectric.annotation.Config
 
-@RunWith(ComposeRobolectricTestRunner::class)
+@RunWith(RobolectricTestRunner::class)
 @Config(
     manifest = Config.NONE,
     minSdk = 23,
diff --git a/compose/ui/ui-android-stubs/build.gradle b/compose/ui/ui-android-stubs/build.gradle
index f0fc4ca..41a7097 100644
--- a/compose/ui/ui-android-stubs/build.gradle
+++ b/compose/ui/ui-android-stubs/build.gradle
@@ -22,13 +22,6 @@
     id("com.android.library")
 }
 
-android {
-    compileOptions {
-        targetCompatibility = JavaVersion.VERSION_1_7
-        sourceCompatibility = JavaVersion.VERSION_1_7
-    }
-}
-
 dependencies {
     api("androidx.annotation:annotation:1.1.0")
 }
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/autofill/AndroidPerformAutofillTest.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/autofill/AndroidPerformAutofillTest.kt
index f223b15..204ad58a 100644
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/autofill/AndroidPerformAutofillTest.kt
+++ b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/autofill/AndroidPerformAutofillTest.kt
@@ -22,16 +22,16 @@
 import android.view.autofill.AutofillValue
 import androidx.compose.ui.ExperimentalComposeUiApi
 import androidx.compose.ui.geometry.Rect
-import androidx.compose.ui.test.ComposeUiRobolectricTestRunner
 import com.google.common.truth.Truth
 import org.junit.Before
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.robolectric.Robolectric
+import org.robolectric.RobolectricTestRunner
 import org.robolectric.annotation.Config
 
 @OptIn(ExperimentalComposeUiApi::class)
-@RunWith(ComposeUiRobolectricTestRunner::class)
+@RunWith(RobolectricTestRunner::class)
 @Config(minSdk = 26)
 class AndroidPerformAutofillTest {
     private val autofillTree = AutofillTree()
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/autofill/AndroidPopulateViewStructureTest.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/autofill/AndroidPopulateViewStructureTest.kt
index 0e4c59d..f56a090 100644
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/autofill/AndroidPopulateViewStructureTest.kt
+++ b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/autofill/AndroidPopulateViewStructureTest.kt
@@ -22,16 +22,16 @@
 import androidx.autofill.HintConstants.AUTOFILL_HINT_PERSON_NAME
 import androidx.compose.ui.ExperimentalComposeUiApi
 import androidx.compose.ui.geometry.Rect
-import androidx.compose.ui.test.ComposeUiRobolectricTestRunner
 import com.google.common.truth.Truth.assertThat
 import org.junit.Before
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.robolectric.Robolectric
+import org.robolectric.RobolectricTestRunner
 import org.robolectric.annotation.Config
 
 @OptIn(ExperimentalComposeUiApi::class)
-@RunWith(ComposeUiRobolectricTestRunner::class)
+@RunWith(RobolectricTestRunner::class)
 @Config(
     manifest = Config.NONE,
     minSdk = 26
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/autofill/AutofillNodeTest.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/autofill/AutofillNodeTest.kt
index b724afb..c11fd2e 100644
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/autofill/AutofillNodeTest.kt
+++ b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/autofill/AutofillNodeTest.kt
@@ -22,7 +22,6 @@
 import androidx.compose.ui.ExperimentalComposeUiApi
 import androidx.compose.ui.geometry.Rect
 import androidx.compose.ui.graphics.toComposeRect
-import androidx.compose.ui.test.ComposeUiRobolectricTestRunner
 import com.google.common.truth.Truth.assertThat
 import org.junit.Before
 import org.junit.Rule
@@ -30,13 +29,14 @@
 import org.junit.rules.ExpectedException
 import org.junit.runner.RunWith
 import org.robolectric.Robolectric
+import org.robolectric.RobolectricTestRunner
 import org.robolectric.annotation.Config
 import org.robolectric.annotation.Implementation
 import org.robolectric.annotation.Implements
 import org.robolectric.shadow.api.Shadow
 
 @OptIn(ExperimentalComposeUiApi::class)
-@RunWith(ComposeUiRobolectricTestRunner::class)
+@RunWith(RobolectricTestRunner::class)
 @Config(
     shadows = [ShadowAutofillManager::class],
     minSdk = 26
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/test/ComposeUiRobolectricTestRunner.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/test/ComposeUiRobolectricTestRunner.kt
deleted file mode 100644
index 77cc9d9..0000000
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/test/ComposeUiRobolectricTestRunner.kt
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2019 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.
- */
-
-package androidx.compose.ui.test
-
-import org.junit.runners.model.FrameworkMethod
-import org.robolectric.RobolectricTestRunner
-import org.robolectric.internal.bytecode.InstrumentationConfiguration
-
-/**
- * A [RobolectricTestRunner] for [androidx.compose].
- *
- * It has instrumentation turned off for the [androidx.compose] package.
- *
- * Robolectric tries to instrument Kotlin classes, and it throws errors when it encounters
- * companion objects and constructors with default values for parameters. We don't need
- * shadowing of our classes because we want to use the actual objects in our tests.
- *
- * We can also make the argument that no external developer should shadow any of
- * androidx.compose, as they shouldn't be testing library code. This concern is being tracked by
- * b/139828620 which will make a change to Robolectric code to prevent instrumentation of all
- * classes under [androidx.compose].
- */
-class ComposeUiRobolectricTestRunner(testClass: Class<*>) : RobolectricTestRunner(testClass) {
-    override fun createClassLoaderConfig(method: FrameworkMethod?): InstrumentationConfiguration {
-        val builder = InstrumentationConfiguration.Builder(super.createClassLoaderConfig(method))
-        // TODO: b/160233169 remove 'androidx.ui' when everything is migrated to androidx.compose
-        builder.doNotInstrumentPackage("androidx.ui")
-        builder.doNotInstrumentPackage("androidx.compose")
-        return builder.build()
-    }
-}
diff --git a/concurrent/futures/build.gradle b/concurrent/futures/build.gradle
index 23d69ea..b1a0910 100644
--- a/concurrent/futures/build.gradle
+++ b/concurrent/futures/build.gradle
@@ -32,9 +32,6 @@
     testImplementation(TRUTH)
 }
 
-sourceCompatibility = JavaVersion.VERSION_1_7
-targetCompatibility = JavaVersion.VERSION_1_7
-
 androidx {
     name = "AndroidX Futures"
     publish = Publish.SNAPSHOT_AND_RELEASE
diff --git a/coordinatorlayout/coordinatorlayout/build.gradle b/coordinatorlayout/coordinatorlayout/build.gradle
index a6a6937..8acc494 100644
--- a/coordinatorlayout/coordinatorlayout/build.gradle
+++ b/coordinatorlayout/coordinatorlayout/build.gradle
@@ -28,10 +28,6 @@
 }
 
 android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
     sourceSets {
         main.res.srcDirs = [
                 "src/main/res",
diff --git a/core/core-appdigest/build.gradle b/core/core-appdigest/build.gradle
index 8270040..e7d2bba 100644
--- a/core/core-appdigest/build.gradle
+++ b/core/core-appdigest/build.gradle
@@ -24,13 +24,6 @@
     id("com.android.library")
 }
 
-android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
-}
-
 dependencies {
     api("androidx.annotation:annotation:1.0.0")
     api("androidx.core:core:1.0.0")
diff --git a/core/core/build.gradle b/core/core/build.gradle
index 4b127c1..ca41212 100644
--- a/core/core/build.gradle
+++ b/core/core/build.gradle
@@ -52,10 +52,6 @@
         aidl = true
     }
     testOptions.unitTests.includeAndroidResources = true
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
     aaptOptions {
         noCompress "ttf"
     }
diff --git a/customview/customview/build.gradle b/customview/customview/build.gradle
index 4ec89b0..1bdb442 100644
--- a/customview/customview/build.gradle
+++ b/customview/customview/build.gradle
@@ -8,13 +8,6 @@
     id("kotlin-android")
 }
 
-android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
-}
-
 dependencies {
     api("androidx.annotation:annotation:1.1.0")
     api("androidx.core:core:1.3.0-beta01")
diff --git a/development/build_log_simplifier/build_log_simplifier.py b/development/build_log_simplifier/build_log_simplifier.py
index 5786dbc..2f73f65 100755
--- a/development/build_log_simplifier/build_log_simplifier.py
+++ b/development/build_log_simplifier/build_log_simplifier.py
@@ -71,6 +71,8 @@
             if self.matches(text):
                 return 0
             return None
+        if not self.matches(text):
+            return None
         self.ensure_split()
         count = 0
         for child in self.children:
diff --git a/exifinterface/exifinterface/build.gradle b/exifinterface/exifinterface/build.gradle
index ce8edbe..5aed262 100644
--- a/exifinterface/exifinterface/build.gradle
+++ b/exifinterface/exifinterface/build.gradle
@@ -8,13 +8,6 @@
     id("com.android.library")
 }
 
-android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
-}
-
 dependencies {
     api("androidx.annotation:annotation:1.1.0")
 
diff --git a/fragment/fragment/build.gradle b/fragment/fragment/build.gradle
index da73487..7a33127 100644
--- a/fragment/fragment/build.gradle
+++ b/fragment/fragment/build.gradle
@@ -10,11 +10,6 @@
 }
 
 android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
-
     testOptions {
         unitTests {
             includeAndroidResources = true
diff --git a/jetifier/jetifier/core/build.gradle b/jetifier/jetifier/core/build.gradle
index 717304d..b94dae3 100644
--- a/jetifier/jetifier/core/build.gradle
+++ b/jetifier/jetifier/core/build.gradle
@@ -26,9 +26,6 @@
 
 }
 
-sourceCompatibility = JavaVersion.VERSION_1_7
-targetCompatibility = JavaVersion.VERSION_1_7
-
 dependencies {
     api("com.google.code.gson:gson:2.8.0")
     api(KOTLIN_STDLIB)
diff --git a/jetifier/jetifier/preprocessor/build.gradle b/jetifier/jetifier/preprocessor/build.gradle
index f478c95..2a764dc 100644
--- a/jetifier/jetifier/preprocessor/build.gradle
+++ b/jetifier/jetifier/preprocessor/build.gradle
@@ -20,9 +20,6 @@
     id("application")
 }
 
-sourceCompatibility = JavaVersion.VERSION_1_7
-targetCompatibility = JavaVersion.VERSION_1_7
-
 mainClassName = "com.android.tools.build.jetifier.preprocessor.MainKt"
 
 dependencies {
diff --git a/jetifier/jetifier/processor/build.gradle b/jetifier/jetifier/processor/build.gradle
index 286b525..39eeeaa 100644
--- a/jetifier/jetifier/processor/build.gradle
+++ b/jetifier/jetifier/processor/build.gradle
@@ -25,9 +25,6 @@
     id("kotlin")
 }
 
-sourceCompatibility = JavaVersion.VERSION_1_7
-targetCompatibility = JavaVersion.VERSION_1_7
-
 dependencies {
     api(project(":jetifier-core"))
     api("org.ow2.asm:asm:8.0.1")
diff --git a/lifecycle/lifecycle-common/build.gradle b/lifecycle/lifecycle-common/build.gradle
index 1d28292..1beb36e 100644
--- a/lifecycle/lifecycle-common/build.gradle
+++ b/lifecycle/lifecycle-common/build.gradle
@@ -26,9 +26,6 @@
     id("java-library")
 }
 
-sourceCompatibility = JavaVersion.VERSION_1_7
-targetCompatibility = JavaVersion.VERSION_1_7
-
 dependencies {
     api("androidx.annotation:annotation:1.1.0")
 
diff --git a/lifecycle/lifecycle-livedata-core/build.gradle b/lifecycle/lifecycle-livedata-core/build.gradle
index c600181..e61b4ac 100644
--- a/lifecycle/lifecycle-livedata-core/build.gradle
+++ b/lifecycle/lifecycle-livedata-core/build.gradle
@@ -25,13 +25,6 @@
     id("com.android.library")
 }
 
-android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
-}
-
 dependencies {
     implementation("androidx.arch.core:core-common:2.1.0")
     implementation("androidx.arch.core:core-runtime:2.1.0")
diff --git a/lifecycle/lifecycle-runtime/build.gradle b/lifecycle/lifecycle-runtime/build.gradle
index 3ee8d69..a053e6d 100644
--- a/lifecycle/lifecycle-runtime/build.gradle
+++ b/lifecycle/lifecycle-runtime/build.gradle
@@ -10,10 +10,6 @@
 }
 
 android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
     buildTypes.all {
         consumerProguardFiles "proguard-rules.pro"
     }
diff --git a/lifecycle/lifecycle-viewmodel/build.gradle b/lifecycle/lifecycle-viewmodel/build.gradle
index d91105d..fb1af37 100644
--- a/lifecycle/lifecycle-viewmodel/build.gradle
+++ b/lifecycle/lifecycle-viewmodel/build.gradle
@@ -27,10 +27,6 @@
 }
 
 android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
     buildTypes.all {
         consumerProguardFiles "proguard-rules.pro"
     }
diff --git a/loader/loader/build.gradle b/loader/loader/build.gradle
index 315f072..48be3ec 100644
--- a/loader/loader/build.gradle
+++ b/loader/loader/build.gradle
@@ -8,13 +8,6 @@
     id("com.android.library")
 }
 
-android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
-}
-
 dependencies {
     api("androidx.annotation:annotation:1.0.0")
     api("androidx.lifecycle:lifecycle-viewmodel:2.0.0")
diff --git a/media2/media2-exoplayer/build.gradle b/media2/media2-exoplayer/build.gradle
index 8630348..c015b9a 100644
--- a/media2/media2-exoplayer/build.gradle
+++ b/media2/media2-exoplayer/build.gradle
@@ -26,10 +26,6 @@
 }
 
 android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
     buildTypes.all {
         consumerProguardFiles "proguard-rules.pro"
     }
diff --git a/preference/preference-ktx/build.gradle b/preference/preference-ktx/build.gradle
index 0f73207..ef77225 100644
--- a/preference/preference-ktx/build.gradle
+++ b/preference/preference-ktx/build.gradle
@@ -27,13 +27,6 @@
     id("org.jetbrains.kotlin.android")
 }
 
-android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
-}
-
 dependencies {
     api(project(":preference:preference"))
     api("androidx.core:core-ktx:1.1.0") {
diff --git a/preference/preference/build.gradle b/preference/preference/build.gradle
index b26f71e..766ba71 100644
--- a/preference/preference/build.gradle
+++ b/preference/preference/build.gradle
@@ -47,10 +47,6 @@
 }
 
 android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
     sourceSets {
         main.res.srcDirs = [
                 "res",
diff --git a/recyclerview/recyclerview/build.gradle b/recyclerview/recyclerview/build.gradle
index b9dc0b6..ab0a17a 100644
--- a/recyclerview/recyclerview/build.gradle
+++ b/recyclerview/recyclerview/build.gradle
@@ -36,10 +36,6 @@
 }
 
 android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
     sourceSets {
         main.res.srcDirs "res", "res-public"
     }
diff --git a/resourceinspection/resourceinspection-annotation/build.gradle b/resourceinspection/resourceinspection-annotation/build.gradle
index 284c6e1..246d60c 100644
--- a/resourceinspection/resourceinspection-annotation/build.gradle
+++ b/resourceinspection/resourceinspection-annotation/build.gradle
@@ -26,11 +26,6 @@
     implementation("androidx.annotation:annotation:1.1.0")
 }
 
-java {
-    sourceCompatibility = JavaVersion.VERSION_1_7
-    targetCompatibility = JavaVersion.VERSION_1_7
-}
-
 androidx {
     name = "Android Resource Inspection - Annotations"
     type = LibraryType.PUBLISHED_LIBRARY
diff --git a/savedstate/savedstate/build.gradle b/savedstate/savedstate/build.gradle
index 84a5b92..df5ca59 100644
--- a/savedstate/savedstate/build.gradle
+++ b/savedstate/savedstate/build.gradle
@@ -10,10 +10,6 @@
 }
 
 android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
     buildTypes.all {
         consumerProguardFiles("proguard-rules.pro")
     }
diff --git a/sqlite/sqlite-inspection/build.gradle b/sqlite/sqlite-inspection/build.gradle
index dda866f..22e08ca 100644
--- a/sqlite/sqlite-inspection/build.gradle
+++ b/sqlite/sqlite-inspection/build.gradle
@@ -55,12 +55,6 @@
         // studio pipeline works only starting with Android O
         minSdkVersion 26
     }
-
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
-
     sourceSets {
         main.resources.srcDirs += "src/main/proto"
     }
diff --git a/startup/startup-runtime/build.gradle b/startup/startup-runtime/build.gradle
index 9b60091..315f1ee 100644
--- a/startup/startup-runtime/build.gradle
+++ b/startup/startup-runtime/build.gradle
@@ -31,10 +31,6 @@
     buildTypes.all {
         consumerProguardFiles "proguard-rules.pro"
     }
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
 }
 
 dependencies {
diff --git a/transition/transition/build.gradle b/transition/transition/build.gradle
index 9b95adc..eb608cb 100644
--- a/transition/transition/build.gradle
+++ b/transition/transition/build.gradle
@@ -34,14 +34,9 @@
 }
 
 android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
     buildTypes.all {
         consumerProguardFiles "proguard-rules.pro"
     }
-
     aaptOptions {
         additionalParameters "--no-version-transitions"
     }
diff --git a/vectordrawable/vectordrawable-animated/build.gradle b/vectordrawable/vectordrawable-animated/build.gradle
index 30d3435..e0a2582 100644
--- a/vectordrawable/vectordrawable-animated/build.gradle
+++ b/vectordrawable/vectordrawable-animated/build.gradle
@@ -21,19 +21,13 @@
 }
 
 android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
     defaultConfig {
         // This disables the builds tools automatic vector -> PNG generation
         generatedDensities = []
     }
-
     aaptOptions {
         additionalParameters("--no-version-vectors")
     }
-
     buildTypes.all {
         consumerProguardFiles("proguard-rules.pro")
     }
diff --git a/vectordrawable/vectordrawable/build.gradle b/vectordrawable/vectordrawable/build.gradle
index 0e0aaf1..9805e43 100644
--- a/vectordrawable/vectordrawable/build.gradle
+++ b/vectordrawable/vectordrawable/build.gradle
@@ -20,15 +20,10 @@
 }
 
 android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
     defaultConfig {
         // This disables the builds tools automatic vector -> PNG generation
         generatedDensities = []
     }
-
     aaptOptions {
         additionalParameters "--no-version-vectors"
     }
diff --git a/versionedparcelable/versionedparcelable/build.gradle b/versionedparcelable/versionedparcelable/build.gradle
index 8a6cd7a..0358e3f 100644
--- a/versionedparcelable/versionedparcelable/build.gradle
+++ b/versionedparcelable/versionedparcelable/build.gradle
@@ -39,10 +39,6 @@
 }
 
 android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
     buildFeatures {
         aidl = true
     }
diff --git a/viewpager/viewpager/build.gradle b/viewpager/viewpager/build.gradle
index 0fa3c58..5665f87 100644
--- a/viewpager/viewpager/build.gradle
+++ b/viewpager/viewpager/build.gradle
@@ -8,13 +8,6 @@
     id("com.android.library")
 }
 
-android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
-}
-
 dependencies {
     api("androidx.annotation:annotation:1.1.0")
     implementation("androidx.core:core:1.3.0-beta01")
diff --git a/viewpager/viewpager/src/main/java/androidx/viewpager/widget/ViewPager.java b/viewpager/viewpager/src/main/java/androidx/viewpager/widget/ViewPager.java
index 76b4a6b..1e1e827 100644
--- a/viewpager/viewpager/src/main/java/androidx/viewpager/widget/ViewPager.java
+++ b/viewpager/viewpager/src/main/java/androidx/viewpager/widget/ViewPager.java
@@ -2441,7 +2441,7 @@
 
                 canvas.rotate(270);
                 canvas.translate(-height + getPaddingTop(), mFirstOffset * width);
-                mLeftEdge.setSize(height, width);
+                mLeftEdge.setSize(/* width= */height, /* height= */width);
                 needsInvalidate |= mLeftEdge.draw(canvas);
                 canvas.restoreToCount(restoreCount);
             }
@@ -2452,7 +2452,7 @@
 
                 canvas.rotate(90);
                 canvas.translate(-getPaddingTop(), -(mLastOffset + 1) * width);
-                mRightEdge.setSize(height, width);
+                mRightEdge.setSize(/* width= */height, /* height= */width);
                 needsInvalidate |= mRightEdge.draw(canvas);
                 canvas.restoreToCount(restoreCount);
             }
diff --git a/viewpager2/viewpager2/build.gradle b/viewpager2/viewpager2/build.gradle
index 96b5361..8ac831b 100644
--- a/viewpager2/viewpager2/build.gradle
+++ b/viewpager2/viewpager2/build.gradle
@@ -51,16 +51,6 @@
     androidTestImplementation(KOTLIN_STDLIB)
 }
 
-android {
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
-    defaultConfig {
-        minSdkVersion 14
-    }
-}
-
 androidx {
     name = "AndroidX Widget ViewPager2"
     publish = Publish.SNAPSHOT_AND_RELEASE
diff --git a/wear/wear-complications-data/api/current.txt b/wear/wear-complications-data/api/current.txt
index 8adecf6..debfecf 100644
--- a/wear/wear-complications-data/api/current.txt
+++ b/wear/wear-complications-data/api/current.txt
@@ -9,14 +9,14 @@
   }
 
   public final class ComplicationProviderInfo {
-    ctor public ComplicationProviderInfo(String appName, String name, android.graphics.drawable.Icon icon, androidx.wear.complications.data.ComplicationType type, android.content.ComponentName componentName);
+    ctor public ComplicationProviderInfo(String appName, String name, android.graphics.drawable.Icon icon, androidx.wear.complications.data.ComplicationType type, android.content.ComponentName? componentName);
     method public String getAppName();
-    method public android.content.ComponentName getComponentName();
+    method public android.content.ComponentName? getComponentName();
     method public android.graphics.drawable.Icon getIcon();
     method public String getName();
     method public androidx.wear.complications.data.ComplicationType getType();
     property public final String appName;
-    property public final android.content.ComponentName componentName;
+    property public final android.content.ComponentName? componentName;
     property public final android.graphics.drawable.Icon icon;
     property public final String name;
     property public final androidx.wear.complications.data.ComplicationType type;
diff --git a/wear/wear-complications-data/api/public_plus_experimental_current.txt b/wear/wear-complications-data/api/public_plus_experimental_current.txt
index 664bc7e..2828788 100644
--- a/wear/wear-complications-data/api/public_plus_experimental_current.txt
+++ b/wear/wear-complications-data/api/public_plus_experimental_current.txt
@@ -9,14 +9,14 @@
   }
 
   public final class ComplicationProviderInfo {
-    ctor public ComplicationProviderInfo(String appName, String name, android.graphics.drawable.Icon icon, androidx.wear.complications.data.ComplicationType type, android.content.ComponentName componentName);
+    ctor public ComplicationProviderInfo(String appName, String name, android.graphics.drawable.Icon icon, androidx.wear.complications.data.ComplicationType type, android.content.ComponentName? componentName);
     method public String getAppName();
-    method public android.content.ComponentName getComponentName();
+    method public android.content.ComponentName? getComponentName();
     method public android.graphics.drawable.Icon getIcon();
     method public String getName();
     method public androidx.wear.complications.data.ComplicationType getType();
     property public final String appName;
-    property public final android.content.ComponentName componentName;
+    property public final android.content.ComponentName? componentName;
     property public final android.graphics.drawable.Icon icon;
     property public final String name;
     property public final androidx.wear.complications.data.ComplicationType type;
diff --git a/wear/wear-complications-data/api/restricted_current.txt b/wear/wear-complications-data/api/restricted_current.txt
index 104f5d8..1dc59bd 100644
--- a/wear/wear-complications-data/api/restricted_current.txt
+++ b/wear/wear-complications-data/api/restricted_current.txt
@@ -85,7 +85,7 @@
   }
 
   @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public final class ComplicationProviderInfo implements android.os.Parcelable {
-    ctor public ComplicationProviderInfo(String, String, android.graphics.drawable.Icon, @android.support.wearable.complications.ComplicationData.ComplicationType int, android.content.ComponentName);
+    ctor public ComplicationProviderInfo(String, String, android.graphics.drawable.Icon, @android.support.wearable.complications.ComplicationData.ComplicationType int, android.content.ComponentName?);
     ctor public ComplicationProviderInfo(android.os.Parcel);
     method public int describeContents();
     method public String? getAppName();
@@ -176,15 +176,15 @@
   }
 
   public final class ComplicationProviderInfo {
-    ctor public ComplicationProviderInfo(String appName, String name, android.graphics.drawable.Icon icon, androidx.wear.complications.data.ComplicationType type, android.content.ComponentName componentName);
+    ctor public ComplicationProviderInfo(String appName, String name, android.graphics.drawable.Icon icon, androidx.wear.complications.data.ComplicationType type, android.content.ComponentName? componentName);
     method public String getAppName();
-    method public android.content.ComponentName getComponentName();
+    method public android.content.ComponentName? getComponentName();
     method public android.graphics.drawable.Icon getIcon();
     method public String getName();
     method public androidx.wear.complications.data.ComplicationType getType();
     method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public android.support.wearable.complications.ComplicationProviderInfo toWireComplicationProviderInfo();
     property public final String appName;
-    property public final android.content.ComponentName componentName;
+    property public final android.content.ComponentName? componentName;
     property public final android.graphics.drawable.Icon icon;
     property public final String name;
     property public final androidx.wear.complications.data.ComplicationType type;
diff --git a/wear/wear-complications-data/src/main/java/android/support/wearable/complications/ComplicationProviderInfo.java b/wear/wear-complications-data/src/main/java/android/support/wearable/complications/ComplicationProviderInfo.java
index 7a334a1..9bfe8f82 100644
--- a/wear/wear-complications-data/src/main/java/android/support/wearable/complications/ComplicationProviderInfo.java
+++ b/wear/wear-complications-data/src/main/java/android/support/wearable/complications/ComplicationProviderInfo.java
@@ -62,21 +62,24 @@
     @Nullable private String mProviderName;
     @Nullable private Icon mProviderIcon;
     @ComplicationData.ComplicationType private int mComplicationType;
+    /** This field is only populate in Android R and up and it is null otherwise. */
     @Nullable private ComponentName mProviderComponentName;
 
     /**
      * Constructs a {@link ComplicationProviderInfo} with the details of a complication provider.
      *
+     * <p>The providerComponentName field is only populated from Android R and up.
+     *
      * @param appName The name of the app providing the complication
      * @param providerName The name of the complication provider within the app
      * @param providerIcon The icon for the complication provider
      * @param complicationType The type of complication provided
-     * @param providerComponentName The preview complication data
+     * @param providerComponentName The component name of the complication provider
      */
     public ComplicationProviderInfo(
             @NonNull String appName, @NonNull String providerName, @NonNull Icon providerIcon,
             @ComplicationData.ComplicationType int complicationType,
-            @NonNull ComponentName providerComponentName) {
+            @Nullable ComponentName providerComponentName) {
         this.mAppName = appName;
         this.mProviderName = providerName;
         this.mProviderIcon = providerIcon;
diff --git a/wear/wear-complications-data/src/main/java/androidx/wear/complications/ProviderInfoRetriever.kt b/wear/wear-complications-data/src/main/java/androidx/wear/complications/ProviderInfoRetriever.kt
index 405cf09..c70dcfd 100644
--- a/wear/wear-complications-data/src/main/java/androidx/wear/complications/ProviderInfoRetriever.kt
+++ b/wear/wear-complications-data/src/main/java/androidx/wear/complications/ProviderInfoRetriever.kt
@@ -138,7 +138,7 @@
         awaitDeferredService().getProviderInfos(
             watchFaceComponent, watchFaceComplicationIds
         )?.mapIndexed { index, info ->
-            ProviderInfo(watchFaceComplicationIds[index], info.toApiComplicationProviderInfo())
+            ProviderInfo(watchFaceComplicationIds[index], info?.toApiComplicationProviderInfo())
         }?.toTypedArray()
     }
 
@@ -246,9 +246,20 @@
     /** The type of the complication provided by the provider. */
     public val type: ComplicationType,
 
-    /** The provider's {@link ComponentName}. */
-    public val componentName: ComponentName,
+    /**
+     * The provider's {@link ComponentName}.
+     *
+     * This field is populated only on Android R and above and it is `null` otherwise.
+     */
+    public val componentName: ComponentName?,
 ) {
+    init {
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
+            require(componentName != null) {
+                "ComponentName is required on Android R and above"
+            }
+        }
+    }
     /**
      * Converts this value to [WireComplicationProviderInfo] object used for serialization.
      *
@@ -269,5 +280,5 @@
 public fun WireComplicationProviderInfo.toApiComplicationProviderInfo(): ComplicationProviderInfo =
     ComplicationProviderInfo(
         appName!!, providerName!!, providerIcon!!, fromWireType(complicationType),
-        providerComponentName!!
+        providerComponentName
     )
diff --git a/wear/wear-complications-data/src/test/java/androidx/wear/complications/ProviderInfoRetrieverTest.kt b/wear/wear-complications-data/src/test/java/androidx/wear/complications/ProviderInfoRetrieverTest.kt
index 6f3382f..3170b0b 100644
--- a/wear/wear-complications-data/src/test/java/androidx/wear/complications/ProviderInfoRetrieverTest.kt
+++ b/wear/wear-complications-data/src/test/java/androidx/wear/complications/ProviderInfoRetrieverTest.kt
@@ -18,6 +18,7 @@
 
 import android.content.ComponentName
 import android.content.Context
+import android.graphics.drawable.Icon
 import android.os.IBinder
 import android.support.wearable.complications.IPreviewComplicationDataCallback
 import android.support.wearable.complications.IProviderInfoService
@@ -147,4 +148,16 @@
                 .isNull()
         }
     }
+
+    @Test
+    public fun complicationProviderInfo_NullComponentName() {
+        val complicationProviderInfo = ComplicationProviderInfo(
+            "appName",
+            "name",
+            Icon.createWithContentUri("icon"),
+            ComplicationType.SHORT_TEXT,
+            componentName = null
+        )
+        assertThat(complicationProviderInfo.componentName).isNull()
+    }
 }
\ No newline at end of file
diff --git a/wear/wear-watchface-client/api/current.txt b/wear/wear-watchface-client/api/current.txt
index 8bb0b56..57cddaa 100644
--- a/wear/wear-watchface-client/api/current.txt
+++ b/wear/wear-watchface-client/api/current.txt
@@ -144,7 +144,7 @@
   }
 
   public static final class WatchFaceControlClient.ServiceStartFailureException extends java.lang.Exception {
-    ctor public WatchFaceControlClient.ServiceStartFailureException();
+    ctor public WatchFaceControlClient.ServiceStartFailureException(optional String message);
   }
 
   public final class WatchFaceId {
diff --git a/wear/wear-watchface-client/api/public_plus_experimental_current.txt b/wear/wear-watchface-client/api/public_plus_experimental_current.txt
index 5d158bb..a957fe1 100644
--- a/wear/wear-watchface-client/api/public_plus_experimental_current.txt
+++ b/wear/wear-watchface-client/api/public_plus_experimental_current.txt
@@ -144,7 +144,7 @@
   }
 
   public static final class WatchFaceControlClient.ServiceStartFailureException extends java.lang.Exception {
-    ctor public WatchFaceControlClient.ServiceStartFailureException();
+    ctor public WatchFaceControlClient.ServiceStartFailureException(optional String message);
   }
 
   public final class WatchFaceId {
diff --git a/wear/wear-watchface-client/api/restricted_current.txt b/wear/wear-watchface-client/api/restricted_current.txt
index cac23d1..709a25d 100644
--- a/wear/wear-watchface-client/api/restricted_current.txt
+++ b/wear/wear-watchface-client/api/restricted_current.txt
@@ -146,7 +146,7 @@
   }
 
   public static final class WatchFaceControlClient.ServiceStartFailureException extends java.lang.Exception {
-    ctor public WatchFaceControlClient.ServiceStartFailureException();
+    ctor public WatchFaceControlClient.ServiceStartFailureException(optional String message);
   }
 
   public final class WatchFaceId {
diff --git a/wear/wear-watchface-client/src/androidTest/java/androidx/wear/watchface/client/test/WatchFaceControlClientTest.kt b/wear/wear-watchface-client/src/androidTest/java/androidx/wear/watchface/client/test/WatchFaceControlClientTest.kt
index 26e014b..f1f0df8 100644
--- a/wear/wear-watchface-client/src/androidTest/java/androidx/wear/watchface/client/test/WatchFaceControlClientTest.kt
+++ b/wear/wear-watchface-client/src/androidTest/java/androidx/wear/watchface/client/test/WatchFaceControlClientTest.kt
@@ -41,6 +41,7 @@
 import androidx.wear.watchface.DrawMode
 import androidx.wear.watchface.RenderParameters
 import androidx.wear.watchface.WatchFace
+import androidx.wear.watchface.WatchFaceService
 import androidx.wear.watchface.WatchState
 import androidx.wear.watchface.client.DeviceConfig
 import androidx.wear.watchface.client.HeadlessWatchFaceClient
@@ -70,6 +71,7 @@
 import org.junit.Assert.assertFalse
 import org.junit.Assert.assertNull
 import org.junit.Assert.assertTrue
+import org.junit.Assert.fail
 import org.junit.Before
 import org.junit.Rule
 import org.junit.Test
@@ -838,6 +840,41 @@
         )
         interactiveInstance.close()
     }
+
+    @Test
+    public fun crashingWatchFace(): Unit = runBlocking {
+        val wallpaperService = TestCrashingWatchFaceService(context)
+
+        // Create the engine which triggers the crashing watchface
+        async {
+            handler.post {
+                engine = wallpaperService.onCreateEngine()
+                engine.onSurfaceChanged(
+                    surfaceHolder,
+                    0,
+                    surfaceHolder.surfaceFrame.width(),
+                    surfaceHolder.surfaceFrame.height()
+                )
+            }
+        }
+
+        try {
+            service.getOrCreateInteractiveWatchFaceClient(
+                "testId",
+                deviceConfig,
+                systemState,
+                null,
+                complications
+            )
+            fail("Expected an exception to be thrown because the watchface crashed on init")
+        } catch (e: Exception) {
+            assertThat(e).isInstanceOf(
+                WatchFaceControlClient.ServiceStartFailureException::class.java
+            )
+            assertThat(e).hasMessageThat().contains("Watchface crashed during init")
+            assertThat(e).hasMessageThat().contains("exceptionMessage: Deliberately crashing")
+        }
+    }
 }
 
 internal class TestExampleCanvasAnalogWatchFaceService(
@@ -860,3 +897,19 @@
         return watchFace
     }
 }
+
+internal class TestCrashingWatchFaceService(
+    testContext: Context
+) : WatchFaceService() {
+
+    init {
+        attachBaseContext(testContext)
+    }
+
+    override suspend fun createWatchFace(
+        surfaceHolder: SurfaceHolder,
+        watchState: WatchState
+    ): WatchFace {
+        throw Exception("Deliberately crashing")
+    }
+}
\ No newline at end of file
diff --git a/wear/wear-watchface-client/src/main/java/androidx/wear/watchface/client/WatchFaceControlClient.kt b/wear/wear-watchface-client/src/main/java/androidx/wear/watchface/client/WatchFaceControlClient.kt
index 7306b7f..09a3f91 100644
--- a/wear/wear-watchface-client/src/main/java/androidx/wear/watchface/client/WatchFaceControlClient.kt
+++ b/wear/wear-watchface-client/src/main/java/androidx/wear/watchface/client/WatchFaceControlClient.kt
@@ -30,6 +30,7 @@
 import androidx.wear.watchface.control.IPendingInteractiveWatchFace
 import androidx.wear.watchface.control.IWatchFaceControlService
 import androidx.wear.watchface.control.WatchFaceControlService
+import androidx.wear.watchface.control.data.CrashInfoParcel
 import androidx.wear.watchface.control.data.HeadlessWatchFaceInstanceParams
 import androidx.wear.watchface.control.data.WallpaperInteractiveWatchFaceInstanceParams
 import androidx.wear.watchface.data.IdAndComplicationDataWireFormat
@@ -105,7 +106,7 @@
     public class ServiceNotBoundException : Exception()
 
     /** Exception thrown by [WatchFaceControlClient] methods if the service dies during start up. */
-    public class ServiceStartFailureException : Exception()
+    public class ServiceStartFailureException(message: String = "") : Exception(message)
 
     /**
      * Returns the [InteractiveWatchFaceClient] for the given instance id, or null if no such
@@ -266,6 +267,16 @@
                             InteractiveWatchFaceClientImpl(iInteractiveWatchFace)
                         )
                     }
+
+                    override fun onInteractiveWatchFaceCrashed(exception: CrashInfoParcel) {
+                        serviceBinder.unlinkToDeath(deathObserver, 0)
+                        traceEvent.close()
+                        continuation.resumeWithException(
+                            WatchFaceControlClient.ServiceStartFailureException(
+                                "Watchface crashed during init: $exception"
+                            )
+                        )
+                    }
                 }
             )?.let {
                 // There was an existing watchface.onInteractiveWatchFaceCreated
diff --git a/wear/wear-watchface-data/api/restricted_current.txt b/wear/wear-watchface-data/api/restricted_current.txt
index 75e3676..98430d9 100644
--- a/wear/wear-watchface-data/api/restricted_current.txt
+++ b/wear/wear-watchface-data/api/restricted_current.txt
@@ -136,6 +136,14 @@
     field public static final android.os.Parcelable.Creator<androidx.wear.watchface.control.data.ComplicationRenderParams!>! CREATOR;
   }
 
+  @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class CrashInfoParcel implements android.os.Parcelable {
+    ctor public CrashInfoParcel(Throwable);
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<androidx.wear.watchface.control.data.CrashInfoParcel!>! CREATOR;
+    field public final android.app.ApplicationErrorReport.CrashInfo crashInfo;
+  }
+
   @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) @androidx.versionedparcelable.VersionedParcelize public class HeadlessWatchFaceInstanceParams implements android.os.Parcelable androidx.versionedparcelable.VersionedParcelable {
     ctor public HeadlessWatchFaceInstanceParams(android.content.ComponentName, androidx.wear.watchface.data.DeviceConfig, int, int);
     method public int describeContents();
diff --git a/wear/wear-watchface-data/src/main/aidl/androidx/wear/watchface/control/IPendingInteractiveWatchFace.aidl b/wear/wear-watchface-data/src/main/aidl/androidx/wear/watchface/control/IPendingInteractiveWatchFace.aidl
index 005eac3..3a46130 100644
--- a/wear/wear-watchface-data/src/main/aidl/androidx/wear/watchface/control/IPendingInteractiveWatchFace.aidl
+++ b/wear/wear-watchface-data/src/main/aidl/androidx/wear/watchface/control/IPendingInteractiveWatchFace.aidl
@@ -17,6 +17,7 @@
 package androidx.wear.watchface.control;
 
 import androidx.wear.watchface.control.IInteractiveWatchFace;
+import androidx.wear.watchface.control.data.CrashInfoParcel;
 
 /**
  * Callback issued when {@link IInteractiveWatchFaceWcs} has been created.
@@ -26,7 +27,7 @@
 interface IPendingInteractiveWatchFace {
    // IMPORTANT NOTE: All methods must be given an explicit transaction id that must never change
    // in the future to remain binary backwards compatible.
-   // Next Id: 8
+   // Next Id: 4
 
    /**
     * API version number. This should be incremented every time a new method is added.
@@ -43,4 +44,7 @@
 
    /** Called by the watchface when {@link IInteractiveWatchFaceWcs} has been created. */
    oneway void onInteractiveWatchFaceCreated(in IInteractiveWatchFace iInteractiveWatchFace) = 2;
+
+   /** Called if the watchface crashed on startup. */
+   oneway void onInteractiveWatchFaceCrashed(in CrashInfoParcel exception) = 3;
 }
diff --git a/wear/wear-watchface-data/src/main/aidl/androidx/wear/watchface/control/data/CrashInfoParcel.aidl b/wear/wear-watchface-data/src/main/aidl/androidx/wear/watchface/control/data/CrashInfoParcel.aidl
new file mode 100644
index 0000000..e2d824c
--- /dev/null
+++ b/wear/wear-watchface-data/src/main/aidl/androidx/wear/watchface/control/data/CrashInfoParcel.aidl
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2020 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.
+ */
+
+package androidx.wear.watchface.control.data;
+
+/** @hide */
+parcelable CrashInfoParcel;
diff --git a/wear/wear-watchface-data/src/main/java/androidx/wear/watchface/control/data/CrashInfoParcel.java b/wear/wear-watchface-data/src/main/java/androidx/wear/watchface/control/data/CrashInfoParcel.java
new file mode 100644
index 0000000..5f0fc51
--- /dev/null
+++ b/wear/wear-watchface-data/src/main/java/androidx/wear/watchface/control/data/CrashInfoParcel.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2021 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.
+ */
+
+package androidx.wear.watchface.control.data;
+
+import static android.app.ApplicationErrorReport.CrashInfo;
+
+import android.annotation.SuppressLint;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.util.StringBuilderPrinter;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.RestrictTo;
+
+/**
+ * Used for sending details of an exception over aidl.
+ * @hide
+ */
+@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
+@SuppressLint("BanParcelableUsage")
+public class CrashInfoParcel implements Parcelable {
+    @NonNull public final CrashInfo crashInfo;
+
+    public CrashInfoParcel(@NonNull Throwable exception) {
+        crashInfo = new CrashInfo(exception);
+    }
+
+    CrashInfoParcel(Parcel in) {
+        crashInfo = new CrashInfo(in);
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(@NonNull Parcel dest, int flags) {
+        crashInfo.writeToParcel(dest, flags);
+    }
+
+    public static final Parcelable.Creator<CrashInfoParcel> CREATOR =
+            new Parcelable.Creator<CrashInfoParcel>() {
+                @Override
+                public CrashInfoParcel createFromParcel(Parcel source) {
+                    return new CrashInfoParcel(source);
+                }
+
+                @Override
+                public CrashInfoParcel[] newArray(int size) {
+                    return new CrashInfoParcel[size];
+                }
+            };
+
+    @NonNull
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        StringBuilderPrinter pr = new StringBuilderPrinter(sb);
+        crashInfo.dump(pr, "");
+        return sb.toString();
+    }
+}
diff --git a/wear/wear-watchface-editor/src/androidTest/java/androidx/wear/watchface/editor/EditingSessionTest.kt b/wear/wear-watchface-editor/src/androidTest/java/androidx/wear/watchface/editor/EditingSessionTest.kt
index b64b5e9..90ef187c 100644
--- a/wear/wear-watchface-editor/src/androidTest/java/androidx/wear/watchface/editor/EditingSessionTest.kt
+++ b/wear/wear-watchface-editor/src/androidTest/java/androidx/wear/watchface/editor/EditingSessionTest.kt
@@ -30,9 +30,6 @@
 import android.os.Handler
 import android.os.IBinder
 import android.os.Looper
-import android.os.Parcel
-import android.support.wearable.complications.ComplicationData
-import android.support.wearable.complications.ComplicationProviderInfo
 import android.support.wearable.complications.IPreviewComplicationDataCallback
 import android.support.wearable.complications.IProviderInfoService
 import android.view.Surface
@@ -43,6 +40,7 @@
 import androidx.test.ext.junit.runners.AndroidJUnit4
 import androidx.test.filters.MediumTest
 import androidx.wear.complications.ComplicationBounds
+import androidx.wear.complications.ComplicationProviderInfo
 import androidx.wear.complications.DefaultComplicationProviderPolicy
 import androidx.wear.complications.ProviderChooserIntent
 import androidx.wear.complications.ProviderInfoRetriever
@@ -112,6 +110,9 @@
 private const val PROVIDER_CHOOSER_EXTRA_KEY = "PROVIDER_CHOOSER_EXTRA_KEY"
 private const val PROVIDER_CHOOSER_EXTRA_VALUE = "PROVIDER_CHOOSER_EXTRA_VALUE"
 
+private typealias WireComplicationProviderInfo =
+    android.support.wearable.complications.ComplicationProviderInfo
+
 /** Trivial "editor" which exposes the EditorSession for testing. */
 public open class OnWatchFaceEditingTestActivity : ComponentActivity() {
     public lateinit var editorSession: EditorSession
@@ -158,14 +159,14 @@
             "ProviderApp1",
             "Provider1",
             providerIcon1,
-            ComplicationType.SHORT_TEXT.toWireComplicationType(),
+            ComplicationType.SHORT_TEXT,
             provider1
         ),
         RIGHT_COMPLICATION_ID to ComplicationProviderInfo(
             "ProviderApp2",
             "Provider2",
             providerIcon2,
-            ComplicationType.LONG_TEXT.toWireComplicationType(),
+            ComplicationType.LONG_TEXT,
             provider2
         )
     )
@@ -192,13 +193,13 @@
     override fun getProviderInfos(
         watchFaceComponent: ComponentName,
         ids: IntArray
-    ): Array<ComplicationProviderInfo>? {
+    ): Array<WireComplicationProviderInfo?>? {
         if (watchFaceComponent != this.watchFaceComponent) {
             return null
         }
-        return ArrayList<ComplicationProviderInfo>().apply {
+        return ArrayList<WireComplicationProviderInfo?>().apply {
             for (id in ids) {
-                providerData[id]?.let { add(it) }
+                add(providerData[id]?.toWireComplicationProviderInfo())
             }
         }.toTypedArray()
     }
@@ -605,7 +606,7 @@
             runBlocking {
                 val editorSession = it.editorSession as OnWatchFaceEditorSessionImpl
                 val mockProviderInfoService = Mockito.mock(IProviderInfoService::class.java)
-                val complicationType = ComplicationData.TYPE_SHORT_TEXT
+                val complicationType = ComplicationType.SHORT_TEXT
                 val complicationText = "TestText"
                 val mockBinder = Mockito.mock(IBinder::class.java)
 
@@ -623,7 +624,7 @@
                     true
                 }.`when`(mockProviderInfoService).requestPreviewComplicationData(
                     eq(providerComponentName),
-                    eq(complicationType),
+                    eq(complicationType.toWireComplicationType()),
                     any()
                 )
 
@@ -665,24 +666,18 @@
             runBlocking {
                 val editorSession = it.editorSession as OnWatchFaceEditorSessionImpl
                 val mockProviderInfoService = Mockito.mock(IProviderInfoService::class.java)
-                val complicationType = ComplicationData.TYPE_SHORT_TEXT
+                val complicationType = ComplicationType.SHORT_TEXT
 
                 val providerInfoRetriever = ProviderInfoRetriever(mockProviderInfoService)
                 val previewComplication = editorSession.getPreviewData(
                     providerInfoRetriever,
                     // Construct a ComplicationProviderInfo with null providerComponentName.
                     ComplicationProviderInfo(
-                        Parcel.obtain().apply {
-                            writeBundle(
-                                Bundle().apply {
-                                    putString("app_name", "provider.app")
-                                    putString("provider_name", "provider")
-                                    putParcelable("provider_icon", providerIcon)
-                                    putInt("complication_type", complicationType)
-                                }
-                            )
-                            setDataPosition(0)
-                        }
+                        "provider.app",
+                        "provider",
+                        providerIcon,
+                        complicationType,
+                        null,
                     )
                 ) as ShortTextComplicationData
 
@@ -708,13 +703,13 @@
             runBlocking {
                 val editorSession = it.editorSession as OnWatchFaceEditorSessionImpl
                 val mockProviderInfoService = Mockito.mock(IProviderInfoService::class.java)
-                val complicationType = ComplicationData.TYPE_SHORT_TEXT
+                val complicationType = ComplicationType.SHORT_TEXT
 
                 `when`(mockProviderInfoService.apiVersion).thenReturn(1)
                 `when`(
                     mockProviderInfoService.requestPreviewComplicationData(
                         eq(providerComponentName),
-                        eq(complicationType),
+                        eq(complicationType.toWireComplicationType()),
                         any(IPreviewComplicationDataCallback::class.java)
                     )
                 ).thenReturn(false) // Triggers the ExecutionException.
@@ -752,9 +747,9 @@
                     Icon.createWithBitmap(
                         Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888)
                     ),
-                    ComplicationType.LONG_TEXT.toWireComplicationType(),
+                    ComplicationType.LONG_TEXT,
                     provider3
-                )
+                ).toWireComplicationProviderInfo()
             )
         }
 
@@ -856,9 +851,9 @@
                     Icon.createWithBitmap(
                         Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888)
                     ),
-                    ComplicationType.LONG_TEXT.toWireComplicationType(),
+                    ComplicationType.LONG_TEXT,
                     provider3
-                )
+                ).toWireComplicationProviderInfo()
             )
         }
 
@@ -1189,7 +1184,7 @@
                         "provider.app",
                         "provider",
                         providerIcon,
-                        ComplicationData.TYPE_SHORT_TEXT,
+                        ComplicationType.SHORT_TEXT,
                         providerComponentName
                     )
                 )
diff --git a/wear/wear-watchface-editor/src/main/java/androidx/wear/watchface/editor/EditorSession.kt b/wear/wear-watchface-editor/src/main/java/androidx/wear/watchface/editor/EditorSession.kt
index 481d301..d3ce984 100644
--- a/wear/wear-watchface-editor/src/main/java/androidx/wear/watchface/editor/EditorSession.kt
+++ b/wear/wear-watchface-editor/src/main/java/androidx/wear/watchface/editor/EditorSession.kt
@@ -25,7 +25,6 @@
 import android.os.Bundle
 import android.os.Handler
 import android.os.Looper
-import android.support.wearable.complications.ComplicationProviderInfo
 import androidx.activity.ComponentActivity
 import androidx.activity.result.contract.ActivityResultContract
 import androidx.annotation.Px
@@ -33,15 +32,16 @@
 import androidx.annotation.RestrictTo
 import androidx.annotation.UiThread
 import androidx.wear.complications.ComplicationHelperActivity
+import androidx.wear.complications.ComplicationProviderInfo
 import androidx.wear.complications.ProviderInfoRetriever
 import androidx.wear.complications.data.ComplicationData
 import androidx.wear.complications.data.ComplicationText
 import androidx.wear.complications.data.ComplicationType
 import androidx.wear.complications.data.EmptyComplicationData
-import androidx.wear.complications.data.LongTextComplicationData
 import androidx.wear.complications.data.MonochromaticImage
 import androidx.wear.complications.data.PlainComplicationText
 import androidx.wear.complications.data.ShortTextComplicationData
+import androidx.wear.complications.toApiComplicationProviderInfo
 import androidx.wear.utility.AsyncTraceEvent
 import androidx.wear.utility.TraceEvent
 import androidx.wear.utility.launchWithTracing
@@ -403,11 +403,11 @@
             return null
         }
         // Fetch preview ComplicationData if possible.
-        return providerInfo.providerComponentName?.let {
+        providerInfo.componentName?.let {
             try {
                 providerInfoRetriever.retrievePreviewComplicationData(
                     it,
-                    ComplicationType.fromWireType(providerInfo.complicationType)
+                    providerInfo.type
                 )
             } catch (e: Exception) {
                 // Something went wrong, so use fallback preview data.
@@ -418,23 +418,13 @@
 
     private fun makeFallbackPreviewData(
         providerInfo: ComplicationProviderInfo
-    ) = when {
-        providerInfo.providerName == null -> null
-
-        providerInfo.providerIcon == null ->
-            LongTextComplicationData.Builder(
-                PlainComplicationText.Builder(providerInfo.providerName!!).build(),
-                ComplicationText.EMPTY
-            ).build()
-
-        else ->
-            ShortTextComplicationData.Builder(
-                PlainComplicationText.Builder(providerInfo.providerName!!).build(),
-                ComplicationText.EMPTY
-            ).setMonochromaticImage(
-                MonochromaticImage.Builder(providerInfo.providerIcon!!).build()
-            ).build()
-    }
+    ) =
+        ShortTextComplicationData.Builder(
+            PlainComplicationText.Builder(providerInfo.name).build(),
+            ComplicationText.EMPTY
+        ).setMonochromaticImage(
+            MonochromaticImage.Builder(providerInfo.icon).build()
+        ).build()
 
     protected fun fetchComplicationPreviewData() {
         val providerInfoRetriever = providerInfoRetrieverProvider.getProviderInfoRetriever()
@@ -453,10 +443,7 @@
                         { it.watchFaceComplicationId },
                         {
                             async {
-                                getPreviewData(
-                                    providerInfoRetriever,
-                                    it.info?.toWireComplicationProviderInfo()
-                                )
+                                getPreviewData(providerInfoRetriever, it.info)
                             }
                         }
                         // Coerce to a Map<Int, ComplicationData> omitting null values.
@@ -711,6 +698,10 @@
     }
 
     override fun parseResult(resultCode: Int, intent: Intent?) = intent?.let {
-        ComplicationProviderChooserResult(it.getParcelableExtra(EXTRA_PROVIDER_INFO))
+        ComplicationProviderChooserResult(
+            it.getParcelableExtra<android.support.wearable.complications.ComplicationProviderInfo>(
+                EXTRA_PROVIDER_INFO
+            )?.toApiComplicationProviderInfo()
+        )
     }
 }
\ No newline at end of file
diff --git a/wear/wear-watchface/api/current.txt b/wear/wear-watchface/api/current.txt
index 55b50bc..becad78 100644
--- a/wear/wear-watchface/api/current.txt
+++ b/wear/wear-watchface/api/current.txt
@@ -221,6 +221,7 @@
     method public final android.opengl.EGLContext? getEglContext();
     method public final android.opengl.EGLDisplay? getEglDisplay();
     method @UiThread public final void initOpenGlContext();
+    method public final void makeContextCurrent();
     method @UiThread public void onGlContextCreated();
     method @UiThread public void onGlSurfaceCreated(@Px int width, @Px int height);
     method @UiThread public abstract void render(android.icu.util.Calendar calendar);
diff --git a/wear/wear-watchface/api/public_plus_experimental_current.txt b/wear/wear-watchface/api/public_plus_experimental_current.txt
index 338ad3a..cba5763 100644
--- a/wear/wear-watchface/api/public_plus_experimental_current.txt
+++ b/wear/wear-watchface/api/public_plus_experimental_current.txt
@@ -221,6 +221,7 @@
     method public final android.opengl.EGLContext? getEglContext();
     method public final android.opengl.EGLDisplay? getEglDisplay();
     method @UiThread public final void initOpenGlContext();
+    method public final void makeContextCurrent();
     method @UiThread public void onGlContextCreated();
     method @UiThread public void onGlSurfaceCreated(@Px int width, @Px int height);
     method @UiThread public abstract void render(android.icu.util.Calendar calendar);
diff --git a/wear/wear-watchface/api/restricted_current.txt b/wear/wear-watchface/api/restricted_current.txt
index 82cf391..6f8c29e 100644
--- a/wear/wear-watchface/api/restricted_current.txt
+++ b/wear/wear-watchface/api/restricted_current.txt
@@ -255,6 +255,7 @@
     method public final android.opengl.EGLContext? getEglContext();
     method public final android.opengl.EGLDisplay? getEglDisplay();
     method @UiThread public final void initOpenGlContext();
+    method public final void makeContextCurrent();
     method @UiThread public void onGlContextCreated();
     method @UiThread public void onGlSurfaceCreated(@Px int width, @Px int height);
     method @UiThread public abstract void render(android.icu.util.Calendar calendar);
diff --git a/wear/wear-watchface/src/androidTest/java/androidx/wear/watchface/test/WatchFaceServiceImageTest.kt b/wear/wear-watchface/src/androidTest/java/androidx/wear/watchface/test/WatchFaceServiceImageTest.kt
index 5724670..d53d413 100644
--- a/wear/wear-watchface/src/androidTest/java/androidx/wear/watchface/test/WatchFaceServiceImageTest.kt
+++ b/wear/wear-watchface/src/androidTest/java/androidx/wear/watchface/test/WatchFaceServiceImageTest.kt
@@ -48,6 +48,7 @@
 import androidx.wear.watchface.control.IInteractiveWatchFace
 import androidx.wear.watchface.control.IPendingInteractiveWatchFace
 import androidx.wear.watchface.control.InteractiveInstanceManager
+import androidx.wear.watchface.control.data.CrashInfoParcel
 import androidx.wear.watchface.control.data.WallpaperInteractiveWatchFaceInstanceParams
 import androidx.wear.watchface.control.data.WatchFaceRenderParams
 import androidx.wear.watchface.data.DeviceConfig
@@ -61,6 +62,7 @@
 import androidx.wear.watchface.style.data.UserStyleWireFormat
 import com.google.common.truth.Truth.assertThat
 import org.junit.After
+import org.junit.Assert.fail
 import org.junit.Before
 import org.junit.Rule
 import org.junit.Test
@@ -268,6 +270,10 @@
                                 initLatch.countDown()
                             }
                         }
+
+                        override fun onInteractiveWatchFaceCrashed(exception: CrashInfoParcel?) {
+                            fail("WatchFace crashed: $exception")
+                        }
                     }
                 )
             )
diff --git a/wear/wear-watchface/src/main/AndroidManifest.xml b/wear/wear-watchface/src/main/AndroidManifest.xml
index d41e9a8..17820ae 100644
--- a/wear/wear-watchface/src/main/AndroidManifest.xml
+++ b/wear/wear-watchface/src/main/AndroidManifest.xml
@@ -25,7 +25,9 @@
   <application>
     <uses-library android:name="com.google.android.wearable" android:required="false" />
     <service
-        android:name="androidx.wear.watchface.control.WatchFaceControlService">
+        android:name="androidx.wear.watchface.control.WatchFaceControlService"
+        android:enabled="@bool/watch_face_instance_service_enabled"
+        android:permission="com.google.android.wearable.permission.BIND_WATCH_FACE_CONTROL">
       <meta-data android:name="androidx.wear.watchface.api_version" android:value="3" />
       <intent-filter>
         <action android:name="com.google.android.wearable.action.WATCH_FACE_CONTROL"/>
diff --git a/wear/wear-watchface/src/main/java/androidx/wear/watchface/Renderer.kt b/wear/wear-watchface/src/main/java/androidx/wear/watchface/Renderer.kt
index 2b1597e..f0c096d 100644
--- a/wear/wear-watchface/src/main/java/androidx/wear/watchface/Renderer.kt
+++ b/wear/wear-watchface/src/main/java/androidx/wear/watchface/Renderer.kt
@@ -598,12 +598,15 @@
         }
 
         /**
-         * Sets our GL context to be the current one. This method *must* be called before any OpenGL
-         * APIs are used.
+         * Sets our GL context to be the current one. The library does this on your behalf before
+         * calling [onGlContextCreated] or [render]. If you need to make any OpenGL calls outside
+         * those functions, this method *must* be called first.
+         *
+         * @throws [IllegalStateException] if the calls to [EGL14.eglMakeCurrent] fails
          */
-        private fun makeContextCurrent() {
+        public fun makeContextCurrent() {
             if (!EGL14.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext)) {
-                throw RuntimeException("eglMakeCurrent failed")
+                throw IllegalStateException("eglMakeCurrent failed")
             }
         }
 
@@ -646,7 +649,10 @@
             initDone = true
         }
 
-        /** Called when a new GL context is created. It's safe to use GL APIs in this method. */
+        /**
+         * Called when a new GL context is created. It's safe to use GL APIs in this method. Note
+         * [makeContextCurrent] is called by the library before this method.
+         */
         @UiThread
         public open fun onGlContextCreated() {
         }
@@ -760,7 +766,8 @@
          * should respect the current [renderParameters]. Any highlights due to
          * [RenderParameters.highlightLayer] should be rendered by [renderHighlightLayer] instead
          * where possible. For correct behavior this function must use the supplied [Calendar]
-         * in favor of any other ways of getting the time.
+         * in favor of any other ways of getting the time. Note [makeContextCurrent] is called by
+         * the library before this method.
          *
          * @param calendar The current [Calendar]
          */
diff --git a/wear/wear-watchface/src/main/java/androidx/wear/watchface/WatchFaceService.kt b/wear/wear-watchface/src/main/java/androidx/wear/watchface/WatchFaceService.kt
index c771b35..2cb6fc3 100644
--- a/wear/wear-watchface/src/main/java/androidx/wear/watchface/WatchFaceService.kt
+++ b/wear/wear-watchface/src/main/java/androidx/wear/watchface/WatchFaceService.kt
@@ -61,6 +61,7 @@
 import androidx.wear.watchface.control.InteractiveInstanceManager
 import androidx.wear.watchface.control.InteractiveWatchFaceImpl
 import androidx.wear.watchface.control.data.ComplicationRenderParams
+import androidx.wear.watchface.control.data.CrashInfoParcel
 import androidx.wear.watchface.control.data.HeadlessWatchFaceInstanceParams
 import androidx.wear.watchface.control.data.WallpaperInteractiveWatchFaceInstanceParams
 import androidx.wear.watchface.control.data.WatchFaceRenderParams
@@ -244,12 +245,17 @@
         // The index of the watch element in the content description labels. Usually it will be
         // first.
         private const val WATCH_ELEMENT_ACCESSIBILITY_TRAVERSAL_INDEX = -1
+
+        // The maximum permitted duration of [WatchFaceService.MAX_CREATE_WATCHFACE_TIME_MILLIS].
+        private const val MAX_CREATE_WATCHFACE_TIME_MILLIS = 5000
     }
 
     /**
      * Override this factory method to create your WatchFaceImpl. This method will be called by the
      * library on the UiThread. If possible any expensive initialization should be done on a
-     * background thread.
+     * background thread to avoid blocking the UiThread.
+     *
+     * Warning watch face initialization will fail if createWatchFace takes longer than 5 seconds.
      *
      * @param surfaceHolder The [SurfaceHolder] to pass to the [Renderer]'s constructor.
      * @param watchState The [WatchState] for the watch face.
@@ -633,16 +639,33 @@
 
             // In a direct boot scenario attempt to load the previously serialized parameters.
             if (pendingWallpaperInstance == null && !expectPreRInitFlow()) {
-                directBootParams = readDirectBootPrefs(_context, DIRECT_BOOT_PREFS)
-                if (directBootParams != null) {
+                val params = readDirectBootPrefs(_context, DIRECT_BOOT_PREFS)
+                directBootParams = params
+                // In tests a watchface may already have been created.
+                if (params != null && !watchFaceCreatedOrPending()) {
                     val asyncTraceEvent = AsyncTraceEvent("DirectBoot")
                     coroutineScope.launch {
-                        // In tests a watchface may already have been created.
-                        if (!watchFaceCreatedOrPending()) {
-                            createInteractiveInstance(
-                                directBootParams!!,
-                                "DirectBoot"
-                            )
+                        try {
+                            val instance = createInteractiveInstance(params, "DirectBoot")
+                            // WatchFace init is async so its possible we now have a pending
+                            // WallpaperInteractiveWatchFaceInstance request.
+                            InteractiveInstanceManager
+                                .takePendingWallpaperInteractiveWatchFaceInstance()?.let {
+                                    require(it.params.instanceId == params.instanceId) {
+                                        "Mismatch between pendingWallpaperInstance id " +
+                                            "${it.params.instanceId} and constructed instance id " +
+                                            "${params.instanceId}"
+                                    }
+                                    it.callback.onInteractiveWatchFaceCreated(instance)
+                                }
+                        } catch (e: Exception) {
+                            InteractiveInstanceManager
+                                .takePendingWallpaperInteractiveWatchFaceInstance()?.let {
+                                    it.callback.onInteractiveWatchFaceCrashed(
+                                        CrashInfoParcel(e)
+                                    )
+                                }
+                        } finally {
                             asyncTraceEvent.close()
                         }
                     }
@@ -660,12 +683,18 @@
                 // workaround the workaround...
                 ignoreNextOnVisibilityChanged = true
                 coroutineScope.launch {
-                    pendingWallpaperInstance.callback.onInteractiveWatchFaceCreated(
-                        createInteractiveInstance(
-                            pendingWallpaperInstance.params,
-                            "Boot with pendingWallpaperInstance"
+                    try {
+                        pendingWallpaperInstance.callback.onInteractiveWatchFaceCreated(
+                            createInteractiveInstance(
+                                pendingWallpaperInstance.params,
+                                "Boot with pendingWallpaperInstance"
+                            )
                         )
-                    )
+                    } catch (e: Exception) {
+                        pendingWallpaperInstance.callback.onInteractiveWatchFaceCrashed(
+                            CrashInfoParcel(e)
+                        )
+                    }
                     asyncTraceEvent.close()
                     val params = pendingWallpaperInstance.params
                     directBootParams = params
@@ -1200,17 +1229,6 @@
             val instance = InteractiveWatchFaceImpl(this, params.instanceId, uiThreadHandler)
             InteractiveInstanceManager.addInstance(instance)
             interactiveInstanceId = params.instanceId
-
-            // WatchFace init is async so its possible we have a pending
-            // WallpaperInteractiveWatchFaceInstance request.
-            InteractiveInstanceManager.takePendingWallpaperInteractiveWatchFaceInstance()?.let {
-                require(it.params.instanceId == params.instanceId) {
-                    "Mismatch between pendingWallpaperInstance id ${it.params.instanceId} and " +
-                        "constructed instance id ${params.instanceId}"
-                }
-                it.callback.onInteractiveWatchFaceCreated(instance)
-            }
-
             return instance
         }
 
@@ -1233,9 +1251,16 @@
         ) {
             asyncWatchFaceConstructionPending = true
             createdBy = _createdBy
+            val timeBefore = System.currentTimeMillis()
             val watchface = TraceEvent("WatchFaceService.createWatchFace").use {
                 createWatchFace(surfaceHolder, watchState)
             }
+            val timeAfter = System.currentTimeMillis()
+            val timeTaken = timeAfter - timeBefore
+            require(timeTaken < MAX_CREATE_WATCHFACE_TIME_MILLIS) {
+                "createWatchFace should complete in less than $MAX_CREATE_WATCHFACE_TIME_MILLIS " +
+                    "milliseconds"
+            }
             watchFaceImpl = TraceEvent("WatchFaceImpl.init").use {
                 WatchFaceImpl(watchface, this, watchState)
             }
diff --git a/wear/wear-watchface/src/main/java/androidx/wear/watchface/control/WatchFaceControlService.kt b/wear/wear-watchface/src/main/java/androidx/wear/watchface/control/WatchFaceControlService.kt
index 4be3d02..7b35f3a 100644
--- a/wear/wear-watchface/src/main/java/androidx/wear/watchface/control/WatchFaceControlService.kt
+++ b/wear/wear-watchface/src/main/java/androidx/wear/watchface/control/WatchFaceControlService.kt
@@ -30,6 +30,7 @@
 import androidx.wear.utility.TraceEvent
 import androidx.wear.watchface.IndentingPrintWriter
 import androidx.wear.watchface.WatchFaceService
+import androidx.wear.watchface.control.data.CrashInfoParcel
 import androidx.wear.watchface.control.data.HeadlessWatchFaceInstanceParams
 import androidx.wear.watchface.control.data.WallpaperInteractiveWatchFaceInstanceParams
 import androidx.wear.watchface.editor.EditorService
@@ -171,6 +172,11 @@
                             asyncTraceEvent.close()
                             callback.onInteractiveWatchFaceCreated(iInteractiveWatchFaceWcs)
                         }
+
+                        override fun onInteractiveWatchFaceCrashed(exception: CrashInfoParcel) {
+                            asyncTraceEvent.close()
+                            callback.onInteractiveWatchFaceCrashed(exception)
+                        }
                     }
                 )
             )
diff --git a/wear/wear-watchface/src/test/java/androidx/wear/watchface/AsyncWatchFaceInitTest.kt b/wear/wear-watchface/src/test/java/androidx/wear/watchface/AsyncWatchFaceInitTest.kt
index 2583b43..fa2726f 100644
--- a/wear/wear-watchface/src/test/java/androidx/wear/watchface/AsyncWatchFaceInitTest.kt
+++ b/wear/wear-watchface/src/test/java/androidx/wear/watchface/AsyncWatchFaceInitTest.kt
@@ -24,6 +24,7 @@
 import androidx.wear.watchface.control.IInteractiveWatchFace
 import androidx.wear.watchface.control.IPendingInteractiveWatchFace
 import androidx.wear.watchface.control.InteractiveInstanceManager
+import androidx.wear.watchface.control.data.CrashInfoParcel
 import androidx.wear.watchface.control.data.WallpaperInteractiveWatchFaceInstanceParams
 import androidx.wear.watchface.data.DeviceConfig
 import androidx.wear.watchface.data.WatchUiState
@@ -37,6 +38,7 @@
 import kotlinx.coroutines.launch
 import org.junit.Assert.assertNotNull
 import org.junit.Assert.assertNull
+import org.junit.Assert.fail
 import org.junit.Before
 import org.junit.Test
 import org.junit.runner.RunWith
@@ -238,6 +240,12 @@
                             ) {
                                 pendingInteractiveWatchFaceWcs = iInteractiveWatchFaceWcs
                             }
+
+                            override fun onInteractiveWatchFaceCrashed(
+                                exception: CrashInfoParcel?
+                            ) {
+                                fail("WatchFace crashed: $exception")
+                            }
                         }
                     )
                 )
diff --git a/wear/wear-watchface/src/test/java/androidx/wear/watchface/WatchFaceServiceTest.kt b/wear/wear-watchface/src/test/java/androidx/wear/watchface/WatchFaceServiceTest.kt
index f616bfa..6f8b52e 100644
--- a/wear/wear-watchface/src/test/java/androidx/wear/watchface/WatchFaceServiceTest.kt
+++ b/wear/wear-watchface/src/test/java/androidx/wear/watchface/WatchFaceServiceTest.kt
@@ -48,6 +48,7 @@
 import androidx.wear.watchface.control.IInteractiveWatchFace
 import androidx.wear.watchface.control.IPendingInteractiveWatchFace
 import androidx.wear.watchface.control.InteractiveInstanceManager
+import androidx.wear.watchface.control.data.CrashInfoParcel
 import androidx.wear.watchface.control.data.WallpaperInteractiveWatchFaceInstanceParams
 import androidx.wear.watchface.data.ComplicationBoundsType
 import androidx.wear.watchface.data.DeviceConfig
@@ -69,6 +70,7 @@
 import org.junit.Assert.assertFalse
 import org.junit.Assert.assertNull
 import org.junit.Assert.assertTrue
+import org.junit.Assert.fail
 import org.junit.Before
 import org.junit.Test
 import org.junit.runner.RunWith
@@ -420,6 +422,10 @@
                         ) {
                             interactiveWatchFaceInstance = iInteractiveWatchFace
                         }
+
+                        override fun onInteractiveWatchFaceCrashed(exception: CrashInfoParcel?) {
+                            fail("WatchFace crashed: $exception")
+                        }
                     }
                 )
             )
diff --git a/work/workmanager-inspection/build.gradle b/work/workmanager-inspection/build.gradle
index f0e66dc..781a9c5 100644
--- a/work/workmanager-inspection/build.gradle
+++ b/work/workmanager-inspection/build.gradle
@@ -57,12 +57,6 @@
         // studio pipeline works only starting with Android O
         minSdkVersion 26
     }
-
-    compileOptions {
-        sourceCompatibility = JavaVersion.VERSION_1_7
-        targetCompatibility = JavaVersion.VERSION_1_7
-    }
-
     sourceSets {
         main.resources.srcDirs += "src/main/proto"
     }