1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.bedstead.harrier; 18 19 /** 20 * A type of user for use with Harrier. 21 * 22 * <p>Generally, you should prefer to use the abstract user types (such as {@link #INITIAL_USER}) 23 * over specific types such as {@link #PRIMARY_USER} to enable running the test on as many 24 * devices as possible. 25 */ 26 public enum UserType { 27 /** No restriction on user. */ 28 ANY, 29 30 // Basic user types 31 32 /** 33 * The system user. This contains all system services. 34 * 35 * <p>Note that the system user is not the same as the {@link UserType#INITIAL_USER} on all 36 * devices. If the intent is to run this test on a user with user apps and data, use 37 * {@link UserType#INITIAL_USER}. 38 */ 39 SYSTEM_USER, 40 41 /** 42 * A user with type {@code android.os.UserManager#USER_TYPE_FULL_SECONDARY}. 43 * 44 * <p>Note that on some devices, this may be the same as {@link UserType#INITIAL_USER}. If you 45 * need a user that is different from {@link UserType#INITIAL_USER} you should use 46 * {@link UserType#ADDITIONAL_USER}. 47 */ 48 SECONDARY_USER, 49 50 /** 51 * A user with type {@code USER_TYPE_PROFILE_MANAGED} and which has a Profile Owner. 52 * 53 * <p>The parent of this profile will be {@link UserType#INITIAL_USER}. 54 */ 55 // TODO(b/210869636): split work profile from managed_profile/profile 56 WORK_PROFILE, 57 58 /** 59 * A user with type {@code com.android.tv.profile}. 60 * 61 * <p>The parent of this profile will be {@link UserType#INITIAL_USER}. 62 */ 63 TV_PROFILE, 64 65 /** 66 * A user with the "primary" flag set to true. 67 * 68 * @deprecated This type of user will not exist on some Android devices. 69 * {@link UserType#INITIAL_USER} serves largely the same purpose but works on all devices. You 70 * can continue to use {@link #PRIMARY_USER} but should make sure you absolutely want to only 71 * support primary users. 72 */ 73 @Deprecated 74 PRIMARY_USER, 75 76 // Abstract user types 77 78 /** The user running the instrumented test process. */ 79 INSTRUMENTED_USER, 80 81 /** The user in the foreground. */ 82 CURRENT_USER, 83 84 /** The user with the primary DPC installed. */ 85 DPC_USER, 86 87 /** The user of the first person using the device. This will be the parent of any profiles. */ 88 INITIAL_USER, 89 90 /** A {@link UserType#SECONDARY_USER} who is not the {@link UserType#INITIAL_USER}. */ 91 ADDITIONAL_USER, 92 93 /** A user for whom {@code UserReference#isAdmin} returns true. */ 94 ADMIN_USER, 95 96 /** 97 * A user with type {@code android.os.usertype.profile.CLONE}. 98 * 99 * <p>The parent of this profile will be {@link UserType#INITIAL_USER}. 100 */ 101 CLONE_PROFILE, 102 103 /** 104 * A user with type {@code android.os.usertype.profile.PRIVATE}. 105 * 106 * <p>The parent of this profile will be {@link UserType#INITIAL_USER}. 107 */ 108 PRIVATE_PROFILE 109 } 110