Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 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 android.content.pm; |
| 18 | |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 19 | import android.annotation.UnsupportedAppUsage; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 20 | import android.os.Parcel; |
| 21 | import android.os.Parcelable; |
Kenny Guy | 1a44753 | 2014-02-20 21:55:32 +0000 | [diff] [blame] | 22 | import android.os.SystemProperties; |
Jeff Sharkey | b049e21 | 2012-09-07 23:16:01 -0700 | [diff] [blame] | 23 | import android.os.UserHandle; |
Xiaohui Chen | 7cb69df | 2015-07-13 16:01:01 -0700 | [diff] [blame] | 24 | import android.os.UserManager; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 25 | |
| 26 | /** |
| 27 | * Per-user information. |
| 28 | * @hide |
| 29 | */ |
| 30 | public class UserInfo implements Parcelable { |
Amith Yamasani | 258848d | 2012-08-10 17:06:33 -0700 | [diff] [blame] | 31 | |
Amith Yamasani | eb437d4 | 2016-04-29 09:31:25 -0700 | [diff] [blame] | 32 | /** 16 bits for user type */ |
| 33 | public static final int FLAG_MASK_USER_TYPE = 0x0000FFFF; |
Amith Yamasani | 258848d | 2012-08-10 17:06:33 -0700 | [diff] [blame] | 34 | |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 35 | /** |
Dianne Hackborn | 5dc5a00 | 2012-09-15 19:33:48 -0700 | [diff] [blame] | 36 | * *************************** NOTE *************************** |
| 37 | * These flag values CAN NOT CHANGE because they are written |
| 38 | * directly to storage. |
| 39 | */ |
| 40 | |
| 41 | /** |
Xiaohui Chen | 70f6c38 | 2015-04-28 14:21:43 -0700 | [diff] [blame] | 42 | * Primary user. Only one user can have this flag set. It identifies the first human user |
| 43 | * on a device. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 44 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 45 | @UnsupportedAppUsage |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 46 | public static final int FLAG_PRIMARY = 0x00000001; |
| 47 | |
| 48 | /** |
| 49 | * User with administrative privileges. Such a user can create and |
| 50 | * delete users. |
| 51 | */ |
| 52 | public static final int FLAG_ADMIN = 0x00000002; |
| 53 | |
| 54 | /** |
| 55 | * Indicates a guest user that may be transient. |
| 56 | */ |
| 57 | public static final int FLAG_GUEST = 0x00000004; |
| 58 | |
Amith Yamasani | 258848d | 2012-08-10 17:06:33 -0700 | [diff] [blame] | 59 | /** |
| 60 | * Indicates the user has restrictions in privileges, in addition to those for normal users. |
| 61 | * Exact meaning TBD. For instance, maybe they can't install apps or administer WiFi access pts. |
| 62 | */ |
| 63 | public static final int FLAG_RESTRICTED = 0x00000008; |
| 64 | |
Dianne Hackborn | 5dc5a00 | 2012-09-15 19:33:48 -0700 | [diff] [blame] | 65 | /** |
| 66 | * Indicates that this user has gone through its first-time initialization. |
| 67 | */ |
| 68 | public static final int FLAG_INITIALIZED = 0x00000010; |
| 69 | |
Kenny Guy | a52dc3e | 2014-02-11 15:33:14 +0000 | [diff] [blame] | 70 | /** |
| 71 | * Indicates that this user is a profile of another user, for example holding a users |
| 72 | * corporate data. |
| 73 | */ |
| 74 | public static final int FLAG_MANAGED_PROFILE = 0x00000020; |
| 75 | |
Alexandra Gherghina | df35d57 | 2014-04-09 13:54:39 +0100 | [diff] [blame] | 76 | /** |
| 77 | * Indicates that this user is disabled. |
Lenka Trochtova | 1ddda47 | 2016-02-12 10:42:12 +0100 | [diff] [blame] | 78 | * |
| 79 | * <p>Note: If an ephemeral user is disabled, it shouldn't be later re-enabled. Ephemeral users |
| 80 | * are disabled as their removal is in progress to indicate that they shouldn't be re-entered. |
Alexandra Gherghina | df35d57 | 2014-04-09 13:54:39 +0100 | [diff] [blame] | 81 | */ |
| 82 | public static final int FLAG_DISABLED = 0x00000040; |
| 83 | |
Rubin Xu | 0a29ecd | 2015-11-04 15:11:48 +0000 | [diff] [blame] | 84 | public static final int FLAG_QUIET_MODE = 0x00000080; |
Kenny Guy | a52dc3e | 2014-02-11 15:33:14 +0000 | [diff] [blame] | 85 | |
Lenka Trochtova | c4dd021 | 2015-11-18 12:22:06 +0100 | [diff] [blame] | 86 | /** |
| 87 | * Indicates that this user is ephemeral. I.e. the user will be removed after leaving |
| 88 | * the foreground. |
| 89 | */ |
| 90 | public static final int FLAG_EPHEMERAL = 0x00000100; |
| 91 | |
Amith Yamasani | eb437d4 | 2016-04-29 09:31:25 -0700 | [diff] [blame] | 92 | /** |
| 93 | * User is for demo purposes only and can be removed at any time. |
| 94 | */ |
| 95 | public static final int FLAG_DEMO = 0x00000200; |
| 96 | |
Fyodor Kupolov | 06a484a | 2015-08-21 16:33:20 -0700 | [diff] [blame] | 97 | public static final int NO_PROFILE_GROUP_ID = UserHandle.USER_NULL; |
Kenny Guy | a52dc3e | 2014-02-11 15:33:14 +0000 | [diff] [blame] | 98 | |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 99 | @UnsupportedAppUsage |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 100 | public int id; |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 101 | @UnsupportedAppUsage |
Amith Yamasani | 2a00329 | 2012-08-14 18:25:45 -0700 | [diff] [blame] | 102 | public int serialNumber; |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 103 | @UnsupportedAppUsage |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 104 | public String name; |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 105 | @UnsupportedAppUsage |
Amith Yamasani | b8151ec | 2012-04-18 18:02:48 -0700 | [diff] [blame] | 106 | public String iconPath; |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 107 | @UnsupportedAppUsage |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 108 | public int flags; |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 109 | @UnsupportedAppUsage |
Amith Yamasani | 920ace0 | 2012-09-20 22:15:37 -0700 | [diff] [blame] | 110 | public long creationTime; |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 111 | @UnsupportedAppUsage |
Amith Yamasani | 920ace0 | 2012-09-20 22:15:37 -0700 | [diff] [blame] | 112 | public long lastLoggedInTime; |
Jeff Sharkey | bd91e2f | 2016-03-22 15:32:31 -0600 | [diff] [blame] | 113 | public String lastLoggedInFingerprint; |
Tony Mak | d3986be | 2016-11-01 18:12:10 +0000 | [diff] [blame] | 114 | /** |
| 115 | * If this user is a parent user, it would be its own user id. |
| 116 | * If this user is a child user, it would be its parent user id. |
| 117 | * Otherwise, it would be {@link #NO_PROFILE_GROUP_ID}. |
| 118 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 119 | @UnsupportedAppUsage |
Kenny Guy | 2a76494 | 2014-04-02 13:29:20 +0100 | [diff] [blame] | 120 | public int profileGroupId; |
Fyodor Kupolov | 06a484a | 2015-08-21 16:33:20 -0700 | [diff] [blame] | 121 | public int restrictedProfileParentId; |
Kenny Guy | 02c8990 | 2016-11-15 19:36:38 +0000 | [diff] [blame] | 122 | /** Which profile badge color/label to use. */ |
| 123 | public int profileBadge; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 124 | |
Dianne Hackborn | d4ac8d7 | 2012-09-27 23:20:10 -0700 | [diff] [blame] | 125 | /** User is only partially created. */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 126 | @UnsupportedAppUsage |
Dianne Hackborn | d4ac8d7 | 2012-09-27 23:20:10 -0700 | [diff] [blame] | 127 | public boolean partial; |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 128 | @UnsupportedAppUsage |
Adam Lesinski | eddeb49 | 2014-09-08 17:50:03 -0700 | [diff] [blame] | 129 | public boolean guestToRemove; |
Dianne Hackborn | d4ac8d7 | 2012-09-27 23:20:10 -0700 | [diff] [blame] | 130 | |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 131 | @UnsupportedAppUsage |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 132 | public UserInfo(int id, String name, int flags) { |
Amith Yamasani | b8151ec | 2012-04-18 18:02:48 -0700 | [diff] [blame] | 133 | this(id, name, null, flags); |
| 134 | } |
| 135 | |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 136 | @UnsupportedAppUsage |
Amith Yamasani | b8151ec | 2012-04-18 18:02:48 -0700 | [diff] [blame] | 137 | public UserInfo(int id, String name, String iconPath, int flags) { |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 138 | this.id = id; |
| 139 | this.name = name; |
| 140 | this.flags = flags; |
Amith Yamasani | b8151ec | 2012-04-18 18:02:48 -0700 | [diff] [blame] | 141 | this.iconPath = iconPath; |
Kenny Guy | 2a76494 | 2014-04-02 13:29:20 +0100 | [diff] [blame] | 142 | this.profileGroupId = NO_PROFILE_GROUP_ID; |
Fyodor Kupolov | 06a484a | 2015-08-21 16:33:20 -0700 | [diff] [blame] | 143 | this.restrictedProfileParentId = NO_PROFILE_GROUP_ID; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 144 | } |
| 145 | |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 146 | @UnsupportedAppUsage |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 147 | public boolean isPrimary() { |
| 148 | return (flags & FLAG_PRIMARY) == FLAG_PRIMARY; |
| 149 | } |
| 150 | |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 151 | @UnsupportedAppUsage |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 152 | public boolean isAdmin() { |
| 153 | return (flags & FLAG_ADMIN) == FLAG_ADMIN; |
| 154 | } |
| 155 | |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 156 | @UnsupportedAppUsage |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 157 | public boolean isGuest() { |
| 158 | return (flags & FLAG_GUEST) == FLAG_GUEST; |
| 159 | } |
| 160 | |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 161 | @UnsupportedAppUsage |
Amith Yamasani | 67df64b | 2012-12-14 12:09:36 -0800 | [diff] [blame] | 162 | public boolean isRestricted() { |
| 163 | return (flags & FLAG_RESTRICTED) == FLAG_RESTRICTED; |
| 164 | } |
| 165 | |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 166 | @UnsupportedAppUsage |
Kenny Guy | a52dc3e | 2014-02-11 15:33:14 +0000 | [diff] [blame] | 167 | public boolean isManagedProfile() { |
| 168 | return (flags & FLAG_MANAGED_PROFILE) == FLAG_MANAGED_PROFILE; |
| 169 | } |
| 170 | |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 171 | @UnsupportedAppUsage |
Alexandra Gherghina | df35d57 | 2014-04-09 13:54:39 +0100 | [diff] [blame] | 172 | public boolean isEnabled() { |
| 173 | return (flags & FLAG_DISABLED) != FLAG_DISABLED; |
| 174 | } |
| 175 | |
Rubin Xu | 0a29ecd | 2015-11-04 15:11:48 +0000 | [diff] [blame] | 176 | public boolean isQuietModeEnabled() { |
| 177 | return (flags & FLAG_QUIET_MODE) == FLAG_QUIET_MODE; |
| 178 | } |
Lenka Trochtova | c4dd021 | 2015-11-18 12:22:06 +0100 | [diff] [blame] | 179 | |
| 180 | public boolean isEphemeral() { |
| 181 | return (flags & FLAG_EPHEMERAL) == FLAG_EPHEMERAL; |
| 182 | } |
| 183 | |
Amith Yamasani | 1274787 | 2015-12-07 14:19:49 -0800 | [diff] [blame] | 184 | public boolean isInitialized() { |
| 185 | return (flags & FLAG_INITIALIZED) == FLAG_INITIALIZED; |
| 186 | } |
| 187 | |
Amith Yamasani | eb437d4 | 2016-04-29 09:31:25 -0700 | [diff] [blame] | 188 | public boolean isDemo() { |
| 189 | return (flags & FLAG_DEMO) == FLAG_DEMO; |
| 190 | } |
| 191 | |
Kenny Guy | 1a44753 | 2014-02-20 21:55:32 +0000 | [diff] [blame] | 192 | /** |
Fyodor Kupolov | 7db5af1 | 2015-07-31 16:50:27 -0700 | [diff] [blame] | 193 | * Returns true if the user is a split system user. |
| 194 | * <p>If {@link UserManager#isSplitSystemUser split system user mode} is not enabled, |
| 195 | * the method always returns false. |
| 196 | */ |
| 197 | public boolean isSystemOnly() { |
Xiaohui Chen | a449062 | 2015-09-22 15:29:31 -0700 | [diff] [blame] | 198 | return isSystemOnly(id); |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * Returns true if the given user is a split system user. |
| 203 | * <p>If {@link UserManager#isSplitSystemUser split system user mode} is not enabled, |
| 204 | * the method always returns false. |
| 205 | */ |
| 206 | public static boolean isSystemOnly(int userId) { |
| 207 | return userId == UserHandle.USER_SYSTEM && UserManager.isSplitSystemUser(); |
Fyodor Kupolov | 7db5af1 | 2015-07-31 16:50:27 -0700 | [diff] [blame] | 208 | } |
| 209 | |
| 210 | /** |
Kenny Guy | 1a44753 | 2014-02-20 21:55:32 +0000 | [diff] [blame] | 211 | * @return true if this user can be switched to. |
| 212 | **/ |
| 213 | public boolean supportsSwitchTo() { |
Lenka Trochtova | 1ddda47 | 2016-02-12 10:42:12 +0100 | [diff] [blame] | 214 | if (isEphemeral() && !isEnabled()) { |
| 215 | // Don't support switching to an ephemeral user with removal in progress. |
| 216 | return false; |
| 217 | } |
Robin Lee | 434a74f | 2016-08-04 15:58:08 +0100 | [diff] [blame] | 218 | return !isManagedProfile(); |
Kenny Guy | 1a44753 | 2014-02-20 21:55:32 +0000 | [diff] [blame] | 219 | } |
| 220 | |
Xiaohui Chen | 7cb69df | 2015-07-13 16:01:01 -0700 | [diff] [blame] | 221 | /** |
| 222 | * @return true if this user can be switched to by end user through UI. |
| 223 | */ |
| 224 | public boolean supportsSwitchToByUser() { |
| 225 | // Hide the system user when it does not represent a human user. |
| 226 | boolean hideSystemUser = UserManager.isSplitSystemUser(); |
| 227 | return (!hideSystemUser || id != UserHandle.USER_SYSTEM) && supportsSwitchTo(); |
| 228 | } |
| 229 | |
Nicolas Prevot | b818681 | 2015-08-06 15:00:03 +0100 | [diff] [blame] | 230 | /* @hide */ |
| 231 | public boolean canHaveProfile() { |
| 232 | if (isManagedProfile() || isGuest() || isRestricted()) { |
| 233 | return false; |
| 234 | } |
| 235 | if (UserManager.isSplitSystemUser()) { |
| 236 | return id != UserHandle.USER_SYSTEM; |
Xiaohui Chen | bd0e03b | 2015-08-21 09:19:49 -0700 | [diff] [blame] | 237 | } else { |
| 238 | return id == UserHandle.USER_SYSTEM; |
Nicolas Prevot | b818681 | 2015-08-06 15:00:03 +0100 | [diff] [blame] | 239 | } |
Nicolas Prevot | b818681 | 2015-08-06 15:00:03 +0100 | [diff] [blame] | 240 | } |
| 241 | |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 242 | public UserInfo() { |
| 243 | } |
| 244 | |
| 245 | public UserInfo(UserInfo orig) { |
| 246 | name = orig.name; |
Amith Yamasani | b8151ec | 2012-04-18 18:02:48 -0700 | [diff] [blame] | 247 | iconPath = orig.iconPath; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 248 | id = orig.id; |
| 249 | flags = orig.flags; |
Amith Yamasani | 2a00329 | 2012-08-14 18:25:45 -0700 | [diff] [blame] | 250 | serialNumber = orig.serialNumber; |
Amith Yamasani | 920ace0 | 2012-09-20 22:15:37 -0700 | [diff] [blame] | 251 | creationTime = orig.creationTime; |
| 252 | lastLoggedInTime = orig.lastLoggedInTime; |
Jeff Sharkey | bd91e2f | 2016-03-22 15:32:31 -0600 | [diff] [blame] | 253 | lastLoggedInFingerprint = orig.lastLoggedInFingerprint; |
Dianne Hackborn | d4ac8d7 | 2012-09-27 23:20:10 -0700 | [diff] [blame] | 254 | partial = orig.partial; |
Kenny Guy | 2a76494 | 2014-04-02 13:29:20 +0100 | [diff] [blame] | 255 | profileGroupId = orig.profileGroupId; |
Amith Yamasani | 6f48d6e | 2016-03-23 14:28:25 -0700 | [diff] [blame] | 256 | restrictedProfileParentId = orig.restrictedProfileParentId; |
Adam Lesinski | eddeb49 | 2014-09-08 17:50:03 -0700 | [diff] [blame] | 257 | guestToRemove = orig.guestToRemove; |
Kenny Guy | 02c8990 | 2016-11-15 19:36:38 +0000 | [diff] [blame] | 258 | profileBadge = orig.profileBadge; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 259 | } |
| 260 | |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 261 | @UnsupportedAppUsage |
Jeff Sharkey | b049e21 | 2012-09-07 23:16:01 -0700 | [diff] [blame] | 262 | public UserHandle getUserHandle() { |
| 263 | return new UserHandle(id); |
| 264 | } |
| 265 | |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 266 | @Override |
| 267 | public String toString() { |
Amith Yamasani | 0b28549 | 2011-04-14 17:35:23 -0700 | [diff] [blame] | 268 | return "UserInfo{" + id + ":" + name + ":" + Integer.toHexString(flags) + "}"; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 269 | } |
| 270 | |
| 271 | public int describeContents() { |
| 272 | return 0; |
| 273 | } |
| 274 | |
| 275 | public void writeToParcel(Parcel dest, int parcelableFlags) { |
| 276 | dest.writeInt(id); |
| 277 | dest.writeString(name); |
Amith Yamasani | b8151ec | 2012-04-18 18:02:48 -0700 | [diff] [blame] | 278 | dest.writeString(iconPath); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 279 | dest.writeInt(flags); |
Amith Yamasani | 2a00329 | 2012-08-14 18:25:45 -0700 | [diff] [blame] | 280 | dest.writeInt(serialNumber); |
Amith Yamasani | 920ace0 | 2012-09-20 22:15:37 -0700 | [diff] [blame] | 281 | dest.writeLong(creationTime); |
| 282 | dest.writeLong(lastLoggedInTime); |
Jeff Sharkey | bd91e2f | 2016-03-22 15:32:31 -0600 | [diff] [blame] | 283 | dest.writeString(lastLoggedInFingerprint); |
Dianne Hackborn | d4ac8d7 | 2012-09-27 23:20:10 -0700 | [diff] [blame] | 284 | dest.writeInt(partial ? 1 : 0); |
Kenny Guy | 2a76494 | 2014-04-02 13:29:20 +0100 | [diff] [blame] | 285 | dest.writeInt(profileGroupId); |
Adam Lesinski | eddeb49 | 2014-09-08 17:50:03 -0700 | [diff] [blame] | 286 | dest.writeInt(guestToRemove ? 1 : 0); |
Fyodor Kupolov | 06a484a | 2015-08-21 16:33:20 -0700 | [diff] [blame] | 287 | dest.writeInt(restrictedProfileParentId); |
Kenny Guy | 02c8990 | 2016-11-15 19:36:38 +0000 | [diff] [blame] | 288 | dest.writeInt(profileBadge); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 289 | } |
| 290 | |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 291 | @UnsupportedAppUsage |
Jeff Sharkey | 9e8f83d | 2019-02-28 12:06:45 -0700 | [diff] [blame] | 292 | public static final @android.annotation.NonNull Parcelable.Creator<UserInfo> CREATOR |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 293 | = new Parcelable.Creator<UserInfo>() { |
| 294 | public UserInfo createFromParcel(Parcel source) { |
| 295 | return new UserInfo(source); |
| 296 | } |
| 297 | public UserInfo[] newArray(int size) { |
| 298 | return new UserInfo[size]; |
| 299 | } |
| 300 | }; |
| 301 | |
| 302 | private UserInfo(Parcel source) { |
| 303 | id = source.readInt(); |
| 304 | name = source.readString(); |
Amith Yamasani | b8151ec | 2012-04-18 18:02:48 -0700 | [diff] [blame] | 305 | iconPath = source.readString(); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 306 | flags = source.readInt(); |
Amith Yamasani | 2a00329 | 2012-08-14 18:25:45 -0700 | [diff] [blame] | 307 | serialNumber = source.readInt(); |
Amith Yamasani | 920ace0 | 2012-09-20 22:15:37 -0700 | [diff] [blame] | 308 | creationTime = source.readLong(); |
| 309 | lastLoggedInTime = source.readLong(); |
Jeff Sharkey | bd91e2f | 2016-03-22 15:32:31 -0600 | [diff] [blame] | 310 | lastLoggedInFingerprint = source.readString(); |
Dianne Hackborn | d4ac8d7 | 2012-09-27 23:20:10 -0700 | [diff] [blame] | 311 | partial = source.readInt() != 0; |
Kenny Guy | 2a76494 | 2014-04-02 13:29:20 +0100 | [diff] [blame] | 312 | profileGroupId = source.readInt(); |
Adam Lesinski | eddeb49 | 2014-09-08 17:50:03 -0700 | [diff] [blame] | 313 | guestToRemove = source.readInt() != 0; |
Fyodor Kupolov | 06a484a | 2015-08-21 16:33:20 -0700 | [diff] [blame] | 314 | restrictedProfileParentId = source.readInt(); |
Kenny Guy | 02c8990 | 2016-11-15 19:36:38 +0000 | [diff] [blame] | 315 | profileBadge = source.readInt(); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 316 | } |
| 317 | } |