使用可配置的模拟器进行测试
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
为了帮助模拟 OEM 中常见的某些配置,某些硬件配置文件支持运行时可配置性。
这些配置是使用运行时资源叠加层 (RRO) 实现的,并且可以使用 adb shell cmd overlay
命令进行管理。
使用以下命令启用或停用 RRO:
adb shell cmd overlay enable NAME
adb shell cmd overlay disable NAME
修改系统栏位置
默认情况下,可配置的模拟器有两个系统栏:屏幕顶部的状态栏和屏幕底部的导航栏。虽然许多汽车都采用这种布局,但有些汽车则不采用。特别值得注意的是,有些汽车的系统栏位于屏幕的横向边,而不是纵向边,这可能会破坏为移动设备外形规格开发应用时做出的假设。如需了解更多详情和技术指南,请参阅系统栏、沉浸式模式和边到边渲染。
以下 RRO 可用于修改系统栏:
com.android.systemui.rro.bottom
com.android.systemui.rro.bottom.rounded
com.android.systemui.rro.left
com.android.systemui.rro.right
模拟刘海屏
某些汽车的屏幕具有与移动设备刘海屏截然不同的刘海屏。有些 Android Automotive OS 车辆配备了曲面屏,而非凹口或针孔摄像头刘海屏,因此屏幕是非矩形的。如需了解详情和技术指南,请参阅适应不规则形状的显示屏。
以下 RRO 可用于模拟显示屏缺口:
com.android.internal.display.cutout.emulation.top_and_right
com.android.internal.display.cutout.emulation.free_form
com.android.internal.emulation.automotive_ultrawide_cutout
建议的测试配置
由于可以通过组合这些 RRO 创建的配置总数非常多,因此我们建议您使用以下硬件配置文件和 RRO 组合来测试应用,这些组合与目前在路上行驶的一些车辆类似。
- Automotive (1080p landscape),使用
com.android.systemui.rro.left
或 com.android.systemui.rro.right
- 汽车超广角,包含
com.android.systemui.rro.left
和 com.android.internal.emulation.automotive_ultrawide_cutout
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Test using the configurable emulator\n\nTo help emulate some of the configurations seen across OEMs, certain [hardware\nprofiles](/training/cars/testing/emulator#bundled-profiles) support runtime\nconfigurability.\n\nThese configurations are implemented using [Runtime Resource\nOverlays](https://source.android.com/docs/core/runtime/rros) (RROs)\nand can be managed using the `adb shell cmd overlay` command.\n\nUse the following commands to enable or disable a RRO: \n\n adb shell cmd overlay enable \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e\n adb shell cmd overlay disable \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e\n\nModify system bar position\n--------------------------\n\nBy default, the configurable emulator has two system bars -- a status bar on the\ntop of the screen and a navigation bar at the bottom of the screen. Though many\ncars share this layout, some don't. Of particular note is that some cars have\ntheir system bar(s) on the horizontal sides of the screen and not the vertical\nsides, which may break assumptions made when developing apps for mobile form\nfactors. See [System bars, immersive mode, and\nedge-to-edge rendering](/training/cars/parked/automotive-os#bars-immersive-edge)\nfor more details and technical guidance.\n\nThe following RROs can be used to modify the system bars:\n\n- `com.android.systemui.rro.bottom`\n- `com.android.systemui.rro.bottom.rounded`\n- `com.android.systemui.rro.left`\n- `com.android.systemui.rro.right`\n\nEmulate display cutouts\n-----------------------\n\nSome cars have screens with display cutouts that are very different when\ncompared to those seen on mobile devices. Instead of the notches or pinhole\ncamera cutouts, some Android Automotive OS vehicles have curved screens that\nmake the screen non-rectangular. See [Adapt to irregularly shaped displays](/training/cars/parked/automotive-os#irregular-displays)\nfor more details and technical guidance.\n\nThe following RROs can be used to emulate display cutouts:\n\n- `com.android.internal.display.cutout.emulation.top_and_right`\n- `com.android.internal.display.cutout.emulation.free_form`\n- `com.android.internal.emulation.automotive_ultrawide_cutout`\n\nRecommended testing configurations\n----------------------------------\n\nSince the total number of configurations that can be created by combining these\nRROs is quite large, we recommend testing your app using the following\ncombinations of [hardware profiles](/training/cars/testing/emulator#bundled-profiles)\nand RROs, which are similar to some vehicles on the road today.\n\n- *Automotive (1080p landscape)* with `com.android.systemui.rro.left` or `com.android.systemui.rro.right`\n- *Automotive Ultrawide* with `com.android.systemui.rro.left` and `com.android.internal.emulation.automotive_ultrawide_cutout`"]]