🎥 Video Link



Transcript

Transcript

Please excuse any grammatical errors. I used a tool to generate the transcript and haven’t had a chance to read through it yet.


Today what I want to talk about is user profiles on GrapheneOS. There’s three questions I want to answer and that’s what’s the max user supported on a device with GrapheneOS, what’s the max running users you can have, and what happens when you reach those limits. As I was planning out this video I came across this change log which says raise maximum running users from the standard three to four for six gigabytes of memory, six for eight gigabytes, 10 for 12, etc. My primary device for the past few years has been a Pixel 6a and it currently still is. I always assumed the limit for everyone was three users at any given time running, but it’s actually dependent on the amount of memory your device has, so I was incorrect about that. So good to know. The device I’ll be using today in the demonstration is a Pixel eight Pro as you’ll see and that actually has 12 gigabytes of memory, so we will see these upper limits instead.

And just a quick warning before we begin, I will be using ADB or Android Debug Bridge for this demonstration to automate some of the tasks. You do need to enable developer options to use ADB and unless you know what you’re doing I’d recommend most people don’t use this or do this at all. You can run a couple of commands and delete all your data and your setup, so be careful if you choose to do this and I would recommend not doing it from your primary device. So the commands we’ll be using I prepared before recording this you don’t need to watch me type them out. The first one I’m going to run is to gather some information about the device connected and we can see here it’s a Pixel eight Pro, that’s the device on the left side of the screen here. The amount of RAM that it has it’s actually 12 gigabytes but the output shows 10.9. There’s memory reserved by the system so it’s less than what the device actually has that we see in the printout.

And then to the users: Max users 32 and the Max running users nine. One thing I forgot to mention about that page I showed a minute ago this is a change log entry not a documentation page. So as we saw in that output the max running users is 9 for a 12 gigabyte device, but this change log shows 10. I’m assuming that’s changed over the years, but since it’s not really officially documented anywhere these numbers might differ a little bit depending on which device you have. So the first thing we want to test is the max users, but before we do that I’m going to get a watch command started to show the current user status on the device. While we could check the user status in settings, system, and users, the output that we get from ADB is a little better overview in my opinion.

So as we can see there’s one owner or one user owner. Same thing we’re seeing in ADB owner and that profile is currently running. Next thing I want to run is a for loop to try and create 35 users. Like we saw the max users is 32, so after creating 31 plus owner this command should error out. So we’ll get that started and we can see our ADB output is updating. The users on the left or on the device does not update automatically, but if we go back and go back in there we can see our new users. You might notice that this second column starting at 70 I was testing these commands earlier and deleted a bunch of users. This is I’m guessing the users table has a primary key that auto increments. Since that’s how that works, even though we deleted all those users or I did, that number doesn’t reset it just increments from where you left off. I guess one thing also worth mentioning the max users you can have is thirty two. I don’t recommend anyone uses anything near that amount of users. Maybe you have a use case for it. I don’t really know what that would be, but it seems a little bit over complicated for me. So we’re getting close now, we’re at 26 plus owner, so 27, 28, 29 users. Once this gets to test 31 this should error out this command since owner accounts as a user. So test 31 and if we check on the right side error cannot add more users of type Android OS user type secondary. Maximum number of that type already exists. So that shows we can have up to 32 users or 31 plus owner and that confirms the output that we saw earlier.

Next thing that I think is actually more interesting than total users is what happens when you exceed the max running users. In this case pixelate 12 gigabytes of RAM, I can have up to nine running users. So next I’ll start the loop to start activating users. Clear this out. So we can see test one running, test two running. Just on the phone quick, get that to update. We have all our users there. So once this gets to eight running users plus owner you’ll start to see what happens to old users that are running. So that should be eight. And we can see the test 10 started and then stopped the oldest running user not including owner. So if you’re using the max limit of users on your phone what’ll happen then when you start the next user is the oldest user essentially gets evicted or stopped, is no longer running, and the next one starts. I do think this output’s kind of a cool way to see it. You kind of see the snake moving down the list of users. The oldest one stops, the new ones start, and that’s how it works.

The last thing I want to talk about is private spaces. So each one of these users can have a private space. So essentially you have 32 secondary users plus 32 private spaces. You’re now up to essentially 64 users. Again, I don’t know why you’d ever need that many, but maybe someone does. So this command that I’ll be running we need to specify the user we want to create it for. So for this I’m going to create a private space for user seventy which is this first one up here. That command finished, created user ID one hundred one, and we can see at the bottom here user one hundred one private space. So if we now go and start the user that private space is associated with which was seventy. That user has started, test 13 was stopped, and again since a private space counts as an active user I’m going to start one hundred one which is the private space. We should see Test 14 get stopped. Private space starts, Test 14 stops because I was the oldest active existing user and that’s exactly what we expected. And then again since a private space counts as an active user if we start that activation loop again you’ll start to see these get activated. Once it gets to I think, 89, we should see one 1 stop. So 89, one 1 should stop. And now the users activate and we start to see the snake going down the list.

So I hope you found that useful or at least interesting. I think this ADB output provides a useful look at how users work on Android OS or Graphene OS specifically. And if you have any questions or comments feel free to leave those down below. I also have anonymous comments available on my blog if you want to leave them there. But I hope you have a great rest of your day and I’ll see you next time.