Starting March 27, 2025, we recommend using android-latest-release instead of aosp-main to build and contribute to AOSP. For more information, see Changes to AOSP.

System properties in SurfaceFlinger

The ConfigStore HAL remains in AOSP to support legacy vendor partitions. On devices running Android 10+, surfaceflinger first reads system properties. If no system property is defined for a config item in SurfaceFlingerProperties.sysprop, surfaceflinger falls back to the ConfigStore HAL.

Build flags and system properties

Each build flag in ConfigStore has a matching system property, as shown in the following table. For details on these properties, see frameworks/native/services/surfaceflinger/sysprop/ SurfaceFlingerProperties.sysprop.

Build flags System properties
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

Use SurfaceFlingerProperties

The following examples show how to use the SurfaceFlingerProperties library and the Surface Flinger property ro.surface_flinger.vsync_event_phase_offset_ns.

To query the property's value, use its api_name as the function name.

Include SurfaceFlingerProperties in your build file, as follows:

cc_binary {
 name: "cc_client",
 srcs: ["baz.cpp"],
 shared_libs: ["SurfaceFlingerProperties"],
}
java_library {
 name: "JavaClient",
 srcs: ["foo/bar.java"],
 libs: ["SurfaceFlingerProperties"],
}

The following Java code snippet uses the ro.surface_flinger.vsync_event_phase_offset_ns system property:

importandroid.sysprop.SurfaceFlingerProperties;
...
staticvoidfoo(){
...
booleantemp=SurfaceFlingerProperties.vsync_event_phase_offset_ns().orElse(true);
...
}
...

The following C++ code snippet uses the ro.surface_flinger.vsync_event_phase_offset_ns system property:

#include <SurfaceFlingerProperties.sysprop.h>
usingnamespaceandroid::sysprop;
...
voidbar(){
...
booltemp=SurfaceFlingerProperties::vsync_event_phase_offset_ns(true);
...
}
...

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2025年12月02日 UTC.