The method is hidden with @hide. The method also requires the system permission android.Manifest.permission.MANAGE_USERS. This permission cannot be granted to third-party apps.
UserManager#getUsers() documentation:
Returns information for all users on this device, including ones marked for deletion. To retrieve only users that are alive, use getUsers(boolean).
Requires android.Manifest.permission.MANAGE_USERS permission.
Returns: the list of users that exist on the device.
How do I list all users on an Android device?
According to this answer, you could possibly use getUserProfiles.