shadows/framework/src/main/java/org/robolectric/shadows/ShadowUserManager.java
@Deprecated
  public void setIsPrimaryUser(boolean isPrimaryUser) {
    UserInfo userInfo = getUserInfo(UserHandle.myUserId());
    if (isPrimaryUser) {
      userInfo.flags |= UserInfo.FLAG_PRIMARY;
    } else {
      userInfo.flags &= ~UserInfo.FLAG_PRIMARY;
    }
  }
@Deprecated
  public void setIsPrimaryUser(boolean isPrimaryUser) {
    UserInfo userInfo = getUserInfo(UserHandle.myUserId());
    if (isPrimaryUser) {
      userInfo.flags |= UserInfo.FLAG_PRIMARY;
    } else {
      userInfo.flags &= ~UserInfo.FLAG_PRIMARY;
    }
  }
Sets that the current user is the primary user; controls the return value of {@link
UserManager#isPrimaryUser()}.

@deprecated Use {@link ShadowUserManager#addUser(int, String, int)} to create a primary user
instead of changing default user flags.