Proprietà di sistema in SurfaceFlinger

L'HAL ConfigStore rimane in AOSP per supportare le partizioni del fornitore legacy. Sui dispositivi con Android 10+, surfaceflinger legge prima le proprietà del sistema; se non è definita alcuna proprietà di sistema per un elemento di configurazione in SurfaceFlingerProperties.sysprop , surfaceflinger ritorna all'HAL ConfigStore.

Crea flag e proprietà di sistema

Ogni flag di build in ConfigStore ha una proprietà di sistema corrispondente, come mostrato nella tabella seguente. Per dettagli su queste proprietà, fare riferimento a frameworks/native/services/surfaceflinger/sysprop/SurfaceFlingerProperties.sysprop .

Costruisci bandiere Proprietà di sistema
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

Utilizzo di SurfaceFlingerProperties

Negli esempi seguenti viene illustrato come utilizzare la libreria SurfaceFlingerProperties e la proprietà Surface Flinger ro.surface_flinger.vsync_event_phase_offset_ns .

Per eseguire una query sul valore della proprietà in riferimento, utilizzare api_name della proprietà come nome della funzione.

Includi SurfaceFlingerProperties nel file di build, come segue:

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

Il seguente frammento di codice Java utilizza la proprietà di sistema 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);
    ...
}
...

Il seguente frammento di codice C++ utilizza la proprietà di sistema 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);
    ...
}
...