/* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.car.user; import static android.car.user.CarUserManager.USER_LIFECYCLE_EVENT_TYPE_SWITCHING; import static com.android.car.CarServiceUtils.isEventOfType; import static com.android.car.PermissionHelper.checkHasAtLeastOnePermissionGranted; import static com.android.car.PermissionHelper.checkHasDumpPermissionGranted; import static com.android.car.internal.ExcludeFromCodeCoverageGeneratedReport.DUMP_INFO; import static com.android.car.user.CarUserService.checkManageUsersPermission; import static com.android.car.user.CarUserService.sendUserSwitchResult; import android.annotation.Nullable; import android.annotation.UserIdInt; import android.app.ActivityManager; import android.car.CarOccupantZoneManager; import android.car.CarOccupantZoneManager.OccupantTypeEnum; import android.car.CarOccupantZoneManager.OccupantZoneInfo; import android.car.IExperimentalCarUserService; import android.car.SyncResultCallback; import android.car.builtin.app.ActivityManagerHelper; import android.car.builtin.os.TraceHelper; import android.car.builtin.os.UserManagerHelper; import android.car.builtin.util.Slogf; import android.car.builtin.util.TimingsTraceLog; import android.car.user.CarUserManager.UserLifecycleListener; import android.car.user.UserCreationResult; import android.car.user.UserLifecycleEventFilter; import android.car.user.UserSwitchResult; import android.car.util.concurrent.AndroidFuture; import android.content.Context; import android.content.res.Resources; import android.os.UserHandle; import android.os.UserManager; import android.util.proto.ProtoOutputStream; import com.android.car.CarLog; import com.android.car.CarServiceBase; import com.android.car.R; import com.android.car.internal.ExcludeFromCodeCoverageGeneratedReport; import com.android.car.internal.ResultCallbackImpl; import com.android.car.internal.common.UserHelperLite; import com.android.car.internal.os.CarSystemProperties; import com.android.car.internal.util.IndentingPrintWriter; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Objects; import java.util.concurrent.CopyOnWriteArrayList; /** * Experimental User Service for Car. Including: *