Kể từ ngày 27 tháng 3 năm 2025, bạn nên sử dụng android-latest-release
thay vì aosp-main
để xây dựng và đóng góp cho AOSP. Để biết thêm thông tin, hãy xem phần Thay đổi đối với AOSP.
Thuộc tính hệ thống trong SurfaceFlinger
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.
HAL ConfigStore vẫn nằm trong AOSP để hỗ trợ các phân vùng nhà cung cấp cũ. Trên các thiết bị chạy Android 10 trở lên, surfaceflinger
sẽ đọc các thuộc tính hệ thống trước tiên; nếu không có thuộc tính hệ thống nào được xác định cho một mục cấu hình trong SurfaceFlingerProperties.sysprop
, thì surfaceflinger
sẽ quay lại HAL ConfigStore.
Cờ bản dựng và thuộc tính hệ thống
Mỗi cờ bản dựng trong ConfigStore đều có một thuộc tính hệ thống phù hợp, như minh hoạ trong bảng sau. Để biết thông tin chi tiết về các thuộc tính này, hãy tham khảo frameworks/native/services/surfaceflinger/sysprop/SurfaceFlingerProperties.sysprop
.
Cờ dựng |
Thuộc tính hệ thống |
TARGET_FORCE_HWC_FOR_VIRTUAL_DISPLAYS
|
ro.surface_flinger.force_hwc_copy_for_virtual_displays
|
TARGET_HAS_HDR_DISPLAY
|
ro.surface_flinger.has_HDR_display
|
TARGET_HAS_WIDE_COLOR_DISPLAY
|
ro.surface_flinger.has_wide_color_display
|
NUM_FRAMEBUFFER_SURFACE_BUFFERS
|
ro.surface_flinger.max_frame_buffer_acquired_buffers
|
MAX_VIRTUAL_DISPLAY_DIMENSION
|
ro.surface_flinger.max_virtual_display_dimension
|
PRIMARY_DISPLAY_ORIENTATION
|
ro.surface_flinger.primary_display_orientation
|
PRESENT_TIME_OFFSET_FROM_VSYNC_NS
|
ro.surface_flinger.present_time_offset_from_vsync_ns
|
TARGET_RUNNING_WITHOUT_SYNC_FRAMEWORK
|
ro.surface_flinger.running_without_sync_framework
|
SF_START_GRAPHICS_ALLOCATOR_SERVICE
|
ro.surface_flinger.start_graphics_allocator_service
|
TARGET_USE_CONTEXT_PRIORITY
|
ro.surface_flinger.use_context_priority
|
USE_VR_FLINGER
|
ro.surface_flinger.use_vr_flinger
|
VSYNC_EVENT_PHASE_OFFSET_NS
|
ro.surface_flinger.vsync_event_phase_offset_ns
|
SF_VSYNC_EVENT_PHASE_OFFSET_NS
|
ro.surface_flinger.vsync_sf_event_phase_offset_ns
|
Sử dụng SurfaceFlingerProperties
Các ví dụ sau đây cho biết cách sử dụng thư viện SurfaceFlingerProperties và thuộc tính Surface Flinger ro.surface_flinger.vsync_event_phase_offset_ns
.
Để truy vấn giá trị của thuộc tính được tham chiếu, hãy sử dụng api_name
của thuộc tính làm tên hàm.
Thêm SurfaceFlingerProperties
vào tệp bản dựng như sau:
cc_binary {
name: "cc_client",
srcs: ["baz.cpp"],
shared_libs: ["SurfaceFlingerProperties"],
}
java_library {
name: "JavaClient",
srcs: ["foo/bar.java"],
libs: ["SurfaceFlingerProperties"],
}
Đoạn mã Java sau đây sử dụng thuộc tính hệ thống ro.surface_flinger.vsync_event_phase_offset_ns
:
import android.sysprop.SurfaceFlingerProperties;
...
static void foo() {
...
boolean temp = SurfaceFlingerProperties.vsync_event_phase_offset_ns().orElse(true);
...
}
...
Đoạn mã C++ sau đây sử dụng thuộc tính hệ thống ro.surface_flinger.vsync_event_phase_offset_ns
:
#include <SurfaceFlingerProperties.sysprop.h>
using namespace android::sysprop;
...
void bar() {
...
bool temp = SurfaceFlingerProperties::vsync_event_phase_offset_ns(true);
...
}
...
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,["# System properties in SurfaceFlinger\n\nThe ConfigStore HAL remains in AOSP to support legacy vendor partitions. On\ndevices running Android 10+, `surfaceflinger` reads\nsystem properties first; if no system property is defined for a config item in\n`SurfaceFlingerProperties.sysprop`, `surfaceflinger` falls back to the\nConfigStore HAL.\n\nBuild flags and system properties\n---------------------------------\n\nEach build flag in ConfigStore has a matching system property, as shown in the\nfollowing table. For details on these properties, refer to `frameworks/native/services/surfaceflinger/sysprop/SurfaceFlingerProperties.sysprop`.\n\n| Build flags | System properties |\n|-----------------------------------------|----------------------------------------------------------|\n| `TARGET_FORCE_HWC_FOR_VIRTUAL_DISPLAYS` | `ro.surface_flinger.force_hwc_copy_for_virtual_displays` |\n| `TARGET_HAS_HDR_DISPLAY` | `ro.surface_flinger.has_HDR_display` |\n| `TARGET_HAS_WIDE_COLOR_DISPLAY` | `ro.surface_flinger.has_wide_color_display` |\n| `NUM_FRAMEBUFFER_SURFACE_BUFFERS` | `ro.surface_flinger.max_frame_buffer_acquired_buffers` |\n| `MAX_VIRTUAL_DISPLAY_DIMENSION` | `ro.surface_flinger.max_virtual_display_dimension` |\n| `PRIMARY_DISPLAY_ORIENTATION` | `ro.surface_flinger.primary_display_orientation` |\n| `PRESENT_TIME_OFFSET_FROM_VSYNC_NS` | `ro.surface_flinger.present_time_offset_from_vsync_ns` |\n| `TARGET_RUNNING_WITHOUT_SYNC_FRAMEWORK` | `ro.surface_flinger.running_without_sync_framework` |\n| `SF_START_GRAPHICS_ALLOCATOR_SERVICE` | `ro.surface_flinger.start_graphics_allocator_service` |\n| `TARGET_USE_CONTEXT_PRIORITY` | `ro.surface_flinger.use_context_priority` |\n| `USE_VR_FLINGER` | `ro.surface_flinger.use_vr_flinger` |\n| `VSYNC_EVENT_PHASE_OFFSET_NS` | `ro.surface_flinger.vsync_event_phase_offset_ns` |\n| `SF_VSYNC_EVENT_PHASE_OFFSET_NS` | `ro.surface_flinger.vsync_sf_event_phase_offset_ns` |\n\nUsing SurfaceFlingerProperties\n------------------------------\n\nThe following examples show how to use the SurfaceFlingerProperties library and\nthe Surface Flinger property `ro.surface_flinger.vsync_event_phase_offset_ns`.\n\nTo query for the value of the property in reference, use the property's\n`api_name` as the function name.\n\nInclude `SurfaceFlingerProperties` in your build file, as follows: \n\n```carbon\ncc_binary {\n name: \"cc_client\",\n srcs: [\"baz.cpp\"],\n shared_libs: [\"SurfaceFlingerProperties\"],\n}\njava_library {\n name: \"JavaClient\",\n srcs: [\"foo/bar.java\"],\n libs: [\"SurfaceFlingerProperties\"],\n}\n```\n\nThe following Java code snippet uses the `ro.surface_flinger.vsync_event_phase_offset_ns`\nsystem property: \n\n```python\nimport android.sysprop.SurfaceFlingerProperties;\n...\n\nstatic void foo() {\n ...\n boolean temp = SurfaceFlingerProperties.vsync_event_phase_offset_ns().orElse(true);\n ...\n}\n...\n```\n\nThe following C++ code snippet uses the `ro.surface_flinger.vsync_event_phase_offset_ns`\nsystem property: \n\n```arduino\n#include \u003cSurfaceFlingerProperties.sysprop.h\u003e\nusing namespace android::sysprop;\n\n...\n\nvoid bar() {\n ...\n bool temp = SurfaceFlingerProperties::vsync_event_phase_offset_ns(true);\n ...\n}\n...\n```"]]