Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 76133cbd authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Convert to android.hardware.configstore@1.1-service" into main

parents a57097f8 a1525fa3
Loading
Loading
Loading
Loading
+142 −0
Original line number Diff line number Diff line
// Copyright (C) 2024 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//###############################################################################
package {
    // See: http://go/android-license-faq
    default_applicable_licenses: [
        "hardware_interfaces_license",
    ],
}

soong_config_module_type {
    name: "surfaceflinger_cc_defaults_type",
    module_type: "cc_defaults",
    config_namespace: "surfaceflinger",
    value_variables: [
        "vsync_event_phase_offset_ns",
        "sf_vsync_event_phase_offset_ns",
        "present_time_offset_from_vsync_ns",
        "max_virtual_displat_dimension",
        "num_framebuffer_surface_buffers",
        "sf_primary_display_orientation",
    ],
    bool_variables: [
        "use_context_priority",
        "has_wide_color_display",
        "has_hdr_display",
        "force_hwc_copy_for_virtual_displays",
        "running_without_sync_framework",
        "use_vr_flinger",
        "sf_start_graphics_allocator_service",
    ],
    properties: [
        "cflags",
    ],
}

surfaceflinger_cc_defaults_type {
    name: "surfaceflinger_cc_defaults",
    srcs: [
        "SurfaceFlingerConfigs.cpp",
    ],
    soong_config_variables: {
        vsync_event_phase_offset_ns: {
            cflags: ["-DVSYNC_EVENT_PHASE_OFFSET_NS=%s"],
        },
        sf_vsync_event_phase_offset_ns: {
            cflags: ["-DSF_VSYNC_EVENT_PHASE_OFFSET_NS=%s"],
        },
        present_time_offset_from_vsync_ns: {
            cflags: ["-DPRESENT_TIME_OFFSET_FROM_VSYNC_NS=%s"],
        },
        max_virtual_displat_dimension: {
            cflags: ["-DMAX_VIRTUAL_DISPLAY_DIMENSION=%s"],
        },
        num_framebuffer_surface_buffers: {
            cflags: ["-DNUM_FRAMEBUFFER_SURFACE_BUFFERS=%s"],
        },
        sf_primary_display_orientation: {
            cflags: ["-DPRIMARY_DISPLAY_ORIENTATION=%s"],
        },
        use_context_priority: {
            cflags: ["-DUSE_CONTEXT_PRIORITY=1"],
        },
        has_wide_color_display: {
            cflags: ["-DHAS_WIDE_COLOR_DISPLAY"],
        },
        has_hdr_display: {
            cflags: ["-DHAS_HDR_DISPLAY"],
        },
        force_hwc_copy_for_virtual_displays: {
            cflags: ["-DFORCE_HWC_COPY_FOR_VIRTUAL_DISPLAYS"],
        },
        running_without_sync_framework: {
            cflags: ["-DRUNNING_WITHOUT_SYNC_FRAMEWORK"],
        },
        use_vr_flinger: {
            cflags: ["-DUSE_VR_FLINGER"],
        },
        sf_start_graphics_allocator_service: {
            cflags: ["-DSTART_GRAPHICS_ALLOCATOR_SERVICE"],
        },
    },
}

cc_binary {
    name: "android.hardware.configstore@1.1-service",
    srcs: ["service.cpp"],
    vendor: true,
    relative_install_path: "hw",
    init_rc: ["android.hardware.configstore@1.1-service.rc"],
    shared_libs: [
        "libhidlbase",
        "libbase",
        "libhwminijail",
        "liblog",
        "libutils",
        "android.hardware.configstore@1.0",
        "android.hardware.configstore@1.1",
    ],
    defaults: [
        "surfaceflinger_cc_defaults",
    ],
    required: select((arch(), soong_config_variable("ANDROID", "GCOV_COVERAGE")), {
        ("arm64", false): ["configstore@1.1.policy"],
        (default, default): [],
    }),
}

// Only build for arm64
prebuilt_etc {
    name: "configstore@1.1.policy",
    relative_install_path: "seccomp_policy",
    proprietary: true,
    enabled: false,
    arch: {
        arm64: {
            src: "seccomp_policy/configstore@1.1-arm64.policy",
            enabled: true,
        },
    },
}

// disable configstore
cc_binary {
    name: "disable_configstore",
    installable: false,
    srcs: ["disable_configstore.cpp"],
    overrides: ["android.hardware.configstore@1.1-service"],
    vendor: true,
}
+0 −57
Original line number Diff line number Diff line
LOCAL_PATH := $(call my-dir)

################################################################################
include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.configstore@1.1-service
LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
LOCAL_LICENSE_CONDITIONS := notice
LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE
# seccomp is not required for coverage build.
ifneq ($(NATIVE_COVERAGE),true)
LOCAL_REQUIRED_MODULES_arm64 := configstore@1.1.policy
endif
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_INIT_RC := android.hardware.configstore@1.1-service.rc
LOCAL_SRC_FILES:= service.cpp

include $(LOCAL_PATH)/surfaceflinger.mk

LOCAL_SHARED_LIBRARIES := \
    libhidlbase \
    libbase \
    libhwminijail \
    liblog \
    libutils \
    android.hardware.configstore@1.0 \
    android.hardware.configstore@1.1

include $(BUILD_EXECUTABLE)

# seccomp filter for configstore
ifeq ($(TARGET_ARCH), $(filter $(TARGET_ARCH), arm64))
include $(CLEAR_VARS)
LOCAL_MODULE := configstore@1.1.policy
LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
LOCAL_LICENSE_CONDITIONS := notice
LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/seccomp_policy
LOCAL_SRC_FILES := seccomp_policy/configstore@1.1-$(TARGET_ARCH).policy
include $(BUILD_PREBUILT)
endif

# disable configstore
include $(CLEAR_VARS)
LOCAL_MODULE := disable_configstore
LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
LOCAL_LICENSE_CONDITIONS := notice
LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_SRC_FILES:= disable_configstore.cpp
LOCAL_OVERRIDES_MODULES := android.hardware.configstore@1.1-service
LOCAL_VENDOR_MODULE := true
LOCAL_UNINSTALLABLE_MODULE := true

include $(BUILD_EXECUTABLE)
+14 −0
Original line number Diff line number Diff line
@@ -2,55 +2,69 @@
LOCAL_SRC_FILES += SurfaceFlingerConfigs.cpp

ifneq ($(VSYNC_EVENT_PHASE_OFFSET_NS),)
    $(call soong_config_set,surfaceflinger,vsync_event_phase_offset_ns,$(VSYNC_EVENT_PHASE_OFFSET_NS))
    LOCAL_CFLAGS += -DVSYNC_EVENT_PHASE_OFFSET_NS=$(VSYNC_EVENT_PHASE_OFFSET_NS)
endif

ifneq ($(SF_VSYNC_EVENT_PHASE_OFFSET_NS),)
    $(call soong_config_set,surfaceflinger,sf_vsync_event_phase_offset_ns,$(SF_VSYNC_EVENT_PHASE_OFFSET_NS))
    LOCAL_CFLAGS += -DSF_VSYNC_EVENT_PHASE_OFFSET_NS=$(SF_VSYNC_EVENT_PHASE_OFFSET_NS)
endif

ifeq ($(TARGET_USE_CONTEXT_PRIORITY),true)
    $(call soong_config_set_bool,surfaceflinger,use_context_priority,true)
    LOCAL_CFLAGS += -DUSE_CONTEXT_PRIORITY=1
endif

ifeq ($(TARGET_HAS_WIDE_COLOR_DISPLAY),true)
    $(call soong_config_set_bool,surfaceflinger,has_wide_color_display,true)
    LOCAL_CFLAGS += -DHAS_WIDE_COLOR_DISPLAY
endif

ifeq ($(TARGET_HAS_HDR_DISPLAY),true)
    $(call soong_config_set_bool,surfaceflinger,has_hdr_display,true)
    LOCAL_CFLAGS += -DHAS_HDR_DISPLAY
endif

ifneq ($(PRESENT_TIME_OFFSET_FROM_VSYNC_NS),)
    $(call soong_config_set,surfaceflinger,present_time_offset_from_vsync_ns,$(PRESENT_TIME_OFFSET_FROM_VSYNC_NS))
    LOCAL_CFLAGS += -DPRESENT_TIME_OFFSET_FROM_VSYNC_NS=$(PRESENT_TIME_OFFSET_FROM_VSYNC_NS)
else
    $(call soong_config_set,surfaceflinger,present_time_offset_from_vsync_ns,0)
    LOCAL_CFLAGS += -DPRESENT_TIME_OFFSET_FROM_VSYNC_NS=0
endif

ifeq ($(TARGET_FORCE_HWC_FOR_VIRTUAL_DISPLAYS),true)
    $(call soong_config_set_bool,surfaceflinger,force_hwc_copy_for_virtual_displays,true)
    LOCAL_CFLAGS += -DFORCE_HWC_COPY_FOR_VIRTUAL_DISPLAYS
endif

ifneq ($(MAX_VIRTUAL_DISPLAY_DIMENSION),)
    $(call soong_config_set,surfaceflinger,max_virtual_displat_dimension,$(MAX_VIRTUAL_DISPLAY_DIMENSION))
    LOCAL_CFLAGS += -DMAX_VIRTUAL_DISPLAY_DIMENSION=$(MAX_VIRTUAL_DISPLAY_DIMENSION)
endif

ifeq ($(TARGET_RUNNING_WITHOUT_SYNC_FRAMEWORK),true)
    $(call soong_config_set_bool,surfaceflinger,running_without_sync_framework,true)
    LOCAL_CFLAGS += -DRUNNING_WITHOUT_SYNC_FRAMEWORK
endif

ifneq ($(USE_VR_FLINGER),)
    $(call soong_config_set_bool,surfaceflinger,use_vr_flinger,true)
    LOCAL_CFLAGS += -DUSE_VR_FLINGER
endif

ifneq ($(NUM_FRAMEBUFFER_SURFACE_BUFFERS),)
    $(call soong_config_set,surfaceflinger,num_framebuffer_surface_buffers,$(NUM_FRAMEBUFFER_SURFACE_BUFFERS))
    LOCAL_CFLAGS += -DNUM_FRAMEBUFFER_SURFACE_BUFFERS=$(NUM_FRAMEBUFFER_SURFACE_BUFFERS)
endif

ifneq ($(SF_START_GRAPHICS_ALLOCATOR_SERVICE),)
    $(call soong_config_set_bool,surfaceflinger,sf_start_graphics_allocator_service,true)
    LOCAL_CFLAGS += -DSTART_GRAPHICS_ALLOCATOR_SERVICE
endif

ifneq ($(SF_PRIMARY_DISPLAY_ORIENTATION),)
    $(call soong_config_set,surfaceflinger,sf_primary_display_orientation,$(SF_PRIMARY_DISPLAY_ORIENTATION))
    LOCAL_CFLAGS += -DPRIMARY_DISPLAY_ORIENTATION=$(SF_PRIMARY_DISPLAY_ORIENTATION)
endif