Merge "Cleanup -- Delete unused APIs"
diff --git a/tests/carservice_unit_test/src/android/car/userlib/CarUserManagerHelperTest.java b/tests/carservice_unit_test/src/android/car/userlib/CarUserManagerHelperTest.java
index 02a3f13..3cc103b 100644
--- a/tests/carservice_unit_test/src/android/car/userlib/CarUserManagerHelperTest.java
+++ b/tests/carservice_unit_test/src/android/car/userlib/CarUserManagerHelperTest.java
@@ -123,17 +123,6 @@
         assertThat(mCarUserManagerHelper.isHeadlessSystemUser()).isTrue();
     }
 
-    @Test
-    public void checkIsSystemUser() {
-        UserInfo testInfo = new UserInfo();
-
-        testInfo.id = UserHandle.USER_SYSTEM;
-        assertThat(mCarUserManagerHelper.isSystemUser(testInfo)).isTrue();
-
-        testInfo.id = UserHandle.USER_SYSTEM + 2; // Make it different than system id.
-        assertThat(mCarUserManagerHelper.isSystemUser(testInfo)).isFalse();
-    }
-
     // System user will not be returned when calling get all users.
     @Test
     public void testHeadlessUser0GetAllUsers_NotReturnSystemUser() {
@@ -239,17 +228,6 @@
     }
 
     @Test
-    public void testCurrentProcessCanSwitchUsers() {
-        doReturn(false).when(mUserManager)
-                .hasUserRestriction(UserManager.DISALLOW_USER_SWITCH);
-        assertThat(mCarUserManagerHelper.canCurrentProcessSwitchUsers()).isTrue();
-
-        doReturn(true).when(mUserManager)
-                .hasUserRestriction(UserManager.DISALLOW_USER_SWITCH);
-        assertThat(mCarUserManagerHelper.canCurrentProcessSwitchUsers()).isFalse();
-    }
-
-    @Test
     public void testCurrentGuestProcessCannotModifyAccounts() {
         assertThat(mCarUserManagerHelper.canCurrentProcessModifyAccounts()).isTrue();
 
@@ -432,20 +410,6 @@
     }
 
     @Test
-    public void testSystemUserCanCreateAdmins() {
-        String newAdminName = "Test new admin";
-        UserInfo expectedAdmin = new UserInfo();
-        expectedAdmin.name = newAdminName;
-
-        doReturn(expectedAdmin).when(mUserManager).createUser(newAdminName, UserInfo.FLAG_ADMIN);
-
-        // System user can create admins.
-        doReturn(true).when(mUserManager).isSystemUser();
-        UserInfo actualAdmin = mCarUserManagerHelper.createNewAdminUser(newAdminName);
-        assertThat(actualAdmin).isEqualTo(expectedAdmin);
-    }
-
-    @Test
     public void testCreateNewNonAdminUser() {
         // Verify createUser on UserManager gets called.
         mCarUserManagerHelper.createNewNonAdminUser(TEST_USER_NAME);
diff --git a/tests/robotests/Android.mk b/tests/robotests/Android.mk
deleted file mode 100644
index 4ad36fa..0000000
--- a/tests/robotests/Android.mk
+++ /dev/null
@@ -1,43 +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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CarServiceRoboTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_CERTIFICATE := platform
-
-LOCAL_MODULE_TAGS := tests
-
-# When built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_INSTRUMENTATION_FOR := CarService
-
-LOCAL_JAVA_LIBRARIES := \
-    android.car \
-    android.car.userlib \
-    robolectric_android-all-stub \
-    Robolectric_all-target \
-    mockito-robolectric-prebuilt \
-    truth-prebuilt
-
-include $(BUILD_PACKAGE)
\ No newline at end of file
diff --git a/tests/robotests/AndroidManifest.xml b/tests/robotests/AndroidManifest.xml
deleted file mode 100644
index d160175..0000000
--- a/tests/robotests/AndroidManifest.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  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.
-  -->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    coreApp="true"
-    package="com.android.car.robotests">
-
-  <application/>
-
-</manifest>
\ No newline at end of file
diff --git a/tests/robotests/config/robolectric.properties b/tests/robotests/config/robolectric.properties
deleted file mode 100644
index b4e3b78..0000000
--- a/tests/robotests/config/robolectric.properties
+++ /dev/null
@@ -1,17 +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.
-#
-manifest=packages/services/Car/tests/robotests/AndroidManifest.xml
-sdk=NEWEST_SDK
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/car/CarServiceRobolectricTestRunner.java b/tests/robotests/src/com/android/car/CarServiceRobolectricTestRunner.java
deleted file mode 100644
index 92b3cd8..0000000
--- a/tests/robotests/src/com/android/car/CarServiceRobolectricTestRunner.java
+++ /dev/null
@@ -1,70 +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.
- */
-
-package com.android.car;
-
-import android.annotation.NonNull;
-
-import org.junit.runners.model.InitializationError;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.annotation.Config;
-import org.robolectric.manifest.AndroidManifest;
-import org.robolectric.res.Fs;
-import org.robolectric.res.ResourcePath;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.List;
-
-public class CarServiceRobolectricTestRunner extends RobolectricTestRunner {
-    public CarServiceRobolectricTestRunner(Class<?> testClass) throws InitializationError {
-        super(testClass);
-    }
-
-    /**
-     * We are going to create our own custom manifest so we can add multiple resource paths to it.
-     */
-    @Override
-    protected AndroidManifest getAppManifest(Config config) {
-        try {
-            // Using the manifest file's relative path, we can figure out the application directory.
-            final URL appRoot =
-                    new URL("file:packages/services/Car/tests/robotests");
-            final URL manifestPath = new URL(appRoot, "AndroidManifest.xml");
-            final URL resDir = new URL(appRoot, "res");
-            final URL assetsDir = new URL(appRoot, "assets");
-
-            return new AndroidManifest(Fs.fromURL(manifestPath), Fs.fromURL(resDir),
-                Fs.fromURL(assetsDir), "com.android.car") {
-                @Override
-                public List<ResourcePath> getIncludedResourcePaths() {
-                    final List<ResourcePath> paths = super.getIncludedResourcePaths();
-                    return paths;
-                }
-            };
-        } catch (MalformedURLException e) {
-            throw new RuntimeException("CarServiceRobolectricTestRunner failure", e);
-        }
-    }
-
-    private static ResourcePath resourcePath(@NonNull String spec) {
-        try {
-            return new ResourcePath(null, Fs.fromURL(new URL(spec)), null);
-        } catch (MalformedURLException e) {
-            throw new RuntimeException("CarServiceRobolectricTestRunner failure", e);
-        }
-    }
-}
diff --git a/tests/robotests/src/com/android/car/testutils/shadow/ShadowActivityManager.java b/tests/robotests/src/com/android/car/testutils/shadow/ShadowActivityManager.java
deleted file mode 100644
index e213c4e..0000000
--- a/tests/robotests/src/com/android/car/testutils/shadow/ShadowActivityManager.java
+++ /dev/null
@@ -1,65 +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.
- */
-
-package com.android.car.testutils.shadow;
-
-import android.app.ActivityManager;
-
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.Implementation;
-import org.robolectric.annotation.Implements;
-import org.robolectric.annotation.Resetter;
-import org.robolectric.shadow.api.Shadow;
-
-@Implements(ActivityManager.class)
-public class ShadowActivityManager {
-    private static int sCurrentUserId = 0;
-    private int mUserSwitchedTo = -1;
-
-    @Resetter
-    public void reset() {
-        sCurrentUserId = 0;
-        mUserSwitchedTo = 0;
-    }
-
-    @Implementation
-    public static int getCurrentUser() {
-        return sCurrentUserId;
-    }
-
-    @Implementation
-    public boolean switchUser(int userId) {
-        mUserSwitchedTo = userId;
-        return true;
-    }
-
-    public boolean getSwitchUserCalled() {
-        return mUserSwitchedTo != -1;
-    }
-
-    public int getUserSwitchedTo() {
-        return mUserSwitchedTo;
-    }
-
-    public static void setCurrentUser(int userId) {
-        sCurrentUserId = userId;
-    }
-
-    public static ShadowActivityManager getShadow() {
-        return (ShadowActivityManager) Shadow.extract(
-            RuntimeEnvironment.application.getSystemService(ActivityManager.class));
-    }
-}
diff --git a/tests/robotests/src/com/android/car/testutils/shadow/ShadowUserHandle.java b/tests/robotests/src/com/android/car/testutils/shadow/ShadowUserHandle.java
deleted file mode 100644
index 656fa97..0000000
--- a/tests/robotests/src/com/android/car/testutils/shadow/ShadowUserHandle.java
+++ /dev/null
@@ -1,36 +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.
- */
-
-package com.android.car.testutils.shadow;
-
-import android.os.UserHandle;
-
-import org.robolectric.annotation.Implementation;
-import org.robolectric.annotation.Implements;
-
-@Implements(UserHandle.class)
-public class ShadowUserHandle {
-    @Implementation
-    public static int myUserId() {
-        try {
-            return ShadowUserManager.getShadow().getCurrentUser();
-        } catch (Throwable t) {
-            // This method may be called before ShadowUserManager is properly initialized. Just
-            // return the default 0 in those cases.
-            return 0;
-        }
-    }
-}
diff --git a/tests/robotests/src/com/android/car/testutils/shadow/ShadowUserManager.java b/tests/robotests/src/com/android/car/testutils/shadow/ShadowUserManager.java
deleted file mode 100644
index bf9cf62..0000000
--- a/tests/robotests/src/com/android/car/testutils/shadow/ShadowUserManager.java
+++ /dev/null
@@ -1,147 +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.
- */
-
-package com.android.car.testutils.shadow;
-
-import android.content.Context;
-import android.content.pm.UserInfo;
-import android.os.UserHandle;
-import android.os.UserManager;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.HiddenApi;
-import org.robolectric.annotation.Implementation;
-import org.robolectric.annotation.Implements;
-import org.robolectric.shadow.api.Shadow;
-
-@Implements(UserManager.class)
-public class ShadowUserManager extends org.robolectric.shadows.ShadowUserManager {
-    private final Map<Integer, UserInfo> mUserInfos = new HashMap<>();
-    private int mCurrentUser = UserHandle.USER_SYSTEM;
-    public boolean isSystemUser = true;
-    public boolean isPrimaryUser = true;
-    public boolean isLinkedUser = false;
-    public boolean isDemoUser = false;
-    public boolean isManagedProfile = false;
-    public boolean isGuestUser = false;
-    public boolean canSwitchUser = true;
-
-    {
-        addUserInfo(new UserInfo(UserHandle.USER_SYSTEM, "system_user", 0));
-    }
-
-    /**
-     * Used by BaseActivity when creating intents.
-     */
-    @Implementation
-    @HiddenApi
-    public List<UserInfo> getUsers() {
-        return new ArrayList<>(mUserInfos.values());
-    }
-
-    @Implementation
-    public boolean isSystemUser() {
-        return isSystemUser;
-    }
-
-    @Implementation
-    public boolean isPrimaryUser() {
-        return isPrimaryUser;
-    }
-
-    @Implementation
-    public boolean isLinkedUser() {
-        return isLinkedUser;
-    }
-
-    @Implementation
-    public boolean isDemoUser() {
-        return isDemoUser;
-    }
-
-    @Implementation
-    public boolean isGuestUser() {
-        return isGuestUser;
-    }
-
-    @Implementation
-    public boolean isManagedProfile(int userId) {
-        return isManagedProfile;
-    }
-
-    @Implementation
-    public static boolean isSplitSystemUser() {
-        return false;
-    }
-
-    @Implementation
-    public UserInfo getUserInfo(int id) {
-        return mUserInfos.get(id);
-    }
-
-    @Implementation
-    public boolean isUserUnlockingOrUnlocked(int userId) {
-        return isUserUnlocked();
-    }
-
-    @Implementation
-    public boolean canSwitchUsers() {
-        return canSwitchUser;
-    }
-
-    @Implementation
-    public boolean removeUser(int userId) {
-        mUserInfos.remove(userId);
-        return true;
-    }
-
-    @Implementation
-    public UserInfo createGuest(Context context, String name) {
-        UserInfo guest = new UserInfo(12, name, UserInfo.FLAG_GUEST);
-
-        addUserInfo(guest);
-        return guest;
-    }
-
-    public void switchUser(int userId) {
-        if (!mUserInfos.containsKey(userId)) {
-            throw new UnsupportedOperationException("Must add user before switching to it");
-        }
-        mCurrentUser = userId;
-    }
-
-    public int getCurrentUser() {
-        return mCurrentUser;
-    }
-
-    public void setCurrentUser(int userId) {
-        mCurrentUser = userId;
-    }
-
-    public void addUserInfo(UserInfo userInfo) {
-        mUserInfos.put(userInfo.id, userInfo);
-    }
-
-    public static ShadowUserManager getShadow() {
-        return (ShadowUserManager) Shadow.extract(
-                RuntimeEnvironment.application.getSystemService(UserManager.class));
-    }
-}
diff --git a/tests/robotests/src/com/android/car/users/CarUserManagerHelperRoboTest.java b/tests/robotests/src/com/android/car/users/CarUserManagerHelperRoboTest.java
deleted file mode 100644
index 6a90cdf..0000000
--- a/tests/robotests/src/com/android/car/users/CarUserManagerHelperRoboTest.java
+++ /dev/null
@@ -1,210 +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.
- */
-
-package com.android.car.users;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.when;
-
-import android.app.ActivityManager;
-import android.car.userlib.CarUserManagerHelper;
-import android.content.Context;
-import android.content.pm.UserInfo;
-import android.os.UserManager;
-
-import com.android.car.CarServiceRobolectricTestRunner;
-import com.android.car.testutils.shadow.ShadowActivityManager;
-import com.android.car.testutils.shadow.ShadowUserHandle;
-import com.android.car.testutils.shadow.ShadowUserManager;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.Config;
-
-@RunWith(CarServiceRobolectricTestRunner.class)
-@Config(shadows = { ShadowActivityManager.class,
-        ShadowUserHandle.class, ShadowUserManager.class})
-public class CarUserManagerHelperRoboTest {
-    @Mock
-    private Context mContext;
-
-    private CarUserManagerHelper mHelper;
-
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-        when(mContext.getSystemService(Context.USER_SERVICE)).thenReturn(
-                RuntimeEnvironment.application.getSystemService(UserManager.class));
-        when(mContext.getSystemService(Context.ACTIVITY_SERVICE)).thenReturn(
-                RuntimeEnvironment.application.getSystemService(ActivityManager.class));
-        when(mContext.getApplicationContext()).thenReturn(mContext);
-        mHelper = new CarUserManagerHelper(mContext);
-    }
-
-    @After
-    public void tearDown() {
-        ShadowActivityManager.getShadow().reset();
-    }
-
-    @Test
-    public void testGetForegroundUserId() {
-        ShadowActivityManager.setCurrentUser(15);
-        assertThat(mHelper.getCurrentForegroundUserId()).isEqualTo(15);
-    }
-
-    @Test
-    public void testGetForegroundUserInfo() {
-        int currentForegroundUserId = 17;
-        ShadowActivityManager.setCurrentUser(currentForegroundUserId);
-
-        assertThat(mHelper.getCurrentForegroundUserInfo().id).isEqualTo(currentForegroundUserId);
-    }
-
-    @Test
-    public void testGetCurrentProcessUserId() {
-        int currentProcessUserId = 11;
-        ShadowUserManager.getShadow().setCurrentUser(currentProcessUserId);
-
-        assertThat(mHelper.getCurrentProcessUserId()).isEqualTo(currentProcessUserId);
-    }
-
-    @Test
-    public void testGetCurrentProcessUserInfo() {
-        int currentProcessUserId = 12;
-        ShadowUserManager.getShadow().setCurrentUser(currentProcessUserId);
-        assertThat(mHelper.getCurrentProcessUserInfo().id).isEqualTo(currentProcessUserId);
-    }
-
-    @Test
-    public void testGetAllUsers() {
-        int currentProcessUserId = 12;
-        ShadowUserManager userManager = ShadowUserManager.getShadow();
-        userManager.setCurrentUser(currentProcessUserId);
-
-        UserInfo currentProcessUser = createUserInfoForId(currentProcessUserId);
-        UserInfo systemUser = createUserInfoForId(0);
-
-        UserInfo otherUser1 = createUserInfoForId(13);
-        UserInfo otherUser2 = createUserInfoForId(14);
-
-        userManager.addUserInfo(systemUser);
-        userManager.addUserInfo(currentProcessUser);
-        userManager.addUserInfo(otherUser1);
-        userManager.addUserInfo(otherUser2);
-
-        if (mHelper.isHeadlessSystemUser()) {
-            // Should return 3 users that don't have system user id.
-            assertThat(mHelper.getAllUsers())
-                .containsExactly(currentProcessUser, otherUser1, otherUser2);
-        } else {
-            assertThat(mHelper.getAllUsers())
-                .containsExactly(systemUser, currentProcessUser, otherUser1, otherUser2);
-        }
-    }
-
-    @Test
-    public void testGetAllUsersExceptForegroundUser() {
-        ShadowActivityManager.setCurrentUser(11);
-        ShadowUserManager userManager = ShadowUserManager.getShadow();
-
-        UserInfo foregroundUser = createUserInfoForId(11);
-        UserInfo otherUser1 = createUserInfoForId(12);
-        UserInfo otherUser2 = createUserInfoForId(13);
-        UserInfo otherUser3 = createUserInfoForId(14);
-
-        userManager.addUserInfo(foregroundUser);
-        userManager.addUserInfo(otherUser1);
-        userManager.addUserInfo(otherUser2);
-        userManager.addUserInfo(otherUser3);
-
-        // Should return 3 users that don't have foregroundUser id.
-        assertThat(mHelper.getAllSwitchableUsers()).hasSize(3);
-        assertThat(mHelper.getAllSwitchableUsers())
-            .containsExactly(otherUser1, otherUser2, otherUser3);
-    }
-
-    @Test
-    public void testCheckForegroundUser() {
-        ShadowActivityManager.setCurrentUser(10);
-        assertThat(mHelper.isForegroundUser(createUserInfoForId(10))).isTrue();
-        assertThat(mHelper.isForegroundUser(createUserInfoForId(11))).isFalse();
-
-        ShadowActivityManager.setCurrentUser(11);
-        assertThat(mHelper.isForegroundUser(createUserInfoForId(11))).isTrue();
-    }
-
-    @Test
-    public void testIsUserRunningCurrentProcess() {
-        ShadowUserManager shadowUserManager = ShadowUserManager.getShadow();
-        UserInfo user1 = createUserInfoForId(10);
-        UserInfo user2 = createUserInfoForId(11);
-        shadowUserManager.addUserInfo(user1);
-        shadowUserManager.addUserInfo(user2);
-        shadowUserManager.setCurrentUser(10);
-
-        assertThat(mHelper.isCurrentProcessUser(user1)).isTrue();
-        assertThat(mHelper.isCurrentProcessUser(user2)).isFalse();
-
-        shadowUserManager.setCurrentUser(11);
-        assertThat(mHelper.isCurrentProcessUser(user2)).isTrue();
-        assertThat(mHelper.isCurrentProcessUser(user1)).isFalse();
-    }
-
-    @Test
-    public void testRemoveCurrentProcessUserSwitchesToGuestUser() {
-        // Set currentProcess user to be user 10.
-        ShadowUserManager shadowUserManager = ShadowUserManager.getShadow();
-        UserInfo user1 = createUserInfoForId(10);
-        UserInfo user2 = createUserInfoForId(11);
-        shadowUserManager.addUserInfo(user1);
-        shadowUserManager.addUserInfo(user2);
-        shadowUserManager.setCurrentUser(10);
-
-        // Removing a currentProcess user, calls "switch" to guest user
-        mHelper.removeUser(user1, "testGuest");
-        assertThat(ShadowActivityManager.getShadow().getSwitchUserCalled()).isTrue();
-        assertThat(ShadowActivityManager.getShadow().getUserSwitchedTo()).isEqualTo(0);
-
-        assertThat(shadowUserManager.removeUser(10)).isTrue();
-    }
-
-    @Test
-    public void testSwitchToUser() {
-        ShadowActivityManager.setCurrentUser(20);
-
-        // Switching to foreground user doesn't do anything.
-        mHelper.switchToUser(createUserInfoForId(20));
-        assertThat(ShadowActivityManager.getShadow().getSwitchUserCalled()).isFalse();
-
-        // Switching to non-current, non-guest user, simply calls switchUser.
-        UserInfo userToSwitchTo = new UserInfo(22, "Test User", 0);
-        mHelper.switchToUser(userToSwitchTo);
-        assertThat(ShadowActivityManager.getShadow().getSwitchUserCalled()).isTrue();
-        assertThat(ShadowActivityManager.getShadow().getUserSwitchedTo()).isEqualTo(22);
-    }
-
-    private UserInfo createUserInfoForId(int id) {
-        UserInfo userInfo = new UserInfo();
-        userInfo.id = id;
-        return userInfo;
-    }
-}
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 0745945..f411688 100644
--- a/user/car-user-lib/src/android/car/userlib/CarUserManagerHelper.java
+++ b/user/car-user-lib/src/android/car/userlib/CarUserManagerHelper.java
@@ -187,21 +187,6 @@
     }
 
     /**
-     * Set last active user.
-     *
-     * @param userId last active user id.
-     * @param skipGlobalSetting whether to skip set the global settings value.
-     * @deprecated Use {@link #setLastActiveUser(int)} instead.
-     */
-    @Deprecated
-    public void setLastActiveUser(int userId, boolean skipGlobalSetting) {
-        if (!skipGlobalSetting) {
-            Settings.Global.putInt(
-                    mContext.getContentResolver(), Settings.Global.LAST_ACTIVE_USER_ID, userId);
-        }
-    }
-
-    /**
      * Get user id for the last active user.
      *
      * @return user id of the last active user.
@@ -529,31 +514,11 @@
      * @param userInfo User to check against system user.
      * @return {@code true} if system user, {@code false} otherwise.
      */
-    public boolean isSystemUser(UserInfo userInfo) {
+    private boolean isSystemUser(UserInfo userInfo) {
         return userInfo.id == UserHandle.USER_SYSTEM;
     }
 
     /**
-     * Checks whether the user is last active user.
-     *
-     * @param userInfo User to check against last active user.
-     * @return {@code true} if is last active user, {@code false} otherwise.
-     */
-    public boolean isLastActiveUser(UserInfo userInfo) {
-        return userInfo.id == getLastActiveUser();
-    }
-
-    /**
-     * Checks whether passed in user is the foreground user.
-     *
-     * @param userInfo User to check.
-     * @return {@code true} if foreground user, {@code false} otherwise.
-     */
-    public boolean isForegroundUser(UserInfo userInfo) {
-        return getCurrentForegroundUserId() == userInfo.id;
-    }
-
-    /**
      * Checks whether passed in user is the user that's running the current process.
      *
      * @param userInfo User to check.
@@ -573,20 +538,6 @@
     }
 
     /**
-     * Checks if the foreground user is a demo user.
-     */
-    public boolean isForegroundUserDemo() {
-        return getCurrentForegroundUserInfo().isDemo();
-    }
-
-    /**
-     * Checks if the foreground user is ephemeral.
-     */
-    public boolean isForegroundUserEphemeral() {
-        return getCurrentForegroundUserInfo().isEphemeral();
-    }
-
-    /**
      * Checks if the given user is non-ephemeral.
      *
      * @param userId User to check
@@ -623,7 +574,7 @@
      * @param restriction Restriction to check. Should be a UserManager.* restriction.
      * @return Whether that restriction exists for the foreground user.
      */
-    public boolean foregroundUserHasUserRestriction(String restriction) {
+    private boolean foregroundUserHasUserRestriction(String restriction) {
         return hasUserRestriction(restriction, getCurrentForegroundUserInfo());
     }
 
@@ -635,16 +586,6 @@
     }
 
     /**
-     * Checks if the current process user can modify accounts. Demo and Guest users cannot modify
-     * accounts even if the DISALLOW_MODIFY_ACCOUNTS restriction is not applied.
-     */
-    public boolean canForegroundUserModifyAccounts() {
-        return !foregroundUserHasUserRestriction(UserManager.DISALLOW_MODIFY_ACCOUNTS)
-            && !isForegroundUserDemo()
-            && !isForegroundUserGuest();
-    }
-
-    /**
      * Returns whether the foreground user can switch to other users.
      *
      * <p>For instance switching users is not allowed if the current user is in a phone call,
@@ -688,14 +629,6 @@
         return mUserManager.isGuestUser();
     }
 
-    /**
-     * Check is the calling app is running as a restricted profile user (ie. a LinkedUser).
-     * Restricted profiles are only available when {@link #isHeadlessSystemUser()} is false.
-     */
-    public boolean isCurrentProcessRestrictedProfileUser() {
-        return mUserManager.isRestrictedProfile();
-    }
-
     // Current process user restriction accessors
 
     /**
@@ -738,7 +671,7 @@
      * <p>For instance switching users is not allowed if the user is in a phone call,
      * or {@link #{UserManager.DISALLOW_USER_SWITCH} is set.
      */
-    public boolean canCurrentProcessSwitchUsers() {
+    private boolean canCurrentProcessSwitchUsers() {
         boolean inIdleCallState = TelephonyManager.getDefault().getCallState()
                 == TelephonyManager.CALL_STATE_IDLE;
         boolean disallowUserSwitching =
@@ -1011,7 +944,7 @@
      * @param userInfo User whose avatar should be returned.
      * @return Default user icon
      */
-    public Bitmap getUserDefaultIcon(UserInfo userInfo) {
+    private Bitmap getUserDefaultIcon(UserInfo userInfo) {
         return UserIcons.convertToBitmap(
             UserIcons.getDefaultUserIcon(mContext.getResources(), userInfo.id, false));
     }