Merge "Parse both whitelist and activity manifest for DO."
diff --git a/car_product/build/car.mk b/car_product/build/car.mk
index f4a67c1..bfe12d6 100644
--- a/car_product/build/car.mk
+++ b/car_product/build/car.mk
@@ -91,7 +91,6 @@
     OverviewApp \
     CarLauncher \
     CarSystemUI \
-    CarLensPickerApp \
     LocalMediaPlayer \
     CarMediaApp \
     CarMessengerApp \
diff --git a/car_product/overlay/frameworks/base/core/res/res/layout/resolve_list_item.xml b/car_product/overlay/frameworks/base/core/res/res/layout/resolve_list_item.xml
new file mode 100644
index 0000000..2cdb228
--- /dev/null
+++ b/car_product/overlay/frameworks/base/core/res/res/layout/resolve_list_item.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+* Copyright 2018, 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.
+*/
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:orientation="horizontal"
+              android:layout_height="wrap_content"
+              android:layout_width="match_parent"
+              android:minHeight="?attr/listPreferredItemHeightLarge"
+              android:paddingTop="4dp"
+              android:paddingBottom="4dp"
+              android:background="?attr/activatedBackgroundIndicator">
+    <ImageView android:id="@+id/icon"
+               android:layout_width="75dp"
+               android:layout_height="75dp"
+               android:layout_gravity="start|center_vertical"
+               android:layout_marginStart="?attr/listPreferredItemPaddingStart"
+               android:layout_marginTop="12dp"
+               android:layout_marginBottom="12dp"
+               android:scaleType="fitXY" />
+
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                  android:gravity="start|center_vertical"
+                  android:orientation="vertical"
+                  android:paddingStart="?attr/listPreferredItemPaddingStart"
+                  android:paddingEnd="?attr/listPreferredItemPaddingEnd"
+                  android:layout_height="wrap_content"
+                  android:layout_width="wrap_content"
+                  android:layout_gravity="start|center_vertical">
+        <!-- Activity name -->
+        <TextView android:id="@android:id/text1"
+                  android:layout_width="wrap_content"
+                  android:layout_height="wrap_content"
+                  android:layout_gravity="start|center_vertical"
+                  android:textAppearance="?attr/textAppearanceLarge"
+                  android:minHeight="50sp"
+                  android:minLines="1"
+                  android:maxLines="1"
+                  android:textColor="@color/white"
+                  android:ellipsize="marquee" />
+        <!-- Extended activity info to distinguish between duplicate activity names -->
+        <TextView android:id="@android:id/text2"
+                  android:textAppearance="?android:attr/textAppearanceLarge"
+                  android:layout_width="wrap_content"
+                  android:layout_height="wrap_content"
+                  android:layout_gravity="center_vertical"
+                  android:textColor="@color/white"
+                  android:minLines="1"
+                  android:maxLines="1"
+                  android:ellipsize="marquee" />
+    </LinearLayout>
+</LinearLayout>
diff --git a/car_product/overlay/frameworks/base/core/res/res/layout/resolver_list.xml b/car_product/overlay/frameworks/base/core/res/res/layout/resolver_list.xml
new file mode 100644
index 0000000..9d64d65
--- /dev/null
+++ b/car_product/overlay/frameworks/base/core/res/res/layout/resolver_list.xml
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+* Copyright 2018, 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.
+*/
+-->
+<com.android.internal.widget.ResolverDrawerLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:theme="@android:style/Theme.DeviceDefault.NoActionBar"
+    android:id="@id/contentPanel">
+
+    <LinearLayout
+        android:id="@+id/button_bar"
+        android:visibility="gone"
+        style="?attr/buttonBarStyle"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_ignoreOffset="true"
+        android:layout_alwaysShow="true"
+        android:layout_hasNestedScrollIndicator="true"
+        android:background="?attr/colorBackgroundFloating"
+        android:orientation="horizontal"
+        android:paddingTop="8dp"
+        android:paddingBottom="8dp"
+        android:paddingStart="12dp"
+        android:weightSum="5"
+        android:paddingEnd="12dp"
+        android:elevation="8dp">
+
+        <TextView
+            android:id="@+id/profile_button"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginEnd="8dp"
+            android:paddingStart="8dp"
+            android:paddingEnd="8dp"
+            android:textSize="40sp"
+            android:layout_weight="5"
+            android:layout_gravity = "left"
+            android:visibility="gone"
+            android:textColor="?attr/colorAccent"
+            android:singleLine="true"/>
+
+        <TextView
+            android:id="@+id/title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:minHeight="56dp"
+            android:layout_gravity = "left"
+            android:layout_weight="3"
+            android:paddingTop="8dp"
+            android:layout_below="@id/profile_button"
+            android:paddingBottom="8dp"/>
+
+        <Button
+            android:id="@+id/button_once"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:enabled="false"
+            android:layout_gravity = "right"
+            android:text="@string/activity_resolver_use_once"
+            android:layout_weight="1"
+            android:onClick="onButtonClick"/>
+
+        <Button
+            android:id="@+id/button_always"
+            android:layout_marginLeft="10dp"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:enabled="false"
+            android:layout_gravity = "right"
+            android:text="@string/activity_resolver_use_always"
+            android:layout_weight="1"
+            android:onClick="onButtonClick"/>
+    </LinearLayout>
+
+    <ListView
+        android:layout_width="match_parent"
+        android:layout_height="500dp"
+        android:id="@+id/resolver_list"
+        android:clipToPadding="false"
+        android:scrollbarStyle="outsideOverlay"
+        android:background="?attr/colorBackgroundFloating"
+        android:elevation="8dp"
+        android:nestedScrollingEnabled="true"
+        android:scrollIndicators="top|bottom"/>
+
+    <TextView android:id="@+id/empty"
+              android:layout_width="match_parent"
+              android:layout_height="wrap_content"
+              android:background="?attr/colorBackgroundFloating"
+              android:elevation="8dp"
+              android:layout_alwaysShow="true"
+              android:text="@string/noApplications"
+              android:padding="32dp"
+              android:gravity="center"
+              android:visibility="gone"/>
+
+</com.android.internal.widget.ResolverDrawerLayout>
diff --git a/car_product/overlay/frameworks/base/core/res/res/layout/resolver_list_with_default.xml b/car_product/overlay/frameworks/base/core/res/res/layout/resolver_list_with_default.xml
new file mode 100644
index 0000000..62d4d69
--- /dev/null
+++ b/car_product/overlay/frameworks/base/core/res/res/layout/resolver_list_with_default.xml
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+* Copyright 2018, 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.
+*/
+-->
+<com.android.internal.widget.ResolverDrawerLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:theme="@android:style/Theme.DeviceDefault"
+    android:maxCollapsedHeight="200dp"
+    android:id="@id/contentPanel">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:weightSum="5"
+        android:layout_alwaysShow="true"
+        android:orientation="vertical"
+        android:background="?attr/colorBackgroundFloating"
+        android:elevation="8dp">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_weight="0.5"
+            android:orientation="horizontal">
+
+            <ImageView
+                android:id="@+id/icon"
+                android:layout_width="24dp"
+                android:layout_height="24dp"
+                android:layout_gravity="start|top"
+                android:layout_marginStart="16dp"
+                android:layout_marginEnd="16dp"
+                android:layout_marginTop="20dp"
+                android:src="@drawable/resolver_icon_placeholder"
+                android:scaleType="fitCenter"/>
+
+            <TextView
+                android:id="@+id/title"
+                android:layout_width="0dp"
+                android:layout_weight="1"
+                android:layout_height="?attr/listPreferredItemHeight"
+                android:layout_marginStart="16dp"
+                android:textAppearance="?attr/textAppearanceMedium"
+                android:gravity="start|center_vertical"
+                android:paddingEnd="16dp"/>
+
+            <LinearLayout
+                android:id="@+id/profile_button"
+                android:layout_width="wrap_content"
+                android:layout_height="48dp"
+                android:layout_marginTop="4dp"
+                android:layout_marginEnd="4dp"
+                android:paddingStart="8dp"
+                android:paddingEnd="8dp"
+                android:paddingTop="4dp"
+                android:paddingBottom="4dp"
+                android:focusable="true"
+                android:visibility="gone"
+                style="?attr/borderlessButtonStyle">
+
+                <ImageView
+                    android:id="@+id/icon"
+                    android:layout_width="24dp"
+                    android:layout_height="24dp"
+                    android:layout_gravity="start|center_vertical"
+                    android:layout_marginEnd="?attr/listPreferredItemPaddingEnd"
+                    android:layout_marginTop="12dp"
+                    android:layout_marginBottom="12dp"
+                    android:scaleType="fitCenter"/>
+
+                <TextView
+                    android:id="@id/text1"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="start|center_vertical"
+                    android:layout_marginEnd="?attr/listPreferredItemPaddingEnd"
+                    android:textAppearance="?attr/textAppearanceButton"
+                    android:textColor="?attr/textColorPrimary"
+                    android:minLines="1"
+                    android:maxLines="1"
+                    android:ellipsize="marquee"/>
+            </LinearLayout>
+        </LinearLayout>
+
+        <LinearLayout
+            android:id="@+id/button_bar"
+            android:visibility="gone"
+            style="?attr/buttonBarStyle"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_alwaysShow="true"
+            android:gravity="end|center_vertical"
+            android:layout_weight="0.5"
+            android:orientation="horizontal"
+            android:layoutDirection="locale"
+            android:measureWithLargestChild="true"
+            android:paddingTop="8dp"
+            android:paddingBottom="8dp"
+            android:paddingStart="12dp"
+            android:paddingEnd="12dp"
+            android:elevation="8dp">
+
+            <Button
+                android:id="@+id/button_once"
+                android:layout_width="wrap_content"
+                android:layout_gravity="start"
+                android:maxLines="2"
+                style="?attr/buttonBarNegativeButtonStyle"
+                android:minHeight="@dimen/alert_dialog_button_bar_height"
+                android:layout_height="wrap_content"
+                android:enabled="false"
+                android:text="@string/activity_resolver_use_once"
+                android:onClick="onButtonClick"/>
+
+            <Button
+                android:id="@+id/button_always"
+                android:layout_width="wrap_content"
+                android:layout_gravity="end"
+                android:maxLines="2"
+                android:minHeight="@dimen/alert_dialog_button_bar_height"
+                style="?attr/buttonBarPositiveButtonStyle"
+                android:layout_height="wrap_content"
+                android:enabled="false"
+                android:text="@string/activity_resolver_use_always"
+                android:onClick="onButtonClick"/>
+        </LinearLayout>
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1dp"
+            android:background="?attr/dividerVertical"/>
+
+
+        <ListView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:id="@+id/resolver_list"
+            android:layout_weight="4"
+            android:clipToPadding="false"
+            android:scrollbarStyle="outsideOverlay"
+            android:background="?attr/colorBackgroundFloating"
+            android:elevation="8dp"
+            android:nestedScrollingEnabled="true"
+            android:divider="@null"/>
+    </LinearLayout>
+
+</com.android.internal.widget.ResolverDrawerLayout>
\ No newline at end of file
diff --git a/car_product/overlay/frameworks/base/core/res/res/values/config.xml b/car_product/overlay/frameworks/base/core/res/res/values/config.xml
index 3ab6085..1de7df0 100644
--- a/car_product/overlay/frameworks/base/core/res/res/values/config.xml
+++ b/car_product/overlay/frameworks/base/core/res/res/values/config.xml
@@ -50,10 +50,6 @@
     <!-- Automotive Bluetooth pairing option -->
     <bool name="enable_pbap_pce_profile">true</bool>
 
-    <!-- Component name of a custom ResolverActivity (Intent resolver) to be used instead of
-         the default framework version. -->
-    <string name="config_customResolverActivity" translatable="false">com.android.support.car.lenspicker/.LensResolverActivity</string>
-
     <!-- Flag indicating that the entire notification header can be clicked to expand the
          notification. If false, then the expand icon has to be clicked in order for the expand
          to occur. -->
diff --git a/car_product/overlay/frameworks/base/core/res/res/values/strings.xml b/car_product/overlay/frameworks/base/core/res/res/values/strings.xml
new file mode 100644
index 0000000..9217647
--- /dev/null
+++ b/car_product/overlay/frameworks/base/core/res/res/values/strings.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Default name of the owner user [CHAR LIMIT=20] -->
+    <string name="owner_name">Driver</string>
+</resources>
diff --git a/tests/android_car_api_test/Android.mk b/tests/android_car_api_test/Android.mk
index b1c2728..c1d412c 100644
--- a/tests/android_car_api_test/Android.mk
+++ b/tests/android_car_api_test/Android.mk
@@ -35,7 +35,7 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := junit
 LOCAL_STATIC_JAVA_LIBRARIES += \
-        android-support-test \
+        androidx.test.rules \
         android.hidl.base-V1.0-java \
         android.hardware.automotive.vehicle-V2.0-java \
 
diff --git a/tests/android_car_api_test/src/android/car/apitest/CarProjectionManagerTest.java b/tests/android_car_api_test/src/android/car/apitest/CarProjectionManagerTest.java
index ecc2e47..abfeb11 100644
--- a/tests/android_car_api_test/src/android/car/apitest/CarProjectionManagerTest.java
+++ b/tests/android_car_api_test/src/android/car/apitest/CarProjectionManagerTest.java
@@ -23,10 +23,11 @@
 import android.net.wifi.WifiConfiguration;
 import android.os.Binder;
 import android.os.IBinder;
-import android.support.test.filters.RequiresDevice;
 import android.test.suitebuilder.annotation.LargeTest;
 import android.test.suitebuilder.annotation.Suppress;
 
+import androidx.test.filters.RequiresDevice;
+
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
diff --git a/tests/android_car_api_test/src/android/car/apitest/CarUxRestrictionsConfigurationTest.java b/tests/android_car_api_test/src/android/car/apitest/CarUxRestrictionsConfigurationTest.java
index c55683a..f86c76e 100644
--- a/tests/android_car_api_test/src/android/car/apitest/CarUxRestrictionsConfigurationTest.java
+++ b/tests/android_car_api_test/src/android/car/apitest/CarUxRestrictionsConfigurationTest.java
@@ -26,10 +26,11 @@
 
 import android.car.drivingstate.CarUxRestrictions;
 import android.car.drivingstate.CarUxRestrictionsConfiguration;
-import android.support.test.filters.SmallTest;
 import android.util.JsonReader;
 import android.util.JsonWriter;
 
+import androidx.test.filters.SmallTest;
+
 import junit.framework.TestCase;
 
 import java.io.ByteArrayInputStream;
diff --git a/tests/carservice_test/Android.mk b/tests/carservice_test/Android.mk
index 7c17e7e..2ac3256 100644
--- a/tests/carservice_test/Android.mk
+++ b/tests/carservice_test/Android.mk
@@ -44,7 +44,7 @@
     vehicle-hal-support-lib \
     car-systemtest \
     mockito-target-inline \
-    android-support-test \
+    androidx.test.rules \
     android.hardware.automotive.vehicle-V2.0-java \
     com.android.car.test.utils \
     truth-prebuilt
diff --git a/tests/carservice_test/AndroidManifest.xml b/tests/carservice_test/AndroidManifest.xml
index 0e98404..7c92513 100644
--- a/tests/carservice_test/AndroidManifest.xml
+++ b/tests/carservice_test/AndroidManifest.xml
@@ -29,7 +29,7 @@
     <uses-permission android:name="android.car.permission.CAR_CONTROL_AUDIO_SETTINGS" />
     <uses-permission android:name="android.car.permission.STORAGE_MONITORING" />
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="com.android.car.test"
             android:label="Tests for Car APIs"/>
 
diff --git a/tests/carservice_test/src/android/media/tests/AudioPolicyTest.java b/tests/carservice_test/src/android/media/tests/AudioPolicyTest.java
index 9fcf449..9e0f311 100644
--- a/tests/carservice_test/src/android/media/tests/AudioPolicyTest.java
+++ b/tests/carservice_test/src/android/media/tests/AudioPolicyTest.java
@@ -30,11 +30,12 @@
 import android.media.audiopolicy.AudioPolicy;
 import android.os.Handler;
 import android.os.Looper;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/carservice_test/src/com/android/car/AppFocusTest.java b/tests/carservice_test/src/com/android/car/AppFocusTest.java
index 630717f..910a132 100644
--- a/tests/carservice_test/src/com/android/car/AppFocusTest.java
+++ b/tests/carservice_test/src/com/android/car/AppFocusTest.java
@@ -19,10 +19,11 @@
 
 import android.car.Car;
 import android.car.CarAppFocusManager;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/carservice_test/src/com/android/car/CarAudioManagerTest.java b/tests/carservice_test/src/com/android/car/CarAudioManagerTest.java
index 1eb641f..d11159e 100644
--- a/tests/carservice_test/src/com/android/car/CarAudioManagerTest.java
+++ b/tests/carservice_test/src/com/android/car/CarAudioManagerTest.java
@@ -17,10 +17,11 @@
 
 import android.car.Car;
 import android.car.media.CarAudioManager;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/carservice_test/src/com/android/car/CarCabinManagerTest.java b/tests/carservice_test/src/com/android/car/CarCabinManagerTest.java
index 67725b9..46d54b7 100644
--- a/tests/carservice_test/src/com/android/car/CarCabinManagerTest.java
+++ b/tests/carservice_test/src/com/android/car/CarCabinManagerTest.java
@@ -30,11 +30,12 @@
 import android.hardware.automotive.vehicle.V2_0.VehiclePropValue;
 import android.hardware.automotive.vehicle.V2_0.VehicleProperty;
 import android.os.SystemClock;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 import android.util.MutableInt;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.car.vehiclehal.VehiclePropValueBuilder;
 import com.android.car.vehiclehal.test.MockedVehicleHal.VehicleHalPropertyHandler;
 
diff --git a/tests/carservice_test/src/com/android/car/CarDiagnosticConstantsTest.java b/tests/carservice_test/src/com/android/car/CarDiagnosticConstantsTest.java
index 4d08e2d..2955345 100644
--- a/tests/carservice_test/src/com/android/car/CarDiagnosticConstantsTest.java
+++ b/tests/carservice_test/src/com/android/car/CarDiagnosticConstantsTest.java
@@ -16,10 +16,11 @@
 
 package com.android.car;
 
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import junit.framework.TestCase;
 
 import org.junit.Test;
diff --git a/tests/carservice_test/src/com/android/car/CarDiagnosticManagerTest.java b/tests/carservice_test/src/com/android/car/CarDiagnosticManagerTest.java
index ac07d0e..f73c401 100644
--- a/tests/carservice_test/src/com/android/car/CarDiagnosticManagerTest.java
+++ b/tests/carservice_test/src/com/android/car/CarDiagnosticManagerTest.java
@@ -16,7 +16,6 @@
 
 package com.android.car;
 
-import static java.lang.Integer.toHexString;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -37,12 +36,13 @@
 import android.hardware.automotive.vehicle.V2_0.VehiclePropValue;
 import android.hardware.automotive.vehicle.V2_0.VehicleProperty;
 import android.os.SystemClock;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.JsonReader;
 import android.util.JsonWriter;
 import android.util.Log;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.car.vehiclehal.DiagnosticEventBuilder;
 import com.android.car.vehiclehal.DiagnosticJson;
 import com.android.car.vehiclehal.VehiclePropValueBuilder;
@@ -51,6 +51,8 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import static java.lang.Integer.toHexString;
+
 import java.io.StringReader;
 import java.io.StringWriter;
 import java.util.Arrays;
diff --git a/tests/carservice_test/src/com/android/car/CarDrivingRestrictionsTest.java b/tests/carservice_test/src/com/android/car/CarDrivingRestrictionsTest.java
index 7f94cbb..88b00cc 100644
--- a/tests/carservice_test/src/com/android/car/CarDrivingRestrictionsTest.java
+++ b/tests/carservice_test/src/com/android/car/CarDrivingRestrictionsTest.java
@@ -31,10 +31,11 @@
 import android.hardware.automotive.vehicle.V2_0.VehicleGear;
 import android.hardware.automotive.vehicle.V2_0.VehicleProperty;
 import android.os.SystemClock;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.car.vehiclehal.VehiclePropValueBuilder;
 import com.android.internal.annotations.GuardedBy;
 
diff --git a/tests/carservice_test/src/com/android/car/CarHvacManagerTest.java b/tests/carservice_test/src/com/android/car/CarHvacManagerTest.java
index 1493fe9..a32cca5 100644
--- a/tests/carservice_test/src/com/android/car/CarHvacManagerTest.java
+++ b/tests/carservice_test/src/com/android/car/CarHvacManagerTest.java
@@ -32,11 +32,12 @@
 import android.hardware.automotive.vehicle.V2_0.VehiclePropertyAccess;
 import android.hardware.automotive.vehicle.V2_0.VehiclePropertyChangeMode;
 import android.os.SystemClock;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 import android.util.MutableInt;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.car.vehiclehal.VehiclePropValueBuilder;
 import com.android.car.vehiclehal.test.MockedVehicleHal.VehicleHalPropertyHandler;
 
diff --git a/tests/carservice_test/src/com/android/car/CarInfoManagerTest.java b/tests/carservice_test/src/com/android/car/CarInfoManagerTest.java
index 9f5aa3a..f028663 100644
--- a/tests/carservice_test/src/com/android/car/CarInfoManagerTest.java
+++ b/tests/carservice_test/src/com/android/car/CarInfoManagerTest.java
@@ -22,8 +22,9 @@
 import android.car.Car;
 import android.car.CarInfoManager;
 import android.hardware.automotive.vehicle.V2_0.VehicleProperty;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.car.vehiclehal.VehiclePropValueBuilder;
 
diff --git a/tests/carservice_test/src/com/android/car/CarPackageManagerTest.java b/tests/carservice_test/src/com/android/car/CarPackageManagerTest.java
index 84afde9..8068241 100644
--- a/tests/carservice_test/src/com/android/car/CarPackageManagerTest.java
+++ b/tests/carservice_test/src/com/android/car/CarPackageManagerTest.java
@@ -24,11 +24,12 @@
 import android.car.content.pm.AppBlockingPackageInfo;
 import android.car.content.pm.CarAppBlockingPolicy;
 import android.car.content.pm.CarPackageManager;
-import android.support.test.filters.SmallTest;
-import android.support.test.filters.Suppress;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.filters.Suppress;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.car.pm.CarPackageManagerService;
 
 import org.junit.Test;
diff --git a/tests/carservice_test/src/com/android/car/CarPowerManagementTest.java b/tests/carservice_test/src/com/android/car/CarPowerManagementTest.java
index 1fdba6e..ab5c271 100644
--- a/tests/carservice_test/src/com/android/car/CarPowerManagementTest.java
+++ b/tests/carservice_test/src/com/android/car/CarPowerManagementTest.java
@@ -28,9 +28,10 @@
 import android.hardware.automotive.vehicle.V2_0.VehiclePropertyAccess;
 import android.hardware.automotive.vehicle.V2_0.VehiclePropertyChangeMode;
 import android.os.SystemClock;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.car.systeminterface.DisplayInterface;
 import com.android.car.systeminterface.SystemInterface;
diff --git a/tests/carservice_test/src/com/android/car/CarProjectionManagerTest.java b/tests/carservice_test/src/com/android/car/CarProjectionManagerTest.java
index 8b108df..8efc823 100644
--- a/tests/carservice_test/src/com/android/car/CarProjectionManagerTest.java
+++ b/tests/carservice_test/src/com/android/car/CarProjectionManagerTest.java
@@ -26,11 +26,12 @@
 import android.hardware.automotive.vehicle.V2_0.VehicleProperty;
 import android.hardware.automotive.vehicle.V2_0.VehiclePropertyAccess;
 import android.os.SystemClock;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 import android.view.KeyEvent;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.car.vehiclehal.VehiclePropValueBuilder;
 import com.android.car.vehiclehal.test.MockedVehicleHal.VehicleHalPropertyHandler;
 
diff --git a/tests/carservice_test/src/com/android/car/CarStorageMonitoringTest.java b/tests/carservice_test/src/com/android/car/CarStorageMonitoringTest.java
index f034ccb..75296d9 100644
--- a/tests/carservice_test/src/com/android/car/CarStorageMonitoringTest.java
+++ b/tests/carservice_test/src/com/android/car/CarStorageMonitoringTest.java
@@ -37,13 +37,14 @@
 import android.content.pm.PackageManager.NameNotFoundException;
 import android.content.pm.ResolveInfo;
 import android.os.SystemClock;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.JsonWriter;
 import android.util.Log;
 import android.util.Pair;
 import android.util.SparseArray;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.car.storagemonitoring.LifetimeWriteInfoProvider;
 import com.android.car.storagemonitoring.UidIoStatsProvider;
 import com.android.car.storagemonitoring.WearEstimateRecord;
diff --git a/tests/carservice_test/src/com/android/car/CarUxRestrictionsConfigurationXmlParserTest.java b/tests/carservice_test/src/com/android/car/CarUxRestrictionsConfigurationXmlParserTest.java
index 02000a3..cad210e 100644
--- a/tests/carservice_test/src/com/android/car/CarUxRestrictionsConfigurationXmlParserTest.java
+++ b/tests/carservice_test/src/com/android/car/CarUxRestrictionsConfigurationXmlParserTest.java
@@ -26,9 +26,10 @@
 import android.car.drivingstate.CarUxRestrictions;
 import android.car.drivingstate.CarUxRestrictionsConfiguration;
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/carservice_test/src/com/android/car/CarUxRestrictionsManagerServiceTest.java b/tests/carservice_test/src/com/android/car/CarUxRestrictionsManagerServiceTest.java
index e87badf..de1c16e 100644
--- a/tests/carservice_test/src/com/android/car/CarUxRestrictionsManagerServiceTest.java
+++ b/tests/carservice_test/src/com/android/car/CarUxRestrictionsManagerServiceTest.java
@@ -35,12 +35,13 @@
 import android.content.Context;
 import android.content.res.Resources;
 import android.hardware.automotive.vehicle.V2_0.VehicleProperty;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.JsonReader;
 import android.util.JsonWriter;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/carservice_test/src/com/android/car/CarVendorExtensionManagerTest.java b/tests/carservice_test/src/com/android/car/CarVendorExtensionManagerTest.java
index 1f6bb10..97d5003 100644
--- a/tests/carservice_test/src/com/android/car/CarVendorExtensionManagerTest.java
+++ b/tests/carservice_test/src/com/android/car/CarVendorExtensionManagerTest.java
@@ -32,11 +32,12 @@
 import android.hardware.automotive.vehicle.V2_0.VehiclePropertyGroup;
 import android.hardware.automotive.vehicle.V2_0.VehiclePropertyType;
 import android.os.SystemClock;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 import android.util.SparseArray;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.car.vehiclehal.test.MockedVehicleHal;
 import com.android.car.vehiclehal.test.VehiclePropConfigBuilder;
 
diff --git a/tests/carservice_test/src/com/android/car/FastPairProviderTest.java b/tests/carservice_test/src/com/android/car/FastPairProviderTest.java
index 02c4cf1..6aee11d 100644
--- a/tests/carservice_test/src/com/android/car/FastPairProviderTest.java
+++ b/tests/carservice_test/src/com/android/car/FastPairProviderTest.java
@@ -28,8 +28,9 @@
 import android.content.Context;
 import android.content.res.Resources;
 import android.os.ParcelUuid;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Assert;
 import org.junit.Before;
diff --git a/tests/carservice_test/src/com/android/car/MockedCarTestBase.java b/tests/carservice_test/src/com/android/car/MockedCarTestBase.java
index b27adfc..e327470 100644
--- a/tests/carservice_test/src/com/android/car/MockedCarTestBase.java
+++ b/tests/carservice_test/src/com/android/car/MockedCarTestBase.java
@@ -34,11 +34,12 @@
 import android.os.Handler;
 import android.os.IBinder;
 import android.os.Looper;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
 import android.util.Log;
 import android.util.SparseArray;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+
 import com.android.car.pm.CarPackageManagerService;
 import com.android.car.systeminterface.DisplayInterface;
 import com.android.car.systeminterface.IOInterface;
diff --git a/tests/carservice_test/src/com/android/car/SystemActivityMonitoringServiceTest.java b/tests/carservice_test/src/com/android/car/SystemActivityMonitoringServiceTest.java
index 4455113..906192a 100644
--- a/tests/carservice_test/src/com/android/car/SystemActivityMonitoringServiceTest.java
+++ b/tests/carservice_test/src/com/android/car/SystemActivityMonitoringServiceTest.java
@@ -23,9 +23,10 @@
 import android.content.Context;
 import android.content.Intent;
 import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.car.SystemActivityMonitoringService.TopTaskInfoContainer;
 
diff --git a/tests/carservice_test/src/com/android/car/VmsHalServiceSubscriptionEventTest.java b/tests/carservice_test/src/com/android/car/VmsHalServiceSubscriptionEventTest.java
index 16b0572..ad586ae 100644
--- a/tests/carservice_test/src/com/android/car/VmsHalServiceSubscriptionEventTest.java
+++ b/tests/carservice_test/src/com/android/car/VmsHalServiceSubscriptionEventTest.java
@@ -30,8 +30,9 @@
 import android.hardware.automotive.vehicle.V2_0.VmsMessageType;
 import android.hardware.automotive.vehicle.V2_0.VmsMessageWithLayerIntegerValuesIndex;
 import android.hardware.automotive.vehicle.V2_0.VmsSubscriptionsStateIntegerValuesIndex;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.car.vehiclehal.VehiclePropValueBuilder;
 import com.android.car.vehiclehal.test.MockedVehicleHal;
diff --git a/tests/carservice_test/src/com/android/car/VmsOperationRecorderTest.java b/tests/carservice_test/src/com/android/car/VmsOperationRecorderTest.java
index c05ec99..2c41f32 100644
--- a/tests/carservice_test/src/com/android/car/VmsOperationRecorderTest.java
+++ b/tests/carservice_test/src/com/android/car/VmsOperationRecorderTest.java
@@ -22,10 +22,11 @@
 import android.car.vms.VmsLayerDependency;
 import android.car.vms.VmsLayersOffering;
 import android.car.vms.VmsOperationRecorder;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
diff --git a/tests/carservice_test/src/com/android/car/VmsPublisherClientServiceTest.java b/tests/carservice_test/src/com/android/car/VmsPublisherClientServiceTest.java
index d8cbe7b..a54b0e3 100644
--- a/tests/carservice_test/src/com/android/car/VmsPublisherClientServiceTest.java
+++ b/tests/carservice_test/src/com/android/car/VmsPublisherClientServiceTest.java
@@ -28,10 +28,11 @@
 import android.hardware.automotive.vehicle.V2_0.VmsBaseMessageIntegerValuesIndex;
 import android.hardware.automotive.vehicle.V2_0.VmsMessageType;
 import android.hardware.automotive.vehicle.V2_0.VmsMessageWithLayerIntegerValuesIndex;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.car.vehiclehal.VehiclePropValueBuilder;
 import com.android.car.vehiclehal.test.MockedVehicleHal;
 import com.android.car.vehiclehal.test.MockedVehicleHal.VehicleHalPropertyHandler;
diff --git a/tests/carservice_test/src/com/android/car/VmsPublisherSubscriberTest.java b/tests/carservice_test/src/com/android/car/VmsPublisherSubscriberTest.java
index 1f0237f..e5a592c 100644
--- a/tests/carservice_test/src/com/android/car/VmsPublisherSubscriberTest.java
+++ b/tests/carservice_test/src/com/android/car/VmsPublisherSubscriberTest.java
@@ -28,9 +28,10 @@
 import android.hardware.automotive.vehicle.V2_0.VehicleProperty;
 import android.hardware.automotive.vehicle.V2_0.VehiclePropertyAccess;
 import android.hardware.automotive.vehicle.V2_0.VehiclePropertyChangeMode;
-import android.support.test.filters.FlakyTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.FlakyTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.car.vehiclehal.test.MockedVehicleHal;
 
diff --git a/tests/carservice_test/src/com/android/car/VmsSubscriberManagerTest.java b/tests/carservice_test/src/com/android/car/VmsSubscriberManagerTest.java
index 63b0e62..8bb4f27 100644
--- a/tests/carservice_test/src/com/android/car/VmsSubscriberManagerTest.java
+++ b/tests/carservice_test/src/com/android/car/VmsSubscriberManagerTest.java
@@ -34,10 +34,11 @@
 import android.hardware.automotive.vehicle.V2_0.VmsAvailabilityStateIntegerValuesIndex;
 import android.hardware.automotive.vehicle.V2_0.VmsMessageType;
 import android.os.SystemClock;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.car.vehiclehal.VehiclePropValueBuilder;
 import com.android.car.vehiclehal.test.MockedVehicleHal.VehicleHalPropertyHandler;
 
diff --git a/tests/carservice_test/src/com/android/car/garagemode/ControllerTest.java b/tests/carservice_test/src/com/android/car/garagemode/ControllerTest.java
index 447cc2c..ae6896d 100644
--- a/tests/carservice_test/src/com/android/car/garagemode/ControllerTest.java
+++ b/tests/carservice_test/src/com/android/car/garagemode/ControllerTest.java
@@ -35,8 +35,9 @@
 import android.content.Intent;
 import android.os.Handler;
 import android.os.Looper;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/carservice_test/src/com/android/car/garagemode/GarageModeServiceTest.java b/tests/carservice_test/src/com/android/car/garagemode/GarageModeServiceTest.java
index b67c50d..91059fc 100644
--- a/tests/carservice_test/src/com/android/car/garagemode/GarageModeServiceTest.java
+++ b/tests/carservice_test/src/com/android/car/garagemode/GarageModeServiceTest.java
@@ -23,8 +23,9 @@
 
 import android.content.ContentResolver;
 import android.content.Context;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/carservice_test/src/com/android/car/garagemode/WakeupPolicyTest.java b/tests/carservice_test/src/com/android/car/garagemode/WakeupPolicyTest.java
index 0a36754..921434b 100644
--- a/tests/carservice_test/src/com/android/car/garagemode/WakeupPolicyTest.java
+++ b/tests/carservice_test/src/com/android/car/garagemode/WakeupPolicyTest.java
@@ -19,9 +19,10 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.car.R;
 
diff --git a/tests/carservice_unit_test/Android.mk b/tests/carservice_unit_test/Android.mk
index b444e05..1045b52 100644
--- a/tests/carservice_unit_test/Android.mk
+++ b/tests/carservice_unit_test/Android.mk
@@ -42,7 +42,7 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     junit \
-    android-support-test \
+    androidx.test.rules \
     mockito-target-minus-junit4 \
     com.android.car.test.utils \
     truth-prebuilt
diff --git a/tests/carservice_unit_test/AndroidManifest.xml b/tests/carservice_unit_test/AndroidManifest.xml
index 0f67275..1a9a3cc 100644
--- a/tests/carservice_unit_test/AndroidManifest.xml
+++ b/tests/carservice_unit_test/AndroidManifest.xml
@@ -18,7 +18,7 @@
         xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
         package="com.android.car.carservice_unittest"
         android:sharedUserId="android.uid.system" >
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="com.android.car"
             android:label="Unit Tests for Car APIs"/>
 
diff --git a/tests/carservice_unit_test/src/com/android/car/CarConfigurationServiceTest.java b/tests/carservice_unit_test/src/com/android/car/CarConfigurationServiceTest.java
index 58b9c9a..9254a56 100644
--- a/tests/carservice_unit_test/src/com/android/car/CarConfigurationServiceTest.java
+++ b/tests/carservice_unit_test/src/com/android/car/CarConfigurationServiceTest.java
@@ -27,8 +27,9 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import android.car.settings.SpeedBumpConfiguration;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.json.JSONException;
 import org.json.JSONObject;
diff --git a/tests/carservice_unit_test/src/com/android/car/CarLocationServiceTest.java b/tests/carservice_unit_test/src/com/android/car/CarLocationServiceTest.java
index 8bc8e34..dabb617 100644
--- a/tests/carservice_unit_test/src/com/android/car/CarLocationServiceTest.java
+++ b/tests/carservice_unit_test/src/com/android/car/CarLocationServiceTest.java
@@ -43,8 +43,9 @@
 import android.location.LocationManager;
 import android.os.RemoteException;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.internal.util.ArrayUtils;
 
diff --git a/tests/carservice_unit_test/src/com/android/car/CarUserManagerHelperTest.java b/tests/carservice_unit_test/src/com/android/car/CarUserManagerHelperTest.java
index 4757015..6b283ed 100644
--- a/tests/carservice_unit_test/src/com/android/car/CarUserManagerHelperTest.java
+++ b/tests/carservice_unit_test/src/com/android/car/CarUserManagerHelperTest.java
@@ -40,11 +40,12 @@
 import android.os.UserHandle;
 import android.os.UserManager;
 import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.sysprop.CarProperties;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -78,11 +79,13 @@
     @Mock
     private CarUserManagerHelper.OnUsersUpdateListener mTestListener;
 
+    private static final String GUEST_USER_NAME = "testGuest";
+    private static final String TEST_USER_NAME = "testUser";
+    private static final String DEFAULT_ADMIN_NAME = "defaultAdminName";
+
     private CarUserManagerHelper mCarUserManagerHelper;
     private UserInfo mCurrentProcessUser;
     private UserInfo mSystemUser;
-    private String mGuestUserName = "testGuest";
-    private String mTestUserName = "testUser";
     private int mForegroundUserId;
     private UserInfo mForegroundUser;
 
@@ -96,7 +99,8 @@
         doReturn(InstrumentationRegistry.getTargetContext().getContentResolver())
                 .when(mContext).getContentResolver();
         doReturn(mContext).when(mContext).getApplicationContext();
-        mCarUserManagerHelper = new CarUserManagerHelper(mContext);
+        mCarUserManagerHelper =
+                new CarUserManagerHelper(mContext, DEFAULT_ADMIN_NAME);
 
         mCurrentProcessUser = createUserInfoForId(UserHandle.myUserId());
         mSystemUser = createUserInfoForId(UserHandle.USER_SYSTEM);
@@ -362,21 +366,61 @@
     }
 
     @Test
-    public void testCreateNewAdminUser() {
+    public void testCreateNewAdminUserCallsCreateUser() {
         // Make sure current user is admin, since only admins can create other admins.
         doReturn(true).when(mUserManager).isAdminUser();
 
-        // Verify createUser on UserManager gets called.
-        mCarUserManagerHelper.createNewAdminUser(mTestUserName);
-        verify(mUserManager).createUser(mTestUserName, UserInfo.FLAG_ADMIN);
+        mCarUserManagerHelper.createNewAdminUser(TEST_USER_NAME);
+        verify(mUserManager).createUser(TEST_USER_NAME, UserInfo.FLAG_ADMIN);
+    }
 
-        doReturn(null).when(mUserManager).createUser(mTestUserName, UserInfo.FLAG_ADMIN);
-        assertThat(mCarUserManagerHelper.createNewAdminUser(mTestUserName)).isNull();
+    @Test
+    public void testCreateNewAdminUserReturnsNullUsers() {
+        // Make sure current user is admin, since only admins can create other admins.
+        doReturn(true).when(mUserManager).isAdminUser();
+
+        doReturn(null).when(mUserManager).createUser(TEST_USER_NAME, UserInfo.FLAG_ADMIN);
+        assertThat(mCarUserManagerHelper.createNewAdminUser(TEST_USER_NAME)).isNull();
+    }
+
+    @Test
+    public void testCreateNewAdminUserReturnsCreatedUser() {
+        // Make sure current user is admin, since only admins can create other admins.
+        doReturn(true).when(mUserManager).isAdminUser();
 
         UserInfo newUser = new UserInfo();
-        newUser.name = mTestUserName;
-        doReturn(newUser).when(mUserManager).createUser(mTestUserName, UserInfo.FLAG_ADMIN);
-        assertThat(mCarUserManagerHelper.createNewAdminUser(mTestUserName)).isEqualTo(newUser);
+        newUser.name = TEST_USER_NAME;
+        doReturn(newUser).when(mUserManager).createUser(TEST_USER_NAME, UserInfo.FLAG_ADMIN);
+        assertThat(mCarUserManagerHelper.createNewAdminUser(TEST_USER_NAME)).isEqualTo(newUser);
+    }
+
+    @Test
+    public void testCreateNewAdminUserWithDefaultUserNameCallsCreateUser() {
+        // Make sure current user is admin, since only admins can create other admins.
+        doReturn(true).when(mUserManager).isAdminUser();
+
+        mCarUserManagerHelper.createNewAdminUser();
+        verify(mUserManager).createUser(DEFAULT_ADMIN_NAME, UserInfo.FLAG_ADMIN);
+    }
+
+    @Test
+    public void testCreateNewAdminUserWithDefaultUserNameReturnsNullUsers() {
+        // Make sure current user is admin, since only admins can create other admins.
+        doReturn(true).when(mUserManager).isAdminUser();
+
+        doReturn(null).when(mUserManager).createUser(DEFAULT_ADMIN_NAME, UserInfo.FLAG_ADMIN);
+        assertThat(mCarUserManagerHelper.createNewAdminUser(DEFAULT_ADMIN_NAME)).isNull();
+    }
+
+    @Test
+    public void testCreateNewAdminUserWithDefaultUserNameReturnsCreatedUser() {
+        // Make sure current user is admin, since only admins can create other admins.
+        doReturn(true).when(mUserManager).isAdminUser();
+
+        UserInfo newUser = new UserInfo();
+        newUser.name = DEFAULT_ADMIN_NAME;
+        doReturn(newUser).when(mUserManager).createUser(DEFAULT_ADMIN_NAME, UserInfo.FLAG_ADMIN);
+        assertThat(mCarUserManagerHelper.createNewAdminUser()).isEqualTo(newUser);
     }
 
     @Test
@@ -421,21 +465,21 @@
     @Test
     public void testCreateNewNonAdminUser() {
         // Verify createUser on UserManager gets called.
-        mCarUserManagerHelper.createNewNonAdminUser(mTestUserName);
-        verify(mUserManager).createUser(mTestUserName, 0);
+        mCarUserManagerHelper.createNewNonAdminUser(TEST_USER_NAME);
+        verify(mUserManager).createUser(TEST_USER_NAME, 0);
 
-        doReturn(null).when(mUserManager).createUser(mTestUserName, 0);
-        assertThat(mCarUserManagerHelper.createNewNonAdminUser(mTestUserName)).isNull();
+        doReturn(null).when(mUserManager).createUser(TEST_USER_NAME, 0);
+        assertThat(mCarUserManagerHelper.createNewNonAdminUser(TEST_USER_NAME)).isNull();
 
         UserInfo newUser = new UserInfo();
-        newUser.name = mTestUserName;
-        doReturn(newUser).when(mUserManager).createUser(mTestUserName, 0);
-        assertThat(mCarUserManagerHelper.createNewNonAdminUser(mTestUserName)).isEqualTo(newUser);
+        newUser.name = TEST_USER_NAME;
+        doReturn(newUser).when(mUserManager).createUser(TEST_USER_NAME, 0);
+        assertThat(mCarUserManagerHelper.createNewNonAdminUser(TEST_USER_NAME)).isEqualTo(newUser);
     }
 
     @Test
     public void testCannotRemoveSystemUser() {
-        assertThat(mCarUserManagerHelper.removeUser(mSystemUser, mGuestUserName)).isFalse();
+        assertThat(mCarUserManagerHelper.removeUser(mSystemUser, GUEST_USER_NAME)).isFalse();
     }
 
     @Test
@@ -447,7 +491,7 @@
 
         // If Admin is removing non-current, non-system user, simply calls removeUser.
         doReturn(true).when(mUserManager).isAdminUser();
-        assertThat(mCarUserManagerHelper.removeUser(userToRemove, mGuestUserName)).isTrue();
+        assertThat(mCarUserManagerHelper.removeUser(userToRemove, GUEST_USER_NAME)).isTrue();
         verify(mUserManager).removeUser(idToRemove);
     }
 
@@ -462,30 +506,72 @@
         doReturn(true).when(mUserManager).removeUser(anyInt());
 
         // If Non-Admin is trying to remove someone other than themselves, they should fail.
-        assertThat(mCarUserManagerHelper.removeUser(otherUser, mGuestUserName)).isFalse();
+        assertThat(mCarUserManagerHelper.removeUser(otherUser, GUEST_USER_NAME)).isFalse();
         verify(mUserManager, never()).removeUser(otherUser.id);
     }
 
     @Test
     public void testRemoveLastActiveUser() {
         // Cannot remove system user.
-        assertThat(mCarUserManagerHelper.removeUser(mSystemUser, mGuestUserName)).isFalse();
+        assertThat(mCarUserManagerHelper.removeUser(mSystemUser, GUEST_USER_NAME)).isFalse();
 
         UserInfo adminInfo = new UserInfo(/* id= */10, "admin", UserInfo.FLAG_ADMIN);
         mockGetUsers(adminInfo);
 
-        assertThat(mCarUserManagerHelper.removeUser(adminInfo, mGuestUserName))
+        assertThat(mCarUserManagerHelper.removeUser(adminInfo, GUEST_USER_NAME))
             .isEqualTo(false);
     }
 
     @Test
-    public void testSwitchToGuest() {
-        mCarUserManagerHelper.startGuestSession(mGuestUserName);
-        verify(mUserManager).createGuest(mContext, mGuestUserName);
+    public void testRemoveLastAdminUser() {
+        // Make current user admin.
+        doReturn(true).when(mUserManager).isAdminUser();
 
-        UserInfo guestInfo = new UserInfo(/* id= */21, mGuestUserName, UserInfo.FLAG_GUEST);
-        doReturn(guestInfo).when(mUserManager).createGuest(mContext, mGuestUserName);
-        mCarUserManagerHelper.startGuestSession(mGuestUserName);
+        UserInfo adminInfo = new UserInfo(/* id= */10, "admin", UserInfo.FLAG_ADMIN);
+        UserInfo nonAdminInfo = new UserInfo(/* id= */11, "non-admin", 0);
+        mockGetUsers(adminInfo, nonAdminInfo);
+
+        UserInfo newAdminInfo = new UserInfo(/* id= */12, DEFAULT_ADMIN_NAME, UserInfo.FLAG_ADMIN);
+        doReturn(newAdminInfo)
+                .when(mUserManager).createUser(DEFAULT_ADMIN_NAME, UserInfo.FLAG_ADMIN);
+
+        mCarUserManagerHelper.removeUser(adminInfo, GUEST_USER_NAME);
+        verify(mUserManager).createUser(DEFAULT_ADMIN_NAME, UserInfo.FLAG_ADMIN);
+        verify(mActivityManager).switchUser(newAdminInfo.id);
+        verify(mUserManager).removeUser(adminInfo.id);
+    }
+
+    @Test
+    public void testRemoveLastAdminUserFailsToCreateNewUser() {
+        // Make current user admin.
+        doReturn(true).when(mUserManager).isAdminUser();
+
+        UserInfo adminInfo = new UserInfo(/* id= */10, "admin", UserInfo.FLAG_ADMIN);
+        UserInfo nonAdminInfo = new UserInfo(/* id= */11, "non-admin", 0);
+        mockGetUsers(adminInfo, nonAdminInfo);
+
+        UserInfo newAdminInfo = new UserInfo(/* id= */12, DEFAULT_ADMIN_NAME, UserInfo.FLAG_ADMIN);
+        doReturn(newAdminInfo)
+                .when(mUserManager).createUser(DEFAULT_ADMIN_NAME, UserInfo.FLAG_ADMIN);
+
+        // Fail to create a new user to force a failure case
+        doReturn(null)
+                .when(mUserManager).createUser(DEFAULT_ADMIN_NAME, UserInfo.FLAG_ADMIN);
+
+        mCarUserManagerHelper.removeUser(adminInfo, GUEST_USER_NAME);
+        verify(mUserManager).createUser(DEFAULT_ADMIN_NAME, UserInfo.FLAG_ADMIN);
+        verify(mActivityManager, never()).switchUser(anyInt());
+        verify(mUserManager, never()).removeUser(adminInfo.id);
+    }
+
+    @Test
+    public void testSwitchToGuest() {
+        mCarUserManagerHelper.startGuestSession(GUEST_USER_NAME);
+        verify(mUserManager).createGuest(mContext, GUEST_USER_NAME);
+
+        UserInfo guestInfo = new UserInfo(/* id= */21, GUEST_USER_NAME, UserInfo.FLAG_GUEST);
+        doReturn(guestInfo).when(mUserManager).createGuest(mContext, GUEST_USER_NAME);
+        mCarUserManagerHelper.startGuestSession(GUEST_USER_NAME);
         verify(mActivityManager).switchUser(21);
     }
 
@@ -810,7 +896,7 @@
         mockGetUsers(user1, user2, user3);
         doReturn(null).when(mUserManager).createGuest(any(), any());
 
-        UserInfo guest = mCarUserManagerHelper.createNewOrFindExistingGuest(mGuestUserName);
+        UserInfo guest = mCarUserManagerHelper.createNewOrFindExistingGuest(GUEST_USER_NAME);
         assertThat(guest).isEqualTo(user3);
     }
 
@@ -823,11 +909,11 @@
         mockGetUsers(user1, user2);
 
         // Create a user for the "new guest" user.
-        UserInfo guestInfo = new UserInfo(/* id= */21, mGuestUserName, UserInfo.FLAG_GUEST);
-        doReturn(guestInfo).when(mUserManager).createGuest(mContext, mGuestUserName);
+        UserInfo guestInfo = new UserInfo(/* id= */21, GUEST_USER_NAME, UserInfo.FLAG_GUEST);
+        doReturn(guestInfo).when(mUserManager).createGuest(mContext, GUEST_USER_NAME);
 
-        UserInfo guest = mCarUserManagerHelper.createNewOrFindExistingGuest(mGuestUserName);
-        verify(mUserManager).createGuest(mContext, mGuestUserName);
+        UserInfo guest = mCarUserManagerHelper.createNewOrFindExistingGuest(GUEST_USER_NAME);
+        verify(mUserManager).createGuest(mContext, GUEST_USER_NAME);
         assertThat(guest).isEqualTo(guestInfo);
     }
 
diff --git a/tests/carservice_unit_test/src/com/android/car/user/CarUserServiceTest.java b/tests/carservice_unit_test/src/com/android/car/user/CarUserServiceTest.java
index 2e3386b..595f6e3 100644
--- a/tests/carservice_unit_test/src/com/android/car/user/CarUserServiceTest.java
+++ b/tests/carservice_unit_test/src/com/android/car/user/CarUserServiceTest.java
@@ -30,7 +30,8 @@
 import android.location.LocationManager;
 import android.os.UserHandle;
 import android.os.UserManager;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -66,6 +67,8 @@
     @Mock
     private CarUserManagerHelper mCarUserManagerHelper;
 
+    private static final String DEFAULT_ADMIN_NAME = "defaultName";
+
     /**
      * Initialize all of the objects with the @Mock annotation.
      */
@@ -169,10 +172,10 @@
     }
 
     private UserInfo mockAdmin(int adminId) {
-        UserInfo admin = new UserInfo(adminId, CarUserManagerHelper.DEFAULT_FIRST_ADMIN_NAME,
+        UserInfo admin = new UserInfo(adminId, DEFAULT_ADMIN_NAME,
                 UserInfo.FLAG_ADMIN);
-        doReturn(admin).when(mCarUserManagerHelper)
-                .createNewAdminUser(CarUserManagerHelper.DEFAULT_FIRST_ADMIN_NAME);
+        doReturn(admin).when(mCarUserManagerHelper).createNewAdminUser();
+
         return admin;
     }
 }
diff --git a/tests/obd2_test/Android.mk b/tests/obd2_test/Android.mk
index 06ffe31..f2ae94d 100644
--- a/tests/obd2_test/Android.mk
+++ b/tests/obd2_test/Android.mk
@@ -33,7 +33,7 @@
 LOCAL_PROGUARD_ENABLED := disabled
 
 LOCAL_STATIC_JAVA_LIBRARIES += com.android.car.obd2 \
-                               android-support-test \
+                               androidx.test.rules \
 
 LOCAL_JAVA_LIBRARIES := android.car android.test.runner
 
diff --git a/tests/obd2_test/AndroidManifest.xml b/tests/obd2_test/AndroidManifest.xml
index 0de21a4..ee40a8a 100644
--- a/tests/obd2_test/AndroidManifest.xml
+++ b/tests/obd2_test/AndroidManifest.xml
@@ -18,7 +18,7 @@
     package="com.android.car.obd2.test"
     android:sharedUserId="android.uid.system" >
 
-  <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
       android:targetPackage="com.android.car.obd2.test"
       android:label="Tests for OBD2 APIs"/>
 
diff --git a/tests/vehiclehal_test/Android.mk b/tests/vehiclehal_test/Android.mk
index d5adc65..58678b3 100644
--- a/tests/vehiclehal_test/Android.mk
+++ b/tests/vehiclehal_test/Android.mk
@@ -33,7 +33,7 @@
 LOCAL_PROGUARD_ENABLED := disabled
 
 LOCAL_STATIC_JAVA_LIBRARIES += vehicle-hal-support-lib \
-                               android-support-test \
+                               androidx.test.rules \
                                android.hidl.base-V1.0-java \
                                android.hardware.automotive.vehicle-V2.0-java
 
diff --git a/tests/vehiclehal_test/AndroidManifest.xml b/tests/vehiclehal_test/AndroidManifest.xml
index c03406d..ee0dccc 100644
--- a/tests/vehiclehal_test/AndroidManifest.xml
+++ b/tests/vehiclehal_test/AndroidManifest.xml
@@ -20,7 +20,7 @@
 
     <uses-permission android:name="android.car.permission.CONTROL_CAR_CLIMATE" />
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="com.android.car.vehiclehal.test"
             android:label="Tests for Vehicle HAL APIs"/>
 
diff --git a/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/CarDiagnosticTest.java b/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/CarDiagnosticTest.java
index b0dd2c7..c39683a 100644
--- a/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/CarDiagnosticTest.java
+++ b/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/CarDiagnosticTest.java
@@ -26,11 +26,12 @@
 import android.car.hardware.CarSensorManager;
 import android.hardware.automotive.vehicle.V2_0.VehiclePropValue;
 import android.hardware.automotive.vehicle.V2_0.VehicleProperty;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 import android.util.SparseIntArray;
 
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.car.vehiclehal.VehiclePropValueBuilder;
 
 import org.junit.Test;
diff --git a/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/CarPropertyTest.java b/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/CarPropertyTest.java
index 27579bd..e47c733 100644
--- a/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/CarPropertyTest.java
+++ b/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/CarPropertyTest.java
@@ -18,21 +18,22 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
-import static java.lang.Integer.toHexString;
-
 import android.car.Car;
 import android.car.hardware.CarPropertyConfig;
 import android.car.hardware.CarPropertyValue;
 import android.car.hardware.property.CarPropertyManager;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.ArraySet;
 import android.util.Log;
 
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import static java.lang.Integer.toHexString;
+
 import java.io.File;
 import java.time.Duration;
 import java.util.List;
diff --git a/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/E2eCarTestBase.java b/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/E2eCarTestBase.java
index 9485d80..d78713f 100644
--- a/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/E2eCarTestBase.java
+++ b/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/E2eCarTestBase.java
@@ -28,9 +28,10 @@
 import android.os.ConditionVariable;
 import android.os.FileUtils;
 import android.os.IBinder;
-import android.support.test.InstrumentationRegistry;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+
 import com.google.android.collect.Lists;
 
 import org.json.JSONException;
@@ -44,7 +45,6 @@
 import java.io.OutputStream;
 import java.util.List;
 
-
 public class E2eCarTestBase {
     private static final String TAG = Utils.concatTag(E2eCarTestBase.class);
     private static final int DEFAULT_WAIT_TIMEOUT_MS = 1000;
diff --git a/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/E2ePerformanceTest.java b/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/E2ePerformanceTest.java
index 6427a07..d2f6669 100644
--- a/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/E2ePerformanceTest.java
+++ b/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/E2ePerformanceTest.java
@@ -21,8 +21,6 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import static java.lang.Integer.toHexString;
-
 import android.annotation.Nullable;
 import android.car.Car;
 import android.car.CarNotConnectedException;
@@ -32,17 +30,20 @@
 import android.car.hardware.hvac.CarHvacManager;
 import android.hardware.automotive.vehicle.V2_0.VehicleProperty;
 import android.os.SystemClock;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 import android.util.SparseArray;
 import android.util.SparseIntArray;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.google.android.collect.Lists;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import static java.lang.Integer.toHexString;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
diff --git a/user/car-user-lib/Android.mk b/user/car-user-lib/Android.mk
deleted file mode 100644
index cc6cb55..0000000
--- a/user/car-user-lib/Android.mk
+++ /dev/null
@@ -1,91 +0,0 @@
-# Copyright (C) 2018 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.
-#
-#
-
-#disble build in PDK, missing aidl import breaks build
-ifneq ($(TARGET_BUILD_PDK),true)
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-car_user_lib_sources := $(call all-java-files-under, src)
-
-# API Check
-# ---------------------------------------------
-car_user_module := android.car.userlib
-car_user_module_src_files := $(car_user_lib_sources)
-car_user_module_api_dir := $(LOCAL_PATH)/api
-car_user_module_java_libraries := framework
-car_user_module_include_systemapi := true
-car_user_module_java_packages := android.car.userlib*
-include $(CAR_API_CHECK)
-
-# Build stubs jar for target android-support-car
-# ---------------------------------------------
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.car.userlib
-
-LOCAL_ADDITIONAL_JAVA_DIR := $(call intermediates-dir-for,JAVA_LIBRARIES,android.car.userlib,,COMMON)/src
-
-android_car_userlib_stub_packages := \
-    android.car.userlib*
-
-android_car_userlib_api := \
-    $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/android.car.userlib_api.txt
-
-# Note: The make target is android.car.userlib-stub-docs
-LOCAL_MODULE := android.car.userlib-stub
-LOCAL_DROIDDOC_OPTIONS := \
-    -stubs $(call intermediates-dir-for,JAVA_LIBRARIES,android.car.userlib-stubs,,COMMON)/src \
-    -stubpackages $(subst $(space),:,$(android_car_userlib_stub_packages)) \
-    -api $(android_car_userlib_api) \
-    -nodocs
-
-LOCAL_DROIDDOC_SOURCE_PATH := $(LOCAL_PATH)/java/
-LOCAL_DROIDDOC_HTML_DIR :=
-
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-
-LOCAL_UNINSTALLABLE_MODULE := true
-
-include $(BUILD_DROIDDOC)
-
-$(android_car_userlib_api): $(full_target)
-
-android.car.userlib-stubs_stamp := $(full_target)
-
-###############################################
-# Build the stubs java files into a jar. This build rule relies on the
-# stubs_stamp make variable being set from the droiddoc rule.
-
-include $(CLEAR_VARS)
-
-# CAR_API_CHECK uses the same name to generate a module, but BUILD_DROIDDOC
-# appends "-docs" to module name.
-LOCAL_MODULE := android.car.userlib-stubs
-LOCAL_SOURCE_FILES_ALL_GENERATED := true
-
-# Make sure to run droiddoc first to generate the stub source files.
-LOCAL_ADDITIONAL_DEPENDENCIES := $(android.car.userlib-stubs_stamp)
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
-
-endif #TARGET_BUILD_PDK
\ No newline at end of file
diff --git a/user/car-user-lib/src/android/car/userlib/CarUserManagerHelper.java b/user/car-user-lib/src/android/car/userlib/CarUserManagerHelper.java
index 649c89d..a95a024 100644
--- a/user/car-user-lib/src/android/car/userlib/CarUserManagerHelper.java
+++ b/user/car-user-lib/src/android/car/userlib/CarUserManagerHelper.java
@@ -57,9 +57,6 @@
 public class CarUserManagerHelper {
     private static final String TAG = "CarUserManagerHelper";
 
-    // Place holder for user name of the first user created.
-    public static final String DEFAULT_FIRST_ADMIN_NAME = "Driver";
-
     /**
      * Default set of restrictions for Non-Admin users.
      */
@@ -83,6 +80,7 @@
     private final Context mContext;
     private final UserManager mUserManager;
     private final ActivityManager mActivityManager;
+    private final String mDefaultAdminName;
     private Bitmap mDefaultGuestUserIcon;
     private ArrayList<OnUsersUpdateListener> mUpdateListeners;
     private final BroadcastReceiver mUserChangeReceiver = new BroadcastReceiver() {
@@ -99,7 +97,23 @@
         }
     };
 
+    /**
+     * Initializes with a default name for admin users.
+     *
+     * @param context Application Context
+     */
     public CarUserManagerHelper(Context context) {
+        this(context, context.getString(com.android.internal.R.string.owner_name));
+    }
+
+    /**
+     * Initializes with the provided default name for admin users.
+     *
+     * @param context Application Context
+     * @param defaultAdminName Default name to use for admin users
+     */
+    public CarUserManagerHelper(Context context, String defaultAdminName) {
+        mDefaultAdminName = defaultAdminName;
         mUpdateListeners = new ArrayList<>();
         mContext = context.getApplicationContext();
         mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
@@ -730,6 +744,18 @@
     }
 
     /**
+     * Creates a new user on the system with a default user name. This user name is set during
+     * constrution. The created user would be granted admin role. Only admins can create other
+     * admins.
+     *
+     * @return Newly created admin user, null if failed to create a user.
+     */
+    @Nullable
+    public UserInfo createNewAdminUser() {
+        return createNewAdminUser(mDefaultAdminName);
+    }
+
+    /**
      * Creates a new user on the system, the created user would be granted admin role.
      * Only admins can create other admins.
      *
@@ -808,8 +834,10 @@
      * Tries to remove the user that's passed in. System user cannot be removed.
      * If the user to be removed is user currently running the process,
      * it switches to the guest user first, and then removes the user.
+     * If the user being removed is the last admin user, this will create a new admin user.
      *
      * @param userInfo User to be removed
+     * @param guestUserName User name to use for the guest user if we need to switch to it
      * @return {@code true} if user is successfully removed, {@code false} otherwise.
      */
     public boolean removeUser(UserInfo userInfo, String guestUserName) {
@@ -843,10 +871,12 @@
     }
 
     private boolean removeLastAdmin(UserInfo userInfo) {
-        Log.i(TAG, "User " + userInfo.id
-                + " is the last admin user on device. Creating a new admin.");
+        if (Log.isLoggable(TAG, Log.INFO)) {
+            Log.i(TAG, "User " + userInfo.id
+                    + " is the last admin user on device. Creating a new admin.");
+        }
 
-        UserInfo newAdmin = createNewAdminUser(DEFAULT_FIRST_ADMIN_NAME);
+        UserInfo newAdmin = createNewAdminUser(mDefaultAdminName);
         if (newAdmin == null) {
             Log.w(TAG, "Couldn't create another admin, cannot delete current user.");
             return false;