summaryrefslogtreecommitdiffstats
path: root/configstore/1.1/default
diff options
context:
space:
mode:
authorJaesoo Lee <jaesoo@google.com>2017-04-28 18:29:40 +0900
committerSteven Moreland <smoreland@google.com>2018-05-23 15:48:36 -0700
commit712ee8216250dfbdd0f8916d4054c09a8c7fe4a9 (patch)
tree227dc31c773a621786b91b2a842952fdc0199841 /configstore/1.1/default
parent08009ec4be0dcb202712a2f1e2f57a3e64797f1d (diff)
downloadandroid_hardware_interfaces-712ee8216250dfbdd0f8916d4054c09a8c7fe4a9.tar.gz
android_hardware_interfaces-712ee8216250dfbdd0f8916d4054c09a8c7fe4a9.tar.bz2
android_hardware_interfaces-712ee8216250dfbdd0f8916d4054c09a8c7fe4a9.zip
configstore: configstore HAL uprev'ed to 1.1
This change provides a reference implementation of the configstore HAL v1.1. Bug: 69691076 Test: tested on walleye-userdebug Change-Id: I68ee224bcbda64f6fef91e8a0f95adb32d504aad
Diffstat (limited to 'configstore/1.1/default')
-rw-r--r--configstore/1.1/default/Android.mk38
-rw-r--r--configstore/1.1/default/SurfaceFlingerConfigs.cpp200
-rw-r--r--configstore/1.1/default/SurfaceFlingerConfigs.h48
-rw-r--r--configstore/1.1/default/android.hardware.configstore@1.1-service.rc4
-rw-r--r--configstore/1.1/default/seccomp_policy/configstore@1.1-arm64.policy55
-rw-r--r--configstore/1.1/default/service.cpp46
-rw-r--r--configstore/1.1/default/surfaceflinger.mk64
7 files changed, 455 insertions, 0 deletions
diff --git a/configstore/1.1/default/Android.mk b/configstore/1.1/default/Android.mk
new file mode 100644
index 000000000..40f621b3a
--- /dev/null
+++ b/configstore/1.1/default/Android.mk
@@ -0,0 +1,38 @@
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.configstore@1.1-service
+# seccomp is not required for coverage build.
+ifneq ($(NATIVE_COVERAGE),true)
+LOCAL_REQUIRED_MODULES_arm64 := configstore@1.1.policy
+endif
+LOCAL_PROPRIETARY_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 \
+ libhidltransport \
+ 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_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
diff --git a/configstore/1.1/default/SurfaceFlingerConfigs.cpp b/configstore/1.1/default/SurfaceFlingerConfigs.cpp
new file mode 100644
index 000000000..da3081c12
--- /dev/null
+++ b/configstore/1.1/default/SurfaceFlingerConfigs.cpp
@@ -0,0 +1,200 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.1 (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.1
+ *
+ * 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.
+ */
+
+#include "SurfaceFlingerConfigs.h"
+
+#include <android/hardware/configstore/1.1/types.h>
+#include <log/log.h>
+
+namespace android {
+namespace hardware {
+namespace configstore {
+namespace V1_1 {
+namespace implementation {
+
+// Methods from ::android::hardware::configstore::V1_0::ISurfaceFlingerConfigs
+// follow.
+Return<void> SurfaceFlingerConfigs::vsyncEventPhaseOffsetNs(vsyncEventPhaseOffsetNs_cb _hidl_cb) {
+#ifdef VSYNC_EVENT_PHASE_OFFSET_NS
+ _hidl_cb({true, VSYNC_EVENT_PHASE_OFFSET_NS});
+#else
+ _hidl_cb({false, 0});
+#endif
+ return Void();
+}
+
+Return<void> SurfaceFlingerConfigs::vsyncSfEventPhaseOffsetNs(vsyncEventPhaseOffsetNs_cb _hidl_cb) {
+#ifdef SF_VSYNC_EVENT_PHASE_OFFSET_NS
+ _hidl_cb({true, SF_VSYNC_EVENT_PHASE_OFFSET_NS});
+#else
+ _hidl_cb({false, 0});
+#endif
+ return Void();
+}
+
+Return<void> SurfaceFlingerConfigs::useContextPriority(useContextPriority_cb _hidl_cb) {
+#ifdef USE_CONTEXT_PRIORITY
+ _hidl_cb({true, USE_CONTEXT_PRIORITY});
+#else
+ _hidl_cb({false, false});
+#endif
+ return Void();
+}
+
+Return<void> SurfaceFlingerConfigs::maxFrameBufferAcquiredBuffers(
+ maxFrameBufferAcquiredBuffers_cb _hidl_cb) {
+#ifdef NUM_FRAMEBUFFER_SURFACE_BUFFERS
+ _hidl_cb({true, NUM_FRAMEBUFFER_SURFACE_BUFFERS});
+#else
+ _hidl_cb({false, 0});
+#endif
+ return Void();
+}
+
+Return<void> SurfaceFlingerConfigs::hasWideColorDisplay(hasWideColorDisplay_cb _hidl_cb) {
+ bool value = false;
+#ifdef HAS_WIDE_COLOR_DISPLAY
+ value = true;
+#endif
+ _hidl_cb({true, value});
+ return Void();
+}
+
+Return<void> SurfaceFlingerConfigs::hasSyncFramework(hasSyncFramework_cb _hidl_cb) {
+ bool value = true;
+#ifdef RUNNING_WITHOUT_SYNC_FRAMEWORK
+ value = false;
+#endif
+ _hidl_cb({true, value});
+ return Void();
+}
+
+Return<void> SurfaceFlingerConfigs::hasHDRDisplay(hasHDRDisplay_cb _hidl_cb) {
+ bool value = false;
+#ifdef HAS_HDR_DISPLAY
+ value = true;
+#endif
+ _hidl_cb({true, value});
+ return Void();
+}
+
+Return<void> SurfaceFlingerConfigs::presentTimeOffsetFromVSyncNs(
+ presentTimeOffsetFromVSyncNs_cb _hidl_cb) {
+#ifdef PRESENT_TIME_OFFSET_FROM_VSYNC_NS
+ _hidl_cb({true, PRESENT_TIME_OFFSET_FROM_VSYNC_NS});
+#else
+ _hidl_cb({false, 0});
+#endif
+ return Void();
+}
+
+Return<void> SurfaceFlingerConfigs::useHwcForRGBtoYUV(useHwcForRGBtoYUV_cb _hidl_cb) {
+ bool value = false;
+#ifdef FORCE_HWC_COPY_FOR_VIRTUAL_DISPLAYS
+ value = true;
+#endif
+ _hidl_cb({true, value});
+ return Void();
+}
+
+Return<void> SurfaceFlingerConfigs::maxVirtualDisplaySize(maxVirtualDisplaySize_cb _hidl_cb) {
+ uint64_t maxSize = 0;
+#ifdef MAX_VIRTUAL_DISPLAY_DIMENSION
+ maxSize = MAX_VIRTUAL_DISPLAY_DIMENSION;
+ _hidl_cb({true, maxSize});
+#else
+ _hidl_cb({false, maxSize});
+#endif
+ return Void();
+}
+
+Return<void> SurfaceFlingerConfigs::useVrFlinger(useVrFlinger_cb _hidl_cb) {
+ bool value = false;
+ bool specified = false;
+#ifdef USE_VR_FLINGER
+ value = true;
+ specified = true;
+#endif
+ _hidl_cb({specified, value});
+ return Void();
+}
+
+Return<void> SurfaceFlingerConfigs::startGraphicsAllocatorService(
+ startGraphicsAllocatorService_cb _hidl_cb) {
+ bool value = false;
+#ifdef START_GRAPHICS_ALLOCATOR_SERVICE
+ value = true;
+#endif
+ _hidl_cb({true, value});
+ return Void();
+}
+
+// Methods from ::android::hardware::configstore::V1_1::ISurfaceFlingerConfigs
+// follow.
+
+#ifdef PRIMARY_DISPLAY_ORIENTATION
+static_assert(PRIMARY_DISPLAY_ORIENTATION == 0 || PRIMARY_DISPLAY_ORIENTATION == 90 ||
+ PRIMARY_DISPLAY_ORIENTATION == 180 || PRIMARY_DISPLAY_ORIENTATION == 270,
+ "Primary display orientation must be 0/90/180/270");
+#endif
+
+Return<void> SurfaceFlingerConfigs::primaryDisplayOrientation(
+ primaryDisplayOrientation_cb _hidl_cb) {
+ using ::android::hardware::configstore::V1_1::DisplayOrientation;
+
+ bool specified = false;
+ DisplayOrientation value = DisplayOrientation::ORIENTATION_0;
+
+ int orientation = 0;
+#ifdef PRIMARY_DISPLAY_ORIENTATION
+ specified = true;
+ orientation = PRIMARY_DISPLAY_ORIENTATION;
+#endif
+
+ switch (orientation) {
+ case 0: {
+ value = DisplayOrientation::ORIENTATION_0;
+ break;
+ }
+ case 90: {
+ value = DisplayOrientation::ORIENTATION_90;
+ break;
+ }
+ case 180: {
+ value = DisplayOrientation::ORIENTATION_180;
+ break;
+ }
+ case 270: {
+ value = DisplayOrientation::ORIENTATION_270;
+ break;
+ }
+ default: {
+ // statically checked above -> memory corruption
+ LOG_ALWAYS_FATAL("Invalid orientation %d", orientation);
+ }
+ }
+
+ _hidl_cb({specified, value});
+ return Void();
+}
+
+// Methods from ::android::hidl::base::V1_0::IBase follow.
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace configstore
+} // namespace hardware
+} // namespace android
diff --git a/configstore/1.1/default/SurfaceFlingerConfigs.h b/configstore/1.1/default/SurfaceFlingerConfigs.h
new file mode 100644
index 000000000..3714e8169
--- /dev/null
+++ b/configstore/1.1/default/SurfaceFlingerConfigs.h
@@ -0,0 +1,48 @@
+#ifndef ANDROID_HARDWARE_CONFIGSTORE_V1_1_SURFACEFLINGERCONFIGS_H
+#define ANDROID_HARDWARE_CONFIGSTORE_V1_1_SURFACEFLINGERCONFIGS_H
+
+#include <android/hardware/configstore/1.1/ISurfaceFlingerConfigs.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace configstore {
+namespace V1_1 {
+namespace implementation {
+
+using ::android::hardware::configstore::V1_1::ISurfaceFlingerConfigs;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::sp;
+
+struct SurfaceFlingerConfigs : public ISurfaceFlingerConfigs {
+ // Methods from
+ // ::android::hardware::configstore::V1_0::ISurfaceFlingerConfigs follow.
+ Return<void> vsyncEventPhaseOffsetNs(vsyncEventPhaseOffsetNs_cb _hidl_cb) override;
+ Return<void> vsyncSfEventPhaseOffsetNs(vsyncSfEventPhaseOffsetNs_cb _hidl_cb) override;
+ Return<void> useContextPriority(useContextPriority_cb _hidl_cb) override;
+ Return<void> hasWideColorDisplay(hasWideColorDisplay_cb _hidl_cb) override;
+ Return<void> hasHDRDisplay(hasHDRDisplay_cb _hidl_cb) override;
+ Return<void> presentTimeOffsetFromVSyncNs(presentTimeOffsetFromVSyncNs_cb _hidl_cb) override;
+ Return<void> useHwcForRGBtoYUV(useHwcForRGBtoYUV_cb _hidl_cb) override;
+ Return<void> maxVirtualDisplaySize(maxVirtualDisplaySize_cb _hidl_cb) override;
+ Return<void> hasSyncFramework(hasSyncFramework_cb _hidl_cb) override;
+ Return<void> useVrFlinger(useVrFlinger_cb _hidl_cb) override;
+ Return<void> maxFrameBufferAcquiredBuffers(maxFrameBufferAcquiredBuffers_cb _hidl_cb) override;
+ Return<void> startGraphicsAllocatorService(startGraphicsAllocatorService_cb _hidl_cb) override;
+
+ // Methods from
+ // ::android::hardware::configstore::V1_1::ISurfaceFlingerConfigs follow.
+ Return<void> primaryDisplayOrientation(primaryDisplayOrientation_cb _hidl_cb) override;
+
+ // Methods from ::android::hidl::base::V1_0::IBase follow.
+};
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace configstore
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_CONFIGSTORE_V1_1_SURFACEFLINGERCONFIGS_H
diff --git a/configstore/1.1/default/android.hardware.configstore@1.1-service.rc b/configstore/1.1/default/android.hardware.configstore@1.1-service.rc
new file mode 100644
index 000000000..105678acb
--- /dev/null
+++ b/configstore/1.1/default/android.hardware.configstore@1.1-service.rc
@@ -0,0 +1,4 @@
+service vendor.configstore-hal /vendor/bin/hw/android.hardware.configstore@1.1-service
+ class hal animation
+ user system
+ group system
diff --git a/configstore/1.1/default/seccomp_policy/configstore@1.1-arm64.policy b/configstore/1.1/default/seccomp_policy/configstore@1.1-arm64.policy
new file mode 100644
index 000000000..d523a1a7c
--- /dev/null
+++ b/configstore/1.1/default/seccomp_policy/configstore@1.1-arm64.policy
@@ -0,0 +1,55 @@
+# Copyright (C) 2017 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.
+
+futex: 1
+# ioctl: arg1 == BINDER_WRITE_READ
+ioctl: arg1 == 0xc0306201
+# prctl: arg0 == PR_SET_NAME || arg0 == PR_SET_VMA || arg0 == PR_SET_TIMERSLACK
+# || arg0 == PR_GET_NO_NEW_PRIVS # used by crash_dump
+# prctl: arg0 == 15 || arg0 == 0x53564d41 || arg0 == 29 || arg0 == 39
+# TODO(b/68162846) reduce scope of prctl() based on arguments
+prctl: 1
+openat: 1
+mmap: 1
+mprotect: 1
+close: 1
+getuid: 1
+read: 1
+faccessat: 1
+write: 1
+fstat: 1
+clone: 1
+sched_setscheduler: 1
+munmap: 1
+lseek: 1
+sigaltstack: 1
+writev: 1
+setpriority: 1
+restart_syscall: 1
+exit: 1
+exit_group: 1
+rt_sigreturn: 1
+getrlimit: 1
+madvise: 1
+getdents64: 1
+clock_gettime: 1
+
+# used during process crash by crash_dump to dump process info
+rt_sigprocmask: 1
+rt_sigaction: 1
+# socket: arg0 == AF_LOCAL
+socket: arg0 == 1
+connect: 1
+recvmsg: 1
+rt_tgsigqueueinfo: 1
diff --git a/configstore/1.1/default/service.cpp b/configstore/1.1/default/service.cpp
new file mode 100644
index 000000000..3b4e7745e
--- /dev/null
+++ b/configstore/1.1/default/service.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.1 (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.1
+ *
+ * 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.
+ */
+
+#define LOG_TAG "android.hardware.configstore@1.1-service"
+
+#include <android/hardware/configstore/1.1/ISurfaceFlingerConfigs.h>
+#include <hidl/HidlTransportSupport.h>
+#include <hwminijail/HardwareMinijail.h>
+
+#include "SurfaceFlingerConfigs.h"
+
+using android::hardware::configureRpcThreadpool;
+using android::hardware::joinRpcThreadpool;
+using android::hardware::configstore::V1_1::ISurfaceFlingerConfigs;
+using android::hardware::configstore::V1_1::implementation::SurfaceFlingerConfigs;
+using android::hardware::SetupMinijail;
+using android::sp;
+using android::status_t;
+using android::OK;
+
+int main() {
+ configureRpcThreadpool(10, true);
+
+ SetupMinijail("/vendor/etc/seccomp_policy/configstore@1.1.policy");
+
+ sp<ISurfaceFlingerConfigs> surfaceFlingerConfigs = new SurfaceFlingerConfigs;
+ status_t status = surfaceFlingerConfigs->registerAsService();
+ LOG_ALWAYS_FATAL_IF(status != OK, "Could not register ISurfaceFlingerConfigs");
+
+ // other interface registration comes here
+ joinRpcThreadpool();
+ return 0;
+}
diff --git a/configstore/1.1/default/surfaceflinger.mk b/configstore/1.1/default/surfaceflinger.mk
new file mode 100644
index 000000000..51f06e1ff
--- /dev/null
+++ b/configstore/1.1/default/surfaceflinger.mk
@@ -0,0 +1,64 @@
+
+LOCAL_SRC_FILES += SurfaceFlingerConfigs.cpp
+
+ifneq ($(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),)
+ LOCAL_CFLAGS += -DSF_VSYNC_EVENT_PHASE_OFFSET_NS=$(SF_VSYNC_EVENT_PHASE_OFFSET_NS)
+endif
+
+ifeq ($(TARGET_BOARD_PLATFORM),omap4)
+ LOCAL_CFLAGS += -DUSE_CONTEXT_PRIORITY=1
+endif
+
+ifeq ($(TARGET_BOARD_PLATFORM),s5pc110)
+ LOCAL_CFLAGS += -DUSE_CONTEXT_PRIORITY=1
+endif
+
+ifeq ($(TARGET_USE_CONTEXT_PRIORITY),true)
+ LOCAL_CFLAGS += -DUSE_CONTEXT_PRIORITY=1
+endif
+
+ifeq ($(TARGET_HAS_WIDE_COLOR_DISPLAY),true)
+ LOCAL_CFLAGS += -DHAS_WIDE_COLOR_DISPLAY
+endif
+
+ifeq ($(TARGET_HAS_HDR_DISPLAY),true)
+ LOCAL_CFLAGS += -DHAS_HDR_DISPLAY
+endif
+
+ifneq ($(PRESENT_TIME_OFFSET_FROM_VSYNC_NS),)
+ LOCAL_CFLAGS += -DPRESENT_TIME_OFFSET_FROM_VSYNC_NS=$(PRESENT_TIME_OFFSET_FROM_VSYNC_NS)
+else
+ LOCAL_CFLAGS += -DPRESENT_TIME_OFFSET_FROM_VSYNC_NS=0
+endif
+
+ifeq ($(TARGET_FORCE_HWC_FOR_VIRTUAL_DISPLAYS),true)
+ LOCAL_CFLAGS += -DFORCE_HWC_COPY_FOR_VIRTUAL_DISPLAYS
+endif
+
+ifneq ($(MAX_VIRTUAL_DISPLAY_DIMENSION),)
+ LOCAL_CFLAGS += -DMAX_VIRTUAL_DISPLAY_DIMENSION=$(MAX_VIRTUAL_DISPLAY_DIMENSION)
+endif
+
+ifeq ($(TARGET_RUNNING_WITHOUT_SYNC_FRAMEWORK),true)
+ LOCAL_CFLAGS += -DRUNNING_WITHOUT_SYNC_FRAMEWORK
+endif
+
+ifneq ($(USE_VR_FLINGER),)
+ LOCAL_CFLAGS += -DUSE_VR_FLINGER
+endif
+
+ifneq ($(NUM_FRAMEBUFFER_SURFACE_BUFFERS),)
+ LOCAL_CFLAGS += -DNUM_FRAMEBUFFER_SURFACE_BUFFERS=$(NUM_FRAMEBUFFER_SURFACE_BUFFERS)
+endif
+
+ifneq ($(SF_START_GRAPHICS_ALLOCATOR_SERVICE),)
+ LOCAL_CFLAGS += -DSTART_GRAPHICS_ALLOCATOR_SERVICE
+endif
+
+ifneq ($(SF_PRIMARY_DISPLAY_ORIENTATION),)
+ LOCAL_CFLAGS += -DPRIMARY_DISPLAY_ORIENTATION=$(SF_PRIMARY_DISPLAY_ORIENTATION)
+endif