diff options
author | Jaesoo Lee <jaesoo@google.com> | 2017-04-28 18:29:40 +0900 |
---|---|---|
committer | Steven Moreland <smoreland@google.com> | 2018-05-23 15:48:36 -0700 |
commit | 712ee8216250dfbdd0f8916d4054c09a8c7fe4a9 (patch) | |
tree | 227dc31c773a621786b91b2a842952fdc0199841 /configstore | |
parent | 08009ec4be0dcb202712a2f1e2f57a3e64797f1d (diff) |
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')
13 files changed, 186 insertions, 27 deletions
diff --git a/configstore/1.0/default/android.hardware.configstore@1.0-service.rc b/configstore/1.0/default/android.hardware.configstore@1.0-service.rc deleted file mode 100644 index 40fb4983ba..0000000000 --- a/configstore/1.0/default/android.hardware.configstore@1.0-service.rc +++ /dev/null @@ -1,4 +0,0 @@ -service vendor.configstore-hal-1-0 /vendor/bin/hw/android.hardware.configstore@1.0-service - class hal animation - user system - group system diff --git a/configstore/1.1/Android.bp b/configstore/1.1/Android.bp new file mode 100644 index 0000000000..2b6e6fa378 --- /dev/null +++ b/configstore/1.1/Android.bp @@ -0,0 +1,23 @@ +// This file is autogenerated by hidl-gen -Landroidbp. + +hidl_interface { + name: "android.hardware.configstore@1.1", + root: "android.hardware", + vndk: { + enabled: true, + }, + srcs: [ + "types.hal", + "ISurfaceFlingerConfigs.hal", + ], + interfaces: [ + "android.hardware.configstore@1.0", + "android.hidl.base@1.0", + ], + types: [ + "DisplayOrientation", + "OptionalDisplayOrientation", + ], + gen_java: true, +} + diff --git a/configstore/1.1/ISurfaceFlingerConfigs.hal b/configstore/1.1/ISurfaceFlingerConfigs.hal new file mode 100644 index 0000000000..3a695941f9 --- /dev/null +++ b/configstore/1.1/ISurfaceFlingerConfigs.hal @@ -0,0 +1,28 @@ +/* + * 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. + */ +package android.hardware.configstore@1.1; + +import @1.0::ISurfaceFlingerConfigs; + +/** + * New revision of ISurfaceFlingerConfigs + */ +interface ISurfaceFlingerConfigs extends @1.0::ISurfaceFlingerConfigs { + /** + * Returns the orientation of the primary display device. + */ + primaryDisplayOrientation() generates (OptionalDisplayOrientation value); +}; diff --git a/configstore/1.0/default/Android.mk b/configstore/1.1/default/Android.mk index 22d7c92035..40f621b3ad 100644 --- a/configstore/1.0/default/Android.mk +++ b/configstore/1.1/default/Android.mk @@ -2,15 +2,15 @@ LOCAL_PATH := $(call my-dir) ################################################################################ include $(CLEAR_VARS) -LOCAL_MODULE := android.hardware.configstore@1.0-service +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.0.policy +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.0-service.rc +LOCAL_INIT_RC := android.hardware.configstore@1.1-service.rc LOCAL_SRC_FILES:= service.cpp include $(LOCAL_PATH)/surfaceflinger.mk @@ -22,16 +22,17 @@ LOCAL_SHARED_LIBRARIES := \ libhwminijail \ liblog \ libutils \ - android.hardware.configstore@1.0 + 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.0.policy +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.0-$(TARGET_ARCH).policy +LOCAL_SRC_FILES := seccomp_policy/configstore@1.1-$(TARGET_ARCH).policy include $(BUILD_PREBUILT) endif diff --git a/configstore/1.0/default/SurfaceFlingerConfigs.cpp b/configstore/1.1/default/SurfaceFlingerConfigs.cpp index 3239274f9f..da3081c12f 100644 --- a/configstore/1.0/default/SurfaceFlingerConfigs.cpp +++ b/configstore/1.1/default/SurfaceFlingerConfigs.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * 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. @@ -16,10 +16,13 @@ #include "SurfaceFlingerConfigs.h" +#include <android/hardware/configstore/1.1/types.h> +#include <log/log.h> + namespace android { namespace hardware { namespace configstore { -namespace V1_0 { +namespace V1_1 { namespace implementation { // Methods from ::android::hardware::configstore::V1_0::ISurfaceFlingerConfigs @@ -139,10 +142,59 @@ Return<void> SurfaceFlingerConfigs::startGraphicsAllocatorService( 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_0 +} // namespace V1_1 } // namespace configstore } // namespace hardware } // namespace android diff --git a/configstore/1.0/default/SurfaceFlingerConfigs.h b/configstore/1.1/default/SurfaceFlingerConfigs.h index 32e5fc3928..3714e81697 100644 --- a/configstore/1.0/default/SurfaceFlingerConfigs.h +++ b/configstore/1.1/default/SurfaceFlingerConfigs.h @@ -1,17 +1,17 @@ -#ifndef ANDROID_HARDWARE_CONFIGSTORE_V1_0_SURFACEFLINGERCONFIGS_H -#define ANDROID_HARDWARE_CONFIGSTORE_V1_0_SURFACEFLINGERCONFIGS_H +#ifndef ANDROID_HARDWARE_CONFIGSTORE_V1_1_SURFACEFLINGERCONFIGS_H +#define ANDROID_HARDWARE_CONFIGSTORE_V1_1_SURFACEFLINGERCONFIGS_H -#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.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_0 { +namespace V1_1 { namespace implementation { -using ::android::hardware::configstore::V1_0::ISurfaceFlingerConfigs; +using ::android::hardware::configstore::V1_1::ISurfaceFlingerConfigs; using ::android::hardware::Return; using ::android::hardware::Void; using ::android::sp; @@ -32,13 +32,17 @@ struct SurfaceFlingerConfigs : public ISurfaceFlingerConfigs { 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_0 +} // namespace V1_1 } // namespace configstore } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_CONFIGSTORE_V1_0_SURFACEFLINGERCONFIGS_H +#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 0000000000..105678acb2 --- /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.0/default/seccomp_policy/configstore@1.0-arm64.policy b/configstore/1.1/default/seccomp_policy/configstore@1.1-arm64.policy index d523a1a7c0..d523a1a7c0 100644 --- a/configstore/1.0/default/seccomp_policy/configstore@1.0-arm64.policy +++ b/configstore/1.1/default/seccomp_policy/configstore@1.1-arm64.policy diff --git a/configstore/1.0/default/service.cpp b/configstore/1.1/default/service.cpp index c9c81a07f5..3b4e7745ee 100644 --- a/configstore/1.0/default/service.cpp +++ b/configstore/1.1/default/service.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * 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. @@ -14,9 +14,9 @@ * limitations under the License. */ -#define LOG_TAG "android.hardware.configstore@1.0-service" +#define LOG_TAG "android.hardware.configstore@1.1-service" -#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h> +#include <android/hardware/configstore/1.1/ISurfaceFlingerConfigs.h> #include <hidl/HidlTransportSupport.h> #include <hwminijail/HardwareMinijail.h> @@ -24,8 +24,8 @@ using android::hardware::configureRpcThreadpool; using android::hardware::joinRpcThreadpool; -using android::hardware::configstore::V1_0::ISurfaceFlingerConfigs; -using android::hardware::configstore::V1_0::implementation::SurfaceFlingerConfigs; +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; @@ -34,7 +34,7 @@ using android::OK; int main() { configureRpcThreadpool(10, true); - SetupMinijail("/vendor/etc/seccomp_policy/configstore@1.0.policy"); + SetupMinijail("/vendor/etc/seccomp_policy/configstore@1.1.policy"); sp<ISurfaceFlingerConfigs> surfaceFlingerConfigs = new SurfaceFlingerConfigs; status_t status = surfaceFlingerConfigs->registerAsService(); diff --git a/configstore/1.0/default/surfaceflinger.mk b/configstore/1.1/default/surfaceflinger.mk index f7487d5864..51f06e1fff 100644 --- a/configstore/1.0/default/surfaceflinger.mk +++ b/configstore/1.1/default/surfaceflinger.mk @@ -58,3 +58,7 @@ 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 diff --git a/configstore/1.1/types.hal b/configstore/1.1/types.hal new file mode 100644 index 0000000000..adc57476ac --- /dev/null +++ b/configstore/1.1/types.hal @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2018 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 android.hardware.configstore@1.1; + +/** + * Orientation in degrees. + */ +enum DisplayOrientation : uint8_t { + ORIENTATION_0, + ORIENTATION_90, + ORIENTATION_180, + ORIENTATION_270, +}; + +struct OptionalDisplayOrientation { + bool specified; + DisplayOrientation value; +}; diff --git a/configstore/utils/Android.bp b/configstore/utils/Android.bp index 93e52f1d4e..cb4e6ebb3c 100644 --- a/configstore/utils/Android.bp +++ b/configstore/utils/Android.bp @@ -28,11 +28,13 @@ cc_library_shared { shared_libs: [ "android.hardware.configstore@1.0", + "android.hardware.configstore@1.1", "libbase", "libhidlbase" ], export_shared_lib_headers: [ "android.hardware.configstore@1.0", + "android.hardware.configstore@1.1", "libbase", "libhidlbase" ], diff --git a/configstore/utils/include/configstore/Utils.h b/configstore/utils/include/configstore/Utils.h index b107a207b3..e04f57df12 100644 --- a/configstore/utils/include/configstore/Utils.h +++ b/configstore/utils/include/configstore/Utils.h @@ -18,6 +18,7 @@ #define ANDROID_HARDWARE_CONFIGSTORE_UTILS_H #include <android/hardware/configstore/1.0/types.h> +#include <android/hardware/configstore/1.1/types.h> #include <hidl/Status.h> #include <sstream> @@ -34,13 +35,20 @@ void logAlwaysError(const std::string& message); } // namespace details namespace configstore { -// import types from V1_0 +// import types from configstore +using ::android::hardware::configstore::V1_1::DisplayOrientation; using ::android::hardware::configstore::V1_0::OptionalBool; using ::android::hardware::configstore::V1_0::OptionalInt32; using ::android::hardware::configstore::V1_0::OptionalUInt32; using ::android::hardware::configstore::V1_0::OptionalInt64; using ::android::hardware::configstore::V1_0::OptionalUInt64; using ::android::hardware::configstore::V1_0::OptionalString; +using ::android::hardware::configstore::V1_1::OptionalDisplayOrientation; + +static inline std::ostream& operator<<(std::ostream& os, DisplayOrientation orientation) { + os << ::android::hardware::configstore::V1_1::toString(orientation); + return os; +} // a function to retrieve and cache the service handle // for a particular interface @@ -141,6 +149,12 @@ std::string getString(const std::string &defValue) { return get<OptionalString, I, func>(defValue); } +template <typename I, android::hardware::Return<void> (I::*func)( + std::function<void(const OptionalDisplayOrientation&)>)> +DisplayOrientation getDisplayOrientation(DisplayOrientation defValue) { + return get<OptionalDisplayOrientation, I, func>(defValue); +} + } // namespace configstore } // namespace hardware } // namespace android |