@@ -78,6 +78,8 @@ public class UserManagerService extends IUserManager.Stub {
7878 private static final String USER_LIST_FILENAME = "userlist.xml" ;
7979 private static final String USER_PHOTO_FILENAME = "photo.png" ;
8080
81+ private static final int MIN_USER_ID = 10 ;
82+
8183 private static final long EPOCH_PLUS_30_YEARS = 30L * 365 * 24 * 60 * 60 * 1000L ; // ms
8284
8385 private final Context mContext ;
@@ -459,6 +461,7 @@ private void fallbackToSingleUserLocked() {
459461 UserInfo primary = new UserInfo (0 , "Primary" , null ,
460462 UserInfo .FLAG_ADMIN | UserInfo .FLAG_PRIMARY );
461463 mUsers .put (0 , primary );
464+ mNextSerialNumber = MIN_USER_ID ;
462465 updateUserIdsLocked ();
463466
464467 writeUserListLocked ();
@@ -832,7 +835,7 @@ public void userForeground(int userId) {
832835 */
833836 private int getNextAvailableIdLocked () {
834837 synchronized (mPackagesLock ) {
835- int i = 10 ;
838+ int i = MIN_USER_ID ;
836839 while (i < Integer .MAX_VALUE ) {
837840 if (mUsers .indexOfKey (i ) < 0 && !mRemovingUserIds .contains (i )) {
838841 break ;
@@ -862,7 +865,7 @@ protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
862865 for (int i = 0 ; i < mUsers .size (); i ++) {
863866 UserInfo user = mUsers .valueAt (i );
864867 if (user == null ) continue ;
865- pw .print (" " ); pw .print (user );
868+ pw .print (" " ); pw .print (user ); pw . print ( " serialNo=" ); pw . print ( user . serialNumber );
866869 if (mRemovingUserIds .contains (mUsers .keyAt (i ))) pw .print (" <removing> " );
867870 if (user .partial ) pw .print (" <partial>" );
868871 pw .println ();
0 commit comments