In the comments on
this topic about Android 4.3, I saw an interest in multiplayer mode on a tablet running Android 4 and regret about the lack thereof on a smartphone.
I want to tell the habrosocommunity about how, by simple manipulations, you can enable multiplayer mode on your smartphone using my Samsung Galaxy Nexus (I9250) with CyanogenMod 10.1 installed on it.
What gives us a multiplayer mode?
- The application installed in the first account, if it is not a system account, is not visible in the other;
- Separate photos;
- Separate Messages;
- Split Call History;
- Each user has their own settings for desktops, lock screen, quick settings panel, sounds, etc.
- Each user has his own set of synchronized accounts, i.e. separate phone books (Contacts), calendars, search history, etc.
- Connecting the phone via USB (MTP) under the second user you will see an empty folder;
- In Android 4.3, it is possible (it’s not possible to check it out) to limit the use of payment apps in the Play;
- Separate achievements in the Games.
')
So, what do we need to implement our plans?
- Smartphone with Android version 4.2 or higher;
- Superuser rights;
- The terminal on the smartphone (I use this , because it is preinstalled in the firmware) or console + ADB (from the Android SDK).
As rightly noted in the comments of the agent0 habraiser , if you selected the second option, you need in Settings - For developers, enable USB debugging and provide Root access via ADB.
Go!
We start the terminal, request Superuser rights and look at the number of possible users on the device (return value 1 on the smartphone):
su
pm get-max-users
Set the maximum number of users to two (you can set more):
setprop fw.max_users 2
Create a user with the name test:
pm create-user test
Done! Now in the
Device Settings menu, caused by holding the lock button, you can switch between users, and the Users item appeared in the Settings (in the second screenshot this menu is displayed).

If you don’t have a user selection in the Device Settings menu, check if the corresponding checkbox in the Settings - Buttons - Power Button Menu is checked.Add that you can switch users from the terminal with the command:
am switch-user <user-id>
where
<user-id>
you get with the command:
pm list users
To delete a user, use the command:
pm remove-user <user-id>
In conclusion, I want to add that after updating the firmware (I update the nightgowns quite often), the fw.max_users property again takes the value 1 and the Users item becomes inaccessible in the Settings, although you can still switch to the created user.