Merge "Add logic to actually read OBD2 sensor properties to VehicleHidlTest"
diff --git a/biometrics/fingerprint/2.1/IBiometricsFingerprintClientCallback.hal b/biometrics/fingerprint/2.1/IBiometricsFingerprintClientCallback.hal
index 63435d1..d913cf1 100644
--- a/biometrics/fingerprint/2.1/IBiometricsFingerprintClientCallback.hal
+++ b/biometrics/fingerprint/2.1/IBiometricsFingerprintClientCallback.hal
@@ -43,8 +43,9 @@
* @param deviceId the instance of this fingerprint device
* @param fingerId the fingerprint templetate that was authenticated
* @param groupId the groupid for the template that was authenticated
+ * @param token the hardware authentication token to pass to Keystore.addAuthToken()
*/
- oneway onAuthenticated(uint64_t deviceId, uint32_t fingerId, uint32_t groupId);
+ oneway onAuthenticated(uint64_t deviceId, uint32_t fingerId, uint32_t groupId, vec<uint8_t> token);
/**
* Sent when a fingerprint error occurs
diff --git a/biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp b/biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp
index 516cd00..154b7a6 100644
--- a/biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp
+++ b/biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp
@@ -14,10 +14,9 @@
* limitations under the License.
*/
#define LOG_TAG "android.hardware.biometrics.fingerprint@2.1-service"
+#define LOG_VERBOSE "android.hardware.biometrics.fingerprint@2.1-service"
// For communication with Keystore binder interface
-#include <binder/IServiceManager.h>
-#include <keystore/IKeystoreService.h>
#include <keystore/keystore.h> // for error codes
#include <hardware/hw_auth_token.h>
@@ -40,23 +39,19 @@
using RequestStatus =
android::hardware::biometrics::fingerprint::V2_1::RequestStatus;
-sp<IBiometricsFingerprintClientCallback>
- BiometricsFingerprint::mClientCallback = nullptr;
+BiometricsFingerprint *BiometricsFingerprint::sInstance = nullptr;
-// TODO: This is here because HAL 2.1 doesn't have a way to propagate a
-// unique token for its driver. Subsequent versions should send a unique
-// token for each call to notify(). This is fine as long as there's only
-// one fingerprint device on the platform.
-fingerprint_device_t *BiometricsFingerprint::sDevice = nullptr;
-
-BiometricsFingerprint::BiometricsFingerprint(fingerprint_device_t *device)
- : mDevice(device) {
- sDevice = mDevice; // keep track of the most recent instance
+BiometricsFingerprint::BiometricsFingerprint() : mClientCallback(nullptr), mDevice(nullptr) {
+ sInstance = this; // keep track of the most recent instance
+ mDevice = openHal();
+ if (!mDevice) {
+ ALOGE("Can't open HAL module");
+ }
}
BiometricsFingerprint::~BiometricsFingerprint() {
- ALOG(LOG_VERBOSE, LOG_TAG, "nativeCloseHal()\n");
- if (mDevice == NULL) {
+ ALOGV(LOG_VERBOSE, LOG_TAG, "~BiometricsFingerprint()\n");
+ if (mDevice == nullptr) {
ALOGE("No valid device");
return;
}
@@ -66,7 +61,7 @@
ALOGE("Can't close fingerprint module, error: %d", err);
return;
}
- mDevice = NULL;
+ mDevice = nullptr;
}
Return<RequestStatus> BiometricsFingerprint::ErrorFilter(int32_t error) {
@@ -107,6 +102,8 @@
return FingerprintError::ERROR_CANCELED;
case FINGERPRINT_ERROR_UNABLE_TO_REMOVE:
return FingerprintError::ERROR_UNABLE_TO_REMOVE;
+ case FINGERPRINT_ERROR_LOCKOUT:
+ return FingerprintError::ERROR_LOCKOUT;
default:
if (error >= FINGERPRINT_ERROR_VENDOR_BASE) {
// vendor specific code.
@@ -114,7 +111,7 @@
return FingerprintError::ERROR_VENDOR;
}
}
- ALOGE("Unknown error from fingerprint vendor library");
+ ALOGE("Unknown error from fingerprint vendor library: %d", error);
return FingerprintError::ERROR_UNABLE_TO_PROCESS;
}
@@ -143,13 +140,17 @@
return FingerprintAcquiredInfo::ACQUIRED_VENDOR;
}
}
- ALOGE("Unknown acquiredmsg from fingerprint vendor library");
+ ALOGE("Unknown acquiredmsg from fingerprint vendor library: %d", info);
return FingerprintAcquiredInfo::ACQUIRED_INSUFFICIENT;
}
Return<uint64_t> BiometricsFingerprint::setNotify(
const sp<IBiometricsFingerprintClientCallback>& clientCallback) {
mClientCallback = clientCallback;
+ // This is here because HAL 2.1 doesn't have a way to propagate a
+ // unique token for its driver. Subsequent versions should send a unique
+ // token for each call to setNotify(). This is fine as long as there's only
+ // one fingerprint device on the platform.
return reinterpret_cast<uint64_t>(mDevice);
}
@@ -199,36 +200,44 @@
}
IBiometricsFingerprint* BiometricsFingerprint::getInstance() {
+ if (!sInstance) {
+ sInstance = new BiometricsFingerprint();
+ }
+ return sInstance;
+}
+
+fingerprint_device_t* BiometricsFingerprint::openHal() {
int err;
- const hw_module_t *hw_mdl = NULL;
- ALOGE("Opening fingerprint hal library...");
+ const hw_module_t *hw_mdl = nullptr;
+ ALOGD("Opening fingerprint hal library...");
if (0 != (err = hw_get_module(FINGERPRINT_HARDWARE_MODULE_ID, &hw_mdl))) {
ALOGE("Can't open fingerprint HW Module, error: %d", err);
return nullptr;
}
- if (hw_mdl == NULL) {
+ if (hw_mdl == nullptr) {
ALOGE("No valid fingerprint module");
return nullptr;
}
fingerprint_module_t const *module =
reinterpret_cast<const fingerprint_module_t*>(hw_mdl);
- if (module->common.methods->open == NULL) {
+ if (module->common.methods->open == nullptr) {
ALOGE("No valid open method");
return nullptr;
}
- hw_device_t *device = NULL;
+ hw_device_t *device = nullptr;
- if (0 != (err = module->common.methods->open(hw_mdl, NULL, &device))) {
+ if (0 != (err = module->common.methods->open(hw_mdl, nullptr, &device))) {
ALOGE("Can't open fingerprint methods, error: %d", err);
return nullptr;
}
if (kVersion != device->version) {
+ // enforce version on new devices because of HIDL@2.1 translation layer
ALOGE("Wrong fp version. Expected %d, got %d", kVersion, device->version);
- return 0; // enforce this on new devices because of HIDL translation layer
+ return nullptr;
}
fingerprint_device_t* fp_device =
@@ -240,23 +249,67 @@
return nullptr;
}
- return new BiometricsFingerprint(fp_device);
+ return fp_device;
}
-void BiometricsFingerprint::notifyKeystore(const uint8_t *auth_token, const size_t auth_token_length) {
- if (auth_token != nullptr && auth_token_length > 0) {
- // TODO: cache service?
- sp<IServiceManager> sm = android::defaultServiceManager();
- sp<::android::IBinder> binder = sm->getService(String16("android.security.keystore"));
- sp<IKeystoreService> service = interface_cast<IKeystoreService>(binder);
- if (service != nullptr) {
- auto ret = service->addAuthToken(auth_token, auth_token_length);
- if (!ret.isOk()) {
- ALOGE("Failure sending auth token to KeyStore: %" PRId32, int32_t(ret));
+void BiometricsFingerprint::notify(const fingerprint_msg_t *msg) {
+ BiometricsFingerprint* thisPtr = static_cast<BiometricsFingerprint*>(
+ BiometricsFingerprint::getInstance());
+ if (thisPtr == nullptr || thisPtr->mClientCallback == nullptr) {
+ ALOGE("Receiving callbacks before the client callback is registered.");
+ return;
+ }
+ const uint64_t devId = reinterpret_cast<uint64_t>(thisPtr->mDevice);
+ switch (msg->type) {
+ case FINGERPRINT_ERROR: {
+ int32_t vendorCode = 0;
+ FingerprintError result = VendorErrorFilter(msg->data.error, &vendorCode);
+ thisPtr->mClientCallback->onError(devId, result, vendorCode);
}
- } else {
- ALOGE("Unable to communicate with KeyStore");
- }
+ break;
+ case FINGERPRINT_ACQUIRED: {
+ int32_t vendorCode = 0;
+ FingerprintAcquiredInfo result =
+ VendorAcquiredFilter(msg->data.acquired.acquired_info, &vendorCode);
+ thisPtr->mClientCallback->onAcquired(devId, result, vendorCode);
+ }
+ break;
+ case FINGERPRINT_TEMPLATE_ENROLLING:
+ thisPtr->mClientCallback->onEnrollResult(devId,
+ msg->data.enroll.finger.fid,
+ msg->data.enroll.finger.gid,
+ msg->data.enroll.samples_remaining);
+ break;
+ case FINGERPRINT_TEMPLATE_REMOVED:
+ thisPtr->mClientCallback->onRemoved(devId,
+ msg->data.removed.finger.fid,
+ msg->data.removed.finger.gid,
+ msg->data.removed.remaining_templates);
+ break;
+ case FINGERPRINT_AUTHENTICATED:
+ if (msg->data.authenticated.finger.fid != 0) {
+ const uint8_t* hat =
+ reinterpret_cast<const uint8_t *>(&msg->data.authenticated.hat);
+ const hidl_vec<uint8_t> token(
+ std::vector<uint8_t>(hat, hat + sizeof(msg->data.authenticated.hat)));
+ thisPtr->mClientCallback->onAuthenticated(devId,
+ msg->data.authenticated.finger.fid,
+ msg->data.authenticated.finger.gid,
+ token);
+ } else {
+ // Not a recognized fingerprint
+ thisPtr->mClientCallback->onAuthenticated(devId,
+ msg->data.authenticated.finger.fid,
+ msg->data.authenticated.finger.gid,
+ hidl_vec<uint8_t>());
+ }
+ break;
+ case FINGERPRINT_TEMPLATE_ENUMERATING:
+ thisPtr->mClientCallback->onEnumerate(devId,
+ msg->data.enumerated.finger.fid,
+ msg->data.enumerated.finger.gid,
+ msg->data.enumerated.remaining_templates);
+ break;
}
}
diff --git a/biometrics/fingerprint/2.1/default/BiometricsFingerprint.h b/biometrics/fingerprint/2.1/default/BiometricsFingerprint.h
index 1f44a1c..652a3e0 100644
--- a/biometrics/fingerprint/2.1/default/BiometricsFingerprint.h
+++ b/biometrics/fingerprint/2.1/default/BiometricsFingerprint.h
@@ -43,7 +43,7 @@
struct BiometricsFingerprint : public IBiometricsFingerprint {
public:
- BiometricsFingerprint(fingerprint_device_t *device);
+ BiometricsFingerprint();
~BiometricsFingerprint();
// Method to wrap legacy HAL with BiometricsFingerprint class
@@ -60,68 +60,17 @@
Return<RequestStatus> remove(uint32_t gid, uint32_t fid) override;
Return<RequestStatus> setActiveGroup(uint32_t gid, const hidl_string& storePath) override;
Return<RequestStatus> authenticate(uint64_t operationId, uint32_t gid) override;
- static void notify(const fingerprint_msg_t *msg) {
- if (mClientCallback == nullptr) {
- ALOGE("Receiving callbacks before the client callback is registered.");
- return;
- }
- const uint64_t devId = reinterpret_cast<uint64_t>(sDevice);
- switch (msg->type) {
- case FINGERPRINT_ERROR: {
- int32_t vendorCode = 0;
- FingerprintError result =
- VendorErrorFilter(msg->data.error, &vendorCode);
- mClientCallback->onError(devId, result, vendorCode);
- }
- break;
- case FINGERPRINT_ACQUIRED: {
- int32_t vendorCode = 0;
- FingerprintAcquiredInfo result =
- VendorAcquiredFilter(msg->data.acquired.acquired_info,
- &vendorCode);
- mClientCallback->onAcquired(devId, result, vendorCode);
- }
- break;
- case FINGERPRINT_TEMPLATE_ENROLLING:
- mClientCallback->onEnrollResult(devId,
- msg->data.enroll.finger.fid,
- msg->data.enroll.finger.gid,
- msg->data.enroll.samples_remaining);
- break;
- case FINGERPRINT_TEMPLATE_REMOVED:
- mClientCallback->onRemoved(devId,
- msg->data.removed.finger.fid,
- msg->data.removed.finger.gid,
- msg->data.removed.remaining_templates);
- break;
- case FINGERPRINT_AUTHENTICATED:
- if (msg->data.authenticated.finger.fid != 0) {
- const uint8_t* hat =
- reinterpret_cast<const uint8_t *>(&msg->data.authenticated.hat);
- notifyKeystore(hat, sizeof(msg->data.authenticated.hat));
- }
- mClientCallback->onAuthenticated(devId,
- msg->data.authenticated.finger.fid,
- msg->data.authenticated.finger.gid);
- break;
- case FINGERPRINT_TEMPLATE_ENUMERATING:
- mClientCallback->onEnumerate(devId,
- msg->data.enumerated.finger.fid,
- msg->data.enumerated.finger.gid,
- msg->data.enumerated.remaining_templates);
- break;
- }
- }
+
private:
- Return<RequestStatus> ErrorFilter(int32_t error);
- static void notifyKeystore(const uint8_t *auth_token, const size_t auth_token_length);
- static FingerprintError VendorErrorFilter(int32_t error,
- int32_t* vendorCode);
- static FingerprintAcquiredInfo VendorAcquiredFilter(int32_t error,
- int32_t* vendorCode);
- static sp<IBiometricsFingerprintClientCallback> mClientCallback;
+ static fingerprint_device_t* openHal();
+ static void notify(const fingerprint_msg_t *msg); /* Static callback for legacy HAL implementation */
+ static Return<RequestStatus> ErrorFilter(int32_t error);
+ static FingerprintError VendorErrorFilter(int32_t error, int32_t* vendorCode);
+ static FingerprintAcquiredInfo VendorAcquiredFilter(int32_t error, int32_t* vendorCode);
+ static BiometricsFingerprint* sInstance;
+
+ sp<IBiometricsFingerprintClientCallback> mClientCallback;
fingerprint_device_t *mDevice;
- static fingerprint_device_t *sDevice; // TODO: allow multiple drivers
};
} // namespace implementation
diff --git a/gatekeeper/1.0/vts/Android.mk b/gatekeeper/1.0/vts/Android.mk
new file mode 100644
index 0000000..58c2dca
--- /dev/null
+++ b/gatekeeper/1.0/vts/Android.mk
@@ -0,0 +1,19 @@
+#
+# Copyright (C) 2016 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.
+
+
+LOCAL_PATH := $(call my-dir)
+
+include $(LOCAL_PATH)/functional/vts/testcases/hal/gatekeeper/hidl/Android.mk
diff --git a/gatekeeper/1.0/vts/functional/vts/testcases/hal/gatekeeper/hidl/Android.mk b/gatekeeper/1.0/vts/functional/vts/testcases/hal/gatekeeper/hidl/Android.mk
new file mode 100644
index 0000000..f9e3276
--- /dev/null
+++ b/gatekeeper/1.0/vts/functional/vts/testcases/hal/gatekeeper/hidl/Android.mk
@@ -0,0 +1,19 @@
+#
+# Copyright (C) 2016 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.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(call all-subdir-makefiles)
diff --git a/graphics/composer/2.1/default/Android.bp b/graphics/composer/2.1/default/Android.bp
index 0d63c3c..a366fa2 100644
--- a/graphics/composer/2.1/default/Android.bp
+++ b/graphics/composer/2.1/default/Android.bp
@@ -1,7 +1,28 @@
+cc_library_static {
+ name: "libhwcomposer-client",
+ export_include_dirs: ["."],
+ srcs: ["ComposerClient.cpp"],
+ cppflags: ["-DBINDERIZED"],
+ shared_libs: [
+ "android.hardware.graphics.allocator@2.0",
+ "android.hardware.graphics.composer@2.1",
+ "libbase",
+ "libcutils",
+ "libfmq",
+ "libhardware",
+ "libhidlbase",
+ "libhidltransport",
+ "libhwbinder",
+ "liblog",
+ "libsync",
+ "libutils",
+ ],
+}
+
cc_library_shared {
name: "android.hardware.graphics.composer@2.1-impl",
relative_install_path: "hw",
- srcs: ["Hwc.cpp", "HwcClient.cpp"],
+ srcs: ["Hwc.cpp", "ComposerClient.cpp"],
shared_libs: [
"android.hardware.graphics.allocator@2.0",
"android.hardware.graphics.composer@2.1",
@@ -21,10 +42,13 @@
cc_binary {
name: "android.hardware.graphics.composer@2.1-service",
relative_install_path: "hw",
- srcs: ["service.cpp", "Hwc.cpp", "HwcClient.cpp"],
+ srcs: ["service.cpp", "Hwc.cpp"],
cppflags: ["-DBINDERIZED"],
init_rc: ["android.hardware.graphics.composer@2.1-service.rc"],
+ static_libs: [
+ "libhwcomposer-client",
+ ],
shared_libs: [
"android.hardware.graphics.allocator@2.0",
"android.hardware.graphics.composer@2.1",
diff --git a/graphics/composer/2.1/default/ComposerBase.h b/graphics/composer/2.1/default/ComposerBase.h
new file mode 100644
index 0000000..85b1a4d
--- /dev/null
+++ b/graphics/composer/2.1/default/ComposerBase.h
@@ -0,0 +1,130 @@
+/*
+ * Copyright 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.
+ */
+
+#ifndef ANDROID_HARDWARE_GRAPHICS_COMPOSER_V2_1_COMPOSER_BASE_H
+#define ANDROID_HARDWARE_GRAPHICS_COMPOSER_V2_1_COMPOSER_BASE_H
+
+#include <android/hardware/graphics/composer/2.1/IComposer.h>
+#include <hardware/hwcomposer2.h>
+
+namespace android {
+namespace hardware {
+namespace graphics {
+namespace composer {
+namespace V2_1 {
+namespace implementation {
+
+using android::hardware::graphics::common::V1_0::PixelFormat;
+using android::hardware::graphics::common::V1_0::Transform;
+using android::hardware::graphics::common::V1_0::Dataspace;
+using android::hardware::graphics::common::V1_0::ColorMode;
+using android::hardware::graphics::common::V1_0::ColorTransform;
+using android::hardware::graphics::common::V1_0::Hdr;
+
+class ComposerBase {
+public:
+ virtual ~ComposerBase() {};
+
+ virtual void removeClient() = 0;
+ virtual void enableCallback(bool enable) = 0;
+ virtual uint32_t getMaxVirtualDisplayCount() = 0;
+ virtual Error createVirtualDisplay(uint32_t width, uint32_t height,
+ PixelFormat* format, Display* outDisplay) = 0;
+ virtual Error destroyVirtualDisplay(Display display) = 0;
+ virtual Error createLayer(Display display, Layer* outLayer) = 0;
+ virtual Error destroyLayer(Display display, Layer layer) = 0;
+
+ virtual Error getActiveConfig(Display display, Config* outConfig) = 0;
+ virtual Error getClientTargetSupport(Display display,
+ uint32_t width, uint32_t height,
+ PixelFormat format, Dataspace dataspace) = 0;
+ virtual Error getColorModes(Display display,
+ hidl_vec<ColorMode>* outModes) = 0;
+ virtual Error getDisplayAttribute(Display display, Config config,
+ IComposerClient::Attribute attribute, int32_t* outValue) = 0;
+ virtual Error getDisplayConfigs(Display display,
+ hidl_vec<Config>* outConfigs) = 0;
+ virtual Error getDisplayName(Display display, hidl_string* outName) = 0;
+ virtual Error getDisplayType(Display display,
+ IComposerClient::DisplayType* outType) = 0;
+ virtual Error getDozeSupport(Display display, bool* outSupport) = 0;
+ virtual Error getHdrCapabilities(Display display, hidl_vec<Hdr>* outTypes,
+ float* outMaxLuminance, float* outMaxAverageLuminance,
+ float* outMinLuminance) = 0;
+
+ virtual Error setActiveConfig(Display display, Config config) = 0;
+ virtual Error setColorMode(Display display, ColorMode mode) = 0;
+ virtual Error setPowerMode(Display display,
+ IComposerClient::PowerMode mode) = 0;
+ virtual Error setVsyncEnabled(Display display,
+ IComposerClient::Vsync enabled) = 0;
+
+ virtual Error setColorTransform(Display display, const float* matrix,
+ int32_t hint) = 0;
+ virtual Error setClientTarget(Display display, buffer_handle_t target,
+ int32_t acquireFence, int32_t dataspace,
+ const std::vector<hwc_rect_t>& damage) = 0;
+ virtual Error setOutputBuffer(Display display, buffer_handle_t buffer,
+ int32_t releaseFence) = 0;
+ virtual Error validateDisplay(Display display,
+ std::vector<Layer>* outChangedLayers,
+ std::vector<IComposerClient::Composition>* outCompositionTypes,
+ uint32_t* outDisplayRequestMask,
+ std::vector<Layer>* outRequestedLayers,
+ std::vector<uint32_t>* outRequestMasks) = 0;
+ virtual Error acceptDisplayChanges(Display display) = 0;
+ virtual Error presentDisplay(Display display, int32_t* outPresentFence,
+ std::vector<Layer>* outLayers,
+ std::vector<int32_t>* outReleaseFences) = 0;
+
+ virtual Error setLayerCursorPosition(Display display, Layer layer,
+ int32_t x, int32_t y) = 0;
+ virtual Error setLayerBuffer(Display display, Layer layer,
+ buffer_handle_t buffer, int32_t acquireFence) = 0;
+ virtual Error setLayerSurfaceDamage(Display display, Layer layer,
+ const std::vector<hwc_rect_t>& damage) = 0;
+ virtual Error setLayerBlendMode(Display display, Layer layer,
+ int32_t mode) = 0;
+ virtual Error setLayerColor(Display display, Layer layer,
+ IComposerClient::Color color) = 0;
+ virtual Error setLayerCompositionType(Display display, Layer layer,
+ int32_t type) = 0;
+ virtual Error setLayerDataspace(Display display, Layer layer,
+ int32_t dataspace) = 0;
+ virtual Error setLayerDisplayFrame(Display display, Layer layer,
+ const hwc_rect_t& frame) = 0;
+ virtual Error setLayerPlaneAlpha(Display display, Layer layer,
+ float alpha) = 0;
+ virtual Error setLayerSidebandStream(Display display, Layer layer,
+ buffer_handle_t stream) = 0;
+ virtual Error setLayerSourceCrop(Display display, Layer layer,
+ const hwc_frect_t& crop) = 0;
+ virtual Error setLayerTransform(Display display, Layer layer,
+ int32_t transform) = 0;
+ virtual Error setLayerVisibleRegion(Display display, Layer layer,
+ const std::vector<hwc_rect_t>& visible) = 0;
+ virtual Error setLayerZOrder(Display display, Layer layer,
+ uint32_t z) = 0;
+};
+
+} // namespace implementation
+} // namespace V2_1
+} // namespace composer
+} // namespace graphics
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GRAPHICS_COMPOSER_V2_1_COMPOSER_BASE_H
diff --git a/graphics/composer/2.1/default/HwcClient.cpp b/graphics/composer/2.1/default/ComposerClient.cpp
similarity index 76%
rename from graphics/composer/2.1/default/HwcClient.cpp
rename to graphics/composer/2.1/default/ComposerClient.cpp
index edd161a..49415ee 100644
--- a/graphics/composer/2.1/default/HwcClient.cpp
+++ b/graphics/composer/2.1/default/ComposerClient.cpp
@@ -20,8 +20,8 @@
#include <hardware/gralloc1.h>
#include <log/log.h>
+#include "ComposerClient.h"
#include "Hwc.h"
-#include "HwcClient.h"
#include "IComposerCommandBuffer.h"
namespace android {
@@ -230,15 +230,12 @@
}
}
-HwcClient::HwcClient(HwcHal& hal)
- : mHal(hal), mReader(*this), mWriter(kWriterInitialSize)
+ComposerClient::ComposerClient(ComposerBase& hal)
+ : mHal(hal), mWriter(kWriterInitialSize)
{
- if (!sHandleImporter.initialize()) {
- LOG_ALWAYS_FATAL("failed to initialize handle importer");
- }
}
-HwcClient::~HwcClient()
+ComposerClient::~ComposerClient()
{
mHal.enableCallback(false);
mHal.removeClient();
@@ -264,7 +261,15 @@
sHandleImporter.cleanup();
}
-void HwcClient::onHotplug(Display display,
+void ComposerClient::initialize()
+{
+ mReader = createCommandReader();
+ if (!sHandleImporter.initialize()) {
+ LOG_ALWAYS_FATAL("failed to initialize handle importer");
+ }
+}
+
+void ComposerClient::onHotplug(Display display,
IComposerCallback::Connection connected)
{
{
@@ -280,17 +285,18 @@
mCallback->onHotplug(display, connected);
}
-void HwcClient::onRefresh(Display display)
+void ComposerClient::onRefresh(Display display)
{
mCallback->onRefresh(display);
}
-void HwcClient::onVsync(Display display, int64_t timestamp)
+void ComposerClient::onVsync(Display display, int64_t timestamp)
{
mCallback->onVsync(display, timestamp);
}
-Return<void> HwcClient::registerCallback(const sp<IComposerCallback>& callback)
+Return<void> ComposerClient::registerCallback(
+ const sp<IComposerCallback>& callback)
{
// no locking as we require this function to be called only once
mCallback = callback;
@@ -299,13 +305,13 @@
return Void();
}
-Return<uint32_t> HwcClient::getMaxVirtualDisplayCount()
+Return<uint32_t> ComposerClient::getMaxVirtualDisplayCount()
{
return mHal.getMaxVirtualDisplayCount();
}
-Return<void> HwcClient::createVirtualDisplay(uint32_t width, uint32_t height,
- PixelFormat formatHint, uint32_t outputBufferSlotCount,
+Return<void> ComposerClient::createVirtualDisplay(uint32_t width,
+ uint32_t height, PixelFormat formatHint, uint32_t outputBufferSlotCount,
createVirtualDisplay_cb hidl_cb)
{
Display display = 0;
@@ -322,7 +328,7 @@
return Void();
}
-Return<Error> HwcClient::destroyVirtualDisplay(Display display)
+Return<Error> ComposerClient::destroyVirtualDisplay(Display display)
{
Error err = mHal.destroyVirtualDisplay(display);
if (err == Error::NONE) {
@@ -334,8 +340,8 @@
return err;
}
-Return<void> HwcClient::createLayer(Display display, uint32_t bufferSlotCount,
- createLayer_cb hidl_cb)
+Return<void> ComposerClient::createLayer(Display display,
+ uint32_t bufferSlotCount, createLayer_cb hidl_cb)
{
Layer layer = 0;
Error err = mHal.createLayer(display, &layer);
@@ -351,7 +357,7 @@
return Void();
}
-Return<Error> HwcClient::destroyLayer(Display display, Layer layer)
+Return<Error> ComposerClient::destroyLayer(Display display, Layer layer)
{
Error err = mHal.destroyLayer(display, layer);
if (err == Error::NONE) {
@@ -364,7 +370,7 @@
return err;
}
-Return<void> HwcClient::getActiveConfig(Display display,
+Return<void> ComposerClient::getActiveConfig(Display display,
getActiveConfig_cb hidl_cb)
{
Config config = 0;
@@ -374,7 +380,7 @@
return Void();
}
-Return<Error> HwcClient::getClientTargetSupport(Display display,
+Return<Error> ComposerClient::getClientTargetSupport(Display display,
uint32_t width, uint32_t height,
PixelFormat format, Dataspace dataspace)
{
@@ -383,7 +389,8 @@
return err;
}
-Return<void> HwcClient::getColorModes(Display display, getColorModes_cb hidl_cb)
+Return<void> ComposerClient::getColorModes(Display display,
+ getColorModes_cb hidl_cb)
{
hidl_vec<ColorMode> modes;
Error err = mHal.getColorModes(display, &modes);
@@ -392,7 +399,7 @@
return Void();
}
-Return<void> HwcClient::getDisplayAttribute(Display display,
+Return<void> ComposerClient::getDisplayAttribute(Display display,
Config config, Attribute attribute,
getDisplayAttribute_cb hidl_cb)
{
@@ -403,7 +410,7 @@
return Void();
}
-Return<void> HwcClient::getDisplayConfigs(Display display,
+Return<void> ComposerClient::getDisplayConfigs(Display display,
getDisplayConfigs_cb hidl_cb)
{
hidl_vec<Config> configs;
@@ -413,7 +420,7 @@
return Void();
}
-Return<void> HwcClient::getDisplayName(Display display,
+Return<void> ComposerClient::getDisplayName(Display display,
getDisplayName_cb hidl_cb)
{
hidl_string name;
@@ -423,7 +430,7 @@
return Void();
}
-Return<void> HwcClient::getDisplayType(Display display,
+Return<void> ComposerClient::getDisplayType(Display display,
getDisplayType_cb hidl_cb)
{
DisplayType type = DisplayType::INVALID;
@@ -433,7 +440,7 @@
return Void();
}
-Return<void> HwcClient::getDozeSupport(Display display,
+Return<void> ComposerClient::getDozeSupport(Display display,
getDozeSupport_cb hidl_cb)
{
bool support = false;
@@ -443,7 +450,7 @@
return Void();
}
-Return<void> HwcClient::getHdrCapabilities(Display display,
+Return<void> ComposerClient::getHdrCapabilities(Display display,
getHdrCapabilities_cb hidl_cb)
{
hidl_vec<Hdr> types;
@@ -457,7 +464,7 @@
return Void();
}
-Return<Error> HwcClient::setClientTargetSlotCount(Display display,
+Return<Error> ComposerClient::setClientTargetSlotCount(Display display,
uint32_t clientTargetSlotCount)
{
std::lock_guard<std::mutex> lock(mDisplayDataMutex);
@@ -472,39 +479,39 @@
return Error::NONE;
}
-Return<Error> HwcClient::setActiveConfig(Display display, Config config)
+Return<Error> ComposerClient::setActiveConfig(Display display, Config config)
{
Error err = mHal.setActiveConfig(display, config);
return err;
}
-Return<Error> HwcClient::setColorMode(Display display, ColorMode mode)
+Return<Error> ComposerClient::setColorMode(Display display, ColorMode mode)
{
Error err = mHal.setColorMode(display, mode);
return err;
}
-Return<Error> HwcClient::setPowerMode(Display display, PowerMode mode)
+Return<Error> ComposerClient::setPowerMode(Display display, PowerMode mode)
{
Error err = mHal.setPowerMode(display, mode);
return err;
}
-Return<Error> HwcClient::setVsyncEnabled(Display display, Vsync enabled)
+Return<Error> ComposerClient::setVsyncEnabled(Display display, Vsync enabled)
{
Error err = mHal.setVsyncEnabled(display, enabled);
return err;
}
-Return<Error> HwcClient::setInputCommandQueue(
+Return<Error> ComposerClient::setInputCommandQueue(
const MQDescriptorSync<uint32_t>& descriptor)
{
std::lock_guard<std::mutex> lock(mCommandMutex);
- return mReader.setMQDescriptor(descriptor) ?
+ return mReader->setMQDescriptor(descriptor) ?
Error::NONE : Error::NO_RESOURCES;
}
-Return<void> HwcClient::getOutputCommandQueue(
+Return<void> ComposerClient::getOutputCommandQueue(
getOutputCommandQueue_cb hidl_cb)
{
// no locking as we require this function to be called inside
@@ -520,7 +527,7 @@
return Void();
}
-Return<void> HwcClient::executeCommands(uint32_t inLength,
+Return<void> ComposerClient::executeCommands(uint32_t inLength,
const hidl_vec<hidl_handle>& inHandles,
executeCommands_cb hidl_cb)
{
@@ -530,12 +537,12 @@
uint32_t outLength = 0;
hidl_vec<hidl_handle> outHandles;
- if (!mReader.readQueue(inLength, inHandles)) {
+ if (!mReader->readQueue(inLength, inHandles)) {
hidl_cb(Error::BAD_PARAMETER, outChanged, outLength, outHandles);
return Void();
}
- Error err = mReader.parse();
+ Error err = mReader->parse();
if (err == Error::NONE &&
!mWriter.writeQueue(&outChanged, &outLength, &outHandles)) {
err = Error::NO_RESOURCES;
@@ -543,18 +550,29 @@
hidl_cb(err, outChanged, outLength, outHandles);
- mReader.reset();
+ mReader->reset();
mWriter.reset();
return Void();
}
-HwcClient::CommandReader::CommandReader(HwcClient& client)
+std::unique_ptr<ComposerClient::CommandReader>
+ComposerClient::createCommandReader()
+{
+ return std::unique_ptr<ComposerClient::CommandReader>(
+ new CommandReader(*this));
+}
+
+ComposerClient::CommandReader::CommandReader(ComposerClient& client)
: mClient(client), mHal(client.mHal), mWriter(client.mWriter)
{
}
-Error HwcClient::CommandReader::parse()
+ComposerClient::CommandReader::~CommandReader()
+{
+}
+
+Error ComposerClient::CommandReader::parse()
{
IComposerClient::Command command;
uint16_t length = 0;
@@ -564,79 +582,7 @@
break;
}
- bool parsed = false;
- switch (command) {
- case IComposerClient::Command::SELECT_DISPLAY:
- parsed = parseSelectDisplay(length);
- break;
- case IComposerClient::Command::SELECT_LAYER:
- parsed = parseSelectLayer(length);
- break;
- case IComposerClient::Command::SET_COLOR_TRANSFORM:
- parsed = parseSetColorTransform(length);
- break;
- case IComposerClient::Command::SET_CLIENT_TARGET:
- parsed = parseSetClientTarget(length);
- break;
- case IComposerClient::Command::SET_OUTPUT_BUFFER:
- parsed = parseSetOutputBuffer(length);
- break;
- case IComposerClient::Command::VALIDATE_DISPLAY:
- parsed = parseValidateDisplay(length);
- break;
- case IComposerClient::Command::ACCEPT_DISPLAY_CHANGES:
- parsed = parseAcceptDisplayChanges(length);
- break;
- case IComposerClient::Command::PRESENT_DISPLAY:
- parsed = parsePresentDisplay(length);
- break;
- case IComposerClient::Command::SET_LAYER_CURSOR_POSITION:
- parsed = parseSetLayerCursorPosition(length);
- break;
- case IComposerClient::Command::SET_LAYER_BUFFER:
- parsed = parseSetLayerBuffer(length);
- break;
- case IComposerClient::Command::SET_LAYER_SURFACE_DAMAGE:
- parsed = parseSetLayerSurfaceDamage(length);
- break;
- case IComposerClient::Command::SET_LAYER_BLEND_MODE:
- parsed = parseSetLayerBlendMode(length);
- break;
- case IComposerClient::Command::SET_LAYER_COLOR:
- parsed = parseSetLayerColor(length);
- break;
- case IComposerClient::Command::SET_LAYER_COMPOSITION_TYPE:
- parsed = parseSetLayerCompositionType(length);
- break;
- case IComposerClient::Command::SET_LAYER_DATASPACE:
- parsed = parseSetLayerDataspace(length);
- break;
- case IComposerClient::Command::SET_LAYER_DISPLAY_FRAME:
- parsed = parseSetLayerDisplayFrame(length);
- break;
- case IComposerClient::Command::SET_LAYER_PLANE_ALPHA:
- parsed = parseSetLayerPlaneAlpha(length);
- break;
- case IComposerClient::Command::SET_LAYER_SIDEBAND_STREAM:
- parsed = parseSetLayerSidebandStream(length);
- break;
- case IComposerClient::Command::SET_LAYER_SOURCE_CROP:
- parsed = parseSetLayerSourceCrop(length);
- break;
- case IComposerClient::Command::SET_LAYER_TRANSFORM:
- parsed = parseSetLayerTransform(length);
- break;
- case IComposerClient::Command::SET_LAYER_VISIBLE_REGION:
- parsed = parseSetLayerVisibleRegion(length);
- break;
- case IComposerClient::Command::SET_LAYER_Z_ORDER:
- parsed = parseSetLayerZOrder(length);
- break;
- default:
- parsed = false;
- break;
- }
-
+ bool parsed = parseCommand(command, length);
endCommand();
if (!parsed) {
@@ -649,7 +595,59 @@
return (isEmpty()) ? Error::NONE : Error::BAD_PARAMETER;
}
-bool HwcClient::CommandReader::parseSelectDisplay(uint16_t length)
+bool ComposerClient::CommandReader::parseCommand(
+ IComposerClient::Command command, uint16_t length) {
+ switch (command) {
+ case IComposerClient::Command::SELECT_DISPLAY:
+ return parseSelectDisplay(length);
+ case IComposerClient::Command::SELECT_LAYER:
+ return parseSelectLayer(length);
+ case IComposerClient::Command::SET_COLOR_TRANSFORM:
+ return parseSetColorTransform(length);
+ case IComposerClient::Command::SET_CLIENT_TARGET:
+ return parseSetClientTarget(length);
+ case IComposerClient::Command::SET_OUTPUT_BUFFER:
+ return parseSetOutputBuffer(length);
+ case IComposerClient::Command::VALIDATE_DISPLAY:
+ return parseValidateDisplay(length);
+ case IComposerClient::Command::ACCEPT_DISPLAY_CHANGES:
+ return parseAcceptDisplayChanges(length);
+ case IComposerClient::Command::PRESENT_DISPLAY:
+ return parsePresentDisplay(length);
+ case IComposerClient::Command::SET_LAYER_CURSOR_POSITION:
+ return parseSetLayerCursorPosition(length);
+ case IComposerClient::Command::SET_LAYER_BUFFER:
+ return parseSetLayerBuffer(length);
+ case IComposerClient::Command::SET_LAYER_SURFACE_DAMAGE:
+ return parseSetLayerSurfaceDamage(length);
+ case IComposerClient::Command::SET_LAYER_BLEND_MODE:
+ return parseSetLayerBlendMode(length);
+ case IComposerClient::Command::SET_LAYER_COLOR:
+ return parseSetLayerColor(length);
+ case IComposerClient::Command::SET_LAYER_COMPOSITION_TYPE:
+ return parseSetLayerCompositionType(length);
+ case IComposerClient::Command::SET_LAYER_DATASPACE:
+ return parseSetLayerDataspace(length);
+ case IComposerClient::Command::SET_LAYER_DISPLAY_FRAME:
+ return parseSetLayerDisplayFrame(length);
+ case IComposerClient::Command::SET_LAYER_PLANE_ALPHA:
+ return parseSetLayerPlaneAlpha(length);
+ case IComposerClient::Command::SET_LAYER_SIDEBAND_STREAM:
+ return parseSetLayerSidebandStream(length);
+ case IComposerClient::Command::SET_LAYER_SOURCE_CROP:
+ return parseSetLayerSourceCrop(length);
+ case IComposerClient::Command::SET_LAYER_TRANSFORM:
+ return parseSetLayerTransform(length);
+ case IComposerClient::Command::SET_LAYER_VISIBLE_REGION:
+ return parseSetLayerVisibleRegion(length);
+ case IComposerClient::Command::SET_LAYER_Z_ORDER:
+ return parseSetLayerZOrder(length);
+ default:
+ return false;
+ }
+}
+
+bool ComposerClient::CommandReader::parseSelectDisplay(uint16_t length)
{
if (length != CommandWriterBase::kSelectDisplayLength) {
return false;
@@ -661,7 +659,7 @@
return true;
}
-bool HwcClient::CommandReader::parseSelectLayer(uint16_t length)
+bool ComposerClient::CommandReader::parseSelectLayer(uint16_t length)
{
if (length != CommandWriterBase::kSelectLayerLength) {
return false;
@@ -672,7 +670,7 @@
return true;
}
-bool HwcClient::CommandReader::parseSetColorTransform(uint16_t length)
+bool ComposerClient::CommandReader::parseSetColorTransform(uint16_t length)
{
if (length != CommandWriterBase::kSetColorTransformLength) {
return false;
@@ -692,7 +690,7 @@
return true;
}
-bool HwcClient::CommandReader::parseSetClientTarget(uint16_t length)
+bool ComposerClient::CommandReader::parseSetClientTarget(uint16_t length)
{
// 4 parameters followed by N rectangles
if ((length - 4) % 4 != 0) {
@@ -720,7 +718,7 @@
return true;
}
-bool HwcClient::CommandReader::parseSetOutputBuffer(uint16_t length)
+bool ComposerClient::CommandReader::parseSetOutputBuffer(uint16_t length)
{
if (length != CommandWriterBase::kSetOutputBufferLength) {
return false;
@@ -744,7 +742,7 @@
return true;
}
-bool HwcClient::CommandReader::parseValidateDisplay(uint16_t length)
+bool ComposerClient::CommandReader::parseValidateDisplay(uint16_t length)
{
if (length != CommandWriterBase::kValidateDisplayLength) {
return false;
@@ -771,7 +769,7 @@
return true;
}
-bool HwcClient::CommandReader::parseAcceptDisplayChanges(uint16_t length)
+bool ComposerClient::CommandReader::parseAcceptDisplayChanges(uint16_t length)
{
if (length != CommandWriterBase::kAcceptDisplayChangesLength) {
return false;
@@ -785,7 +783,7 @@
return true;
}
-bool HwcClient::CommandReader::parsePresentDisplay(uint16_t length)
+bool ComposerClient::CommandReader::parsePresentDisplay(uint16_t length)
{
if (length != CommandWriterBase::kPresentDisplayLength) {
return false;
@@ -805,7 +803,7 @@
return true;
}
-bool HwcClient::CommandReader::parseSetLayerCursorPosition(uint16_t length)
+bool ComposerClient::CommandReader::parseSetLayerCursorPosition(uint16_t length)
{
if (length != CommandWriterBase::kSetLayerCursorPositionLength) {
return false;
@@ -820,7 +818,7 @@
return true;
}
-bool HwcClient::CommandReader::parseSetLayerBuffer(uint16_t length)
+bool ComposerClient::CommandReader::parseSetLayerBuffer(uint16_t length)
{
if (length != CommandWriterBase::kSetLayerBufferLength) {
return false;
@@ -844,7 +842,7 @@
return true;
}
-bool HwcClient::CommandReader::parseSetLayerSurfaceDamage(uint16_t length)
+bool ComposerClient::CommandReader::parseSetLayerSurfaceDamage(uint16_t length)
{
// N rectangles
if (length % 4 != 0) {
@@ -860,7 +858,7 @@
return true;
}
-bool HwcClient::CommandReader::parseSetLayerBlendMode(uint16_t length)
+bool ComposerClient::CommandReader::parseSetLayerBlendMode(uint16_t length)
{
if (length != CommandWriterBase::kSetLayerBlendModeLength) {
return false;
@@ -874,7 +872,7 @@
return true;
}
-bool HwcClient::CommandReader::parseSetLayerColor(uint16_t length)
+bool ComposerClient::CommandReader::parseSetLayerColor(uint16_t length)
{
if (length != CommandWriterBase::kSetLayerColorLength) {
return false;
@@ -888,7 +886,8 @@
return true;
}
-bool HwcClient::CommandReader::parseSetLayerCompositionType(uint16_t length)
+bool ComposerClient::CommandReader::parseSetLayerCompositionType(
+ uint16_t length)
{
if (length != CommandWriterBase::kSetLayerCompositionTypeLength) {
return false;
@@ -902,7 +901,7 @@
return true;
}
-bool HwcClient::CommandReader::parseSetLayerDataspace(uint16_t length)
+bool ComposerClient::CommandReader::parseSetLayerDataspace(uint16_t length)
{
if (length != CommandWriterBase::kSetLayerDataspaceLength) {
return false;
@@ -916,7 +915,7 @@
return true;
}
-bool HwcClient::CommandReader::parseSetLayerDisplayFrame(uint16_t length)
+bool ComposerClient::CommandReader::parseSetLayerDisplayFrame(uint16_t length)
{
if (length != CommandWriterBase::kSetLayerDisplayFrameLength) {
return false;
@@ -930,7 +929,7 @@
return true;
}
-bool HwcClient::CommandReader::parseSetLayerPlaneAlpha(uint16_t length)
+bool ComposerClient::CommandReader::parseSetLayerPlaneAlpha(uint16_t length)
{
if (length != CommandWriterBase::kSetLayerPlaneAlphaLength) {
return false;
@@ -944,7 +943,7 @@
return true;
}
-bool HwcClient::CommandReader::parseSetLayerSidebandStream(uint16_t length)
+bool ComposerClient::CommandReader::parseSetLayerSidebandStream(uint16_t length)
{
if (length != CommandWriterBase::kSetLayerSidebandStreamLength) {
return false;
@@ -963,7 +962,7 @@
return true;
}
-bool HwcClient::CommandReader::parseSetLayerSourceCrop(uint16_t length)
+bool ComposerClient::CommandReader::parseSetLayerSourceCrop(uint16_t length)
{
if (length != CommandWriterBase::kSetLayerSourceCropLength) {
return false;
@@ -977,7 +976,7 @@
return true;
}
-bool HwcClient::CommandReader::parseSetLayerTransform(uint16_t length)
+bool ComposerClient::CommandReader::parseSetLayerTransform(uint16_t length)
{
if (length != CommandWriterBase::kSetLayerTransformLength) {
return false;
@@ -991,7 +990,7 @@
return true;
}
-bool HwcClient::CommandReader::parseSetLayerVisibleRegion(uint16_t length)
+bool ComposerClient::CommandReader::parseSetLayerVisibleRegion(uint16_t length)
{
// N rectangles
if (length % 4 != 0) {
@@ -1007,7 +1006,7 @@
return true;
}
-bool HwcClient::CommandReader::parseSetLayerZOrder(uint16_t length)
+bool ComposerClient::CommandReader::parseSetLayerZOrder(uint16_t length)
{
if (length != CommandWriterBase::kSetLayerZOrderLength) {
return false;
@@ -1021,7 +1020,7 @@
return true;
}
-hwc_rect_t HwcClient::CommandReader::readRect()
+hwc_rect_t ComposerClient::CommandReader::readRect()
{
return hwc_rect_t{
readSigned(),
@@ -1031,7 +1030,7 @@
};
}
-std::vector<hwc_rect_t> HwcClient::CommandReader::readRegion(size_t count)
+std::vector<hwc_rect_t> ComposerClient::CommandReader::readRegion(size_t count)
{
std::vector<hwc_rect_t> region;
region.reserve(count);
@@ -1043,7 +1042,7 @@
return region;
}
-hwc_frect_t HwcClient::CommandReader::readFRect()
+hwc_frect_t ComposerClient::CommandReader::readFRect()
{
return hwc_frect_t{
readFloat(),
@@ -1053,8 +1052,8 @@
};
}
-Error HwcClient::CommandReader::lookupBuffer(BufferCache cache, uint32_t slot,
- bool useCache, buffer_handle_t& handle)
+Error ComposerClient::CommandReader::lookupBuffer(BufferCache cache,
+ uint32_t slot, bool useCache, buffer_handle_t& handle)
{
std::lock_guard<std::mutex> lock(mClient.mDisplayDataMutex);
diff --git a/graphics/composer/2.1/default/HwcClient.h b/graphics/composer/2.1/default/ComposerClient.h
similarity index 89%
rename from graphics/composer/2.1/default/HwcClient.h
rename to graphics/composer/2.1/default/ComposerClient.h
index 35a0450..d351cfb 100644
--- a/graphics/composer/2.1/default/HwcClient.h
+++ b/graphics/composer/2.1/default/ComposerClient.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ANDROID_HARDWARE_GRAPHICS_COMPOSER_V2_1_HWC_CLIENT_H
-#define ANDROID_HARDWARE_GRAPHICS_COMPOSER_V2_1_HWC_CLIENT_H
+#ifndef ANDROID_HARDWARE_GRAPHICS_COMPOSER_V2_1_COMPOSER_CLIENT_H
+#define ANDROID_HARDWARE_GRAPHICS_COMPOSER_V2_1_COMPOSER_CLIENT_H
#include <mutex>
#include <unordered_map>
@@ -50,10 +50,12 @@
buffer_handle_t mHandle;
};
-class HwcClient : public IComposerClient {
+class ComposerClient : public IComposerClient {
public:
- HwcClient(HwcHal& hal);
- virtual ~HwcClient();
+ ComposerClient(ComposerBase& hal);
+ virtual ~ComposerClient();
+
+ void initialize();
void onHotplug(Display display, IComposerCallback::Connection connected);
void onRefresh(Display display);
@@ -104,7 +106,7 @@
const hidl_vec<hidl_handle>& inHandles,
executeCommands_cb hidl_cb) override;
-private:
+protected:
struct LayerBuffers {
std::vector<BufferClone> Buffers;
BufferClone SidebandStream;
@@ -123,10 +125,15 @@
class CommandReader : public CommandReaderBase {
public:
- CommandReader(HwcClient& client);
+ CommandReader(ComposerClient& client);
+ virtual ~CommandReader();
+
Error parse();
- private:
+ protected:
+ virtual bool parseCommand(IComposerClient::Command command,
+ uint16_t length);
+
bool parseSelectDisplay(uint16_t length);
bool parseSelectLayer(uint16_t length);
bool parseSetColorTransform(uint16_t length);
@@ -169,21 +176,23 @@
0, false, handle);
}
- HwcClient& mClient;
- HwcHal& mHal;
+ ComposerClient& mClient;
+ ComposerBase& mHal;
CommandWriterBase& mWriter;
Display mDisplay;
Layer mLayer;
};
- HwcHal& mHal;
+ virtual std::unique_ptr<CommandReader> createCommandReader();
+
+ ComposerBase& mHal;
// 64KiB minus a small space for metadata such as read/write pointers
static constexpr size_t kWriterInitialSize =
64 * 1024 / sizeof(uint32_t) - 16;
std::mutex mCommandMutex;
- CommandReader mReader;
+ std::unique_ptr<CommandReader> mReader;
CommandWriterBase mWriter;
sp<IComposerCallback> mCallback;
@@ -199,4 +208,4 @@
} // namespace hardware
} // namespace android
-#endif // ANDROID_HARDWARE_GRAPHICS_COMPOSER_V2_1_HWC_CLIENT_H
+#endif // ANDROID_HARDWARE_GRAPHICS_COMPOSER_V2_1_COMPOSER_CLIENT_H
diff --git a/graphics/composer/2.1/default/Hwc.cpp b/graphics/composer/2.1/default/Hwc.cpp
index 4efb12b..cf82967 100644
--- a/graphics/composer/2.1/default/Hwc.cpp
+++ b/graphics/composer/2.1/default/Hwc.cpp
@@ -20,8 +20,8 @@
#include <log/log.h>
+#include "ComposerClient.h"
#include "Hwc.h"
-#include "HwcClient.h"
namespace android {
namespace hardware {
@@ -184,14 +184,15 @@
Return<void> HwcHal::createClient(createClient_cb hidl_cb)
{
Error err = Error::NONE;
- sp<HwcClient> client;
+ sp<ComposerClient> client;
{
std::lock_guard<std::mutex> lock(mClientMutex);
// only one client is allowed
if (mClient == nullptr) {
- client = new HwcClient(*this);
+ client = new ComposerClient(*this);
+ client->initialize();
mClient = client;
} else {
err = Error::NO_RESOURCES;
@@ -203,7 +204,7 @@
return Void();
}
-sp<HwcClient> HwcHal::getClient()
+sp<ComposerClient> HwcHal::getClient()
{
std::lock_guard<std::mutex> lock(mClientMutex);
return (mClient != nullptr) ? mClient.promote() : nullptr;
diff --git a/graphics/composer/2.1/default/Hwc.h b/graphics/composer/2.1/default/Hwc.h
index 6420b31..ca08cf0 100644
--- a/graphics/composer/2.1/default/Hwc.h
+++ b/graphics/composer/2.1/default/Hwc.h
@@ -24,6 +24,8 @@
#include <android/hardware/graphics/composer/2.1/IComposer.h>
#include <hardware/hwcomposer2.h>
+#include "ComposerBase.h"
+
namespace android {
namespace hardware {
namespace graphics {
@@ -38,96 +40,101 @@
using android::hardware::graphics::common::V1_0::ColorTransform;
using android::hardware::graphics::common::V1_0::Hdr;
-class HwcClient;
+class ComposerClient;
-class HwcHal : public IComposer {
+class HwcHal : public IComposer, public ComposerBase {
public:
HwcHal(const hw_module_t* module);
virtual ~HwcHal();
+ bool hasCapability(Capability capability) const;
+
// IComposer interface
Return<void> getCapabilities(getCapabilities_cb hidl_cb) override;
Return<void> dumpDebugInfo(dumpDebugInfo_cb hidl_cb) override;
Return<void> createClient(createClient_cb hidl_cb) override;
- bool hasCapability(Capability capability) const;
-
- void removeClient();
-
- void enableCallback(bool enable);
-
- uint32_t getMaxVirtualDisplayCount();
+ // ComposerBase interface
+ void removeClient() override;
+ void enableCallback(bool enable) override;
+ uint32_t getMaxVirtualDisplayCount() override;
Error createVirtualDisplay(uint32_t width, uint32_t height,
- PixelFormat* format, Display* outDisplay);
- Error destroyVirtualDisplay(Display display);
+ PixelFormat* format, Display* outDisplay) override;
+ Error destroyVirtualDisplay(Display display) override;
- Error createLayer(Display display, Layer* outLayer);
- Error destroyLayer(Display display, Layer layer);
+ Error createLayer(Display display, Layer* outLayer) override;
+ Error destroyLayer(Display display, Layer layer) override;
- Error getActiveConfig(Display display, Config* outConfig);
+ Error getActiveConfig(Display display, Config* outConfig) override;
Error getClientTargetSupport(Display display,
uint32_t width, uint32_t height,
- PixelFormat format, Dataspace dataspace);
- Error getColorModes(Display display, hidl_vec<ColorMode>* outModes);
+ PixelFormat format, Dataspace dataspace) override;
+ Error getColorModes(Display display,
+ hidl_vec<ColorMode>* outModes) override;
Error getDisplayAttribute(Display display, Config config,
- IComposerClient::Attribute attribute, int32_t* outValue);
- Error getDisplayConfigs(Display display, hidl_vec<Config>* outConfigs);
- Error getDisplayName(Display display, hidl_string* outName);
+ IComposerClient::Attribute attribute, int32_t* outValue) override;
+ Error getDisplayConfigs(Display display,
+ hidl_vec<Config>* outConfigs) override;
+ Error getDisplayName(Display display, hidl_string* outName) override;
Error getDisplayType(Display display,
- IComposerClient::DisplayType* outType);
- Error getDozeSupport(Display display, bool* outSupport);
+ IComposerClient::DisplayType* outType) override;
+ Error getDozeSupport(Display display, bool* outSupport) override;
Error getHdrCapabilities(Display display, hidl_vec<Hdr>* outTypes,
float* outMaxLuminance, float* outMaxAverageLuminance,
- float* outMinLuminance);
+ float* outMinLuminance) override;
- Error setActiveConfig(Display display, Config config);
- Error setColorMode(Display display, ColorMode mode);
- Error setPowerMode(Display display, IComposerClient::PowerMode mode);
- Error setVsyncEnabled(Display display, IComposerClient::Vsync enabled);
+ Error setActiveConfig(Display display, Config config) override;
+ Error setColorMode(Display display, ColorMode mode) override;
+ Error setPowerMode(Display display,
+ IComposerClient::PowerMode mode) override;
+ Error setVsyncEnabled(Display display,
+ IComposerClient::Vsync enabled) override;
Error setColorTransform(Display display, const float* matrix,
- int32_t hint);
+ int32_t hint) override;
Error setClientTarget(Display display, buffer_handle_t target,
int32_t acquireFence, int32_t dataspace,
- const std::vector<hwc_rect_t>& damage);
+ const std::vector<hwc_rect_t>& damage) override;
Error setOutputBuffer(Display display, buffer_handle_t buffer,
- int32_t releaseFence);
+ int32_t releaseFence) override;
Error validateDisplay(Display display,
std::vector<Layer>* outChangedLayers,
std::vector<IComposerClient::Composition>* outCompositionTypes,
uint32_t* outDisplayRequestMask,
std::vector<Layer>* outRequestedLayers,
- std::vector<uint32_t>* outRequestMasks);
- Error acceptDisplayChanges(Display display);
+ std::vector<uint32_t>* outRequestMasks) override;
+ Error acceptDisplayChanges(Display display) override;
Error presentDisplay(Display display, int32_t* outPresentFence,
std::vector<Layer>* outLayers,
- std::vector<int32_t>* outReleaseFences);
+ std::vector<int32_t>* outReleaseFences) override;
Error setLayerCursorPosition(Display display, Layer layer,
- int32_t x, int32_t y);
+ int32_t x, int32_t y) override;
Error setLayerBuffer(Display display, Layer layer,
- buffer_handle_t buffer, int32_t acquireFence);
+ buffer_handle_t buffer, int32_t acquireFence) override;
Error setLayerSurfaceDamage(Display display, Layer layer,
- const std::vector<hwc_rect_t>& damage);
- Error setLayerBlendMode(Display display, Layer layer, int32_t mode);
+ const std::vector<hwc_rect_t>& damage) override;
+ Error setLayerBlendMode(Display display, Layer layer,
+ int32_t mode) override;
Error setLayerColor(Display display, Layer layer,
- IComposerClient::Color color);
+ IComposerClient::Color color) override;
Error setLayerCompositionType(Display display, Layer layer,
- int32_t type);
+ int32_t type) override;
Error setLayerDataspace(Display display, Layer layer,
- int32_t dataspace);
+ int32_t dataspace) override;
Error setLayerDisplayFrame(Display display, Layer layer,
- const hwc_rect_t& frame);
- Error setLayerPlaneAlpha(Display display, Layer layer, float alpha);
+ const hwc_rect_t& frame) override;
+ Error setLayerPlaneAlpha(Display display, Layer layer,
+ float alpha) override;
Error setLayerSidebandStream(Display display, Layer layer,
- buffer_handle_t stream);
+ buffer_handle_t stream) override;
Error setLayerSourceCrop(Display display, Layer layer,
- const hwc_frect_t& crop);
+ const hwc_frect_t& crop) override;
Error setLayerTransform(Display display, Layer layer,
- int32_t transform);
+ int32_t transform) override;
Error setLayerVisibleRegion(Display display, Layer layer,
- const std::vector<hwc_rect_t>& visible);
- Error setLayerZOrder(Display display, Layer layer, uint32_t z);
+ const std::vector<hwc_rect_t>& visible) override;
+ Error setLayerZOrder(Display display, Layer layer, uint32_t z) override;
private:
void initCapabilities();
@@ -136,7 +143,7 @@
void initDispatch(hwc2_function_descriptor_t desc, T* outPfn);
void initDispatch();
- sp<HwcClient> getClient();
+ sp<ComposerClient> getClient();
static void hotplugHook(hwc2_callback_data_t callbackData,
hwc2_display_t display, int32_t connected);
@@ -196,7 +203,7 @@
} mDispatch;
std::mutex mClientMutex;
- wp<HwcClient> mClient;
+ wp<ComposerClient> mClient;
};
extern "C" IComposer* HIDL_FETCH_IComposer(const char* name);
diff --git a/memtrack/1.0/vts/Android.mk b/memtrack/1.0/vts/Android.mk
index 397f946..fbb5951 100644
--- a/memtrack/1.0/vts/Android.mk
+++ b/memtrack/1.0/vts/Android.mk
@@ -16,6 +16,4 @@
LOCAL_PATH := $(call my-dir)
-include $(call all-subdir-makefiles)
-
-include $(LOCAL_PATH)/functional/vts/testcases/hal/memtrack/hidl/target/Android.mk
+include $(LOCAL_PATH)/functional/vts/testcases/hal/memtrack/hidl/Android.mk
diff --git a/memtrack/1.0/vts/functional/vts/testcases/hal/memtrack/hidl/Android.mk b/memtrack/1.0/vts/functional/vts/testcases/hal/memtrack/hidl/Android.mk
new file mode 100644
index 0000000..f9e3276
--- /dev/null
+++ b/memtrack/1.0/vts/functional/vts/testcases/hal/memtrack/hidl/Android.mk
@@ -0,0 +1,19 @@
+#
+# Copyright (C) 2016 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.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(call all-subdir-makefiles)
diff --git a/nfc/1.0/vts/functional/vts/testcases/hal/nfc/hidl/target_profiling/AndroidTest.xml b/nfc/1.0/vts/functional/vts/testcases/hal/nfc/hidl/target_profiling/AndroidTest.xml
index 42c7e22..3b570f9 100644
--- a/nfc/1.0/vts/functional/vts/testcases/hal/nfc/hidl/target_profiling/AndroidTest.xml
+++ b/nfc/1.0/vts/functional/vts/testcases/hal/nfc/hidl/target_profiling/AndroidTest.xml
@@ -25,7 +25,7 @@
_64bit::DATA/nativetest64/nfc_hidl_hal_test/nfc_hidl_hal_test,
"/>
<option name="binary-test-type" value="gtest" />
- <option name="test-timeout" value="20m" />
+ <option name="test-timeout" value="25m" />
<option name="enable-profiling" value="true" />
</test>
</configuration>
diff --git a/vehicle/2.0/default/tests/VehicleHalManager_test.cpp b/vehicle/2.0/default/tests/VehicleHalManager_test.cpp
index 4a20ea5..dc32252 100644
--- a/vehicle/2.0/default/tests/VehicleHalManager_test.cpp
+++ b/vehicle/2.0/default/tests/VehicleHalManager_test.cpp
@@ -67,7 +67,7 @@
pValue = getValuePool()->obtainFloat(42.42);
}
break;
- case VehicleProperty::VEHICLE_MAPS_DATA_SERVICE:
+ case VehicleProperty::VEHICLE_MAP_SERVICE:
pValue = getValuePool()->obtainComplex();
pValue->value.int32Values = hidl_vec<int32_t> { 10, 20 };
pValue->value.int64Values = hidl_vec<int64_t> { 30, 40 };
@@ -317,10 +317,10 @@
}
TEST_F(VehicleHalManagerTest, get_Complex) {
- invokeGet(VehicleProperty::VEHICLE_MAPS_DATA_SERVICE, 0);
+ invokeGet(VehicleProperty::VEHICLE_MAP_SERVICE, 0);
ASSERT_EQ(StatusCode::OK, actualStatusCode);
- ASSERT_EQ(VehicleProperty::VEHICLE_MAPS_DATA_SERVICE, actualValue.prop);
+ ASSERT_EQ(VehicleProperty::VEHICLE_MAP_SERVICE, actualValue.prop);
ASSERT_EQ(3, actualValue.value.bytes.size());
ASSERT_EQ(1, actualValue.value.bytes[0]);
diff --git a/vehicle/2.0/default/tests/VehicleHalTestUtils.h b/vehicle/2.0/default/tests/VehicleHalTestUtils.h
index b6a5c31..538c022 100644
--- a/vehicle/2.0/default/tests/VehicleHalTestUtils.h
+++ b/vehicle/2.0/default/tests/VehicleHalTestUtils.h
@@ -107,7 +107,7 @@
// Complex data type.
{
- .prop = VehicleProperty::VEHICLE_MAPS_DATA_SERVICE,
+ .prop = VehicleProperty::VEHICLE_MAP_SERVICE,
.access = VehiclePropertyAccess::READ_WRITE,
.changeMode = VehiclePropertyChangeMode::ON_CHANGE
}
diff --git a/vehicle/2.0/types.hal b/vehicle/2.0/types.hal
index a9b706d..fb59a5a 100644
--- a/vehicle/2.0/types.hal
+++ b/vehicle/2.0/types.hal
@@ -964,6 +964,7 @@
*
* @change_mode VehiclePropertyChangeMode:ON_CHANGE
* @access VehiclePropertyAccess:READ_WRITE
+ */
AUDIO_PARAMETERS = (
0x907
| VehiclePropertyGroup:SYSTEM
@@ -1718,7 +1719,7 @@
* @change_mode VehiclePropertyChangeMode:ON_CHANGE
* @access VehiclePropertyAccess:READ_WRITE
*/
- VEHICLE_MAPS_DATA_SERVICE = (
+ VEHICLE_MAP_SERVICE = (
0x0C00
| VehiclePropertyGroup:SYSTEM
| VehiclePropertyType:COMPLEX
diff --git a/vehicle/2.0/vts/types.vts b/vehicle/2.0/vts/types.vts
index fa7d892..067a7d6 100644
--- a/vehicle/2.0/vts/types.vts
+++ b/vehicle/2.0/vts/types.vts
@@ -494,7 +494,7 @@
scalar_value: {
int32_t: 287312836
}
- enumerator: "VEHICLE_MAPS_DATA_SERVICE"
+ enumerator: "VEHICLE_MAP_SERVICE"
scalar_value: {
int32_t: 299895808
}