Kiểm thử bằng trình mô phỏng có thể định cấu hình
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Để mô phỏng một số cấu hình được thấy trên các nhà sản xuất thiết bị gốc (OEM), một số hồ sơ phần cứng nhất định hỗ trợ khả năng định cấu hình thời gian chạy.
Các cấu hình này được triển khai bằng Lớp phủ tài nguyên thời gian chạy (RRO) và có thể được quản lý bằng lệnh adb shell cmd overlay
.
Sử dụng các lệnh sau để bật hoặc tắt RRO:
adb shell cmd overlay enable NAME
adb shell cmd overlay disable NAME
Sửa đổi vị trí thanh hệ thống
Theo mặc định, trình mô phỏng có thể định cấu hình có hai thanh hệ thống – một thanh trạng thái ở đầu màn hình và một thanh điều hướng ở cuối màn hình. Mặc dù nhiều xe có chung bố cục này, nhưng một số xe thì không. Điều đáng chú ý là một số ô tô có(các) thanh hệ thống ở các cạnh ngang của màn hình chứ không phải ở các cạnh dọc, điều này có thể phá vỡ các giả định được đưa ra khi phát triển ứng dụng cho các hệ số hình dạng thiết bị di động. Hãy xem phần Thanh hệ thống, chế độ hiển thị tối đa và hiển thị tràn viền để biết thêm thông tin chi tiết và hướng dẫn kỹ thuật.
Bạn có thể sử dụng các RRO sau để sửa đổi các thanh hệ thống:
com.android.systemui.rro.bottom
com.android.systemui.rro.bottom.rounded
com.android.systemui.rro.left
com.android.systemui.rro.right
Mô phỏng vết cắt trên màn hình
Màn hình của một số ô tô có vết cắt trên màn hình rất khác so với các vết cắt trên thiết bị di động. Thay vì các đường cắt hoặc lỗ camera hình lỗ chốt, một số xe chạy Android Automotive OS có màn hình cong khiến màn hình không phải là hình chữ nhật. Hãy xem phần Thích ứng với màn hình có hình dạng không đều để biết thêm thông tin chi tiết và hướng dẫn kỹ thuật.
Bạn có thể dùng các RRO sau để mô phỏng phần cắt màn hình:
com.android.internal.display.cutout.emulation.top_and_right
com.android.internal.display.cutout.emulation.free_form
com.android.internal.emulation.automotive_ultrawide_cutout
Cấu hình kiểm thử được đề xuất
Vì tổng số cấu hình có thể tạo bằng cách kết hợp các RRO này khá lớn, nên bạn nên kiểm thử ứng dụng bằng cách sử dụng các tổ hợp sau đây của hồ sơ phần cứng và RRO, tương tự như một số xe đang lưu thông trên đường hiện nay.
- Automotive (1080p theo chiều ngang) với
com.android.systemui.rro.left
hoặc com.android.systemui.rro.right
- Automotive Ultrawide (Chế độ siêu rộng cho ô tô) với
com.android.systemui.rro.left
và com.android.internal.emulation.automotive_ultrawide_cutout
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-27 UTC."],[],[],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`"]]