Add CarUserManager API
- Car-specific user management APIs are added to CarUserManager.
- ICarUserService binder interface is defined.
- Remove CarUserService's dependency on CarUserManagerHelper.
- Unit tests for the newly added interface are implemented.
Bug: 139743504
Test: Run CarUserServiceTest.
Change-Id: I50f148a920f15a36aad6863d604ada12702f1ebf
diff --git a/service/src/com/android/car/ICarImpl.java b/service/src/com/android/car/ICarImpl.java
index 17d3e83..e168af3 100644
--- a/service/src/com/android/car/ICarImpl.java
+++ b/service/src/com/android/car/ICarImpl.java
@@ -131,7 +131,7 @@
final Resources res = mContext.getResources();
final int maxRunningUsers = res.getInteger(
com.android.internal.R.integer.config_multiuserMaxRunningUsers);
- mCarUserService = new CarUserService(serviceContext, mUserManagerHelper, userManager,
+ mCarUserService = new CarUserService(serviceContext, userManager,
ActivityManager.getService(), maxRunningUsers);
mCarOccupantZoneService = new CarOccupantZoneService(serviceContext);
mSystemActivityMonitoringService = new SystemActivityMonitoringService(serviceContext);
@@ -258,18 +258,18 @@
}
@Override
- public void setUserLockStatus(int userHandle, int unlocked) {
+ public void setUserLockStatus(int userId, int unlocked) {
assertCallingFromSystemProcess();
- mCarUserService.setUserLockStatus(userHandle, unlocked == 1);
- mCarMediaService.setUserLockStatus(userHandle, unlocked == 1);
+ mCarUserService.setUserLockStatus(userId, unlocked == 1);
+ mCarMediaService.setUserLockStatus(userId, unlocked == 1);
}
@Override
- public void onSwitchUser(int userHandle) {
+ public void onSwitchUser(int userId) {
assertCallingFromSystemProcess();
- Log.i(TAG, "Foreground user switched to " + userHandle);
- mCarUserService.onSwitchUser(userHandle);
+ Log.i(TAG, "Foreground user switched to " + userId);
+ mCarUserService.onSwitchUser(userId);
}
static void assertCallingFromSystemProcess() {
@@ -357,6 +357,8 @@
return mCarOccupantZoneService;
case Car.CAR_BUGREPORT_SERVICE:
return mCarBugreportManagerService;
+ case Car.CAR_USER_SERVICE:
+ return mCarUserService;
default:
Log.w(CarLog.TAG_SERVICE, "getCarService for unknown service:" + serviceName);
return null;