Merge changes from topic "policy-xml-vts"
* changes:
Audio VTS: Reset HAL after setConnectionState
Audio HAL: do not test input stream if no Built-in mic on primary
diff --git a/Android.bp b/Android.bp
index 05ca928..1c6e1b2 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,5 +1,6 @@
hidl_package_root {
name: "android.hardware",
+ use_current: true,
}
cc_defaults {
diff --git a/camera/metadata/3.4/types.hal b/camera/metadata/3.4/types.hal
index 4eb6929..61a399e 100644
--- a/camera/metadata/3.4/types.hal
+++ b/camera/metadata/3.4/types.hal
@@ -113,6 +113,15 @@
= 0x18,
};
+/** android.sensor.info.colorFilterArrangement enumeration values added since v3.2
+ * @see ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT
+ */
+enum CameraMetadataEnumAndroidSensorInfoColorFilterArrangement :
+ @3.2::CameraMetadataEnumAndroidSensorInfoColorFilterArrangement {
+ ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO,
+ ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR,
+};
+
/** android.info.supportedBufferManagementVersion enumeration values
* @see ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION
*/
diff --git a/camera/provider/2.4/vts/functional/Android.bp b/camera/provider/2.4/vts/functional/Android.bp
index 2db1584..f8f058e 100644
--- a/camera/provider/2.4/vts/functional/Android.bp
+++ b/camera/provider/2.4/vts/functional/Android.bp
@@ -38,6 +38,7 @@
"android.hardware.camera.device@3.3",
"android.hardware.camera.device@3.4",
"android.hardware.camera.device@3.5",
+ "android.hardware.camera.metadata@3.4",
"android.hardware.camera.provider@2.4",
"android.hardware.graphics.allocator@2.0",
"android.hardware.graphics.common@1.0",
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index c324d59..bb03d91 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -31,8 +31,11 @@
#include <android/hardware/camera/device/3.5/ICameraDevice.h>
#include <android/hardware/camera/device/3.3/ICameraDeviceSession.h>
#include <android/hardware/camera/device/3.4/ICameraDeviceSession.h>
+#include <android/hardware/camera/device/3.5/ICameraDeviceSession.h>
#include <android/hardware/camera/device/3.4/ICameraDeviceCallback.h>
+#include <android/hardware/camera/device/3.5/ICameraDeviceCallback.h>
#include <android/hardware/camera/provider/2.4/ICameraProvider.h>
+#include <android/hardware/camera/metadata/3.4/types.h>
#include <android/hidl/manager/1.0/IServiceManager.h>
#include <binder/MemoryHeapBase.h>
#include <CameraMetadata.h>
@@ -110,6 +113,7 @@
using ::android::hardware::camera::device::V1_0::ICameraDevicePreviewCallback;
using ::android::hardware::camera::device::V1_0::FrameCallbackFlag;
using ::android::hardware::camera::device::V1_0::HandleTimestampMessage;
+using ::android::hardware::camera::metadata::V3_4::CameraMetadataEnumAndroidSensorInfoColorFilterArrangement;
using ::android::hardware::MessageQueue;
using ::android::hardware::kSynchronizedReadWrite;
using ::android::hidl::allocator::V1_0::IAllocator;
@@ -130,6 +134,7 @@
const int64_t kEmptyFlushTimeoutMSec = 200;
const char kDumpOutput[] = "/dev/null";
const uint32_t kBurstFrameCount = 10;
+const int64_t kBufferReturnTimeoutSec = 1;
struct AvailableStream {
int32_t width;
@@ -541,7 +546,7 @@
hidl_vec<hidl_string> getCameraDeviceNames(sp<ICameraProvider> provider);
- struct EmptyDeviceCb : public V3_4::ICameraDeviceCallback {
+ struct EmptyDeviceCb : public V3_5::ICameraDeviceCallback {
virtual Return<void> processCaptureResult(
const hidl_vec<CaptureResult>& /*results*/) override {
ALOGI("processCaptureResult callback");
@@ -561,21 +566,63 @@
ADD_FAILURE(); // Empty callback should not reach here
return Void();
}
+
+ virtual Return<void> requestStreamBuffers(
+ const hidl_vec<V3_5::BufferRequest>&,
+ requestStreamBuffers_cb _hidl_cb) override {
+ ALOGI("requestStreamBuffers callback");
+ // HAL might want to request buffer after configureStreams, but tests with EmptyDeviceCb
+ // doesn't actually need to send capture requests, so just return an error.
+ hidl_vec<V3_5::StreamBufferRet> emptyBufRets;
+ _hidl_cb(V3_5::BufferRequestStatus::FAILED_UNKNOWN, emptyBufRets);
+ return Void();
+ }
+
+ virtual Return<void> returnStreamBuffers(const hidl_vec<StreamBuffer>&) override {
+ ALOGI("returnStreamBuffers");
+ ADD_FAILURE(); // Empty callback should not reach here
+ return Void();
+ }
+
};
- struct DeviceCb : public V3_4::ICameraDeviceCallback {
+ struct DeviceCb : public V3_5::ICameraDeviceCallback {
DeviceCb(CameraHidlTest *parent, bool checkMonochromeResult) : mParent(parent),
mCheckMonochromeResult(checkMonochromeResult) {}
+
Return<void> processCaptureResult_3_4(
const hidl_vec<V3_4::CaptureResult>& results) override;
Return<void> processCaptureResult(const hidl_vec<CaptureResult>& results) override;
Return<void> notify(const hidl_vec<NotifyMsg>& msgs) override;
+ Return<void> requestStreamBuffers(
+ const hidl_vec<V3_5::BufferRequest>& bufReqs,
+ requestStreamBuffers_cb _hidl_cb) override;
+
+ Return<void> returnStreamBuffers(const hidl_vec<StreamBuffer>& buffers) override;
+
+ void setCurrentStreamConfig(const hidl_vec<V3_2::Stream>& streams,
+ const hidl_vec<V3_2::HalStream>& halStreams);
+
+ void waitForBuffersReturned();
+
private:
bool processCaptureResultLocked(const CaptureResult& results);
- CameraHidlTest *mParent; // Parent object
+ CameraHidlTest *mParent; // Parent object
bool mCheckMonochromeResult;
+ bool hasOutstandingBuffersLocked();
+
+ /* members for requestStreamBuffers() and returnStreamBuffers()*/
+ std::mutex mLock; // protecting members below
+ bool mUseHalBufManager = false;
+ hidl_vec<V3_2::Stream> mStreams;
+ hidl_vec<V3_2::HalStream> mHalStreams;
+ uint64_t mNextBufferId = 1;
+ using OutstandingBuffers = std::unordered_map<uint64_t, hidl_handle>;
+ // size == mStreams.size(). Tracking each streams outstanding buffers
+ std::vector<OutstandingBuffers> mOutstandingBufferIds;
+ std::condition_variable mFlushedCondition;
};
struct TorchProviderCb : public ICameraProviderCallback {
@@ -659,21 +706,27 @@
camera_metadata_t **staticMeta /*out*/);
void castSession(const sp<ICameraDeviceSession> &session, int32_t deviceVersion,
sp<device::V3_3::ICameraDeviceSession> *session3_3 /*out*/,
- sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/);
+ sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/,
+ sp<device::V3_5::ICameraDeviceSession> *session3_5 /*out*/);
void createStreamConfiguration(const ::android::hardware::hidl_vec<V3_2::Stream>& streams3_2,
StreamConfigurationMode configMode,
::android::hardware::camera::device::V3_2::StreamConfiguration *config3_2,
- ::android::hardware::camera::device::V3_4::StreamConfiguration *config3_4);
+ ::android::hardware::camera::device::V3_4::StreamConfiguration *config3_4,
+ ::android::hardware::camera::device::V3_5::StreamConfiguration *config3_5);
void configurePreviewStreams3_4(const std::string &name, int32_t deviceVersion,
sp<ICameraProvider> provider,
const AvailableStream *previewThreshold,
const std::unordered_set<std::string>& physicalIds,
sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/,
+ sp<device::V3_5::ICameraDeviceSession> *session3_5 /*out*/,
V3_2::Stream* previewStream /*out*/,
device::V3_4::HalStreamConfiguration *halStreamConfig /*out*/,
bool *supportsPartialResults /*out*/,
- uint32_t *partialResultCount /*out*/);
+ uint32_t *partialResultCount /*out*/,
+ bool *useHalBufManager /*out*/,
+ sp<DeviceCb> *cb /*out*/,
+ uint32_t streamConfigCounter = 0);
void configurePreviewStream(const std::string &name, int32_t deviceVersion,
sp<ICameraProvider> provider,
const AvailableStream *previewThreshold,
@@ -681,7 +734,10 @@
V3_2::Stream *previewStream /*out*/,
HalStreamConfiguration *halStreamConfig /*out*/,
bool *supportsPartialResults /*out*/,
- uint32_t *partialResultCount /*out*/);
+ uint32_t *partialResultCount /*out*/,
+ bool *useHalBufManager /*out*/,
+ sp<DeviceCb> *cb /*out*/,
+ uint32_t streamConfigCounter = 0);
void verifyLogicalCameraMetadata(const std::string& cameraName,
const ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice>& device,
@@ -693,6 +749,14 @@
void verifyMonochromeCameraResult(
const ::android::hardware::camera::common::V1_0::helper::CameraMetadata& metadata);
+ void verifyBuffersReturned(sp<device::V3_2::ICameraDeviceSession> session,
+ int deviceVerison, int32_t streamId, sp<DeviceCb> cb,
+ uint32_t streamConfigCounter = 0);
+
+ void verifyBuffersReturned(sp<device::V3_4::ICameraDeviceSession> session,
+ hidl_vec<int32_t> streamIds, sp<DeviceCb> cb,
+ uint32_t streamConfigCounter = 0);
+
static Status getAvailableOutputStreams(camera_metadata_t *staticMeta,
std::vector<AvailableStream> &outputStreams,
const AvailableStream *threshold = nullptr);
@@ -1092,9 +1156,51 @@
if (request->shutterTimestamp != 0) {
notify = true;
}
+
+ if (mUseHalBufManager) {
+ returnStreamBuffers(results.outputBuffers);
+ }
return notify;
}
+void CameraHidlTest::DeviceCb::setCurrentStreamConfig(
+ const hidl_vec<V3_2::Stream>& streams, const hidl_vec<V3_2::HalStream>& halStreams) {
+ ASSERT_EQ(streams.size(), halStreams.size());
+ ASSERT_NE(streams.size(), 0);
+ for (size_t i = 0; i < streams.size(); i++) {
+ ASSERT_EQ(streams[i].id, halStreams[i].id);
+ }
+ std::lock_guard<std::mutex> l(mLock);
+ mUseHalBufManager = true;
+ mStreams = streams;
+ mHalStreams = halStreams;
+ mOutstandingBufferIds.clear();
+ for (size_t i = 0; i < streams.size(); i++) {
+ mOutstandingBufferIds.emplace_back();
+ }
+}
+
+bool CameraHidlTest::DeviceCb::hasOutstandingBuffersLocked() {
+ if (!mUseHalBufManager) {
+ return false;
+ }
+ for (const auto& outstandingBuffers : mOutstandingBufferIds) {
+ if (!outstandingBuffers.empty()) {
+ return true;
+ }
+ }
+ return false;
+}
+
+void CameraHidlTest::DeviceCb::waitForBuffersReturned() {
+ std::unique_lock<std::mutex> lk(mLock);
+ if (hasOutstandingBuffersLocked()) {
+ auto timeout = std::chrono::seconds(kBufferReturnTimeoutSec);
+ auto st = mFlushedCondition.wait_for(lk, timeout);
+ ASSERT_NE(std::cv_status::timeout, st);
+ }
+}
+
Return<void> CameraHidlTest::DeviceCb::notify(
const hidl_vec<NotifyMsg>& messages) {
std::lock_guard<std::mutex> l(mParent->mLock);
@@ -1137,6 +1243,124 @@
return Void();
}
+Return<void> CameraHidlTest::DeviceCb::requestStreamBuffers(
+ const hidl_vec<V3_5::BufferRequest>& bufReqs,
+ requestStreamBuffers_cb _hidl_cb) {
+ using V3_5::BufferRequestStatus;
+ using V3_5::StreamBufferRet;
+ using V3_5::StreamBufferRequestError;
+ hidl_vec<StreamBufferRet> bufRets;
+ std::unique_lock<std::mutex> l(mLock);
+
+ if (!mUseHalBufManager) {
+ ALOGE("%s: Camera does not support HAL buffer management", __FUNCTION__);
+ ADD_FAILURE();
+ _hidl_cb(BufferRequestStatus::FAILED_ILLEGAL_ARGUMENTS, bufRets);
+ return Void();
+ }
+
+ if (bufReqs.size() > mStreams.size()) {
+ ALOGE("%s: illegal buffer request: too many requests!", __FUNCTION__);
+ ADD_FAILURE();
+ _hidl_cb(BufferRequestStatus::FAILED_ILLEGAL_ARGUMENTS, bufRets);
+ return Void();
+ }
+
+ std::vector<int32_t> indexes(bufReqs.size());
+ for (size_t i = 0; i < bufReqs.size(); i++) {
+ bool found = false;
+ for (size_t idx = 0; idx < mStreams.size(); idx++) {
+ if (bufReqs[i].streamId == mStreams[idx].id) {
+ found = true;
+ indexes[i] = idx;
+ break;
+ }
+ }
+ if (!found) {
+ ALOGE("%s: illegal buffer request: unknown streamId %d!",
+ __FUNCTION__, bufReqs[i].streamId);
+ ADD_FAILURE();
+ _hidl_cb(BufferRequestStatus::FAILED_ILLEGAL_ARGUMENTS, bufRets);
+ return Void();
+ }
+ }
+
+ bool allStreamOk = true;
+ bool atLeastOneStreamOk = false;
+ bufRets.resize(bufReqs.size());
+ for (size_t i = 0; i < bufReqs.size(); i++) {
+ int32_t idx = indexes[i];
+ const auto& stream = mStreams[idx];
+ const auto& halStream = mHalStreams[idx];
+ const V3_5::BufferRequest& bufReq = bufReqs[i];
+ if (mOutstandingBufferIds[idx].size() + bufReq.numBuffersRequested > halStream.maxBuffers) {
+ bufRets[i].streamId = stream.id;
+ bufRets[i].val.error(StreamBufferRequestError::MAX_BUFFER_EXCEEDED);
+ allStreamOk = false;
+ continue;
+ }
+
+ hidl_vec<StreamBuffer> tmpRetBuffers(bufReq.numBuffersRequested);
+ for (size_t i = 0; i < bufReq.numBuffersRequested; i++) {
+ hidl_handle buffer_handle;
+ mParent->allocateGraphicBuffer(stream.width, stream.height,
+ android_convertGralloc1To0Usage(
+ halStream.producerUsage, halStream.consumerUsage),
+ halStream.overrideFormat, &buffer_handle);
+
+ tmpRetBuffers[i] = {stream.id, mNextBufferId, buffer_handle, BufferStatus::OK,
+ nullptr, nullptr};
+ mOutstandingBufferIds[idx].insert(std::make_pair(mNextBufferId++, buffer_handle));
+ }
+ atLeastOneStreamOk = true;
+ bufRets[0].val.buffers(std::move(tmpRetBuffers));
+ }
+
+ if (allStreamOk) {
+ _hidl_cb(BufferRequestStatus::OK, bufRets);
+ } else if (atLeastOneStreamOk) {
+ _hidl_cb(BufferRequestStatus::FAILED_PARTIAL, bufRets);
+ } else {
+ _hidl_cb(BufferRequestStatus::FAILED_UNKNOWN, bufRets);
+ }
+
+ if (!hasOutstandingBuffersLocked()) {
+ l.unlock();
+ mFlushedCondition.notify_one();
+ }
+ return Void();
+}
+
+Return<void> CameraHidlTest::DeviceCb::returnStreamBuffers(
+ const hidl_vec<StreamBuffer>& buffers) {
+ if (!mUseHalBufManager) {
+ ALOGE("%s: Camera does not support HAL buffer management", __FUNCTION__);
+ ADD_FAILURE();
+ }
+
+ std::lock_guard<std::mutex> l(mLock);
+ for (const auto& buf : buffers) {
+ bool found = false;
+ for (size_t idx = 0; idx < mOutstandingBufferIds.size(); idx++) {
+ if (mStreams[idx].id == buf.streamId &&
+ mOutstandingBufferIds[idx].count(buf.bufferId) == 1) {
+ mOutstandingBufferIds[idx].erase(buf.bufferId);
+ // TODO: check do we need to close/delete native handle or assume we have enough
+ // memory to run till the test finish? since we do not capture much requests (and
+ // most of time one buffer is sufficient)
+ found = true;
+ break;
+ }
+ }
+ if (found) {
+ continue;
+ }
+ ALOGE("%s: unknown buffer ID %" PRIu64, __FUNCTION__, buf.bufferId);
+ ADD_FAILURE();
+ }
+ return Void();
+}
+
hidl_vec<hidl_string> CameraHidlTest::getCameraDeviceNames(sp<ICameraProvider> provider) {
std::vector<std::string> cameraDeviceNames;
Return<void> ret;
@@ -2377,14 +2601,18 @@
// cast the 3.3/3.4 interface, and that lower versions can't be cast to it.
sp<device::V3_3::ICameraDeviceSession> sessionV3_3;
sp<device::V3_4::ICameraDeviceSession> sessionV3_4;
- castSession(session, deviceVersion, &sessionV3_3, &sessionV3_4);
- if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_4 ||
- deviceVersion == CAMERA_DEVICE_API_VERSION_3_5) {
+ sp<device::V3_5::ICameraDeviceSession> sessionV3_5;
+ castSession(session, deviceVersion, &sessionV3_3, &sessionV3_4, &sessionV3_5);
+ if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_5) {
+ ASSERT_TRUE(sessionV3_5.get() != nullptr);
+ } else if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_4) {
ASSERT_TRUE(sessionV3_4.get() != nullptr);
} else if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_3) {
ASSERT_TRUE(sessionV3_3.get() != nullptr);
- } else {
+ } else { //V3_2
ASSERT_TRUE(sessionV3_3.get() == nullptr);
+ ASSERT_TRUE(sessionV3_4.get() == nullptr);
+ ASSERT_TRUE(sessionV3_5.get() == nullptr);
}
native_handle_t* raw_handle = native_handle_create(1, 0);
raw_handle->data[0] = open(kDumpOutput, O_RDWR);
@@ -2540,15 +2768,17 @@
sp<ICameraDeviceSession> session;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
openEmptyDeviceSession(name, mProvider,
&session /*out*/, &staticMeta /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
outputStreams.clear();
ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, outputStreams));
ASSERT_NE(0u, outputStreams.size());
int32_t streamId = 0;
+ uint32_t streamConfigCounter = 0;
for (auto& it : outputStreams) {
V3_2::Stream stream3_2;
bool isJpeg = static_cast<PixelFormat>(it.format) == PixelFormat::BLOB;
@@ -2561,11 +2791,20 @@
(isJpeg) ? static_cast<V3_2::DataspaceFlags>(Dataspace::V0_JFIF) : 0,
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<V3_2::Stream> streams3_2 = {stream3_2};
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
createStreamConfiguration(streams3_2, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [streamId](Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(1u, halConfig.streams.size());
+ ASSERT_EQ(halConfig.streams[0].v3_3.v3_2.id, streamId);
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[streamId](Status s, device::V3_4::HalStreamConfiguration halConfig) {
ASSERT_EQ(Status::OK, s);
@@ -2617,8 +2856,9 @@
sp<ICameraDeviceSession> session;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
outputStreams.clear();
ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, outputStreams));
@@ -2633,29 +2873,38 @@
GRALLOC1_CONSUMER_USAGE_HWCOMPOSER,
0,
StreamRotation::ROTATION_0};
+ uint32_t streamConfigCounter = 0;
::android::hardware::hidl_vec<V3_2::Stream> streams = {stream3_2};
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if(session3_4 != nullptr) {
- ret = session3_4->configureStreams_3_4(config3_4,
- [](Status s, device::V3_4::HalStreamConfiguration) {
- ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration) {
+ ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
(Status::INTERNAL_ERROR == s));
- });
+ });
+ } else if (session3_4 != nullptr) {
+ ret = session3_4->configureStreams_3_4(config3_4,
+ [](Status s, device::V3_4::HalStreamConfiguration) {
+ ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
+ (Status::INTERNAL_ERROR == s));
+ });
} else if(session3_3 != nullptr) {
ret = session3_3->configureStreams_3_3(config3_2,
- [](Status s, device::V3_3::HalStreamConfiguration) {
- ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
- (Status::INTERNAL_ERROR == s));
- });
+ [](Status s, device::V3_3::HalStreamConfiguration) {
+ ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
+ (Status::INTERNAL_ERROR == s));
+ });
} else {
ret = session->configureStreams(config3_2,
- [](Status s, HalStreamConfiguration) {
- ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
- (Status::INTERNAL_ERROR == s));
- });
+ [](Status s, HalStreamConfiguration) {
+ ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
+ (Status::INTERNAL_ERROR == s));
+ });
}
ASSERT_TRUE(ret.isOk());
@@ -2669,8 +2918,14 @@
StreamRotation::ROTATION_0};
streams[0] = stream3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if(session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5, [](Status s,
+ device::V3_4::HalStreamConfiguration) {
+ ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
+ });
+ } else if(session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4, [](Status s,
device::V3_4::HalStreamConfiguration) {
ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
@@ -2699,8 +2954,14 @@
StreamRotation::ROTATION_0};
streams[0] = stream3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if(session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration) {
+ ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
+ });
+ } else if(session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration) {
ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
@@ -2728,8 +2989,14 @@
static_cast<StreamRotation>(UINT32_MAX)};
streams[0] = stream3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if(session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration) {
+ ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
+ });
+ } else if(session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration) {
ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
@@ -2776,8 +3043,9 @@
sp<ICameraDeviceSession> session;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
Status rc = isZSLModeAvailable(staticMeta);
if (Status::METHOD_NOT_SUPPORTED == rc) {
@@ -2807,6 +3075,7 @@
int32_t streamId = 0;
bool hasPrivToY8 = false, hasY8ToY8 = false, hasY8ToBlob = false;
+ uint32_t streamConfigCounter = 0;
for (auto& inputIter : inputOutputMap) {
AvailableStream input;
ASSERT_EQ(Status::OK, findLargestSize(inputStreams, inputIter.inputFormat,
@@ -2857,11 +3126,19 @@
::android::hardware::hidl_vec<V3_2::Stream> streams = {inputStream, zslStream,
outputStream};
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(3u, halConfig.streams.size());
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration halConfig) {
ASSERT_EQ(Status::OK, s);
@@ -2923,9 +3200,14 @@
sp<ICameraDeviceSession> session;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMetaBuffer /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4);
- ASSERT_NE(session3_4, nullptr);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
+ if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_4) {
+ ASSERT_NE(session3_4, nullptr);
+ } else {
+ ASSERT_NE(session3_5, nullptr);
+ }
std::unordered_set<int32_t> availableSessionKeys;
auto rc = getSupportedKeys(staticMetaBuffer, ANDROID_REQUEST_AVAILABLE_SESSION_KEYS,
@@ -2964,17 +3246,29 @@
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<V3_4::Stream> streams = {previewStream};
::android::hardware::camera::device::V3_4::StreamConfiguration config;
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
config.streams = streams;
config.operationMode = StreamConfigurationMode::NORMAL_MODE;
const camera_metadata_t *sessionParamsBuffer = sessionParams.getAndLock();
config.sessionParams.setToExternal(
reinterpret_cast<uint8_t *> (const_cast<camera_metadata_t *> (sessionParamsBuffer)),
get_camera_metadata_size(sessionParamsBuffer));
- ret = session3_4->configureStreams_3_4(config,
- [](Status s, device::V3_4::HalStreamConfiguration halConfig) {
- ASSERT_EQ(Status::OK, s);
- ASSERT_EQ(1u, halConfig.streams.size());
- });
+ config3_5.v3_4 = config;
+ config3_5.streamConfigCounter = 0;
+ if (session3_5 != nullptr) {
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(1u, halConfig.streams.size());
+ });
+ } else {
+ ret = session3_4->configureStreams_3_4(config,
+ [](Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(1u, halConfig.streams.size());
+ });
+ }
+
ASSERT_TRUE(ret.isOk());
free_camera_metadata(staticMetaBuffer);
@@ -3009,8 +3303,9 @@
sp<ICameraDeviceSession> session;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
outputBlobStreams.clear();
ASSERT_EQ(Status::OK,
@@ -3024,6 +3319,7 @@
ASSERT_NE(0u, outputPreviewStreams.size());
int32_t streamId = 0;
+ uint32_t streamConfigCounter = 0;
for (auto& blobIter : outputBlobStreams) {
for (auto& previewIter : outputPreviewStreams) {
V3_2::Stream previewStream = {streamId++,
@@ -3044,11 +3340,19 @@
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<V3_2::Stream> streams = {previewStream,
blobStream};
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(2u, halConfig.streams.size());
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration halConfig) {
ASSERT_EQ(Status::OK, s);
@@ -3098,8 +3402,9 @@
sp<ICameraDeviceSession> session;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
Status rc = isConstrainedModeAvailable(staticMeta);
if (Status::METHOD_NOT_SUPPORTED == rc) {
@@ -3114,6 +3419,7 @@
ASSERT_EQ(Status::OK, rc);
int32_t streamId = 0;
+ uint32_t streamConfigCounter = 0;
V3_2::Stream stream = {streamId,
StreamType::OUTPUT,
static_cast<uint32_t>(hfrStream.width),
@@ -3123,11 +3429,20 @@
0,
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<V3_2::Stream> streams = {stream};
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
createStreamConfiguration(streams, StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [streamId](Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(1u, halConfig.streams.size());
+ ASSERT_EQ(halConfig.streams[0].v3_3.v3_2.id, streamId);
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[streamId](Status s, device::V3_4::HalStreamConfiguration halConfig) {
ASSERT_EQ(Status::OK, s);
@@ -3161,8 +3476,15 @@
StreamRotation::ROTATION_0};
streams[0] = stream;
createStreamConfiguration(streams, StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration) {
+ ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
+ (Status::INTERNAL_ERROR == s));
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration) {
ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
@@ -3193,8 +3515,14 @@
StreamRotation::ROTATION_0};
streams[0] = stream;
createStreamConfiguration(streams, StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration) {
+ ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration) {
ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
@@ -3222,8 +3550,14 @@
StreamRotation::ROTATION_0};
streams[0] = stream;
createStreamConfiguration(streams, StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration) {
+ ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration) {
ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
@@ -3273,8 +3607,9 @@
sp<ICameraDeviceSession> session;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
outputBlobStreams.clear();
ASSERT_EQ(Status::OK,
@@ -3289,6 +3624,7 @@
ASSERT_NE(0u, outputVideoStreams.size());
int32_t streamId = 0;
+ uint32_t streamConfigCounter = 0;
for (auto& blobIter : outputBlobStreams) {
for (auto& videoIter : outputVideoStreams) {
V3_2::Stream videoStream = {streamId++,
@@ -3308,11 +3644,19 @@
static_cast<V3_2::DataspaceFlags>(Dataspace::V0_JFIF),
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<V3_2::Stream> streams = {videoStream, blobStream};
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(2u, halConfig.streams.size());
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration halConfig) {
ASSERT_EQ(Status::OK, s);
@@ -3363,12 +3707,14 @@
V3_2::Stream previewStream;
HalStreamConfiguration halStreamConfig;
sp<ICameraDeviceSession> session;
+ sp<DeviceCb> cb;
bool supportsPartialResults = false;
+ bool useHalBufManager = false;
uint32_t partialResultCount = 0;
configurePreviewStream(name, deviceVersion, mProvider, &previewThreshold, &session /*out*/,
&previewStream /*out*/, &halStreamConfig /*out*/,
&supportsPartialResults /*out*/,
- &partialResultCount /*out*/);
+ &partialResultCount /*out*/, &useHalBufManager /*out*/, &cb /*out*/);
std::shared_ptr<ResultMetadataQueue> resultQueue;
auto resultQueueRet =
@@ -3399,17 +3745,26 @@
ASSERT_TRUE(ret.isOk());
hidl_handle buffer_handle;
- allocateGraphicBuffer(previewStream.width, previewStream.height,
- android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
- halStreamConfig.streams[0].consumerUsage),
- halStreamConfig.streams[0].overrideFormat, &buffer_handle);
-
- StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
- bufferId,
- buffer_handle,
- BufferStatus::OK,
- nullptr,
- nullptr};
+ StreamBuffer outputBuffer;
+ if (useHalBufManager) {
+ outputBuffer = {halStreamConfig.streams[0].id,
+ /*bufferId*/ 0,
+ buffer_handle,
+ BufferStatus::OK,
+ nullptr,
+ nullptr};
+ } else {
+ allocateGraphicBuffer(previewStream.width, previewStream.height,
+ android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
+ halStreamConfig.streams[0].consumerUsage),
+ halStreamConfig.streams[0].overrideFormat, &buffer_handle);
+ outputBuffer = {halStreamConfig.streams[0].id,
+ bufferId,
+ buffer_handle,
+ BufferStatus::OK,
+ nullptr,
+ nullptr};
+ }
::android::hardware::hidl_vec<StreamBuffer> outputBuffers = {outputBuffer};
StreamBuffer emptyInputBuffer = {-1, 0, nullptr, BufferStatus::ERROR, nullptr,
nullptr};
@@ -3489,6 +3844,10 @@
ASSERT_EQ(previewStream.id, inflightReq.resultOutputBuffers[0].streamId);
}
+ if (useHalBufManager) {
+ verifyBuffersReturned(session, deviceVersion, previewStream.id, cb);
+ }
+
ret = session->close();
ASSERT_TRUE(ret.isOk());
}
@@ -3570,12 +3929,16 @@
V3_4::HalStreamConfiguration halStreamConfig;
bool supportsPartialResults = false;
+ bool useHalBufManager = false;
uint32_t partialResultCount = 0;
V3_2::Stream previewStream;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
+ sp<DeviceCb> cb;
configurePreviewStreams3_4(name, deviceVersion, mProvider, &previewThreshold, physicalIds,
- &session3_4, &previewStream, &halStreamConfig /*out*/,
- &supportsPartialResults /*out*/, &partialResultCount /*out*/);
+ &session3_4, &session3_5, &previewStream, &halStreamConfig /*out*/,
+ &supportsPartialResults /*out*/, &partialResultCount /*out*/,
+ &useHalBufManager /*out*/, &cb /*out*/);
ASSERT_NE(session3_4, nullptr);
std::shared_ptr<ResultMetadataQueue> resultQueue;
@@ -3604,14 +3967,19 @@
size_t k = 0;
for (const auto& halStream : halStreamConfig.streams) {
hidl_handle buffer_handle;
- allocateGraphicBuffer(previewStream.width, previewStream.height,
- android_convertGralloc1To0Usage(halStream.v3_3.v3_2.producerUsage,
- halStream.v3_3.v3_2.consumerUsage),
- halStream.v3_3.v3_2.overrideFormat, &buffer_handle);
- graphicBuffers.push_back(buffer_handle);
- outputBuffers[k] = {halStream.v3_3.v3_2.id, bufferId, buffer_handle,
- BufferStatus::OK, nullptr, nullptr};
- bufferId++;
+ if (useHalBufManager) {
+ outputBuffers[k] = {halStream.v3_3.v3_2.id, /*bufferId*/0, buffer_handle,
+ BufferStatus::OK, nullptr, nullptr};
+ } else {
+ allocateGraphicBuffer(previewStream.width, previewStream.height,
+ android_convertGralloc1To0Usage(halStream.v3_3.v3_2.producerUsage,
+ halStream.v3_3.v3_2.consumerUsage),
+ halStream.v3_3.v3_2.overrideFormat, &buffer_handle);
+ graphicBuffers.push_back(buffer_handle);
+ outputBuffers[k] = {halStream.v3_3.v3_2.id, bufferId, buffer_handle,
+ BufferStatus::OK, nullptr, nullptr};
+ bufferId++;
+ }
k++;
}
hidl_vec<V3_4::PhysicalCameraSetting> camSettings(1);
@@ -3713,6 +4081,15 @@
defaultPreviewSettings.unlock(settingsBuffer);
filteredSettings.unlock(filteredSettingsBuffer);
+
+ if (useHalBufManager) {
+ hidl_vec<int32_t> streamIds(halStreamConfig.streams.size());
+ for (size_t i = 0; i < streamIds.size(); i++) {
+ streamIds[i] = halStreamConfig.streams[i].v3_3.v3_2.id;
+ }
+ verifyBuffersReturned(session3_4, streamIds, cb);
+ }
+
ret = session3_4->close();
ASSERT_TRUE(ret.isOk());
}
@@ -3761,12 +4138,15 @@
ASSERT_TRUE(ret.isOk());
bool supportsPartialResults = false;
+ bool useHalBufManager = false;
uint32_t partialResultCount = 0;
V3_2::Stream previewStream;
HalStreamConfiguration halStreamConfig;
+ sp<DeviceCb> cb;
configurePreviewStream(name, deviceVersion, mProvider, &previewThreshold,
&session /*out*/, &previewStream /*out*/, &halStreamConfig /*out*/,
- &supportsPartialResults /*out*/, &partialResultCount /*out*/);
+ &supportsPartialResults /*out*/, &partialResultCount /*out*/,
+ &useHalBufManager /*out*/, &cb /*out*/);
std::shared_ptr<ResultMetadataQueue> resultQueue;
auto resultQueueRet = session->getCaptureResultMetadataQueue(
@@ -3800,13 +4180,18 @@
std::unique_lock<std::mutex> l(mLock);
isoValues[i] = ((i % 2) == 0) ? isoRange.data.i32[0] : isoRange.data.i32[1];
- allocateGraphicBuffer(previewStream.width, previewStream.height,
- android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
- halStreamConfig.streams[0].consumerUsage),
- halStreamConfig.streams[0].overrideFormat, &buffers[i]);
+ if (useHalBufManager) {
+ outputBuffers[i] = {halStreamConfig.streams[0].id, /*bufferId*/0,
+ nullptr, BufferStatus::OK, nullptr, nullptr};
+ } else {
+ allocateGraphicBuffer(previewStream.width, previewStream.height,
+ android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
+ halStreamConfig.streams[0].consumerUsage),
+ halStreamConfig.streams[0].overrideFormat, &buffers[i]);
+ outputBuffers[i] = {halStreamConfig.streams[0].id, bufferId + i,
+ buffers[i], BufferStatus::OK, nullptr, nullptr};
+ }
- outputBuffers[i] = {halStreamConfig.streams[0].id, bufferId + i,
- buffers[i], BufferStatus::OK, nullptr, nullptr};
requestMeta.append(reinterpret_cast<camera_metadata_t *> (settings.data()));
// Disable all 3A routines
@@ -3859,6 +4244,9 @@
std::round(isoValues[i]*isoTol));
}
+ if (useHalBufManager) {
+ verifyBuffersReturned(session, deviceVersion, previewStream.id, cb);
+ }
ret = session->close();
ASSERT_TRUE(ret.isOk());
}
@@ -3888,18 +4276,25 @@
V3_2::Stream previewStream;
HalStreamConfiguration halStreamConfig;
sp<ICameraDeviceSession> session;
+ sp<DeviceCb> cb;
bool supportsPartialResults = false;
+ bool useHalBufManager = false;
uint32_t partialResultCount = 0;
configurePreviewStream(name, deviceVersion, mProvider, &previewThreshold, &session /*out*/,
&previewStream /*out*/, &halStreamConfig /*out*/,
&supportsPartialResults /*out*/,
- &partialResultCount /*out*/);
+ &partialResultCount /*out*/, &useHalBufManager /*out*/, &cb /*out*/);
hidl_handle buffer_handle;
- allocateGraphicBuffer(previewStream.width, previewStream.height,
- android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
- halStreamConfig.streams[0].consumerUsage),
- halStreamConfig.streams[0].overrideFormat, &buffer_handle);
+
+ if (useHalBufManager) {
+ bufferId = 0;
+ } else {
+ allocateGraphicBuffer(previewStream.width, previewStream.height,
+ android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
+ halStreamConfig.streams[0].consumerUsage),
+ halStreamConfig.streams[0].overrideFormat, &buffer_handle);
+ }
StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
bufferId,
@@ -3955,12 +4350,14 @@
V3_2::Stream previewStream;
HalStreamConfiguration halStreamConfig;
sp<ICameraDeviceSession> session;
+ sp<DeviceCb> cb;
bool supportsPartialResults = false;
+ bool useHalBufManager = false;
uint32_t partialResultCount = 0;
configurePreviewStream(name, deviceVersion, mProvider, &previewThreshold, &session /*out*/,
&previewStream /*out*/, &halStreamConfig /*out*/,
&supportsPartialResults /*out*/,
- &partialResultCount /*out*/);
+ &partialResultCount /*out*/, &useHalBufManager /*out*/, &cb /*out*/);
RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
Return<void> ret;
@@ -4019,12 +4416,14 @@
V3_2::Stream previewStream;
HalStreamConfiguration halStreamConfig;
sp<ICameraDeviceSession> session;
+ sp<DeviceCb> cb;
bool supportsPartialResults = false;
+ bool useHalBufManager = false;
uint32_t partialResultCount = 0;
configurePreviewStream(name, deviceVersion, mProvider, &previewThreshold, &session /*out*/,
&previewStream /*out*/, &halStreamConfig /*out*/,
&supportsPartialResults /*out*/,
- &partialResultCount /*out*/);
+ &partialResultCount /*out*/, &useHalBufManager /*out*/, &cb /*out*/);
std::shared_ptr<ResultMetadataQueue> resultQueue;
auto resultQueueRet =
@@ -4054,10 +4453,14 @@
ASSERT_TRUE(ret.isOk());
hidl_handle buffer_handle;
- allocateGraphicBuffer(previewStream.width, previewStream.height,
- android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
- halStreamConfig.streams[0].consumerUsage),
- halStreamConfig.streams[0].overrideFormat, &buffer_handle);
+ if (useHalBufManager) {
+ bufferId = 0;
+ } else {
+ allocateGraphicBuffer(previewStream.width, previewStream.height,
+ android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
+ halStreamConfig.streams[0].consumerUsage),
+ halStreamConfig.streams[0].overrideFormat, &buffer_handle);
+ }
StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
bufferId,
@@ -4124,6 +4527,10 @@
}
}
+ if (useHalBufManager) {
+ verifyBuffersReturned(session, deviceVersion, previewStream.id, cb);
+ }
+
ret = session->close();
ASSERT_TRUE(ret.isOk());
}
@@ -4149,12 +4556,14 @@
V3_2::Stream previewStream;
HalStreamConfiguration halStreamConfig;
sp<ICameraDeviceSession> session;
+ sp<DeviceCb> cb;
bool supportsPartialResults = false;
+ bool useHalBufManager = false;
uint32_t partialResultCount = 0;
configurePreviewStream(name, deviceVersion, mProvider, &previewThreshold, &session /*out*/,
&previewStream /*out*/, &halStreamConfig /*out*/,
&supportsPartialResults /*out*/,
- &partialResultCount /*out*/);
+ &partialResultCount /*out*/, &useHalBufManager /*out*/, &cb /*out*/);
Return<Status> returnStatus = session->flush();
ASSERT_TRUE(returnStatus.isOk());
@@ -4496,9 +4905,11 @@
const ::android::hardware::hidl_vec<V3_2::Stream>& streams3_2,
StreamConfigurationMode configMode,
::android::hardware::camera::device::V3_2::StreamConfiguration *config3_2 /*out*/,
- ::android::hardware::camera::device::V3_4::StreamConfiguration *config3_4 /*out*/) {
+ ::android::hardware::camera::device::V3_4::StreamConfiguration *config3_4 /*out*/,
+ ::android::hardware::camera::device::V3_5::StreamConfiguration *config3_5 /*out*/) {
ASSERT_NE(nullptr, config3_2);
ASSERT_NE(nullptr, config3_4);
+ ASSERT_NE(nullptr, config3_5);
::android::hardware::hidl_vec<V3_4::Stream> streams3_4(streams3_2.size());
size_t idx = 0;
@@ -4507,7 +4918,9 @@
stream.v3_2 = stream3_2;
streams3_4[idx++] = stream;
}
- *config3_4 = {streams3_4, configMode, {}};
+ // Caller is responsible to fill in non-zero config3_5->streamConfigCounter after this returns
+ *config3_5 = {{streams3_4, configMode, {}}, 0};
+ *config3_4 = config3_5->v3_4;
*config3_2 = {streams3_2, configMode};
}
@@ -4517,15 +4930,22 @@
const AvailableStream *previewThreshold,
const std::unordered_set<std::string>& physicalIds,
sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/,
+ sp<device::V3_5::ICameraDeviceSession> *session3_5 /*out*/,
V3_2::Stream *previewStream /*out*/,
device::V3_4::HalStreamConfiguration *halStreamConfig /*out*/,
bool *supportsPartialResults /*out*/,
- uint32_t *partialResultCount /*out*/) {
+ uint32_t *partialResultCount /*out*/,
+ bool *useHalBufManager /*out*/,
+ sp<DeviceCb> *outCb /*out*/,
+ uint32_t streamConfigCounter) {
ASSERT_NE(nullptr, session3_4);
+ ASSERT_NE(nullptr, session3_5);
ASSERT_NE(nullptr, halStreamConfig);
ASSERT_NE(nullptr, previewStream);
ASSERT_NE(nullptr, supportsPartialResults);
ASSERT_NE(nullptr, partialResultCount);
+ ASSERT_NE(nullptr, useHalBufManager);
+ ASSERT_NE(nullptr, outCb);
ASSERT_FALSE(physicalIds.empty());
std::vector<AvailableStream> outputPreviewStreams;
@@ -4574,10 +4994,19 @@
session = newSession;
});
ASSERT_TRUE(ret.isOk());
+ *outCb = cb;
sp<device::V3_3::ICameraDeviceSession> session3_3;
- castSession(session, deviceVersion, &session3_3, session3_4);
- ASSERT_NE(nullptr, session3_4);
+ castSession(session, deviceVersion, &session3_3, session3_4, session3_5);
+ ASSERT_NE(nullptr, (*session3_4).get());
+
+ *useHalBufManager = false;
+ status = find_camera_metadata_ro_entry(staticMeta,
+ ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION, &entry);
+ if ((0 == status) && (entry.count == 1)) {
+ *useHalBufManager = (entry.data.u8[0] ==
+ ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_HIDL_DEVICE_3_5);
+ }
outputPreviewStreams.clear();
auto rc = getAvailableOutputStreams(staticMeta,
@@ -4599,6 +5028,7 @@
}
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
config3_4 = {streams3_4, StreamConfigurationMode::NORMAL_MODE, {}};
RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
ret = (*session3_4)->constructDefaultRequestSettings(reqTemplate,
@@ -4608,12 +5038,32 @@
});
ASSERT_TRUE(ret.isOk());
- ret = (*session3_4)->configureStreams_3_4(config3_4,
- [&] (Status s, device::V3_4::HalStreamConfiguration halConfig) {
- ASSERT_EQ(Status::OK, s);
- ASSERT_EQ(physicalIds.size(), halConfig.streams.size());
- *halStreamConfig = halConfig;
- });
+ if (*session3_5 != nullptr) {
+ config3_5.v3_4 = config3_4;
+ config3_5.streamConfigCounter = streamConfigCounter;
+ ret = (*session3_5)->configureStreams_3_5(config3_5,
+ [&] (Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(physicalIds.size(), halConfig.streams.size());
+ *halStreamConfig = halConfig;
+ if (*useHalBufManager) {
+ hidl_vec<V3_2::Stream> streams(physicalIds.size());
+ hidl_vec<V3_2::HalStream> halStreams(physicalIds.size());
+ for (size_t i = 0; i < physicalIds.size(); i++) {
+ streams[i] = streams3_4[i].v3_2;
+ halStreams[i] = halConfig.streams[i].v3_3.v3_2;
+ }
+ cb->setCurrentStreamConfig(streams, halStreams);
+ }
+ });
+ } else {
+ ret = (*session3_4)->configureStreams_3_4(config3_4,
+ [&] (Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(physicalIds.size(), halConfig.streams.size());
+ *halStreamConfig = halConfig;
+ });
+ }
*previewStream = streams3_4[0].v3_2;
ASSERT_TRUE(ret.isOk());
}
@@ -4626,12 +5076,17 @@
V3_2::Stream *previewStream /*out*/,
HalStreamConfiguration *halStreamConfig /*out*/,
bool *supportsPartialResults /*out*/,
- uint32_t *partialResultCount /*out*/) {
+ uint32_t *partialResultCount /*out*/,
+ bool *useHalBufManager /*out*/,
+ sp<DeviceCb> *outCb /*out*/,
+ uint32_t streamConfigCounter) {
ASSERT_NE(nullptr, session);
ASSERT_NE(nullptr, previewStream);
ASSERT_NE(nullptr, halStreamConfig);
ASSERT_NE(nullptr, supportsPartialResults);
ASSERT_NE(nullptr, partialResultCount);
+ ASSERT_NE(nullptr, useHalBufManager);
+ ASSERT_NE(nullptr, outCb);
std::vector<AvailableStream> outputPreviewStreams;
::android::sp<ICameraDevice> device3_x;
@@ -4678,10 +5133,20 @@
*session = newSession;
});
ASSERT_TRUE(ret.isOk());
+ *outCb = cb;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
- castSession(*session, deviceVersion, &session3_3, &session3_4);
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
+ castSession(*session, deviceVersion, &session3_3, &session3_4, &session3_5);
+
+ *useHalBufManager = false;
+ status = find_camera_metadata_ro_entry(staticMeta,
+ ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION, &entry);
+ if ((0 == status) && (entry.count == 1)) {
+ *useHalBufManager = (entry.data.u8[0] ==
+ ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_HIDL_DEVICE_3_5);
+ }
outputPreviewStreams.clear();
auto rc = getAvailableOutputStreams(staticMeta,
@@ -4698,9 +5163,33 @@
::android::hardware::hidl_vec<V3_2::Stream> streams3_2 = {stream3_2};
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
createStreamConfiguration(streams3_2, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
+ ret = session3_5->constructDefaultRequestSettings(reqTemplate,
+ [&config3_5](auto status, const auto& req) {
+ ASSERT_EQ(Status::OK, status);
+ config3_5.v3_4.sessionParams = req;
+ });
+ ASSERT_TRUE(ret.isOk());
+ config3_5.streamConfigCounter = streamConfigCounter;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [&] (Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(1u, halConfig.streams.size());
+ halStreamConfig->streams.resize(1);
+ halStreamConfig->streams[0] = halConfig.streams[0].v3_3.v3_2;
+ if (*useHalBufManager) {
+ hidl_vec<V3_2::Stream> streams(1);
+ hidl_vec<V3_2::HalStream> halStreams(1);
+ streams[0] = stream3_2;
+ halStreams[0] = halConfig.streams[0].v3_3.v3_2;
+ cb->setCurrentStreamConfig(streams, halStreams);
+ }
+ });
+ } else if (session3_4 != nullptr) {
RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
ret = session3_4->constructDefaultRequestSettings(reqTemplate,
[&config3_4](auto status, const auto& req) {
@@ -4742,18 +5231,25 @@
//Cast camera device session to corresponding version
void CameraHidlTest::castSession(const sp<ICameraDeviceSession> &session, int32_t deviceVersion,
sp<device::V3_3::ICameraDeviceSession> *session3_3 /*out*/,
- sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/) {
+ sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/,
+ sp<device::V3_5::ICameraDeviceSession> *session3_5 /*out*/) {
ASSERT_NE(nullptr, session3_3);
ASSERT_NE(nullptr, session3_4);
+ ASSERT_NE(nullptr, session3_5);
switch (deviceVersion) {
- case CAMERA_DEVICE_API_VERSION_3_5:
+ case CAMERA_DEVICE_API_VERSION_3_5: {
+ auto castResult = device::V3_5::ICameraDeviceSession::castFrom(session);
+ ASSERT_TRUE(castResult.isOk());
+ *session3_5 = castResult;
+ }
+ [[fallthrough]];
case CAMERA_DEVICE_API_VERSION_3_4: {
auto castResult = device::V3_4::ICameraDeviceSession::castFrom(session);
ASSERT_TRUE(castResult.isOk());
*session3_4 = castResult;
- break;
}
+ [[fallthrough]];
case CAMERA_DEVICE_API_VERSION_3_3: {
auto castResult = device::V3_3::ICameraDeviceSession::castFrom(session);
ASSERT_TRUE(castResult.isOk());
@@ -4891,8 +5387,10 @@
retcode = find_camera_metadata_ro_entry(metadata,
ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT, &entry);
if ((0 == retcode) && (entry.count == 1)) {
- ASSERT_TRUE(entry.data.i32[0] == ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO
- || entry.data.i32[0] == ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR);
+ ASSERT_TRUE(entry.data.i32[0] == static_cast<int32_t>(
+ CameraMetadataEnumAndroidSensorInfoColorFilterArrangement::ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO)
+ || entry.data.i32[0] == static_cast<int32_t>(
+ CameraMetadataEnumAndroidSensorInfoColorFilterArrangement::ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR));
}
// Check availableRequestKeys
@@ -5004,6 +5502,33 @@
}
}
+void CameraHidlTest::verifyBuffersReturned(
+ sp<device::V3_2::ICameraDeviceSession> session,
+ int deviceVersion, int32_t streamId,
+ sp<DeviceCb> cb, uint32_t streamConfigCounter) {
+ sp<device::V3_3::ICameraDeviceSession> session3_3;
+ sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
+ ASSERT_NE(nullptr, session3_5.get());
+
+ hidl_vec<int32_t> streamIds(1);
+ streamIds[0] = streamId;
+ session3_5->signalStreamFlush(streamIds, /*streamConfigCounter*/streamConfigCounter);
+ cb->waitForBuffersReturned();
+}
+
+void CameraHidlTest::verifyBuffersReturned(
+ sp<device::V3_4::ICameraDeviceSession> session3_4,
+ hidl_vec<int32_t> streamIds, sp<DeviceCb> cb, uint32_t streamConfigCounter) {
+ auto castResult = device::V3_5::ICameraDeviceSession::castFrom(session3_4);
+ ASSERT_TRUE(castResult.isOk());
+ sp<device::V3_5::ICameraDeviceSession> session3_5 = castResult;
+ ASSERT_NE(nullptr, session3_5.get());
+
+ session3_5->signalStreamFlush(streamIds, /*streamConfigCounter*/streamConfigCounter);
+ cb->waitForBuffersReturned();
+}
// Open a device session with empty callbacks and return static metadata.
void CameraHidlTest::openEmptyDeviceSession(const std::string &name,
diff --git a/cas/1.0/default/Android.bp b/cas/1.0/default/Android.bp
index a80c47f..debb3e5 100644
--- a/cas/1.0/default/Android.bp
+++ b/cas/1.0/default/Android.bp
@@ -1,6 +1,5 @@
-cc_binary {
- name: "android.hardware.cas@1.0-service",
- vintf_fragments: ["android.hardware.cas@1.0-service.xml"],
+cc_defaults {
+ name: "cas_service_defaults",
defaults: ["hidl_defaults"],
vendor: true,
relative_install_path: "hw",
@@ -14,7 +13,6 @@
],
compile_multilib: "32",
- init_rc: ["android.hardware.cas@1.0-service.rc"],
shared_libs: [
"android.hardware.cas@1.0",
@@ -32,3 +30,19 @@
"media_plugin_headers",
],
}
+
+cc_binary {
+ name: "android.hardware.cas@1.0-service",
+ vintf_fragments: ["android.hardware.cas@1.0-service.xml"],
+ defaults: ["cas_service_defaults"],
+ init_rc: ["android.hardware.cas@1.0-service.rc"],
+}
+
+cc_binary {
+ name: "android.hardware.cas@1.0-service-lazy",
+ vintf_fragments: ["android.hardware.cas@1.0-service-lazy.xml"],
+ overrides: ["android.hardware.cas@1.0-service"],
+ defaults: ["cas_service_defaults"],
+ init_rc: ["android.hardware.cas@1.0-service-lazy.rc"],
+ cflags: ["-DLAZY_SERVICE"],
+}
diff --git a/cas/1.0/default/android.hardware.cas@1.0-service-lazy.rc b/cas/1.0/default/android.hardware.cas@1.0-service-lazy.rc
new file mode 100644
index 0000000..735cfbc
--- /dev/null
+++ b/cas/1.0/default/android.hardware.cas@1.0-service-lazy.rc
@@ -0,0 +1,9 @@
+service vendor.cas-hal-1-0 /vendor/bin/hw/android.hardware.cas@1.0-service
+ interface android.hardware.cas@1.0::IMediaCasService default
+ oneshot
+ disabled
+ class hal
+ user media
+ group mediadrm drmrpc
+ ioprio rt 4
+ writepid /dev/cpuset/foreground/tasks
diff --git a/cas/1.0/default/android.hardware.cas@1.0-service-lazy.xml b/cas/1.0/default/android.hardware.cas@1.0-service-lazy.xml
new file mode 100644
index 0000000..9b55370
--- /dev/null
+++ b/cas/1.0/default/android.hardware.cas@1.0-service-lazy.xml
@@ -0,0 +1,11 @@
+<manifest version="1.0" type="device">
+ <hal format="hidl">
+ <name>android.hardware.cas</name>
+ <transport>hwbinder</transport>
+ <version>1.0</version>
+ <interface>
+ <name>IMediaCasService</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
+</manifest>
diff --git a/cas/1.0/default/service.cpp b/cas/1.0/default/service.cpp
index 04a8ad9..2e6e55d 100644
--- a/cas/1.0/default/service.cpp
+++ b/cas/1.0/default/service.cpp
@@ -15,7 +15,11 @@
*/
//#define LOG_NDEBUG 0
+#ifdef LAZY_SERVICE
+#define LOG_TAG "android.hardware.cas@1.0-service-lazy"
+#else
#define LOG_TAG "android.hardware.cas@1.0-service"
+#endif
#include <binder/ProcessState.h>
#include <hidl/HidlTransportSupport.h>
@@ -25,24 +29,30 @@
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
-using android::hardware::cas::V1_0::implementation::MediaCasService;
+using android::hardware::LazyServiceRegistrar;
using android::hardware::cas::V1_0::IMediaCasService;
+using android::hardware::cas::V1_0::implementation::MediaCasService;
+
+#ifdef LAZY_SERVICE
+const bool kLazyService = true;
+#else
+const bool kLazyService = false;
+#endif
int main() {
- ALOGD("android.hardware.cas@1.0-service starting...");
-
- // The CAS HAL may communicate to other vendor components via
- // /dev/vndbinder
- android::ProcessState::initWithDriver("/dev/vndbinder");
-
configureRpcThreadpool(8, true /* callerWillJoin */);
// Setup hwbinder service
android::sp<IMediaCasService> service = new MediaCasService();
- android::status_t status = service->registerAsService();
- LOG_ALWAYS_FATAL_IF(
- status != android::OK,
- "Error while registering cas service: %d", status);
+ android::status_t status;
+ if (kLazyService) {
+ auto serviceRegistrar = std::make_shared<LazyServiceRegistrar>();
+ status = serviceRegistrar->registerServiceWithCallback(service);
+ } else {
+ status = service->registerAsService();
+ }
+ LOG_ALWAYS_FATAL_IF(status != android::OK, "Error while registering cas service: %d", status);
+
joinRpcThreadpool();
return 0;
}
diff --git a/compatibility_matrices/Android.bp b/compatibility_matrices/Android.bp
index 49674e3..b88d88f 100644
--- a/compatibility_matrices/Android.bp
+++ b/compatibility_matrices/Android.bp
@@ -73,5 +73,6 @@
"kernel_config_current_4.4",
"kernel_config_current_4.9",
"kernel_config_current_4.14",
+ "kernel_config_current_4.19",
]
}
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index fd996fb..ceb53be 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -186,6 +186,7 @@
<hal format="hidl" optional="true">
<name>android.hardware.gnss</name>
<version>1.0-1</version>
+ <version>2.0</version>
<interface>
<name>IGnss</name>
<instance>default</instance>
diff --git a/gnss/2.0/Android.bp b/gnss/2.0/Android.bp
new file mode 100644
index 0000000..39fe97d
--- /dev/null
+++ b/gnss/2.0/Android.bp
@@ -0,0 +1,21 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+ name: "android.hardware.gnss@2.0",
+ root: "android.hardware",
+ vndk: {
+ enabled: true,
+ },
+ srcs: [
+ "IGnss.hal",
+ "IGnssMeasurement.hal",
+ "IGnssMeasurementCallback.hal",
+ ],
+ interfaces: [
+ "android.hardware.gnss@1.0",
+ "android.hardware.gnss@1.1",
+ "android.hidl.base@1.0",
+ ],
+ gen_java: true,
+}
+
diff --git a/gnss/2.0/IGnss.hal b/gnss/2.0/IGnss.hal
new file mode 100644
index 0000000..a05f61a
--- /dev/null
+++ b/gnss/2.0/IGnss.hal
@@ -0,0 +1,34 @@
+/*
+ * 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.gnss@2.0;
+
+import @1.1::IGnss;
+
+import IGnssMeasurement;
+
+/** Represents the standard GNSS (Global Navigation Satellite System) interface. */
+interface IGnss extends @1.1::IGnss {
+ /**
+ * This method returns the IGnssMeasurement interface.
+ *
+ * Exactly one of getExtensionGnssMeasurement_1_1() and getExtensionGnssMeasurement_2_0() must
+ * return a non-null handle, and the other method must return nullptr.
+ *
+ * @return gnssMeasurementIface Handle to the IGnssMeasurement interface.
+ */
+ getExtensionGnssMeasurement_2_0() generates (IGnssMeasurement gnssMeasurementIface);
+};
\ No newline at end of file
diff --git a/gnss/2.0/IGnssMeasurement.hal b/gnss/2.0/IGnssMeasurement.hal
new file mode 100644
index 0000000..108f3d2
--- /dev/null
+++ b/gnss/2.0/IGnssMeasurement.hal
@@ -0,0 +1,51 @@
+/*
+ * 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.gnss@2.0;
+
+import @1.0::IGnssMeasurement;
+import @1.1::IGnssMeasurement;
+import IGnssMeasurementCallback;
+
+/**
+ * Extended interface for GNSS Measurements support.
+ */
+interface IGnssMeasurement extends @1.1::IGnssMeasurement {
+
+ /**
+ * Initializes the interface and registers the callback routines with the HAL. After a
+ * successful call to 'setCallback_2_0' the HAL must begin to provide updates at an average
+ * output rate of 1Hz (occasional intra-measurement time offsets in the range from 0-2000msec
+ * can be tolerated.)
+ *
+ * @param callback Handle to GnssMeasurement callback interface.
+ * @param enableFullTracking If true, GNSS chipset must switch off duty cycling. In such mode
+ * no clock discontinuities are expected and, when supported, carrier phase should be
+ * continuous in good signal conditions. All non-blacklisted, healthy constellations,
+ * satellites and frequency bands that the chipset supports must be reported in this mode.
+ * The GNSS chipset is allowed to consume more power in this mode. If false, API must behave
+ * as in HAL V1_0, optimizing power via duty cycling, constellations and frequency limits,
+ * etc.
+ *
+ * @return initRet Returns SUCCESS if successful. Returns ERROR_ALREADY_INIT if a callback has
+ * already been registered without a corresponding call to 'close'. Returns ERROR_GENERIC
+ * for any other error. The HAL must not generate any other updates upon returning this
+ * error code.
+ */
+ setCallback_2_0(IGnssMeasurementCallback callback, bool enableFullTracking)
+ generates (GnssMeasurementStatus initRet);
+
+};
diff --git a/gnss/2.0/IGnssMeasurementCallback.hal b/gnss/2.0/IGnssMeasurementCallback.hal
new file mode 100644
index 0000000..226934e
--- /dev/null
+++ b/gnss/2.0/IGnssMeasurementCallback.hal
@@ -0,0 +1,128 @@
+/*
+ * 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.gnss@2.0;
+
+import @1.0::IGnssMeasurementCallback;
+import @1.1::IGnssMeasurementCallback;
+
+/** The callback interface to report measurements from the HAL. */
+interface IGnssMeasurementCallback extends @1.1::IGnssMeasurementCallback {
+ /**
+ * Enumeration of available values for the GNSS Measurement's code type. Similar to the
+ * Attribute field described in Rinex 3.03, e.g., in Tables 4-10, and Table A2 at the Rinex 3.03
+ * Update 1 Document.
+ */
+ enum GnssMeasurementCodeType : uint8_t {
+ /** GALILEO E1A, GALILEO E6A, IRNSS L5A, IRNSS SA. */
+ CODE_TYPE_A = 0,
+
+ /** GALILEO E1B, GALILEO E6B, IRNSS L5B, IRNSS SB. */
+ CODE_TYPE_B = 1,
+
+ /**
+ * GPS L1 C/A, GPS L2 C/A, GLONASS G1 C/A, GLONASS G2 C/A, GALILEO E1C, GALILEO E6C, SBAS
+ * L1 C/A, QZSS L1 C/A, IRNSS L5C.
+ */
+ CODE_TYPE_C = 2,
+
+ /**
+ * GPS L5 I, GLONASS G3 I, GALILEO E5a I, GALILEO E5b I, GALILEO E5a+b I, SBAS L5 I, QZSS L5
+ * I, BDS B1 I, BDS B2 I, BDS B3 I.
+ */
+ CODE_TYPE_I = 3,
+
+ /** GPS L1C (P), GPS L2C (L), QZSS L1C (P), QZSS L2C (L), LEX(6) L. */
+ CODE_TYPE_L = 4,
+
+ /** GPS L1M, GPS L2M. */
+ CODE_TYPE_M = 5,
+
+ /** GPS L1P, GPS L2P, GLONASS G1P, GLONASS G2P. */
+ CODE_TYPE_P = 6,
+
+ /**
+ * GPS L5 Q, GLONASS G3 Q, GALILEO E5a Q, GALILEO E5b Q, GALILEO E5a+b Q, SBAS L5 Q, QZSS L5
+ * Q, BDS B1 Q, BDS B2 Q, BDS B3 Q.
+ */
+ CODE_TYPE_Q = 7,
+
+ /** GPS L1C (D), GPS L2C (M), QZSS L1C (D), QZSS L2C (M), LEX(6) S. */
+ CODE_TYPE_S = 8,
+
+ /** GPS L1 Z-tracking, GPS L2 Z-tracking. */
+ CODE_TYPE_W = 9,
+
+ /**
+ * GPS L1C (D+P), GPS L2C (M+L), GPS L5 (I+Q), GLONASS G3 (I+Q), GALILEO E1 (B+C), GALILEO
+ * E5a (I+Q), GALILEO E5b (I+Q), GALILEO E5a+b(I+Q), GALILEO E6 (B+C), SBAS L5 (I+Q), QZSS
+ * L1C (D+P), QZSS L2C (M+L), QZSS L5 (I+Q), LEX(6) (S+L), BDS B1 (I+Q), BDS B2 (I+Q), BDS
+ * B3 (I+Q), IRNSS L5 (B+C).
+ */
+ CODE_TYPE_X = 10,
+
+ /** GPS L1Y, GPS L2Y. */
+ CODE_TYPE_Y = 11,
+
+ /** GALILEO E1 (A+B+C), GALILEO E6 (A+B+C), QZSS L1-SAIF. */
+ CODE_TYPE_Z = 12,
+
+ /** GPS L1 codeless, GPS L2 codeless. */
+ CODE_TYPE_CODELESS = 13
+ };
+
+ /**
+ * Extends a GNSS Measurement, adding a GnssMeasurementCodeType.
+ */
+ struct GnssMeasurement {
+ /**
+ * GNSS measurement information for a single satellite and frequency, as in the 1.1
+ * version of the HAL with further clarification of the value reported in the
+ * accumulatedDeltaRangeM field, i.e., the alignment of the phase measurement will not be
+ * adjusted by the receiver so the in-phase and quadrature phase components will have a
+ * quarter cycle offset as they do when transmitted from the satellites. If the measurement
+ * is from a combination of the in-phase and quadrature phase components, then the alignment
+ * of the phase measurement will be aligned to the in-phase component.
+ */
+ @1.1::IGnssMeasurementCallback.GnssMeasurement v1_1;
+
+ /**
+ * The type of code that is currently being tracked in the GNSS measurement.
+ *
+ * For high precision applications the type of code being tracked needs to be considered
+ * in-order to properly apply code specific corrections to the psuedorange measurements.
+ */
+ GnssMeasurementCodeType codeType;
+ };
+
+ /**
+ * Complete set of GNSS Measurement data, same as 1.1 with additional enum in measurements.
+ */
+ struct GnssData {
+ /** The full set of satellite measurement observations. */
+ vec<GnssMeasurement> measurements;
+
+ /** The GNSS clock time reading. */
+ GnssClock clock;
+ };
+
+ /**
+ * Callback for the hal to pass a GnssData structure back to the client.
+ *
+ * @param data Contains a reading of GNSS measurements.
+ */
+ gnssMeasurementCb_2_0(GnssData data);
+};
diff --git a/gnss/2.0/default/Android.bp b/gnss/2.0/default/Android.bp
new file mode 100644
index 0000000..3c55578
--- /dev/null
+++ b/gnss/2.0/default/Android.bp
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+cc_binary {
+ name: "android.hardware.gnss@2.0-service",
+ init_rc: ["android.hardware.gnss@2.0-service.rc"],
+ relative_install_path: "hw",
+ vendor: true,
+ srcs: [
+ "Gnss.cpp",
+ "GnssMeasurement.cpp",
+ "service.cpp"
+ ],
+ shared_libs: [
+ "libhidlbase",
+ "libhidltransport",
+ "libutils",
+ "liblog",
+ "android.hardware.gnss@2.0",
+ "android.hardware.gnss@1.0",
+ "android.hardware.gnss@1.1",
+ ],
+}
diff --git a/gnss/2.0/default/Gnss.cpp b/gnss/2.0/default/Gnss.cpp
new file mode 100644
index 0000000..1170f73
--- /dev/null
+++ b/gnss/2.0/default/Gnss.cpp
@@ -0,0 +1,187 @@
+/*
+ * 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.
+ */
+
+#define LOG_TAG "Gnss"
+
+#include "Gnss.h"
+#include <log/log.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+sp<V1_1::IGnssCallback> Gnss::sGnssCallback = nullptr;
+
+// Methods from V1_0::IGnss follow.
+Return<bool> Gnss::setCallback(const sp<V1_0::IGnssCallback>&) {
+ // TODO implement
+ return bool{};
+}
+
+Return<bool> Gnss::start() {
+ // TODO implement
+ return bool{};
+}
+
+Return<bool> Gnss::stop() {
+ // TODO implement
+ return bool{};
+}
+
+Return<void> Gnss::cleanup() {
+ // TODO implement
+ return Void();
+}
+
+Return<bool> Gnss::injectTime(int64_t, int64_t, int32_t) {
+ // TODO implement
+ return bool{};
+}
+
+Return<bool> Gnss::injectLocation(double, double, float) {
+ // TODO implement
+ return bool{};
+}
+
+Return<void> Gnss::deleteAidingData(V1_0::IGnss::GnssAidingData) {
+ // TODO implement
+ return Void();
+}
+
+Return<bool> Gnss::setPositionMode(V1_0::IGnss::GnssPositionMode,
+ V1_0::IGnss::GnssPositionRecurrence, uint32_t, uint32_t,
+ uint32_t) {
+ // TODO implement
+ return bool{};
+}
+
+Return<sp<V1_0::IAGnssRil>> Gnss::getExtensionAGnssRil() {
+ // TODO implement
+ return sp<V1_0::IAGnssRil>{};
+}
+
+Return<sp<V1_0::IGnssGeofencing>> Gnss::getExtensionGnssGeofencing() {
+ // TODO implement
+ return sp<V1_0::IGnssGeofencing>{};
+}
+
+Return<sp<V1_0::IAGnss>> Gnss::getExtensionAGnss() {
+ // TODO implement
+ return sp<V1_0::IAGnss>{};
+}
+
+Return<sp<V1_0::IGnssNi>> Gnss::getExtensionGnssNi() {
+ // TODO implement
+ return sp<V1_0::IGnssNi>{};
+}
+
+Return<sp<V1_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement() {
+ // TODO implement
+ return sp<V1_0::IGnssMeasurement>{};
+}
+
+Return<sp<V1_0::IGnssNavigationMessage>> Gnss::getExtensionGnssNavigationMessage() {
+ // TODO implement
+ return sp<V1_0::IGnssNavigationMessage>{};
+}
+
+Return<sp<V1_0::IGnssXtra>> Gnss::getExtensionXtra() {
+ // TODO implement
+ return sp<V1_0::IGnssXtra>{};
+}
+
+Return<sp<V1_0::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration() {
+ // TODO implement
+ return sp<V1_0::IGnssConfiguration>{};
+}
+
+Return<sp<V1_0::IGnssDebug>> Gnss::getExtensionGnssDebug() {
+ // TODO implement
+ return sp<V1_0::IGnssDebug>{};
+}
+
+Return<sp<V1_0::IGnssBatching>> Gnss::getExtensionGnssBatching() {
+ // TODO implement
+ return sp<V1_0::IGnssBatching>{};
+}
+
+// Methods from V1_1::IGnss follow.
+Return<bool> Gnss::setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) {
+ ALOGD("Gnss::setCallback_1_1");
+ if (callback == nullptr) {
+ ALOGE("%s: Null callback ignored", __func__);
+ return false;
+ }
+
+ sGnssCallback = callback;
+
+ uint32_t capabilities = 0x0;
+ auto ret = sGnssCallback->gnssSetCapabilitesCb(capabilities);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
+
+ V1_1::IGnssCallback::GnssSystemInfo gnssInfo = {.yearOfHw = 2019};
+
+ ret = sGnssCallback->gnssSetSystemInfoCb(gnssInfo);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
+
+ auto gnssName = "Google Mock GNSS Implementation v2.0";
+ ret = sGnssCallback->gnssNameCb(gnssName);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
+
+ return true;
+}
+
+Return<bool> Gnss::setPositionMode_1_1(V1_0::IGnss::GnssPositionMode,
+ V1_0::IGnss::GnssPositionRecurrence, uint32_t, uint32_t,
+ uint32_t, bool) {
+ // TODO implement
+ return bool{};
+}
+
+Return<sp<V1_1::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration_1_1() {
+ // TODO implement
+ return sp<V1_1::IGnssConfiguration>{};
+}
+
+Return<sp<V1_1::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement_1_1() {
+ // TODO implement
+ return sp<V1_1::IGnssMeasurement>{};
+}
+
+Return<bool> Gnss::injectBestLocation(const V1_0::GnssLocation&) {
+ // TODO implement
+ return bool{};
+}
+
+// Methods from V2_0::IGnss follow.
+Return<sp<V2_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement_2_0() {
+ // TODO implement
+ return sp<V2_0::IGnssMeasurement>{};
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gnss/2.0/default/Gnss.h b/gnss/2.0/default/Gnss.h
new file mode 100644
index 0000000..17e439f
--- /dev/null
+++ b/gnss/2.0/default/Gnss.h
@@ -0,0 +1,87 @@
+/*
+ * 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.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V2_0_GNSS_H
+#define ANDROID_HARDWARE_GNSS_V2_0_GNSS_H
+
+#include <android/hardware/gnss/2.0/IGnss.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::sp;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+
+struct Gnss : public IGnss {
+ // Methods from V1_0::IGnss follow.
+ Return<bool> setCallback(const sp<V1_0::IGnssCallback>& callback) override;
+ Return<bool> start() override;
+ Return<bool> stop() override;
+ Return<void> cleanup() override;
+ Return<bool> injectTime(int64_t timeMs, int64_t timeReferenceMs,
+ int32_t uncertaintyMs) override;
+ Return<bool> injectLocation(double latitudeDegrees, double longitudeDegrees,
+ float accuracyMeters) override;
+ Return<void> deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) override;
+ Return<bool> setPositionMode(V1_0::IGnss::GnssPositionMode mode,
+ V1_0::IGnss::GnssPositionRecurrence recurrence,
+ uint32_t minIntervalMs, uint32_t preferredAccuracyMeters,
+ uint32_t preferredTimeMs) override;
+ Return<sp<V1_0::IAGnssRil>> getExtensionAGnssRil() override;
+ Return<sp<V1_0::IGnssGeofencing>> getExtensionGnssGeofencing() override;
+ Return<sp<V1_0::IAGnss>> getExtensionAGnss() override;
+ Return<sp<V1_0::IGnssNi>> getExtensionGnssNi() override;
+ Return<sp<V1_0::IGnssMeasurement>> getExtensionGnssMeasurement() override;
+ Return<sp<V1_0::IGnssNavigationMessage>> getExtensionGnssNavigationMessage() override;
+ Return<sp<V1_0::IGnssXtra>> getExtensionXtra() override;
+ Return<sp<V1_0::IGnssConfiguration>> getExtensionGnssConfiguration() override;
+ Return<sp<V1_0::IGnssDebug>> getExtensionGnssDebug() override;
+ Return<sp<V1_0::IGnssBatching>> getExtensionGnssBatching() override;
+
+ // Methods from V1_1::IGnss follow.
+ Return<bool> setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) override;
+ Return<bool> setPositionMode_1_1(V1_0::IGnss::GnssPositionMode mode,
+ V1_0::IGnss::GnssPositionRecurrence recurrence,
+ uint32_t minIntervalMs, uint32_t preferredAccuracyMeters,
+ uint32_t preferredTimeMs, bool lowPowerMode) override;
+ Return<sp<V1_1::IGnssConfiguration>> getExtensionGnssConfiguration_1_1() override;
+ Return<sp<V1_1::IGnssMeasurement>> getExtensionGnssMeasurement_1_1() override;
+ Return<bool> injectBestLocation(const V1_0::GnssLocation& location) override;
+
+ // Methods from V2_0::IGnss follow.
+ Return<sp<V2_0::IGnssMeasurement>> getExtensionGnssMeasurement_2_0() override;
+
+ private:
+ static sp<V1_1::IGnssCallback> sGnssCallback;
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V2_0_GNSS_H
diff --git a/gnss/2.0/default/GnssMeasurement.cpp b/gnss/2.0/default/GnssMeasurement.cpp
new file mode 100644
index 0000000..fbcdc12
--- /dev/null
+++ b/gnss/2.0/default/GnssMeasurement.cpp
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+#include "GnssMeasurement.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+// Methods from V1_0::IGnssMeasurement follow.
+Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback(
+ const sp<V1_0::IGnssMeasurementCallback>&) {
+ // TODO implement
+ return V1_0::IGnssMeasurement::GnssMeasurementStatus{};
+}
+
+Return<void> GnssMeasurement::close() {
+ // TODO implement
+ return Void();
+}
+
+// Methods from V1_1::IGnssMeasurement follow.
+Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback_1_1(
+ const sp<V1_1::IGnssMeasurementCallback>&, bool) {
+ // TODO implement
+ return V1_0::IGnssMeasurement::GnssMeasurementStatus{};
+}
+
+// Methods from V2_0::IGnssMeasurement follow.
+Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback_2_0(
+ const sp<V2_0::IGnssMeasurementCallback>&, bool) {
+ // TODO implement
+ return V1_0::IGnssMeasurement::GnssMeasurementStatus{};
+}
+
+// Methods from ::android::hidl::base::V1_0::IBase follow.
+
+// IGnssMeasurement* HIDL_FETCH_IGnssMeasurement(const char* /* name */) {
+// return new GnssMeasurement();
+//}
+//
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gnss/2.0/default/GnssMeasurement.h b/gnss/2.0/default/GnssMeasurement.h
new file mode 100644
index 0000000..8c621bb
--- /dev/null
+++ b/gnss/2.0/default/GnssMeasurement.h
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V2_0_GNSSMEASUREMENT_H
+#define ANDROID_HARDWARE_GNSS_V2_0_GNSSMEASUREMENT_H
+
+#include <android/hardware/gnss/2.0/IGnssMeasurement.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::sp;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+
+struct GnssMeasurement : public IGnssMeasurement {
+ // Methods from V1_0::IGnssMeasurement follow.
+ Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> setCallback(
+ const sp<V1_0::IGnssMeasurementCallback>& callback) override;
+ Return<void> close() override;
+
+ // Methods from V1_1::IGnssMeasurement follow.
+ Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> setCallback_1_1(
+ const sp<V1_1::IGnssMeasurementCallback>& callback, bool enableFullTracking) override;
+
+ // Methods from V2_0::IGnssMeasurement follow.
+ Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> setCallback_2_0(
+ const sp<V2_0::IGnssMeasurementCallback>& callback, bool enableFullTracking) override;
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSMEASUREMENT_H
diff --git a/gnss/2.0/default/OWNERS b/gnss/2.0/default/OWNERS
new file mode 100644
index 0000000..8da956c
--- /dev/null
+++ b/gnss/2.0/default/OWNERS
@@ -0,0 +1,5 @@
+wyattriley@google.com
+gomo@google.com
+smalkos@google.com
+yuhany@google.com
+aadmal@google.com
diff --git a/gnss/2.0/default/android.hardware.gnss@2.0-service.rc b/gnss/2.0/default/android.hardware.gnss@2.0-service.rc
new file mode 100644
index 0000000..a27240d
--- /dev/null
+++ b/gnss/2.0/default/android.hardware.gnss@2.0-service.rc
@@ -0,0 +1,4 @@
+service vendor.gnss-2-0 /vendor/bin/hw/android.hardware.gnss@2.0-service
+ class hal
+ user system
+ group system
diff --git a/gnss/2.0/default/service.cpp b/gnss/2.0/default/service.cpp
new file mode 100644
index 0000000..301d181
--- /dev/null
+++ b/gnss/2.0/default/service.cpp
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+#define LOG_TAG "android.hardware.gnss@2.0-service"
+
+#include <hidl/HidlSupport.h>
+#include <hidl/HidlTransportSupport.h>
+#include "Gnss.h"
+
+using ::android::OK;
+using ::android::sp;
+using ::android::hardware::configureRpcThreadpool;
+using ::android::hardware::joinRpcThreadpool;
+using ::android::hardware::gnss::V2_0::IGnss;
+using ::android::hardware::gnss::V2_0::implementation::Gnss;
+
+int main(int /* argc */, char* /* argv */ []) {
+ sp<IGnss> gnss = new Gnss();
+ configureRpcThreadpool(1, true /* will join */);
+ if (gnss->registerAsService() != OK) {
+ ALOGE("Could not register gnss 2.0 service.");
+ return 1;
+ }
+ joinRpcThreadpool();
+
+ ALOGE("Service exited!");
+ return 1;
+}
diff --git a/gnss/2.0/vts/OWNERS b/gnss/2.0/vts/OWNERS
new file mode 100644
index 0000000..0a7ce6c
--- /dev/null
+++ b/gnss/2.0/vts/OWNERS
@@ -0,0 +1,8 @@
+wyattriley@google.com
+gomo@google.com
+smalkos@google.com
+yuhany@google.com
+aadmal@google.com
+
+# VTS team
+yim@google.com
diff --git a/gnss/2.0/vts/functional/Android.bp b/gnss/2.0/vts/functional/Android.bp
new file mode 100644
index 0000000..7db142f
--- /dev/null
+++ b/gnss/2.0/vts/functional/Android.bp
@@ -0,0 +1,30 @@
+//
+// 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.
+//
+
+cc_test {
+ name: "VtsHalGnssV2_0TargetTest",
+ defaults: ["VtsHalTargetTestDefaults"],
+ srcs: [
+ "gnss_hal_test.cpp",
+ "gnss_hal_test_cases.cpp",
+ "VtsHalGnssV2_0TargetTest.cpp",
+ ],
+ static_libs: [
+ "android.hardware.gnss@1.0",
+ "android.hardware.gnss@1.1",
+ "android.hardware.gnss@2.0",
+ ],
+}
diff --git a/gnss/2.0/vts/functional/VtsHalGnssV2_0TargetTest.cpp b/gnss/2.0/vts/functional/VtsHalGnssV2_0TargetTest.cpp
new file mode 100644
index 0000000..ae36c50
--- /dev/null
+++ b/gnss/2.0/vts/functional/VtsHalGnssV2_0TargetTest.cpp
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+#define LOG_TAG "VtsHalGnssV2_0TargetTest"
+
+#include <VtsHalHidlTargetTestBase.h>
+
+#include "gnss_hal_test.h"
+
+int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(GnssHidlEnvironment::Instance());
+ ::testing::InitGoogleTest(&argc, argv);
+ GnssHidlEnvironment::Instance()->init(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ ALOGI("Test result = %d", status);
+ return status;
+}
diff --git a/gnss/2.0/vts/functional/gnss_hal_test.cpp b/gnss/2.0/vts/functional/gnss_hal_test.cpp
new file mode 100644
index 0000000..d7101a0
--- /dev/null
+++ b/gnss/2.0/vts/functional/gnss_hal_test.cpp
@@ -0,0 +1,129 @@
+/*
+ * 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.
+ */
+
+#define LOG_TAG "GnssHalTest"
+
+#include <gnss_hal_test.h>
+
+#include <chrono>
+
+// Implementations for the main test class for GNSS HAL
+GnssHalTest::GnssHalTest()
+ : info_called_count_(0),
+ capabilities_called_count_(0),
+ location_called_count_(0),
+ name_called_count_(0),
+ notify_count_(0) {}
+
+void GnssHalTest::SetUp() {
+ gnss_hal_ = ::testing::VtsHalHidlTargetTestBase::getService<IGnss>(
+ GnssHidlEnvironment::Instance()->getServiceName<IGnss>());
+ list_gnss_sv_status_.clear();
+ ASSERT_NE(gnss_hal_, nullptr);
+
+ SetUpGnssCallback();
+}
+
+void GnssHalTest::TearDown() {
+ if (gnss_hal_ != nullptr) {
+ gnss_hal_->cleanup();
+ }
+ if (notify_count_ > 0) {
+ ALOGW("%d unprocessed callbacks discarded", notify_count_);
+ }
+}
+
+void GnssHalTest::SetUpGnssCallback() {
+ gnss_cb_ = new GnssCallback(*this);
+ ASSERT_NE(gnss_cb_, nullptr);
+
+ auto result = gnss_hal_->setCallback_1_1(gnss_cb_);
+ if (!result.isOk()) {
+ ALOGE("result of failed setCallback %s", result.description().c_str());
+ }
+
+ ASSERT_TRUE(result.isOk());
+ ASSERT_TRUE(result);
+
+ /*
+ * All capabilities, name and systemInfo callbacks should trigger
+ */
+ EXPECT_EQ(std::cv_status::no_timeout, wait(TIMEOUT_SEC));
+ EXPECT_EQ(std::cv_status::no_timeout, wait(TIMEOUT_SEC));
+ EXPECT_EQ(std::cv_status::no_timeout, wait(TIMEOUT_SEC));
+
+ EXPECT_EQ(capabilities_called_count_, 1);
+ EXPECT_EQ(info_called_count_, 1);
+ EXPECT_EQ(name_called_count_, 1);
+}
+
+void GnssHalTest::notify() {
+ std::unique_lock<std::mutex> lock(mtx_);
+ notify_count_++;
+ cv_.notify_one();
+}
+
+std::cv_status GnssHalTest::wait(int timeout_seconds) {
+ std::unique_lock<std::mutex> lock(mtx_);
+
+ auto status = std::cv_status::no_timeout;
+ while (notify_count_ == 0) {
+ status = cv_.wait_for(lock, std::chrono::seconds(timeout_seconds));
+ if (status == std::cv_status::timeout) return status;
+ }
+ notify_count_--;
+ return status;
+}
+
+Return<void> GnssHalTest::GnssCallback::gnssSetSystemInfoCb(
+ const IGnssCallback::GnssSystemInfo& info) {
+ ALOGI("Info received, year %d", info.yearOfHw);
+ parent_.info_called_count_++;
+ parent_.last_info_ = info;
+ parent_.notify();
+ return Void();
+}
+
+Return<void> GnssHalTest::GnssCallback::gnssSetCapabilitesCb(uint32_t capabilities) {
+ ALOGI("Capabilities received %d", capabilities);
+ parent_.capabilities_called_count_++;
+ parent_.last_capabilities_ = capabilities;
+ parent_.notify();
+ return Void();
+}
+
+Return<void> GnssHalTest::GnssCallback::gnssNameCb(const android::hardware::hidl_string& name) {
+ ALOGI("Name received: %s", name.c_str());
+ parent_.name_called_count_++;
+ parent_.last_name_ = name;
+ parent_.notify();
+ return Void();
+}
+
+Return<void> GnssHalTest::GnssCallback::gnssLocationCb(const GnssLocation& location) {
+ ALOGI("Location received");
+ parent_.location_called_count_++;
+ parent_.last_location_ = location;
+ parent_.notify();
+ return Void();
+}
+
+Return<void> GnssHalTest::GnssCallback::gnssSvStatusCb(
+ const IGnssCallback::GnssSvStatus& svStatus) {
+ ALOGI("GnssSvStatus received");
+ parent_.list_gnss_sv_status_.emplace_back(svStatus);
+ return Void();
+}
diff --git a/gnss/2.0/vts/functional/gnss_hal_test.h b/gnss/2.0/vts/functional/gnss_hal_test.h
new file mode 100644
index 0000000..64f3575
--- /dev/null
+++ b/gnss/2.0/vts/functional/gnss_hal_test.h
@@ -0,0 +1,132 @@
+/*
+ * 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.
+ */
+
+#ifndef GNSS_HAL_TEST_H_
+#define GNSS_HAL_TEST_H_
+
+#include <android/hardware/gnss/2.0/IGnss.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
+
+#include <condition_variable>
+#include <list>
+#include <mutex>
+
+using android::hardware::Return;
+using android::hardware::Void;
+
+using android::hardware::gnss::V1_0::GnssLocation;
+
+using android::hardware::gnss::V1_0::GnssLocationFlags;
+using android::hardware::gnss::V1_1::IGnssCallback;
+using android::hardware::gnss::V2_0::IGnss;
+
+using android::sp;
+
+#define TIMEOUT_SEC 2 // for basic commands/responses
+
+// Test environment for GNSS HIDL HAL.
+class GnssHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static GnssHidlEnvironment* Instance() {
+ static GnssHidlEnvironment* instance = new GnssHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IGnss>(); }
+
+ private:
+ GnssHidlEnvironment() {}
+};
+
+// The main test class for GNSS HAL.
+class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
+ public:
+ GnssHalTest();
+
+ virtual void SetUp() override;
+
+ virtual void TearDown() override;
+
+ /* Used as a mechanism to inform the test that a callback has occurred */
+ void notify();
+
+ /* Test code calls this function to wait for a callback */
+ std::cv_status wait(int timeout_seconds);
+
+ /* Callback class for data & Event. */
+ class GnssCallback : public IGnssCallback {
+ public:
+ GnssHalTest& parent_;
+
+ GnssCallback(GnssHalTest& parent) : parent_(parent){};
+
+ virtual ~GnssCallback() = default;
+
+ // Dummy callback handlers
+ Return<void> gnssStatusCb(const IGnssCallback::GnssStatusValue /* status */) override {
+ return Void();
+ }
+ Return<void> gnssNmeaCb(int64_t /* timestamp */,
+ const android::hardware::hidl_string& /* nmea */) override {
+ return Void();
+ }
+ Return<void> gnssAcquireWakelockCb() override { return Void(); }
+ Return<void> gnssReleaseWakelockCb() override { return Void(); }
+ Return<void> gnssRequestLocationCb(bool /* independentFromGnss */) override {
+ return Void();
+ }
+ Return<void> gnssRequestTimeCb() override { return Void(); }
+ // Actual (test) callback handlers
+ Return<void> gnssNameCb(const android::hardware::hidl_string& name) override;
+ Return<void> gnssLocationCb(const GnssLocation& location) override;
+ Return<void> gnssSetCapabilitesCb(uint32_t capabilities) override;
+ Return<void> gnssSetSystemInfoCb(const IGnssCallback::GnssSystemInfo& info) override;
+ Return<void> gnssSvStatusCb(const IGnssCallback::GnssSvStatus& svStatus) override;
+ };
+
+ /*
+ * SetUpGnssCallback:
+ * Set GnssCallback and verify the result.
+ */
+ void SetUpGnssCallback();
+
+ sp<IGnss> gnss_hal_; // GNSS HAL to call into
+ sp<IGnssCallback> gnss_cb_; // Primary callback interface
+
+ /* Count of calls to set the following items, and the latest item (used by
+ * test.)
+ */
+ int info_called_count_;
+ IGnssCallback::GnssSystemInfo last_info_;
+ uint32_t last_capabilities_;
+ int capabilities_called_count_;
+ int location_called_count_;
+ GnssLocation last_location_;
+ list<IGnssCallback::GnssSvStatus> list_gnss_sv_status_;
+
+ int name_called_count_;
+ android::hardware::hidl_string last_name_;
+
+ private:
+ std::mutex mtx_;
+ std::condition_variable cv_;
+ int notify_count_;
+};
+
+#endif // GNSS_HAL_TEST_H_
diff --git a/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp b/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp
new file mode 100644
index 0000000..12a15e8
--- /dev/null
+++ b/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+#define LOG_TAG "GnssHalTestCases"
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <gnss_hal_test.h>
+
+using android::hardware::hidl_vec;
+
+using IGnssMeasurement_2_0 = android::hardware::gnss::V2_0::IGnssMeasurement;
+using IGnssMeasurement_1_1 = android::hardware::gnss::V1_1::IGnssMeasurement;
+
+/*
+ * SetupTeardownCreateCleanup:
+ * Requests the gnss HAL then calls cleanup
+ *
+ * Empty test fixture to verify basic Setup & Teardown
+ */
+TEST_F(GnssHalTest, SetupTeardownCreateCleanup) {}
+
+/*
+ * TestGnssMeasurementCallback:
+ * Gets the GnssMeasurementExtension and verify that it returns an actual extension.
+ */
+TEST_F(GnssHalTest, TestGnssMeasurementCallback) {
+ auto gnssMeasurement_2_0 = gnss_hal_->getExtensionGnssMeasurement_2_0();
+ auto gnssMeasurement_1_1 = gnss_hal_->getExtensionGnssMeasurement_1_1();
+ ASSERT_TRUE(gnssMeasurement_2_0.isOk() || gnssMeasurement_1_1.isOk());
+ if (last_capabilities_ & IGnssCallback::Capabilities::MEASUREMENTS) {
+ sp<IGnssMeasurement_2_0> iGnssMeas_2_0 = gnssMeasurement_2_0;
+ sp<IGnssMeasurement_1_1> iGnssMeas_1_1 = gnssMeasurement_1_1;
+ // Exactly one interface is non-null.
+ ASSERT_TRUE((iGnssMeas_1_1 != nullptr) != (iGnssMeas_2_0 != nullptr));
+ }
+}
diff --git a/neuralnetworks/1.2/Android.bp b/neuralnetworks/1.2/Android.bp
index 5a661e0..e155bbd 100644
--- a/neuralnetworks/1.2/Android.bp
+++ b/neuralnetworks/1.2/Android.bp
@@ -19,8 +19,10 @@
"Model",
"Operand",
"OperandType",
+ "OperandTypeRange",
"Operation",
"OperationType",
+ "OperationTypeRange",
],
gen_java: false,
}
diff --git a/radio/1.4/Android.bp b/radio/1.4/Android.bp
index 02c6cad..a450f20 100644
--- a/radio/1.4/Android.bp
+++ b/radio/1.4/Android.bp
@@ -22,21 +22,21 @@
],
types: [
"AccessNetwork",
+ "CardStatus",
"CellConfigLte",
"CellInfo",
"CellInfoLte",
- "CardStatus",
"DataProfileInfo",
"DataRegStateResult",
"EmergencyNumber",
"EmergencyNumberSource",
"EmergencyServiceCategory",
"FrequencyRange",
- "RadioFrequencyInfo",
- "RadioTechnology",
- "PhysicalChannelConfig",
"LteVopsInfo",
"NetworkScanResult",
+ "PhysicalChannelConfig",
+ "RadioFrequencyInfo",
+ "RadioTechnology",
],
gen_java: true,
}
diff --git a/radio/config/1.1/Android.bp b/radio/config/1.1/Android.bp
index f228704..10c4c98 100644
--- a/radio/config/1.1/Android.bp
+++ b/radio/config/1.1/Android.bp
@@ -11,9 +11,10 @@
"IRadioConfigResponse.hal",
],
interfaces: [
- "android.hardware.radio@1.0",
"android.hardware.radio.config@1.0",
+ "android.hardware.radio@1.0",
"android.hidl.base@1.0",
],
gen_java: true,
}
+
diff --git a/radio/config/1.2/Android.bp b/radio/config/1.2/Android.bp
index c1eeb35..3e6a425 100644
--- a/radio/config/1.2/Android.bp
+++ b/radio/config/1.2/Android.bp
@@ -12,9 +12,9 @@
"IRadioConfigResponse.hal",
],
interfaces: [
- "android.hardware.radio@1.0",
"android.hardware.radio.config@1.0",
"android.hardware.radio.config@1.1",
+ "android.hardware.radio@1.0",
"android.hidl.base@1.0",
],
types: [
@@ -22,3 +22,4 @@
],
gen_java: true,
}
+
diff --git a/wifi/supplicant/1.2/Android.bp b/wifi/supplicant/1.2/Android.bp
index 93ce573..529dad4 100644
--- a/wifi/supplicant/1.2/Android.bp
+++ b/wifi/supplicant/1.2/Android.bp
@@ -8,6 +8,7 @@
},
srcs: [
"ISupplicant.hal",
+ "ISupplicantP2pIface.hal",
"ISupplicantStaIface.hal",
"ISupplicantStaNetwork.hal",
],
diff --git a/wifi/supplicant/1.2/ISupplicantP2pIface.hal b/wifi/supplicant/1.2/ISupplicantP2pIface.hal
new file mode 100644
index 0000000..7f6970f
--- /dev/null
+++ b/wifi/supplicant/1.2/ISupplicantP2pIface.hal
@@ -0,0 +1,71 @@
+/*
+ * Copyright 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.wifi.supplicant@1.2;
+
+import @1.0::ISupplicantP2pIface;
+import @1.0::MacAddress;
+import @1.0::Ssid;
+import @1.0::SupplicantStatus;
+
+/**
+ * Interface exposed by the supplicant for each P2P mode network
+ * interface (e.g p2p0) it controls.
+ * To use 1.2 features you must cast specific interfaces returned from the
+ * 1.2 HAL. For example V1_2::ISupplicant::addIface() adds V1_2::ISupplicantIface,
+ * which can be cast to V1_2::ISupplicantP2pIface.
+ */
+interface ISupplicantP2pIface extends @1.0::ISupplicantP2pIface {
+ /**
+ * Set up a P2P group owner or join a group as a group client
+ * with the specified configuration.
+ *
+ * If joinExistingGroup is false, this device sets up a P2P group owner manually (i.e.,
+ * without group owner negotiation with a specific peer) with the specified SSID,
+ * passphrase, persistent mode, and frequency/band.
+ *
+ * If joinExistingGroup is true, this device acts as a group client and joins the group
+ * whose network name and group owner's MAC address matches the specified SSID
+ * and peer address without WPS process. If peerAddress is 00:00:00:00:00:00, the first found
+ * group whose network name matches the specified SSID is joined.
+ *
+ * @param ssid The SSID of this group.
+ * @param pskPassphrase The passphrase of this group.
+ * @param persistent Used to request a persistent group to be formed,
+ * only applied for the group owner.
+ * @param freq The required frequency or band for this group.
+ * only applied for the group owner.
+ * The following values are supported:
+ * 0: automatic channel selection,
+ * 2: for 2.4GHz channels
+ * 5: for 5GHz channels
+ * specific frequency, i.e., 2412, 5500, etc.
+ * If an invalid band or unsupported frequency are specified, it fails.
+ * @param peerAddress the group owner's MAC address, only applied for the group client.
+ * If the MAC is "00:00:00:00:00:00", the device must try to find a peer
+ * whose network name matches the specified SSID.
+ * @param joinExistingGroup if true, join a group as a group client; otherwise,
+ * create a group as a group owner.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ addGroup_1_2(Ssid ssid, string pskPassphrase, bool persistent,
+ uint32_t freq, MacAddress peerAddress, bool joinExistingGroup)
+ generates (SupplicantStatus status);
+};