ConfigStore

في Android، يتم تخزين خصائص النظام في فئة ConfigStore. يستخدم ConfigStore إشارات البناء لتخزين قيم التكوين في قسم البائع، وتصل الخدمة الموجودة في قسم النظام إلى هذه القيم باستخدام HIDL.

تستخدم خصائص النظام PRODUCT_DEFAULT_PROPERTY_OVERRIDES لتخزين خصائص النظام في default.prop في قسم البائع، وتستخدم الخدمة sysprop لقراءة تلك الخصائص.

يبقى ConfigStore HAL في AOSP لدعم أقسام البائع القديمة. على الأجهزة التي تعمل بنظام التشغيل Android 10، يقرأ surfaceflinger خصائص النظام أولاً؛ إذا لم يتم تحديد أي خاصية نظام لعنصر تكوين في SurfaceFlingerProperties.sysprop ، فسيعود surfaceflinger إلى ConfigStore HAL.

بناء الأعلام وخصائص النظام

تحتوي كل علامة بناء في ConfigStore على خاصية نظام مطابقة، كما هو موضح في الجدول التالي.

بناء الأعلام خصائص النظام
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

خصائص النظام الجديد

يتضمن Android 10 خصائص النظام الجديدة التالية:

  • ro.surface_flinger.default_composition_dataspace
  • ro.surface_flinger.default_composition_pixel_format
  • ro.surface_flinger.use_color_management
  • ro.surface_flinger.wcg_composition_dataspace
  • ro.surface_flinger.wcg_composition_pixel_format
  • ro.surface_flinger.display_primary_red
  • ro.surface_flinger.display_primary_green
  • ro.surface_flinger.display_primary_blue
  • ro.surface_flinger.display_primary_white
  • ro.surface_flinger.protected_contents
  • ro.surface_flinger.set_idle_timer_ms
  • ro.surface_flinger.set_touch_timer_ms
  • ro.surface_flinger.use_smart_90_for_video
  • ro.surface_flinger.protected_contents
  • ro.surface_flinger.support_kernel_idle_timer

للحصول على تفاصيل حول هذه الخصائص، راجع frameworks/native/services/surfaceflinger/sysprop/SurfaceFlingerProperties.sysprop .

باستخدام SurfaceFlingerProperties

في الأمثلة التالية لمكتبة SurfaceFlingerProperties، اسم الوظيفة هو api_name في SurfaceFlingerProperties.sysprop .

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

static void foo() {
    ...
    boolean temp = SurfaceFlingerProperties.vsync_event_phase_offset_ns().orElse(true);
    ...
}
...
#include <SurfaceFlingerProperties.sysprop.h>
using namespace android::sysprop;

...

void bar() {
    ...
    bool temp = SurfaceFlingerProperties::vsync_event_phase_offset_ns(true);
    ...
}
...