Merge "Add mnc and modify docs for emergencyDial"
diff --git a/audio/5.0/config/audio_policy_configuration.xsd b/audio/5.0/config/audio_policy_configuration.xsd
index 311b9c1..b0927b2 100644
--- a/audio/5.0/config/audio_policy_configuration.xsd
+++ b/audio/5.0/config/audio_policy_configuration.xsd
@@ -281,6 +281,19 @@
<xs:enumeration value="AUDIO_DEVICE_IN_STUB"/>
</xs:restriction>
</xs:simpleType>
+ <xs:simpleType name="vendorExtension">
+ <!-- Vendor extension names must be prefixed by "VX_" to distinguish them from AOSP values.
+ Vendor are encouraged to namespace their module names to avoid conflicts.
+ Example for an hypothetical Google virtual reality device:
+ <devicePort tagName="VR" type="VX_GOOGLE_VR" role="sink">
+ -->
+ <xs:restriction base="xs:string">
+ <xs:pattern value="VX_[_a-zA-Z0-9]+"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="extendableAudioDevice">
+ <xs:union memberTypes="audioDevice vendorExtension"/>
+ </xs:simpleType>
<!-- Enum values of audio_format_t in audio.h
TODO: generate from hidl to avoid manual sync. -->
<xs:simpleType name="audioFormat">
@@ -353,6 +366,9 @@
<xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_XHE"/>
</xs:restriction>
</xs:simpleType>
+ <xs:simpleType name="extendableAudioFormat">
+ <xs:union memberTypes="audioFormat vendorExtension"/>
+ </xs:simpleType>
<!-- Enum values of audio::common::4_0::AudioUsage
TODO: generate from HIDL to avoid manual sync. -->
<xs:simpleType name="audioUsage">
@@ -395,7 +411,7 @@
</xs:simpleType>
<xs:complexType name="profile">
<xs:attribute name="name" type="xs:token" use="optional"/>
- <xs:attribute name="format" type="audioFormat" use="optional"/>
+ <xs:attribute name="format" type="extendableAudioFormat" use="optional"/>
<xs:attribute name="samplingRates" type="samplingRates" use="optional"/>
<xs:attribute name="channelMasks" type="channelMask" use="optional"/>
</xs:complexType>
@@ -432,7 +448,7 @@
<xs:element name="gains" type="gains" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="tagName" type="xs:token" use="required"/>
- <xs:attribute name="type" type="audioDevice" use="required"/>
+ <xs:attribute name="type" type="extendableAudioDevice" use="required"/>
<xs:attribute name="role" type="role" use="required"/>
<xs:attribute name="address" type="xs:string" use="optional" default=""/>
<!-- Note that XSD 1.0 can not check that a type only has one default. -->
diff --git a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
index c523013..e36f4d9 100644
--- a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
+++ b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
@@ -512,12 +512,12 @@
// TODO(b/69958777): see FmTune workaround
std::this_thread::sleep_for(gTuneWorkaround);
- EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged_, _);
+ EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged_, _).Times(AnyNumber());
auto result = mSession->scan(true /* up */, true /* skip subchannel */);
EXPECT_EQ(Result::OK, result);
EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChanged_, timeout::tune);
- EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged_, _);
+ EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged_, _).Times(AnyNumber());
result = mSession->scan(false /* down */, false /* don't skip subchannel */);
EXPECT_EQ(Result::OK, result);
EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChanged_, timeout::tune);
@@ -546,7 +546,7 @@
EXPECT_EQ(Result::OK, result);
EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChanged_, timeout::tune);
- EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged_, _);
+ EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged_, _).Times(AnyNumber());
result = mSession->step(false /* down */);
EXPECT_EQ(Result::OK, result);
EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChanged_, timeout::tune);
diff --git a/camera/common/1.0/default/CameraModule.cpp b/camera/common/1.0/default/CameraModule.cpp
index 9c2b02b..08354b3 100644
--- a/camera/common/1.0/default/CameraModule.cpp
+++ b/camera/common/1.0/default/CameraModule.cpp
@@ -452,6 +452,16 @@
return res;
}
+int CameraModule::isStreamCombinationSupported(int cameraId, camera_stream_combination_t *streams) {
+ int res = INVALID_OPERATION;
+ if (mModule->is_stream_combination_supported != NULL) {
+ ATRACE_BEGIN("camera_module->is_stream_combination_supported");
+ res = mModule->is_stream_combination_supported(cameraId, streams);
+ ATRACE_END();
+ }
+ return res;
+}
+
status_t CameraModule::filterOpenErrorCode(status_t err) {
switch(err) {
case NO_ERROR:
diff --git a/camera/common/1.0/default/include/CameraModule.h b/camera/common/1.0/default/include/CameraModule.h
index aee9654..ee75e72 100644
--- a/camera/common/1.0/default/include/CameraModule.h
+++ b/camera/common/1.0/default/include/CameraModule.h
@@ -66,6 +66,7 @@
// Only used by CameraProvider
void removeCamera(int cameraId);
int getPhysicalCameraInfo(int physicalCameraId, camera_metadata_t **physicalInfo);
+ int isStreamCombinationSupported(int cameraId, camera_stream_combination_t *streams);
private:
// Derive camera characteristics keys defined after HAL device version
diff --git a/camera/device/3.4/default/ExternalCameraDeviceSession.cpp b/camera/device/3.4/default/ExternalCameraDeviceSession.cpp
index 4ef5fc9..66b17db 100644
--- a/camera/device/3.4/default/ExternalCameraDeviceSession.cpp
+++ b/camera/device/3.4/default/ExternalCameraDeviceSession.cpp
@@ -2163,7 +2163,8 @@
}
}
-bool ExternalCameraDeviceSession::isSupported(const Stream& stream) {
+bool ExternalCameraDeviceSession::isSupported(const Stream& stream,
+ const std::vector<SupportedV4L2Format>& supportedFormats) {
int32_t ds = static_cast<int32_t>(stream.dataSpace);
PixelFormat fmt = stream.format;
uint32_t width = stream.width;
@@ -2206,7 +2207,7 @@
// Assume we can convert any V4L2 format to any of supported output format for now, i.e,
// ignoring v4l2Fmt.fourcc for now. Might need more subtle check if we support more v4l format
// in the futrue.
- for (const auto& v4l2Fmt : mSupportedFormats) {
+ for (const auto& v4l2Fmt : supportedFormats) {
if (width == v4l2Fmt.width && height == v4l2Fmt.height) {
return true;
}
@@ -2541,11 +2542,9 @@
mV4L2BufferReturned.notify_one();
}
-Status ExternalCameraDeviceSession::configureStreams(
+Status ExternalCameraDeviceSession::isStreamCombinationSupported(
const V3_2::StreamConfiguration& config,
- V3_3::HalStreamConfiguration* out,
- uint32_t blobBufferSize) {
- ATRACE_CALL();
+ const std::vector<SupportedV4L2Format>& supportedFormats) {
if (config.operationMode != StreamConfigurationMode::NORMAL_MODE) {
ALOGE("%s: unsupported operation mode: %d", __FUNCTION__, config.operationMode);
return Status::ILLEGAL_ARGUMENT;
@@ -2560,7 +2559,7 @@
int numStallStream = 0;
for (const auto& stream : config.streams) {
// Check if the format/width/height combo is supported
- if (!isSupported(stream)) {
+ if (!isSupported(stream, supportedFormats)) {
return Status::ILLEGAL_ARGUMENT;
}
if (stream.format == PixelFormat::BLOB) {
@@ -2582,7 +2581,21 @@
return Status::ILLEGAL_ARGUMENT;
}
- Status status = initStatus();
+ return Status::OK;
+}
+
+Status ExternalCameraDeviceSession::configureStreams(
+ const V3_2::StreamConfiguration& config,
+ V3_3::HalStreamConfiguration* out,
+ uint32_t blobBufferSize) {
+ ATRACE_CALL();
+
+ Status status = isStreamCombinationSupported(config, mSupportedFormats);
+ if (status != Status::OK) {
+ return status;
+ }
+
+ status = initStatus();
if (status != Status::OK) {
return status;
}
diff --git a/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraDeviceSession.h b/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraDeviceSession.h
index cabeaa4..9cc55cb 100644
--- a/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraDeviceSession.h
+++ b/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraDeviceSession.h
@@ -193,13 +193,16 @@
int configureV4l2StreamLocked(const SupportedV4L2Format& fmt, double fps = 0.0);
int v4l2StreamOffLocked();
int setV4l2FpsLocked(double fps);
+ static Status isStreamCombinationSupported(const V3_2::StreamConfiguration& config,
+ const std::vector<SupportedV4L2Format>& supportedFormats);
// TODO: change to unique_ptr for better tracking
sp<V4L2Frame> dequeueV4l2FrameLocked(/*out*/nsecs_t* shutterTs); // Called with mLock hold
void enqueueV4l2Frame(const sp<V4L2Frame>&);
// Check if input Stream is one of supported stream setting on this device
- bool isSupported(const Stream&);
+ static bool isSupported(const Stream& stream,
+ const std::vector<SupportedV4L2Format>& supportedFormats);
// Validate and import request's output buffers and acquire fence
virtual Status importRequestLocked(
diff --git a/camera/device/3.5/ICameraDevice.hal b/camera/device/3.5/ICameraDevice.hal
index a77380f..d9f2837 100644
--- a/camera/device/3.5/ICameraDevice.hal
+++ b/camera/device/3.5/ICameraDevice.hal
@@ -19,6 +19,7 @@
import android.hardware.camera.common@1.0::Status;
import @3.2::CameraMetadata;
import @3.2::ICameraDevice;
+import @3.4::StreamConfiguration;
/**
* Camera device interface
@@ -75,4 +76,41 @@
getPhysicalCameraCharacteristics(string physicalCameraId)
generates (Status status, CameraMetadata cameraCharacteristics);
+
+ /**
+ * isStreamCombinationSupported:
+ *
+ * Check for device support of specific camera stream combination.
+ *
+ * The streamList must contain at least one output-capable stream, and may
+ * not contain more than one input-capable stream.
+ *
+ * ------------------------------------------------------------------------
+ *
+ * Preconditions:
+ *
+ * The framework can call this method at any time before, during and
+ * after active session configuration. This means that calls must not
+ * impact the performance of pending camera requests in any way. In
+ * particular there must not be any glitches or delays during normal
+ * camera streaming.
+ *
+ * Performance requirements:
+ * This call is expected to be significantly faster than stream
+ * configuration. In general HW and SW camera settings must not be
+ * changed and there must not be a user-visible impact on camera performance.
+ *
+ * @return Status Status code for the operation, one of:
+ * OK:
+ * On successful stream combination query.
+ * METHOD_NOT_SUPPORTED:
+ * The camera device does not support stream combination query.
+ * INTERNAL_ERROR:
+ * The stream combination query cannot complete due to internal
+ * error.
+ * @return true in case the stream combination is supported, false otherwise.
+ *
+ */
+ isStreamCombinationSupported(@3.4::StreamConfiguration streams)
+ generates (Status status, bool queryStatus);
};
diff --git a/camera/device/3.5/default/CameraDevice.cpp b/camera/device/3.5/default/CameraDevice.cpp
index a6969af..cffda4e 100644
--- a/camera/device/3.5/default/CameraDevice.cpp
+++ b/camera/device/3.5/default/CameraDevice.cpp
@@ -95,6 +95,57 @@
return Void();
}
+Return<void> CameraDevice::isStreamCombinationSupported(const V3_4::StreamConfiguration& streams,
+ V3_5::ICameraDevice::isStreamCombinationSupported_cb _hidl_cb) {
+ Status status;
+ bool streamsSupported = false;
+
+ // Require module 2.5+ version.
+ if (mModule->getModuleApiVersion() < CAMERA_MODULE_API_VERSION_2_5) {
+ ALOGE("%s: is_stream_combination_supported must be called on camera module 2.5 or "\
+ "newer", __FUNCTION__);
+ status = Status::INTERNAL_ERROR;
+ } else {
+ camera_stream_combination_t streamComb{};
+ streamComb.operation_mode = static_cast<uint32_t> (streams.operationMode);
+ streamComb.num_streams = streams.streams.size();
+ camera_stream_t *streamBuffer = new camera_stream_t[streamComb.num_streams];
+
+ size_t i = 0;
+ for (const auto &it : streams.streams) {
+ streamBuffer[i].stream_type = static_cast<int> (it.v3_2.streamType);
+ streamBuffer[i].width = it.v3_2.width;
+ streamBuffer[i].height = it.v3_2.height;
+ streamBuffer[i].format = static_cast<int> (it.v3_2.format);
+ streamBuffer[i].data_space = static_cast<android_dataspace_t> (it.v3_2.dataSpace);
+ streamBuffer[i].usage = static_cast<uint32_t> (it.v3_2.usage);
+ streamBuffer[i].physical_camera_id = it.physicalCameraId.c_str();
+ streamBuffer[i++].rotation = static_cast<int> (it.v3_2.rotation);
+ }
+ streamComb.streams = streamBuffer;
+ auto res = mModule->isStreamCombinationSupported(mCameraIdInt, &streamComb);
+ switch (res) {
+ case NO_ERROR:
+ streamsSupported = true;
+ status = Status::OK;
+ break;
+ case BAD_VALUE:
+ status = Status::OK;
+ break;
+ case INVALID_OPERATION:
+ status = Status::METHOD_NOT_SUPPORTED;
+ break;
+ default:
+ ALOGE("%s: Unexpected error: %d", __FUNCTION__, res);
+ status = Status::INTERNAL_ERROR;
+ };
+ delete [] streamBuffer;
+ }
+
+ _hidl_cb(status, streamsSupported);
+ return Void();
+}
+
// End of methods from ::android::hardware::camera::device::V3_2::ICameraDevice.
} // namespace implementation
diff --git a/camera/device/3.5/default/ExternalCameraDevice.cpp b/camera/device/3.5/default/ExternalCameraDevice.cpp
index e8d14b5..6a0b51e 100644
--- a/camera/device/3.5/default/ExternalCameraDevice.cpp
+++ b/camera/device/3.5/default/ExternalCameraDevice.cpp
@@ -86,6 +86,27 @@
return OK;
}
+Return<void> ExternalCameraDevice::isStreamCombinationSupported(
+ const V3_4::StreamConfiguration& streams,
+ V3_5::ICameraDevice::isStreamCombinationSupported_cb _hidl_cb) {
+
+ if (isInitFailed()) {
+ ALOGE("%s: camera %s. camera init failed!", __FUNCTION__, mCameraId.c_str());
+ _hidl_cb(Status::INTERNAL_ERROR, false);
+ return Void();
+ }
+
+ hidl_vec<V3_2::Stream> streamsV3_2(streams.streams.size());
+ size_t i = 0;
+ for (const auto& it : streams.streams) {
+ streamsV3_2[i++] = it.v3_2;
+ }
+ V3_2::StreamConfiguration streamConfig = {streamsV3_2, streams.operationMode};
+ auto status = ExternalCameraDeviceSession::isStreamCombinationSupported(streamConfig,
+ mSupportedFormats);
+ _hidl_cb(Status::OK, Status::OK == status);
+ return Void();
+}
#undef UPDATE
} // namespace implementation
diff --git a/camera/device/3.5/default/include/device_v3_5_impl/CameraDevice_3_5.h b/camera/device/3.5/default/include/device_v3_5_impl/CameraDevice_3_5.h
index 6bdc60f..76c8cf8 100644
--- a/camera/device/3.5/default/include/device_v3_5_impl/CameraDevice_3_5.h
+++ b/camera/device/3.5/default/include/device_v3_5_impl/CameraDevice_3_5.h
@@ -64,6 +64,10 @@
Return<void> getPhysicalCameraCharacteristics(const hidl_string& physicalCameraId,
V3_5::ICameraDevice::getPhysicalCameraCharacteristics_cb _hidl_cb);
+ Return<void> isStreamCombinationSupported(
+ const V3_4::StreamConfiguration& streams,
+ V3_5::ICameraDevice::isStreamCombinationSupported_cb _hidl_cb);
+
private:
struct TrampolineDeviceInterface_3_5 : public ICameraDevice {
TrampolineDeviceInterface_3_5(sp<CameraDevice> parent) :
@@ -96,6 +100,13 @@
V3_5::ICameraDevice::getPhysicalCameraCharacteristics_cb _hidl_cb) override {
return mParent->getPhysicalCameraCharacteristics(physicalCameraId, _hidl_cb);
}
+
+ virtual Return<void> isStreamCombinationSupported(
+ const V3_4::StreamConfiguration& streams,
+ V3_5::ICameraDevice::isStreamCombinationSupported_cb _hidl_cb) override {
+ return mParent->isStreamCombinationSupported(streams, _hidl_cb);
+ }
+
private:
sp<CameraDevice> mParent;
};
diff --git a/camera/device/3.5/default/include/ext_device_v3_5_impl/ExternalCameraDeviceSession.h b/camera/device/3.5/default/include/ext_device_v3_5_impl/ExternalCameraDeviceSession.h
index 4d2d6b7..aa119fc 100644
--- a/camera/device/3.5/default/include/ext_device_v3_5_impl/ExternalCameraDeviceSession.h
+++ b/camera/device/3.5/default/include/ext_device_v3_5_impl/ExternalCameraDeviceSession.h
@@ -90,6 +90,12 @@
return new TrampolineSessionInterface_3_5(this);
}
+ static Status isStreamCombinationSupported(const V3_2::StreamConfiguration& config,
+ const std::vector<SupportedV4L2Format>& supportedFormats) {
+ return V3_4::implementation::ExternalCameraDeviceSession::isStreamCombinationSupported(
+ config, supportedFormats);
+ }
+
protected:
// Methods from v3.4 and earlier will trampoline to inherited implementation
Return<void> configureStreams_3_5(
diff --git a/camera/device/3.5/default/include/ext_device_v3_5_impl/ExternalCameraDevice_3_5.h b/camera/device/3.5/default/include/ext_device_v3_5_impl/ExternalCameraDevice_3_5.h
index 7db86dc..b73490c 100644
--- a/camera/device/3.5/default/include/ext_device_v3_5_impl/ExternalCameraDevice_3_5.h
+++ b/camera/device/3.5/default/include/ext_device_v3_5_impl/ExternalCameraDevice_3_5.h
@@ -67,6 +67,10 @@
Return<void> getPhysicalCameraCharacteristics(const hidl_string& physicalCameraId,
V3_5::ICameraDevice::getPhysicalCameraCharacteristics_cb _hidl_cb);
+ Return<void> isStreamCombinationSupported(
+ const V3_4::StreamConfiguration& streams,
+ V3_5::ICameraDevice::isStreamCombinationSupported_cb _hidl_cb);
+
protected:
virtual sp<V3_4::implementation::ExternalCameraDeviceSession> createSession(
const sp<V3_2::ICameraDeviceCallback>&,
@@ -116,6 +120,13 @@
V3_5::ICameraDevice::getPhysicalCameraCharacteristics_cb _hidl_cb) override {
return mParent->getPhysicalCameraCharacteristics(physicalCameraId, _hidl_cb);
}
+
+ virtual Return<void> isStreamCombinationSupported(
+ const V3_4::StreamConfiguration& streams,
+ V3_5::ICameraDevice::isStreamCombinationSupported_cb _hidl_cb) override {
+ return mParent->isStreamCombinationSupported(streams, _hidl_cb);
+ }
+
private:
sp<ExternalCameraDevice> mParent;
};
diff --git a/camera/provider/2.4/default/Android.bp b/camera/provider/2.4/default/Android.bp
index 167954c..81e5738 100644
--- a/camera/provider/2.4/default/Android.bp
+++ b/camera/provider/2.4/default/Android.bp
@@ -43,14 +43,12 @@
],
}
-cc_binary {
- name: "android.hardware.camera.provider@2.4-service",
+cc_defaults {
+ name: "camera_service_defaults",
defaults: ["hidl_defaults"],
proprietary: true,
relative_install_path: "hw",
srcs: ["service.cpp"],
- compile_multilib: "32",
- init_rc: ["android.hardware.camera.provider@2.4-service.rc"],
shared_libs: [
"libhidlbase",
"libhidltransport",
@@ -67,29 +65,36 @@
],
}
+cc_binary {
+ name: "android.hardware.camera.provider@2.4-service",
+ defaults: ["camera_service_defaults"],
+ compile_multilib: "32",
+ init_rc: ["android.hardware.camera.provider@2.4-service.rc"],
+}
cc_binary {
name: "android.hardware.camera.provider@2.4-service_64",
- defaults: ["hidl_defaults"],
- proprietary: true,
- relative_install_path: "hw",
- srcs: ["service.cpp"],
+ defaults: ["camera_service_defaults"],
compile_multilib: "64",
init_rc: ["android.hardware.camera.provider@2.4-service_64.rc"],
- shared_libs: [
- "libhidlbase",
- "libhidltransport",
- "libbinder",
- "liblog",
- "libutils",
- "android.hardware.camera.device@1.0",
- "android.hardware.camera.device@3.2",
- "android.hardware.camera.device@3.3",
- "android.hardware.camera.device@3.4",
- "android.hardware.camera.device@3.5",
- "android.hardware.camera.provider@2.4",
- "android.hardware.camera.common@1.0",
- ],
+}
+
+cc_binary {
+ name: "android.hardware.camera.provider@2.4-service-lazy",
+ overrides: ["android.hardware.camera.provider@2.4-service"],
+ defaults: ["camera_service_defaults"],
+ compile_multilib: "32",
+ init_rc: ["android.hardware.camera.provider@2.4-service-lazy.rc"],
+ cflags: ["-DLAZY_SERVICE"],
+}
+
+cc_binary {
+ name: "android.hardware.camera.provider@2.4-service-lazy_64",
+ overrides: ["android.hardware.camera.provider@2.4-service_64"],
+ defaults: ["camera_service_defaults"],
+ compile_multilib: "64",
+ init_rc: ["android.hardware.camera.provider@2.4-service-lazy_64.rc"],
+ cflags: ["-DLAZY_SERVICE"],
}
cc_binary {
diff --git a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-external-service.rc b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-external-service.rc
index acdb200..64cf321 100644
--- a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-external-service.rc
+++ b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-external-service.rc
@@ -1,4 +1,5 @@
service vendor.camera-provider-2-4-ext /vendor/bin/hw/android.hardware.camera.provider@2.4-external-service
+ interface android.hardware.camera.provider@2.4::ICameraProvider external/0
class hal
user cameraserver
group audio camera input drmrpc usb
diff --git a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service-lazy.rc b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service-lazy.rc
new file mode 100644
index 0000000..e8549ed
--- /dev/null
+++ b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service-lazy.rc
@@ -0,0 +1,10 @@
+service vendor.camera-provider-2-4 /vendor/bin/hw/android.hardware.camera.provider@2.4-service-lazy
+ interface android.hardware.camera.provider@2.4::ICameraProvider legacy/0
+ oneshot
+ disabled
+ class hal
+ user cameraserver
+ group audio camera input drmrpc
+ ioprio rt 4
+ capabilities SYS_NICE
+ writepid /dev/cpuset/camera-daemon/tasks /dev/stune/top-app/tasks
diff --git a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service-lazy_64.rc b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service-lazy_64.rc
new file mode 100644
index 0000000..2dfac76
--- /dev/null
+++ b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service-lazy_64.rc
@@ -0,0 +1,10 @@
+service vendor.camera-provider-2-4 /vendor/bin/hw/android.hardware.camera.provider@2.4-service-lazy_64
+ interface android.hardware.camera.provider@2.4::ICameraProvider legacy/0
+ oneshot
+ disabled
+ class hal
+ user cameraserver
+ group audio camera input drmrpc
+ ioprio rt 4
+ capabilities SYS_NICE
+ writepid /dev/cpuset/camera-daemon/tasks /dev/stune/top-app/tasks
diff --git a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service.rc b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service.rc
index c919628..913561b 100644
--- a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service.rc
+++ b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service.rc
@@ -1,4 +1,5 @@
service vendor.camera-provider-2-4 /vendor/bin/hw/android.hardware.camera.provider@2.4-service
+ interface android.hardware.camera.provider@2.4::ICameraProvider legacy/0
class hal
user cameraserver
group audio camera input drmrpc
diff --git a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service_64.rc b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service_64.rc
index 4c721ec..fd4826e 100644
--- a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service_64.rc
+++ b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service_64.rc
@@ -1,4 +1,5 @@
service vendor.camera-provider-2-4 /vendor/bin/hw/android.hardware.camera.provider@2.4-service_64
+ interface android.hardware.camera.provider@2.4::ICameraProvider legacy/0
class hal
user cameraserver
group audio camera input drmrpc
diff --git a/camera/provider/2.4/default/service.cpp b/camera/provider/2.4/default/service.cpp
index 7eeb637..15d0ea6 100644
--- a/camera/provider/2.4/default/service.cpp
+++ b/camera/provider/2.4/default/service.cpp
@@ -14,15 +14,27 @@
* limitations under the License.
*/
+#ifdef LAZY_SERVICE
+#define LOG_TAG "android.hardware.camera.provider@2.4-service-lazy"
+#else
#define LOG_TAG "android.hardware.camera.provider@2.4-service"
+#endif
#include <android/hardware/camera/provider/2.4/ICameraProvider.h>
#include <hidl/LegacySupport.h>
#include <binder/ProcessState.h>
-using android::hardware::camera::provider::V2_4::ICameraProvider;
+using android::status_t;
+using android::hardware::defaultLazyPassthroughServiceImplementation;
using android::hardware::defaultPassthroughServiceImplementation;
+using android::hardware::camera::provider::V2_4::ICameraProvider;
+
+#ifdef LAZY_SERVICE
+const bool kLazyService = true;
+#else
+const bool kLazyService = false;
+#endif
int main()
{
@@ -30,5 +42,13 @@
// The camera HAL may communicate to other vendor components via
// /dev/vndbinder
android::ProcessState::initWithDriver("/dev/vndbinder");
- return defaultPassthroughServiceImplementation<ICameraProvider>("legacy/0", /*maxThreads*/ 6);
+ status_t status;
+ if (kLazyService) {
+ status = defaultLazyPassthroughServiceImplementation<ICameraProvider>("legacy/0",
+ /*maxThreads*/ 6);
+ } else {
+ status = defaultPassthroughServiceImplementation<ICameraProvider>("legacy/0",
+ /*maxThreads*/ 6);
+ }
+ return status;
}
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index bb03d91..e376551 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -703,11 +703,14 @@
void openEmptyDeviceSession(const std::string &name,
sp<ICameraProvider> provider,
sp<ICameraDeviceSession> *session /*out*/,
- camera_metadata_t **staticMeta /*out*/);
+ camera_metadata_t **staticMeta /*out*/,
+ ::android::sp<ICameraDevice> *device = nullptr/*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_5::ICameraDeviceSession> *session3_5 /*out*/);
+ void castDevice(const sp<device::V3_2::ICameraDevice> &device, int32_t deviceVersion,
+ sp<device::V3_5::ICameraDevice> *device3_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,
@@ -748,6 +751,9 @@
void verifyMonochromeCharacteristics(const CameraMetadata& chars, int deviceVersion);
void verifyMonochromeCameraResult(
const ::android::hardware::camera::common::V1_0::helper::CameraMetadata& metadata);
+ void verifyStreamCombination(sp<device::V3_5::ICameraDevice> cameraDevice3_5,
+ const ::android::hardware::camera::device::V3_4::StreamConfiguration &config3_4,
+ bool expectedStatus);
void verifyBuffersReturned(sp<device::V3_2::ICameraDeviceSession> session,
int deviceVerison, int32_t streamId, sp<DeviceCb> cb,
@@ -2769,9 +2775,12 @@
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
sp<device::V3_5::ICameraDeviceSession> session3_5;
+ sp<device::V3_2::ICameraDevice> cameraDevice;
+ sp<device::V3_5::ICameraDevice> cameraDevice3_5;
openEmptyDeviceSession(name, mProvider,
- &session /*out*/, &staticMeta /*out*/);
+ &session /*out*/, &staticMeta /*out*/, &cameraDevice /*out*/);
castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
+ castDevice(cameraDevice, deviceVersion, &cameraDevice3_5);
outputStreams.clear();
ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, outputStreams));
@@ -2797,6 +2806,8 @@
createStreamConfiguration(streams3_2, StreamConfigurationMode::NORMAL_MODE,
&config3_2, &config3_4, &config3_5);
if (session3_5 != nullptr) {
+ verifyStreamCombination(cameraDevice3_5, config3_4,
+ /*expectedStatus*/ true);
config3_5.streamConfigCounter = streamConfigCounter++;
ret = session3_5->configureStreams_3_5(config3_5,
[streamId](Status s, device::V3_4::HalStreamConfiguration halConfig) {
@@ -2857,8 +2868,12 @@
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*/);
+ sp<device::V3_2::ICameraDevice> cameraDevice;
+ sp<device::V3_5::ICameraDevice> cameraDevice3_5;
+ openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/,
+ &cameraDevice /*out*/);
castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
+ castDevice(cameraDevice, deviceVersion, &cameraDevice3_5);
outputStreams.clear();
ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, outputStreams));
@@ -2881,6 +2896,7 @@
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
&config3_2, &config3_4, &config3_5);
if (session3_5 != nullptr) {
+ verifyStreamCombination(cameraDevice3_5, config3_4, /*expectedStatus*/ false);
config3_5.streamConfigCounter = streamConfigCounter++;
ret = session3_5->configureStreams_3_5(config3_5,
[](Status s, device::V3_4::HalStreamConfiguration) {
@@ -3044,8 +3060,12 @@
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*/);
+ sp<device::V3_2::ICameraDevice> cameraDevice;
+ sp<device::V3_5::ICameraDevice> cameraDevice3_5;
+ openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/,
+ &cameraDevice /*out*/);
castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
+ castDevice(cameraDevice, deviceVersion, &cameraDevice3_5);
Status rc = isZSLModeAvailable(staticMeta);
if (Status::METHOD_NOT_SUPPORTED == rc) {
@@ -3132,6 +3152,8 @@
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
&config3_2, &config3_4, &config3_5);
if (session3_5 != nullptr) {
+ verifyStreamCombination(cameraDevice3_5, config3_4,
+ /*expectedStatus*/ true);
config3_5.streamConfigCounter = streamConfigCounter++;
ret = session3_5->configureStreams_3_5(config3_5,
[](Status s, device::V3_4::HalStreamConfiguration halConfig) {
@@ -3304,8 +3326,12 @@
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*/);
+ sp<device::V3_2::ICameraDevice> cameraDevice;
+ sp<device::V3_5::ICameraDevice> cameraDevice3_5;
+ openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/,
+ &cameraDevice /*out*/);
castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
+ castDevice(cameraDevice, deviceVersion, &cameraDevice3_5);
outputBlobStreams.clear();
ASSERT_EQ(Status::OK,
@@ -3346,6 +3372,8 @@
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
&config3_2, &config3_4, &config3_5);
if (session3_5 != nullptr) {
+ verifyStreamCombination(cameraDevice3_5, config3_4,
+ /*expectedStatus*/ true);
config3_5.streamConfigCounter = streamConfigCounter++;
ret = session3_5->configureStreams_3_5(config3_5,
[](Status s, device::V3_4::HalStreamConfiguration halConfig) {
@@ -3403,8 +3431,12 @@
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*/);
+ sp<device::V3_2::ICameraDevice> cameraDevice;
+ sp<device::V3_5::ICameraDevice> cameraDevice3_5;
+ openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/,
+ &cameraDevice /*out*/);
castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
+ castDevice(cameraDevice, deviceVersion, &cameraDevice3_5);
Status rc = isConstrainedModeAvailable(staticMeta);
if (Status::METHOD_NOT_SUPPORTED == rc) {
@@ -3435,6 +3467,8 @@
createStreamConfiguration(streams, StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE,
&config3_2, &config3_4, &config3_5);
if (session3_5 != nullptr) {
+ verifyStreamCombination(cameraDevice3_5, config3_4,
+ /*expectedStatus*/ true);
config3_5.streamConfigCounter = streamConfigCounter++;
ret = session3_5->configureStreams_3_5(config3_5,
[streamId](Status s, device::V3_4::HalStreamConfiguration halConfig) {
@@ -3608,8 +3642,12 @@
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*/);
+ sp<device::V3_2::ICameraDevice> cameraDevice;
+ sp<device::V3_5::ICameraDevice> cameraDevice3_5;
+ openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/,
+ &cameraDevice /*out*/);
castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
+ castDevice(cameraDevice, deviceVersion, &cameraDevice3_5);
outputBlobStreams.clear();
ASSERT_EQ(Status::OK,
@@ -3650,6 +3688,8 @@
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
&config3_2, &config3_4, &config3_5);
if (session3_5 != nullptr) {
+ verifyStreamCombination(cameraDevice3_5, config3_4,
+ /*expectedStatus*/ true);
config3_5.streamConfigCounter = streamConfigCounter++;
ret = session3_5->configureStreams_3_5(config3_5,
[](Status s, device::V3_4::HalStreamConfiguration halConfig) {
@@ -5228,6 +5268,16 @@
ASSERT_TRUE(ret.isOk());
}
+void CameraHidlTest::castDevice(const sp<device::V3_2::ICameraDevice> &device,
+ int32_t deviceVersion, sp<device::V3_5::ICameraDevice> *device3_5/*out*/) {
+ ASSERT_NE(nullptr, device3_5);
+ if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_5) {
+ auto castResult = device::V3_5::ICameraDevice::castFrom(device);
+ ASSERT_TRUE(castResult.isOk());
+ *device3_5 = castResult;
+ }
+}
+
//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*/,
@@ -5262,6 +5312,21 @@
}
}
+void CameraHidlTest::verifyStreamCombination(sp<device::V3_5::ICameraDevice> cameraDevice3_5,
+ const ::android::hardware::camera::device::V3_4::StreamConfiguration &config3_4,
+ bool expectedStatus) {
+ if (cameraDevice3_5.get() != nullptr) {
+ auto ret = cameraDevice3_5->isStreamCombinationSupported(config3_4,
+ [expectedStatus] (Status s, bool combStatus) {
+ ASSERT_TRUE((Status::OK == s) || (Status::METHOD_NOT_SUPPORTED == s));
+ if (Status::OK == s) {
+ ASSERT_TRUE(combStatus == expectedStatus);
+ }
+ });
+ ASSERT_TRUE(ret.isOk());
+ }
+}
+
// Verify logical camera static metadata
void CameraHidlTest::verifyLogicalCameraMetadata(const std::string& cameraName,
const ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice>& device,
@@ -5531,10 +5596,9 @@
}
// Open a device session with empty callbacks and return static metadata.
-void CameraHidlTest::openEmptyDeviceSession(const std::string &name,
- sp<ICameraProvider> provider,
- sp<ICameraDeviceSession> *session /*out*/,
- camera_metadata_t **staticMeta /*out*/) {
+void CameraHidlTest::openEmptyDeviceSession(const std::string &name, sp<ICameraProvider> provider,
+ sp<ICameraDeviceSession> *session /*out*/, camera_metadata_t **staticMeta /*out*/,
+ ::android::sp<ICameraDevice> *cameraDevice /*out*/) {
ASSERT_NE(nullptr, session);
ASSERT_NE(nullptr, staticMeta);
@@ -5551,6 +5615,9 @@
device3_x = device;
});
ASSERT_TRUE(ret.isOk());
+ if (cameraDevice != nullptr) {
+ *cameraDevice = device3_x;
+ }
sp<EmptyDeviceCb> cb = new EmptyDeviceCb();
ret = device3_x->open(cb, [&](auto status, const auto& newSession) {
diff --git a/neuralnetworks/1.2/types.hal b/neuralnetworks/1.2/types.hal
index f196792..7824d23 100644
--- a/neuralnetworks/1.2/types.hal
+++ b/neuralnetworks/1.2/types.hal
@@ -40,7 +40,7 @@
* scale is a 32 bit floating point with value greater then zero.
*/
TENSOR_QUANT16_SYMM = 7,
- /** A tensor of 16 bit floating point values. */
+ /** A tensor of IEEE 754 16 bit floating point values. */
TENSOR_FLOAT16 = 8,
/**
* A tensor of 8 bit boolean values.
@@ -49,6 +49,8 @@
* represents false; any other value represents true.
*/
TENSOR_BOOL8 = 9,
+ /** An IEEE 754 16 bit floating point scalar value. */
+ FLOAT16 = 10,
/* ADDING A NEW FUNDAMENTAL TYPE REQUIRES UPDATING THE VALUE OF
* OperandTypeRange::OPERAND_FUNDAMENTAL_MAX.
*/
@@ -62,7 +64,7 @@
*/
enum OperandTypeRange : uint32_t {
OPERAND_FUNDAMENTAL_MIN = 0,
- OPERAND_FUNDAMENTAL_MAX = 9,
+ OPERAND_FUNDAMENTAL_MAX = 10,
OPERAND_OEM_MIN = 10000,
OPERAND_OEM_MAX = 10001,
};
@@ -109,7 +111,7 @@
QUANTIZE = 70,
QUANTIZED_16BIT_LSTM = 71,
RANDOM_MULTINOMIAL = 72,
- REDUCE = 73,
+ REDUCE_PROD = 73,
ROI_ALIGN = 74,
RSQRT = 75,
SELECT = 76,
@@ -126,6 +128,13 @@
ROTATED_BBOX_TRANSFORM = 87,
ABS = 88,
ROI_POOLING = 89,
+ EQUAL = 90,
+ NOT_EQUAL = 91,
+ REDUCE_SUM = 92,
+ REDUCE_MAX = 93,
+ REDUCE_MIN = 94,
+ REDUCE_ANY = 95,
+ REDUCE_ALL = 96,
/* ADDING A NEW FUNDAMENTAL OPERATION REQUIRES UPDATING THE VALUE OF
* OperationTypeRange::OPERATION_FUNDAMENTAL_MAX.
*/
@@ -139,7 +148,7 @@
*/
enum OperationTypeRange : uint32_t {
OPERATION_FUNDAMENTAL_MIN = 0,
- OPERATION_FUNDAMENTAL_MAX = 89,
+ OPERATION_FUNDAMENTAL_MAX = 96,
OPERATION_OEM_MIN = 10000,
OPERATION_OEM_MAX = 10000,
};
diff --git a/neuralnetworks/1.2/vts/functional/ValidateModel.cpp b/neuralnetworks/1.2/vts/functional/ValidateModel.cpp
index 294415b..ac23f41 100644
--- a/neuralnetworks/1.2/vts/functional/ValidateModel.cpp
+++ b/neuralnetworks/1.2/vts/functional/ValidateModel.cpp
@@ -152,6 +152,7 @@
static uint32_t getInvalidRank(OperandType type) {
switch (type) {
+ case OperandType::FLOAT16:
case OperandType::FLOAT32:
case OperandType::INT32:
case OperandType::UINT32:
@@ -183,6 +184,7 @@
static float getInvalidScale(OperandType type) {
switch (type) {
+ case OperandType::FLOAT16:
case OperandType::FLOAT32:
case OperandType::INT32:
case OperandType::UINT32:
@@ -215,6 +217,7 @@
static std::vector<int32_t> getInvalidZeroPoints(OperandType type) {
switch (type) {
+ case OperandType::FLOAT16:
case OperandType::FLOAT32:
case OperandType::INT32:
case OperandType::UINT32:
@@ -258,6 +261,7 @@
Operand newOperand = *operand;
newOperand.type = type;
switch (type) {
+ case OperandType::FLOAT16:
case OperandType::FLOAT32:
case OperandType::INT32:
case OperandType::UINT32:
@@ -304,6 +308,7 @@
// - ARGMIN and ARGMAX's first argument can be any of
// TENSOR_(FLOAT16|FLOAT32|INT32|QUANT8_ASYMM).
// - CAST's argument can be any of TENSOR_(FLOAT16|FLOAT32|INT32|QUANT8_ASYMM).
+ // - RANDOM_MULTINOMIAL's argument can be either TENSOR_FLOAT16 or TENSOR_FLOAT32.
switch (operation.type) {
case OperationType::LSH_PROJECTION: {
if (operand == operation.inputs[1]) {
@@ -318,6 +323,11 @@
return true;
}
} break;
+ case OperationType::RANDOM_MULTINOMIAL: {
+ if (type == OperandType::TENSOR_FLOAT16 || type == OperandType::TENSOR_FLOAT32) {
+ return true;
+ }
+ } break;
default:
break;
}
diff --git a/sensors/2.0/types.hal b/sensors/2.0/types.hal
index e1a029a..f9defa2 100644
--- a/sensors/2.0/types.hal
+++ b/sensors/2.0/types.hal
@@ -29,4 +29,14 @@
* Used to notify the Event FMQ that events should be read and processed.
*/
READ_AND_PROCESS = 1 << 0,
+
+ /**
+ * Used by the framework to signal to the HAL when events have been
+ * successfully read from the Event FMQ.
+ *
+ * If the MessageQueue::writeBlocking function is being used to write sensor
+ * events to the Event FMQ, then the readNotification parameter must be set
+ * to EVENTS_READ.
+ */
+ EVENTS_READ = 1 << 1,
};
diff --git a/wifi/1.3/Android.bp b/wifi/1.3/Android.bp
index 163a870..45e2e88 100644
--- a/wifi/1.3/Android.bp
+++ b/wifi/1.3/Android.bp
@@ -21,6 +21,7 @@
types: [
"StaLinkLayerRadioStats",
"StaLinkLayerStats",
+ "WifiChannelStats",
],
gen_java: true,
}
diff --git a/wifi/1.3/default/hidl_struct_util.cpp b/wifi/1.3/default/hidl_struct_util.cpp
index b3d612f..a24d048 100644
--- a/wifi/1.3/default/hidl_struct_util.cpp
+++ b/wifi/1.3/default/hidl_struct_util.cpp
@@ -797,6 +797,55 @@
return true;
}
+bool convertLegacyLinkLayerRadioStatsToHidl(
+ const legacy_hal::LinkLayerRadioStats& legacy_radio_stat,
+ V1_3::StaLinkLayerRadioStats* hidl_radio_stat) {
+ if (!hidl_radio_stat) {
+ return false;
+ }
+ *hidl_radio_stat = {};
+
+ hidl_radio_stat->V1_0.onTimeInMs = legacy_radio_stat.stats.on_time;
+ hidl_radio_stat->V1_0.txTimeInMs = legacy_radio_stat.stats.tx_time;
+ hidl_radio_stat->V1_0.rxTimeInMs = legacy_radio_stat.stats.rx_time;
+ hidl_radio_stat->V1_0.onTimeInMsForScan =
+ legacy_radio_stat.stats.on_time_scan;
+ hidl_radio_stat->V1_0.txTimeInMsPerLevel =
+ legacy_radio_stat.tx_time_per_levels;
+ hidl_radio_stat->onTimeInMsForNanScan = legacy_radio_stat.stats.on_time_nbd;
+ hidl_radio_stat->onTimeInMsForBgScan =
+ legacy_radio_stat.stats.on_time_gscan;
+ hidl_radio_stat->onTimeInMsForRoamScan =
+ legacy_radio_stat.stats.on_time_roam_scan;
+ hidl_radio_stat->onTimeInMsForPnoScan =
+ legacy_radio_stat.stats.on_time_pno_scan;
+ hidl_radio_stat->onTimeInMsForHs20Scan =
+ legacy_radio_stat.stats.on_time_hs20;
+
+ std::vector<V1_3::WifiChannelStats> hidl_channel_stats;
+
+ for (const auto& channel_stat : legacy_radio_stat.channel_stats) {
+ V1_3::WifiChannelStats hidl_channel_stat;
+ hidl_channel_stat.onTimeInMs = channel_stat.on_time;
+ hidl_channel_stat.ccaBusyTimeInMs = channel_stat.cca_busy_time;
+ /*
+ * TODO once b/119142899 is fixed,
+ * replace below code with convertLegacyWifiChannelInfoToHidl()
+ */
+ hidl_channel_stat.channel.width = WifiChannelWidthInMhz::WIDTH_20;
+ hidl_channel_stat.channel.centerFreq = channel_stat.channel.center_freq;
+ hidl_channel_stat.channel.centerFreq0 =
+ channel_stat.channel.center_freq0;
+ hidl_channel_stat.channel.centerFreq1 =
+ channel_stat.channel.center_freq1;
+ hidl_channel_stats.push_back(hidl_channel_stat);
+ }
+
+ hidl_radio_stat->channelStats = hidl_channel_stats;
+
+ return true;
+}
+
bool convertLegacyLinkLayerStatsToHidl(
const legacy_hal::LinkLayerStats& legacy_stats,
V1_3::StaLinkLayerStats* hidl_stats) {
@@ -843,23 +892,10 @@
std::vector<V1_3::StaLinkLayerRadioStats> hidl_radios_stats;
for (const auto& legacy_radio_stats : legacy_stats.radios) {
V1_3::StaLinkLayerRadioStats hidl_radio_stats;
- hidl_radio_stats.V1_0.onTimeInMs = legacy_radio_stats.stats.on_time;
- hidl_radio_stats.V1_0.txTimeInMs = legacy_radio_stats.stats.tx_time;
- hidl_radio_stats.V1_0.rxTimeInMs = legacy_radio_stats.stats.rx_time;
- hidl_radio_stats.V1_0.onTimeInMsForScan =
- legacy_radio_stats.stats.on_time_scan;
- hidl_radio_stats.V1_0.txTimeInMsPerLevel =
- legacy_radio_stats.tx_time_per_levels;
- hidl_radio_stats.onTimeInMsForNanScan =
- legacy_radio_stats.stats.on_time_nbd;
- hidl_radio_stats.onTimeInMsForBgScan =
- legacy_radio_stats.stats.on_time_gscan;
- hidl_radio_stats.onTimeInMsForRoamScan =
- legacy_radio_stats.stats.on_time_roam_scan;
- hidl_radio_stats.onTimeInMsForPnoScan =
- legacy_radio_stats.stats.on_time_pno_scan;
- hidl_radio_stats.onTimeInMsForHs20Scan =
- legacy_radio_stats.stats.on_time_hs20;
+ if (!convertLegacyLinkLayerRadioStatsToHidl(legacy_radio_stats,
+ &hidl_radio_stats)) {
+ return false;
+ }
hidl_radios_stats.push_back(hidl_radio_stats);
}
hidl_stats->radios = hidl_radios_stats;
diff --git a/wifi/1.3/default/tests/hidl_struct_util_unit_tests.cpp b/wifi/1.3/default/tests/hidl_struct_util_unit_tests.cpp
index 7056759..790b7fa 100644
--- a/wifi/1.3/default/tests/hidl_struct_util_unit_tests.cpp
+++ b/wifi/1.3/default/tests/hidl_struct_util_unit_tests.cpp
@@ -37,6 +37,7 @@
namespace V1_3 {
namespace implementation {
using namespace android::hardware::wifi::V1_0;
+using ::android::hardware::wifi::V1_0::WifiChannelWidthInMhz;
class HidlStructUtilTest : public Test {};
@@ -166,6 +167,17 @@
for (int i = 0; i < 4; i++) {
radio.tx_time_per_levels.push_back(rand());
}
+
+ legacy_hal::wifi_channel_stat channel_stat1 = {
+ .channel = {legacy_hal::WIFI_CHAN_WIDTH_20, 2437, 2437, 0},
+ .cca_busy_time = 0x55,
+ .on_time = 0x1111};
+ legacy_hal::wifi_channel_stat channel_stat2 = {
+ .channel = {legacy_hal::WIFI_CHAN_WIDTH_20, 5180, 5180, 0},
+ .cca_busy_time = 0x66,
+ .on_time = 0x2222};
+ radio.channel_stats.push_back(channel_stat1);
+ radio.channel_stats.push_back(channel_stat2);
}
V1_3::StaLinkLayerStats converted{};
@@ -236,6 +248,25 @@
converted.radios[i].onTimeInMsForPnoScan);
EXPECT_EQ(legacy_stats.radios[i].stats.on_time_hs20,
converted.radios[i].onTimeInMsForHs20Scan);
+ EXPECT_EQ(legacy_stats.radios[i].channel_stats.size(),
+ converted.radios[i].channelStats.size());
+ for (int k = 0; k < legacy_stats.radios[i].channel_stats.size(); k++) {
+ EXPECT_EQ(WifiChannelWidthInMhz::WIDTH_20,
+ converted.radios[i].channelStats[k].channel.width);
+ EXPECT_EQ(
+ legacy_stats.radios[i].channel_stats[k].channel.center_freq,
+ converted.radios[i].channelStats[k].channel.centerFreq);
+ EXPECT_EQ(
+ legacy_stats.radios[i].channel_stats[k].channel.center_freq0,
+ converted.radios[i].channelStats[k].channel.centerFreq0);
+ EXPECT_EQ(
+ legacy_stats.radios[i].channel_stats[k].channel.center_freq1,
+ converted.radios[i].channelStats[k].channel.centerFreq1);
+ EXPECT_EQ(legacy_stats.radios[i].channel_stats[k].cca_busy_time,
+ converted.radios[i].channelStats[k].ccaBusyTimeInMs);
+ EXPECT_EQ(legacy_stats.radios[i].channel_stats[k].on_time,
+ converted.radios[i].channelStats[k].onTimeInMs);
+ }
}
}
diff --git a/wifi/1.3/default/wifi_legacy_hal.cpp b/wifi/1.3/default/wifi_legacy_hal.cpp
index 2cd7c2a..84a2c03 100644
--- a/wifi/1.3/default/wifi_legacy_hal.cpp
+++ b/wifi/1.3/default/wifi_legacy_hal.cpp
@@ -652,6 +652,8 @@
[&link_stats_ptr](wifi_request_id /* id */,
wifi_iface_stat* iface_stats_ptr, int num_radios,
wifi_radio_stat* radio_stats_ptr) {
+ wifi_radio_stat* l_radio_stats_ptr;
+
if (iface_stats_ptr != nullptr) {
link_stats_ptr->iface = *iface_stats_ptr;
link_stats_ptr->iface.num_peers = 0;
@@ -662,20 +664,35 @@
LOG(ERROR) << "Invalid radio stats in link layer stats";
return;
}
+ l_radio_stats_ptr = radio_stats_ptr;
for (int i = 0; i < num_radios; i++) {
LinkLayerRadioStats radio;
- radio.stats = radio_stats_ptr[i];
+
+ radio.stats = *l_radio_stats_ptr;
// Copy over the tx level array to the separate vector.
- if (radio_stats_ptr[i].num_tx_levels > 0 &&
- radio_stats_ptr[i].tx_time_per_levels != nullptr) {
+ if (l_radio_stats_ptr->num_tx_levels > 0 &&
+ l_radio_stats_ptr->tx_time_per_levels != nullptr) {
radio.tx_time_per_levels.assign(
- radio_stats_ptr[i].tx_time_per_levels,
- radio_stats_ptr[i].tx_time_per_levels +
- radio_stats_ptr[i].num_tx_levels);
+ l_radio_stats_ptr->tx_time_per_levels,
+ l_radio_stats_ptr->tx_time_per_levels +
+ l_radio_stats_ptr->num_tx_levels);
}
radio.stats.num_tx_levels = 0;
radio.stats.tx_time_per_levels = nullptr;
+ /* Copy over the channel stat to separate vector */
+ if (l_radio_stats_ptr->num_channels > 0) {
+ /* Copy the channel stats */
+ radio.channel_stats.assign(
+ l_radio_stats_ptr->channels,
+ l_radio_stats_ptr->channels +
+ l_radio_stats_ptr->num_channels);
+ }
link_stats_ptr->radios.push_back(radio);
+ l_radio_stats_ptr =
+ (wifi_radio_stat*)((u8*)l_radio_stats_ptr +
+ sizeof(wifi_radio_stat) +
+ (sizeof(wifi_channel_stat) *
+ l_radio_stats_ptr->num_channels));
}
};
diff --git a/wifi/1.3/default/wifi_legacy_hal.h b/wifi/1.3/default/wifi_legacy_hal.h
index 2f513c4..d6f05ae 100644
--- a/wifi/1.3/default/wifi_legacy_hal.h
+++ b/wifi/1.3/default/wifi_legacy_hal.h
@@ -61,6 +61,7 @@
struct LinkLayerRadioStats {
wifi_radio_stat stats;
std::vector<uint32_t> tx_time_per_levels;
+ std::vector<wifi_channel_stat> channel_stats;
};
struct LinkLayerStats {
diff --git a/wifi/1.3/types.hal b/wifi/1.3/types.hal
index 4585ff3..3b292b0 100644
--- a/wifi/1.3/types.hal
+++ b/wifi/1.3/types.hal
@@ -19,6 +19,22 @@
import @1.0::StaLinkLayerRadioStats;
import @1.0::StaLinkLayerIfaceStats;
import @1.0::TimeStampInMs;
+import @1.0::WifiChannelInfo;
+
+struct WifiChannelStats {
+ /**
+ * Channel information.
+ */
+ WifiChannelInfo channel;
+ /**
+ * Total time for which the radio is awake on this channel.
+ */
+ uint32_t onTimeInMs;
+ /**
+ * Total time for which CCA is held busy on this channel.
+ */
+ uint32_t ccaBusyTimeInMs;
+};
struct StaLinkLayerRadioStats {
/**
@@ -51,6 +67,11 @@
* or crash.
*/
uint32_t onTimeInMsForHs20Scan;
+
+ /**
+ * List of channel stats associated with this radio
+ */
+ vec<WifiChannelStats> channelStats;
};
/**