自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
多用户支持
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Android 支持多用户设置、应用和数据。Android Automotive 依靠 Android 的多用户支持来提供共用设备体验,其中每个设备用户意指一个自然人。在 Android 10 及更高版本中,Android Automotive 支持以下类型的用户:
- 无头系统用户。无头系统用户在后台运行并托管所有系统服务。对于 Automotive,系统用户不意指自然人,也不由自然人直接访问。
- 普通用户。Automotive 设备是共用设备,每个用户对应一个不同的自然人。Android 用户可以拥有不同的角色。如需了解详情,请参阅角色和限制。在 Automotive 中,所有普通用户都是次要用户。
- 访客用户。Automotive 用户可以包括临时用户,例如借用车辆的朋友。为了应对类似的使用情况,Android Automotive 允许访客用户访问使用车辆所需的全部组件。一台设备上只能定义一个访客用户。
下图说明了 Automotive 无头系统用户模式如何支持多用户体验:

图 1. 多用户体验。
如需了解详情,请参阅 Android Automotive 多用户。
角色和限制
车辆是可由不同人员驾驶的共用设备。每个人都可以拥有自己的用户身份,每个用户都有自己的应用和数据。不过,车辆所有者可能不希望所有用户都拥有修改设备的相同权限。因此,Automotive 支持为用户提供不同角色和限制的概念。支持以下用户角色:
- 管理员。默认情况下,具有管理员角色的普通用户可以执行各种任务。管理员用户可以向其他用户授予管理员角色。
- 非管理员。默认情况下,具有非管理员角色的普通用户无法将设备恢复出厂设置、自行授予管理员角色或删除其他用户。
- 访客。默认情况下,访客用户既不能将设备恢复出厂设置,也不能删除其他用户。默认情况下,访客用户还具有其他限制,例如无法修改/添加/移除账号、安装应用或应用屏幕锁定。此外,访客用户默认是临时用户。
如上所述,每个角色都有一组默认限制,因此使用相应角色创建的新用户具有相同的相应限制。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Multi-user support\n\nAndroid supports [multiple users](/docs/devices/admin/multi-user#general_defs)\nsettings, apps, and data. Android Automotive relies on Android's multi-user support\nto provide a shared device experience, wherein each device user is intended to be used by a\ndifferent physical person. In Android 10 and higher, Android\nAutomotive supports these types of users:\n\n- **[Headless\n system user](/docs/devices/admin/multi-user#automotive-user-types).** The headless system user runs in the background and hosts all system services. For Automotive, the system user isn't intended to be used, nor directly accessed, by a physical person.\n- **[Regular user](/docs/devices/admin/multi-user#automotive-user-types).** Automotive devices are shared devices and each user is intended to be used by a different physical person. Android users can have different roles. See [Roles and restrictions](#roles-restrictions) for more information. In Automotive, all regular users are secondary users.\n- **Guest user.** Automotive users can include temporary users, such as friends, who borrow a vehicle. To accommodate uses like this, Android Automotive provides a guest user with access to all components needed to use the vehicle. Only one guest user can be defined on a device at a time.\n\n| **Note:** The primary user flag ([FLAG_PRIMARY](https://android.googlesource.com/platform/frameworks/base/+/refs/heads/android10-release/core/java/android/content/pm/UserInfo.java#46)) isn't yet supported in the Automotive headless system user model.\n\nThe following diagram illustrates how the Automotive headless system user mode\nsupports the multi-user experience:\n\n**Figure 1.** Multi-user experience.\n\nTo learn more, see [Android Automotive multi-user](/docs/devices/admin/multi-user#automotive-multi-user).\n\nRoles and restrictions\n----------------------\n\nVehicles are shared devices that may be driven by different people. Each person\ncan have their own user, each with their own apps and data. However, a vehicle owner may\nnot want all users to have the same ability to modify the device. Therefore, Automotive supports\nthe concept of providing users with different roles and restrictions. The following user roles are\nsupported:\n\n- **Admin.** By default, regular users with the role of admin can perform *every* task. Admin users can grant the admin role to other users.\n- **Non-admin.** By default, regular users with the role non-admin can't factory data reset the device, grant themselves an admin role, or delete other users.\n- **Guest.** By default, a guest user can neither factory data reset the device nor delete other users. By default, a guest user has other restrictions, such as not being able to modify (add or remove) accounts, install apps, or apply a lockscreen. By default, guest is also ephemeral.\n\nAs stated above, each role has a default set of restrictions so that a new\nuser created with that role has the same respective restrictions."]]