Merge "vibrator: Async Callback API VTS Tests"
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index 76d1697..c920674 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -204,7 +204,7 @@
</hal>
<hal format="hidl" optional="false">
<name>android.hardware.graphics.composer</name>
- <version>2.1-3</version>
+ <version>2.1-4</version>
<interface>
<name>IComposer</name>
<instance>default</instance>
diff --git a/graphics/composer/2.4/IComposer.hal b/graphics/composer/2.4/IComposer.hal
index 34801da..d3b3cb6 100644
--- a/graphics/composer/2.4/IComposer.hal
+++ b/graphics/composer/2.4/IComposer.hal
@@ -17,12 +17,10 @@
package android.hardware.graphics.composer@2.4;
import IComposerClient;
-
import @2.1::Error;
import @2.3::IComposer;
interface IComposer extends @2.3::IComposer {
-
/**
* Creates a v2.4 client of the composer. Supersedes @2.3::createClient.
*
diff --git a/graphics/composer/2.4/IComposerClient.hal b/graphics/composer/2.4/IComposerClient.hal
index 8fe0976..60445f5 100644
--- a/graphics/composer/2.4/IComposerClient.hal
+++ b/graphics/composer/2.4/IComposerClient.hal
@@ -21,13 +21,12 @@
import @2.3::IComposerClient;
interface IComposerClient extends @2.3::IComposerClient {
-
/**
* Required capabilities which are supported by the display. The
* particular set of supported capabilities for a given display may be
* retrieved using getDisplayCapabilities.
*/
- enum DisplayCapability : uint32_t {
+ enum DisplayCapability : @2.3::IComposerClient.DisplayCapability {
/**
* Indicates that the display supports protected contents.
* When returned, hardware composer must be able to accept client target
@@ -37,6 +36,20 @@
};
/**
+ * Supersedes {@link @2.1::IComposerClient.DisplayType}.
+ */
+ enum DisplayConnectionType : uint32_t {
+ /**
+ * Display is connected through internal port, e.g. DSI, eDP.
+ */
+ INTERNAL = 0,
+ /**
+ * Display is connected through external port, e.g. HDMI, DisplayPort.
+ */
+ EXTERNAL = 1,
+ };
+
+ /**
* Provides a list of supported capabilities (as described in the
* definition of DisplayCapability above). This list must not change after
* initialization.
@@ -46,6 +59,14 @@
* @return capabilities is a list of supported capabilities.
*/
getDisplayCapabilities_2_4(Display display)
- generates (Error error,
- vec<DisplayCapability> capabilities);
+ generates (Error error, vec<DisplayCapability> capabilities);
+
+ /**
+ * Returns whether the given physical display is internal or external.
+ *
+ * @return error is NONE upon success. Otherwise,
+ * BAD_DISPLAY when the given display is invalid or virtual.
+ * @return type is the connection type of the display.
+ */
+ getDisplayConnectionType(Display display) generates (Error error, DisplayConnectionType type);
};
diff --git a/graphics/composer/2.4/utils/hal/include/composer-hal/2.4/ComposerClient.h b/graphics/composer/2.4/utils/hal/include/composer-hal/2.4/ComposerClient.h
index 7110c80..c810186 100644
--- a/graphics/composer/2.4/utils/hal/include/composer-hal/2.4/ComposerClient.h
+++ b/graphics/composer/2.4/utils/hal/include/composer-hal/2.4/ComposerClient.h
@@ -46,6 +46,14 @@
return Void();
}
+ Return<void> getDisplayConnectionType(
+ Display display, IComposerClient::getDisplayConnectionType_cb hidl_cb) override {
+ IComposerClient::DisplayConnectionType type;
+ Error error = mHal->getDisplayConnectionType(display, &type);
+ hidl_cb(error, type);
+ return Void();
+ }
+
static std::unique_ptr<ComposerClientImpl> create(Hal* hal) {
auto client = std::make_unique<ComposerClientImpl>(hal);
return client->init() ? std::move(client) : nullptr;
diff --git a/graphics/composer/2.4/utils/hal/include/composer-hal/2.4/ComposerHal.h b/graphics/composer/2.4/utils/hal/include/composer-hal/2.4/ComposerHal.h
index 0074808..c3bb535 100644
--- a/graphics/composer/2.4/utils/hal/include/composer-hal/2.4/ComposerHal.h
+++ b/graphics/composer/2.4/utils/hal/include/composer-hal/2.4/ComposerHal.h
@@ -38,6 +38,8 @@
public:
virtual Error getDisplayCapabilities_2_4(
Display display, std::vector<IComposerClient::DisplayCapability>* outCapabilities) = 0;
+ virtual Error getDisplayConnectionType(Display display,
+ IComposerClient::DisplayConnectionType* outType) = 0;
};
} // namespace hal
diff --git a/graphics/composer/2.4/utils/passthrough/include/composer-passthrough/2.4/HwcHal.h b/graphics/composer/2.4/utils/passthrough/include/composer-passthrough/2.4/HwcHal.h
index 65d47d7..fd05f66 100644
--- a/graphics/composer/2.4/utils/passthrough/include/composer-passthrough/2.4/HwcHal.h
+++ b/graphics/composer/2.4/utils/passthrough/include/composer-passthrough/2.4/HwcHal.h
@@ -62,15 +62,34 @@
return Error::NONE;
}
+ Error getDisplayConnectionType(Display display,
+ IComposerClient::DisplayConnectionType* outType) override {
+ if (!mDispatch.getDisplayConnectionType) {
+ return Error::UNSUPPORTED;
+ }
+
+ uint32_t type = HWC2_DISPLAY_CONNECTION_TYPE_INTERNAL;
+ int32_t error = mDispatch.getDisplayConnectionType(mDevice, display, &type);
+ *outType = static_cast<IComposerClient::DisplayConnectionType>(type);
+ return static_cast<Error>(error);
+ }
+
protected:
bool initDispatch() override {
if (!BaseType2_3::initDispatch()) {
return false;
}
+
+ this->initOptionalDispatch(HWC2_FUNCTION_GET_DISPLAY_CONNECTION_TYPE,
+ &mDispatch.getDisplayConnectionType);
return true;
}
private:
+ struct {
+ HWC2_PFN_GET_DISPLAY_CONNECTION_TYPE getDisplayConnectionType;
+ } mDispatch = {};
+
using BaseType2_1 = V2_1::passthrough::detail::HwcHalImpl<Hal>;
using BaseType2_3 = V2_3::passthrough::detail::HwcHalImpl<Hal>;
using BaseType2_1::mDevice;
diff --git a/graphics/composer/2.4/utils/vts/ComposerVts.cpp b/graphics/composer/2.4/utils/vts/ComposerVts.cpp
index ee4f3a3..937b50e 100644
--- a/graphics/composer/2.4/utils/vts/ComposerVts.cpp
+++ b/graphics/composer/2.4/utils/vts/ComposerVts.cpp
@@ -51,7 +51,6 @@
Error ComposerClient::getDisplayCapabilities(
Display display, std::vector<IComposerClient::DisplayCapability>* outCapabilities) {
- std::vector<IComposerClient::DisplayCapability> capabilities;
Error error = Error::NONE;
mClient->getDisplayCapabilities_2_4(display,
[&](const auto& tmpError, const auto& tmpCapabilities) {
@@ -61,6 +60,16 @@
return error;
}
+Error ComposerClient::getDisplayConnectionType(Display display,
+ IComposerClient::DisplayConnectionType* outType) {
+ Error error = Error::NONE;
+ mClient->getDisplayConnectionType(display, [&](const auto& tmpError, const auto& tmpType) {
+ error = tmpError;
+ *outType = tmpType;
+ });
+ return error;
+}
+
} // namespace vts
} // namespace V2_4
} // namespace composer
diff --git a/graphics/composer/2.4/utils/vts/include/composer-vts/2.4/ComposerVts.h b/graphics/composer/2.4/utils/vts/include/composer-vts/2.4/ComposerVts.h
index 0a301c6..a7d7f86 100644
--- a/graphics/composer/2.4/utils/vts/include/composer-vts/2.4/ComposerVts.h
+++ b/graphics/composer/2.4/utils/vts/include/composer-vts/2.4/ComposerVts.h
@@ -71,6 +71,9 @@
Display display,
std::vector<IComposerClient::DisplayCapability>* outDisplayCapabilities);
+ Error getDisplayConnectionType(Display display,
+ IComposerClient::DisplayConnectionType* outType);
+
private:
const sp<IComposerClient> mClient;
};
diff --git a/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp b/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp
index 0fccc58..76c0039 100644
--- a/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp
+++ b/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp
@@ -179,6 +179,16 @@
EXPECT_EQ(Error::BAD_DISPLAY, error);
}
+TEST_F(GraphicsComposerHidlTest, getDisplayConnectionType) {
+ IComposerClient::DisplayConnectionType type;
+ EXPECT_EQ(Error::BAD_DISPLAY,
+ mComposerClient->getDisplayConnectionType(mInvalidDisplayId, &type));
+
+ for (Display display : mComposerCallback->getDisplays()) {
+ EXPECT_EQ(Error::NONE, mComposerClient->getDisplayConnectionType(display, &type));
+ }
+}
+
} // namespace
} // namespace vts
} // namespace V2_4
diff --git a/graphics/mapper/2.1/utils/passthrough/include/mapper-passthrough/2.1/Gralloc0Hal.h b/graphics/mapper/2.1/utils/passthrough/include/mapper-passthrough/2.1/Gralloc0Hal.h
index 18fbb6d..8540068 100644
--- a/graphics/mapper/2.1/utils/passthrough/include/mapper-passthrough/2.1/Gralloc0Hal.h
+++ b/graphics/mapper/2.1/utils/passthrough/include/mapper-passthrough/2.1/Gralloc0Hal.h
@@ -37,6 +37,10 @@
Error validateBufferSize(const native_handle_t* bufferHandle,
const IMapper::BufferDescriptorInfo& descriptorInfo,
uint32_t stride) override {
+ if (descriptorInfo.layerCount != 1) {
+ return Error::BAD_VALUE;
+ }
+
if (!mModule->validateBufferSize) {
return Error::NONE;
}