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
This commit is contained in:
Jaesoo Lee 2017-04-28 18:29:40 +09:00 committed by Steven Moreland
parent 08009ec4be
commit 712ee82162
16 changed files with 191 additions and 28 deletions

View file

@ -64,3 +64,5 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/android.hardware.tests*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/vndk/android.hardware.tests*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/vndk-sp/android.hardware.graphics.allocator*)
$(call add-clean-step, find $(PRODUCT_OUT)/system $(PRODUCT_OUT)/vendor -type f -name "android\.hardware\.configstore\@1\.1*" -print0 | xargs -0 rm -f)
$(call add-clean-step, find $(PRODUCT_OUT)/system $(PRODUCT_OUT)/vendor -type f -name "android\.hardware\.configstore*" -print0 | xargs -0 rm -f)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/seccomp_policy/configstore@1.0.policy)

View file

@ -113,7 +113,7 @@
</hal>
<hal format="hidl" optional="false">
<name>android.hardware.configstore</name>
<version>1.0</version>
<version>1.0-1</version>
<interface>
<name>ISurfaceFlingerConfigs</name>
<instance>default</instance>

View file

@ -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

View file

@ -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,
}

View file

@ -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);
};

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,4 @@
service vendor.configstore-hal /vendor/bin/hw/android.hardware.configstore@1.1-service
class hal animation
user system
group system

View file

@ -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();

View file

@ -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

31
configstore/1.1/types.hal Normal file
View file

@ -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;
};

View file

@ -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"
],

View file

@ -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

View file

@ -325,6 +325,8 @@ eacf4e7491fc52c4db90898faddf25ec7bc72501b07ae8737434c47cb845128c android.hardwar
812fa66aa10ba0cba27cfddc2fd7f0ee27a8ab65a1f15aa79fdad97d403e6a14 android.hardware.camera.device@3.4::ICameraDeviceSession
cc288f1f78d1e643eb3d3dbc16e1401d44033d8e6856761f5156814a29986ec7 android.hardware.camera.device@3.4::types
f9278c8beb9d42d96e26d73ecabe1dff1d7e2fb301ab7f737d93e5ffae8d3312 android.hardware.camera.metadata@3.3::types
f858091b10f7d5927be60573c06df4805275d37226bbb41a732190bfb81457ec android.hardware.configstore@1.1::ISurfaceFlingerConfigs
5b0fb9842f8b0eb3730b93c30a7925290ab44763ab86bb493bfa58d0f2eeb369 android.hardware.configstore@1.1::types
1a46aeae45b7a0e47f79b7207300532986f9d9cd7060779afc7a529f54d712ab android.hardware.confirmationui@1.0::IConfirmationResultCallback
6d8347ff3cd7de471065ac3e8e68385073630cdeebe9f8fa58cb91cf44436c95 android.hardware.confirmationui@1.0::IConfirmationUI
a3ff916784dce87a56c757ab5c86433f0cdf562280999a5f978a6e8a0f3f19e7 android.hardware.confirmationui@1.0::types