在多用户Android 设备中,当我们切换到其他次要用户(使用 Ui 或以编程方式)时,Android 是否会保持任何主要用户组件处于活动状态,例如启动ContentProviders或后台服务
1 回答
The main thing to know is that Android users can run in the background (at least until Android 10). If you start user A and then switch to user B, the user B will become the active one but user A will still run in the background until Android decides to stop it because resources are low.
It's especially true for the Primary user because by default it will never be stopped by Android (as it is merged with the System user under which run all the system services of Android).
It means that when you switch to a Secondary user, the Primary user will still continue to run in the background, hence the applications of the Primary user will continue to run in the background (so also most of their Android components). At some point, if Android needs resources, it can decide to stop applications of the any Android user or even completely stop any Secondary Android user running in the background.