自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
常见问题解答
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Android 10 是否支持每屏幕 VSYNC?
目前还不行。Android 10 中默认屏幕的 VSYNC 驱动所有屏幕。
各屏幕是否可以单独打开或关闭?
在 Android 10 中,设备电源状态的实现主要是全局性的实现,由默认屏幕的电源状态决定。只有虚拟屏幕可单独开启/关闭,具体是通过将 Surface 设置为 null
来做到。Activity/WindowManager 会对这种状态变化做出响应。
在 Android 10 中,无法通过内置方式动态配置输入和设备之间的关联,但在大多数情况下可以采用一些权宜之计。如需了解详情,请参阅输入路由。
如何在屏幕上启用系统装饰?
对于测试环境,最直接的方法是使用“强制使用桌面模式”这一开发者选项,该选项可在所有辅助屏幕上启用系统装饰和 IME 支持。该选项适用于由系统拥有的屏幕(例如物理面板或模拟屏幕),但对于由应用拥有的虚拟屏幕,可能存在使用限制。
对于生产环境,请提供默认配置文件。如需了解详情,请参阅:
使用 LaunchParamsController
,它可截获所有 activity 启动操作并允许系统组件修改用于启动操作的参数。目前,可在 system_server
内使用它。
设备是否可以从辅助屏幕解锁?
Android 10 中默认的锁屏实现方式不是交互式的,不允许解锁。如果能够保障满足基本的安全要求,OEM 可以自行实现锁屏。
如何在与目标不同的屏幕上显示 IME?
IME 只能显示在 DisplayWindowSettings
中配置的屏幕上。如果未对请求输入的屏幕启用配置,则 IME 会显示在默认屏幕上。
如何始终将按键事件发送到特定屏幕?
键盘被视为未指定目标的输入源,因此键盘输入会进入到系统中最上层的聚焦窗口。如需查看指定了目标的按键输入的示例,请参阅 PhoneWindowManager 类中对“返回”/“主屏幕”按钮的实现。这些按键仅以屏幕作为输入目标,但它们会显示在 Android 10 中。
音频是如何处理的?
Android 10 在这方面没有重大改进。Android 10 开始支持在汽车中使用多区音频,但用于处理单独的定向音频流的通用解决方案仍处于待定状态。
能否在多个屏幕上显示同一个应用?
如果应用支持,则可以创建应用 activity 的多个实例。默认情况下,每个实例都在相同的进程下运行。Chrome 便是这样一款应用。使用启动器示例进行这方面的测试很方便,该示例允许有针对性地启动 activity 和请求新实例。
能否为不同的屏幕/用户创建同一应用的多个实例?
AOSP 不允许为同一用户创建同一应用的多个独立的沙盒和进程。与此请求关联的用例需要并发多用户支持,而不是应用级分隔。
如果不同的用户想要使用同一应用,他们应使用各自的个人资料登录。应用级分隔需要针对每个会话登录应用。否则,其他用户的数据可能仍然存在。
Android 10 是否支持多个用户?
不支持。Android 10 支持单个登录用户。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-26。
[[["易于理解","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-03-26。"],[],[],null,["# Frequently asked questions\n\nDoes Android 10 support per-display VSync?\n------------------------------------------\n\nNot yet. The VSync of the default display in Android 10\ndrives all displays.\n\nCan displays be individually turned ON or OFF?\n----------------------------------------------\n\nIn Android 10, the implementation of the device power\nstate is primarily global and determined by the power state of the default display.\nOnly virtual displays can be turned ON or OFF individually, by setting the surface to\n`null`. The activity or WindowManager responds to this state change.\n\nHow do I dynamically configure input-display association?\n---------------------------------------------------------\n\nThere's no built-in way to dynamically configure the association between an\ninput and a device in Android 10, but some workarounds can\nbe applied in most cases. See\n[Input routing](/docs/core/display/multi_display/input-routing) for details.\n\nHow do I enable system decorations on a display?\n------------------------------------------------\n\nFor testing, the most straightforward method is to use the Force Desktop Mode developer\noption, which enables system decorations and IME support on all secondary displays. This\nworks for system-owned displays, such as physical panels or a simulated display, but\nmay be restricted for virtual displays owned by apps.\n\nFor production, provide the default configuration file. For details, see:\n\n- [Configuring\n display windowing settings and system decorations](/docs/core/display/multi_display/recommended-practices#windowing)\n- [System decorations](/docs/core/display/multi_display/system-decorations#decorations)\n\nHow do I configure activities for specific displays?\n----------------------------------------------------\n\nUse `LaunchParamsController`, which intercepts all activity\nlaunches and lets a system component modify the parameters used for launch.\nIt's available within `system_server`.\n\nCan a device be unlocked from a secondary screen?\n-------------------------------------------------\n\nThe default implementation of the lock screen in Android 10\nisn't interactive and doesn't allow for unlocking. An OEM can implement their own lock\nscreen provided the fundamental security requirement is maintained.\n\nThe device lock state is global and it applies to all displays.\n\nHow do I display an IME on a different display than its target?\n---------------------------------------------------------------\n\nAn IME can only appear on a display configured in\n`DisplayWindowSettings`. If the config isn't enabled for a display\nwhere input is requested, the IME appears on the default display.\n\nHow do I always send key events to a specific display?\n------------------------------------------------------\n\nA keyboard is considered to be a non-targeted input source, so the input goes\nto the topmost focused window in the system. For an example of targeted key\ninput see the Back or Home button implementation in the `PhoneWindowManager` class. These\nkeys only target the display whereas they are displayed in Android 10.\n\nHow is audio handled?\n---------------------\n\nAndroid 10 contains no major improvements in this area.\n[Multi-zone audio](/docs/core/display/multi_display/multi-zone-audio)\nsupport for Auto has been added in Android 10, but a generic solution to\nhandle separate targeted audio streams remains pending.\n\nCan the same app be shown on several displays?\n----------------------------------------------\n\nIf the app supports it, then multiple instances of the app's activities can\nbe created. By default, each runs under the same process. Chrome is an example of such an\napp. It's convenient to test this using a\n[Launcher](/docs/core/display/multi_display/system-decorations#launcher) sample, which\nallows for a targeted activity launch and a request for a new instance.\n\nCan multiple instances of the same app be created for different screens/users?\n------------------------------------------------------------------------------\n\nAOSP doesn't let you create multiple separate sandboxes and processes of the\nsame app for the same user. Use cases associated with this request require concurrent\nmulti-user support instead of app-level separation.\n\nIf different users want to use the same app, they should log in with their\nprofiles. App-level separation requires logging in to the app for each session.\nOtherwise, other user's data may still be present.\n\nDoes Android 10 support multiple users?\n---------------------------------------\n\nNo. Android 10 supports a single logged-in user."]]