Increase CarUserService class code coverage
- Excludes methods that are going to be moved to
ExperimentalCarUserManager
- Adds more unit tests
Fixes: 190839545
Test: atest CarServiceUnitTest:CarUserServiceTest \
CarSecurityPermissionTest
Change-Id: Ic4c9e4fd6badcfabf8b1e4e16ecaa37be10d5079
diff --git a/service/src/com/android/car/user/CarUserService.java b/service/src/com/android/car/user/CarUserService.java
index e61419b..1fde509 100644
--- a/service/src/com/android/car/user/CarUserService.java
+++ b/service/src/com/android/car/user/CarUserService.java
@@ -22,6 +22,7 @@
import static com.android.car.PermissionHelper.checkHasAtLeastOnePermissionGranted;
import static com.android.car.PermissionHelper.checkHasDumpPermissionGranted;
+import static com.android.car.internal.ExcludeFromCodeCoverageGeneratedReport.DEPRECATED_CODE;
import static com.android.car.internal.ExcludeFromCodeCoverageGeneratedReport.DUMP_INFO;
import android.annotation.NonNull;
@@ -475,6 +476,8 @@
* @see ExperimentalCarUserManager.createDriver
*/
@Override
+ @ExcludeFromCodeCoverageGeneratedReport(reason = DEPRECATED_CODE,
+ details = "TODO(b/172262561) remove annotation after refactoring")
public AndroidFuture<UserCreationResult> createDriver(@NonNull String name, boolean admin) {
checkManageUsersPermission("createDriver");
Objects.requireNonNull(name, "name cannot be null");
@@ -510,6 +513,8 @@
*/
@Override
@Nullable
+ @ExcludeFromCodeCoverageGeneratedReport(reason = DEPRECATED_CODE,
+ details = "TODO(b/172262561) remove annotation after refactoring")
public UserInfo createPassenger(@NonNull String name, @UserIdInt int driverId) {
checkManageUsersPermission("createPassenger");
Objects.requireNonNull(name, "name cannot be null");
@@ -540,6 +545,8 @@
* @see ExperimentalCarUserManager.switchDriver
*/
@Override
+ @ExcludeFromCodeCoverageGeneratedReport(reason = DEPRECATED_CODE,
+ details = "TODO(b/172262561) remove annotation after refactoring")
public void switchDriver(@UserIdInt int driverId, AndroidFuture<UserSwitchResult> receiver) {
checkManageUsersPermission("switchDriver");
if (UserHelperLite.isHeadlessSystemUser(driverId)) {