Multi user support

Hello everyone,

I’m currently facing an issue related to android customization.

The issue is as follows: I’m attempting to enable multi-user support on Android using Anbox Cloud. For this purpose, I modified the fw.max_users value to 10 in my Anbox Cloud instance. I applied this modification using a pre-start hook, ensuring that it is enacted before the instance starts.

After booting the instance, I run pm get-max-users expecting to see a maximum of 10 users supported. However, the command is still returning Maximum supported users: 1.

Additionally, my attempt to create a test user fails with the same error message indicating a maximum of one user.

Based on the steps I’ve taken, I would expect the instance to support up to 10 users. The configuration file is set correctly and I didn’t find any limitations about this in Anbox Cloud documentation.

Is there something I might be missing here or is there a different process I should be following to enable multi-user support in Anbox Cloud?

Any advice or guidance on this issue would be greatly appreciated. Thank you for your time!

Best,

1 Like

Hey @kernelmode,

we currently explicitly disable multi-user support as there had been issues in the past and no one needed it. It’s disabled by not shipping the feature flag from https://cs.android.com/android/platform/superproject/+/master:frameworks/native/data/etc/android.software.managed_users.xml in /var/lib/anbox/android-system/system/etc/permissions. Due to this you wont get more allowed users, even if you set fw.max_users to a higher number.

If you put the feature flag in place and set fw.max_users, you should be able to create a new user via anbox-shell pm create-user <name>.

However I do not recall the exact reason, why we have disabled this in the past. Can you tell us what do you want to achieve by having multiple user accounts?

regards,
Simon

2 Likes

Hey @Simon,

Thank you for your detailed explanation regarding the multi-user support. I am currently working on a project that could greatly benefit from this feature.

One of the main use cases for enabling multi-user support in Anbox Cloud is for testing and development purposes. For instance, developers could simulate different user scenarios concurrently within a single Anbox instance. It would be useful for testing different user experiences, permissions, or behaviors under various users.

Moreover, in an educational or corporate context, multiple user support would allow different users to have separate spaces in the same Anbox instance. They can install and manage their apps independently without affecting others. This could be helpful in reducing resource usage as each user doesn’t need a separate Anbox instance.

Therefore, it would be great if Anbox Cloud could support multi-user mode in the future, or at least provide a feasible workaround for it. I understand the potential challenges and issues it might bring, but I believe the benefits would outweigh the drawbacks.

I look forward to hearing any further suggestions or thoughts you may have on this matter.

Best Regards,
Paolo

Hey Paolo,

thanks for describing your use case.

This could be helpful in reducing resource usage as each user doesn’t need a separate Anbox instance.

I am not sure I understand this part. Even if you have multiple users in a single instance, only one user can be active at a given time, so you’re effectively sharing a resource. Is that what you have in mind?

Android is a bit different here from other operating systems where you may have multiple concurrent users on the same system using it simultaneously.

The current feature in Android is more meant to separate different identities/personas but not allow concurrent use.

One of the main use cases for enabling multi-user support in Anbox Cloud is for testing and development purposes. For instance, developers could simulate different user scenarios concurrently within a single Anbox instance. It would be useful for testing different user experiences, permissions, or behaviors under various users.

Can’t you do this more effectively with separate instances? Testing and development in parallel often causes changes to a system which may affect others.

Hi,

Thank you for your response and clarifications. I understand your perspective, but allow me to further explain my use case.

In my scenario, users would not be using the instance concurrently, but rather at separate times. In this manner, a single Anbox instance could be used more efficiently as it wouldn’t require resources all the time. This might seem like a minor advantage, but when multiplied by numerous users and instances, it could result in a significant resource saving.

Also, as you correctly pointed out, Android differs from other operating systems in terms of multi-user support. However, in the context of software development, it’s crucial to be able to test how an application behaves under various scenarios, including multi-user ones. While it’s true that such tests can be conducted with separate instances, testing in a multi-user environment on a single instance provides a more realistic testing scenario for situations where multiple users are accessing the application on a single device at different times.

Moreover, by having the ability to enable or disable multi-user support based on the needs, I could have more flexibility during the testing and development process.

I hope this further clarifies my use case. I would be happy to discuss any further details you deem necessary.

Thanks @kernelmode!

Your explanation makes sense. I’ve put down multi-user support as a feature request.

Have you played with the instructions I gave in my first post already?

Hi,

Thank you for considering the feature request. I appreciate your understanding of my use case.

Yes, I have tried following the instructions you provided in your initial post, and they’ve been quite helpful, multi-user is enabled now… I can continue experimenting with it, and in case of problem, I’ll let you know.

I am looking forward to seeing how the multi-user support feature evolves, as I believe it could greatly enhance the versatility of Anbox Cloud.

Again, thank you for your time and your willingness to consider this feature.

Best regards,
Paolo

If you can let us know how the small changes I suggested above work out, that would be great help. I will schedule some initial work to let us see if we’re passing relevant CTS changes with these changes.

1 Like

Hi,

Thanks for your support and suggestions on enabling multi-user functionality. I’ve added the feature flag file as instructed, and I can confirm that this indeed allows for multi-user enablement.

However, an interesting observation has been made. The addition of this file seems to have triggered a reset of the fw.max_users value that I set in the hook script. Previously, before copying the file, I was able to modify the value, but now it always returns to 1. This is irrespective of whether I use a pre-start or post-start hook.

Considering that this is quite a deep hack and not officially supported, it’s not entirely unexpected, but thought I should bring it to your attention. Although this has presented a minor hurdle, I’m confident I can work around it, possibly through the use of the SDK or by executing SSH commands within the container.

Also, I was wondering if you might know of any methods to test hooks without having to recreate the container each time? It would greatly speed up the development and testing process.

Thanks again for your help. Looking forward to any further insights you may have.

Best regards,
Paolo

The simplest is (if you don’t need streaming) to run with devmode enabled:

amc launch --devmode ...

This will let you restart the Anbox runtime inside the container via systemctl restart anbox. That way you can easily develop and test your scripts and then build them into an addon.

How to develop a platform plugin | Anbox documentation shows the general flow for this.

This will let you restart the Anbox runtime inside the container via systemctl restart anbox .

Thank you very much for the suggestion.
I appreciate your insight and will give it a try immediately.

1 Like

@kernelmode Just as an update, multi-user support will be properly enabled in the upcoming 1.19 release coming on Aug 16 for all supported Android versions.

Hi @morphis ,

Thank you so much for the update! This is fantastic news, and something I’ve been eagerly looking forward to.

I appreciate the effort you and the team have put into making this happen, and I can’t wait to try out the multi-user support in the upcoming 1.19 release. The constant improvements and responsive support from the team are part of what makes this community great.

Thanks again for keeping us informed.

Best,

Paolo

Thanks @kernelmode! That’s nice to hear :slight_smile:

@kernelmode in case you haven’t noticed yet, 1.19.0 is since yesterday. Eager to hear if things will work for you.

Hi @morphis! Thanks for the update on 1.19.0. I’m on vacation at the moment, so I’ll dive into it in September. Looking forward to it! Enjoy your summer.

Best,
Paolo