diff options
| -rw-r--r-- | camera/device/1.0/default/Android.bp | 8 | ||||
| -rw-r--r-- | camera/device/1.0/default/CameraDevice.cpp | 97 | ||||
| -rw-r--r-- | camera/device/1.0/default/CameraDevice_1_0.h | 9 | ||||
| -rw-r--r-- | camera/provider/2.4/default/Android.bp | 16 | ||||
| -rw-r--r-- | graphics/mapper/2.1/utils/passthrough/include/mapper-passthrough/2.1/Gralloc0Hal.h | 7 | ||||
| -rw-r--r-- | keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h | 3 | ||||
| -rw-r--r-- | wifi/1.3/default/Android.mk | 3 | ||||
| -rw-r--r-- | wifi/1.3/default/wifi_chip.cpp | 49 | ||||
| -rw-r--r-- | wifi/1.3/default/wifi_chip.h | 3 | ||||
| -rw-r--r-- | wifi/1.3/default/wifi_feature_flags.cpp | 28 | ||||
| -rw-r--r-- | wifi/1.3/default/wifi_legacy_hal.cpp | 29 | ||||
| -rw-r--r-- | wifi/1.3/default/wifi_legacy_hal.h | 7 |
12 files changed, 227 insertions, 32 deletions
diff --git a/camera/device/1.0/default/Android.bp b/camera/device/1.0/default/Android.bp index aa3b941c2..45722cfcd 100644 --- a/camera/device/1.0/default/Android.bp +++ b/camera/device/1.0/default/Android.bp @@ -30,6 +30,14 @@ cc_library_shared { header_libs: [ "media_plugin_headers", ], + product_variables: { + lineage: { + uses_qti_camera_device: { + cppflags: ["-DQTI_CAMERA_DEVICE"], + shared_libs: ["vendor.qti.hardware.camera.device@1.0"], + }, + }, + }, export_include_dirs: ["."] } diff --git a/camera/device/1.0/default/CameraDevice.cpp b/camera/device/1.0/default/CameraDevice.cpp index a03bbc867..a1f1830fd 100644 --- a/camera/device/1.0/default/CameraDevice.cpp +++ b/camera/device/1.0/default/CameraDevice.cpp @@ -428,30 +428,72 @@ void CameraDevice::sDataCb(int32_t msg_type, const camera_memory_t *data, unsign index, mem->mNumBufs); return; } - if (object->mDeviceCallback != nullptr) { - CameraFrameMetadata hidlMetadata; - if (metadata) { - hidlMetadata.faces.resize(metadata->number_of_faces); - for (size_t i = 0; i < hidlMetadata.faces.size(); i++) { - hidlMetadata.faces[i].score = metadata->faces[i].score; - hidlMetadata.faces[i].id = metadata->faces[i].id; - for (int k = 0; k < 4; k++) { - hidlMetadata.faces[i].rect[k] = metadata->faces[i].rect[k]; - } - for (int k = 0; k < 2; k++) { - hidlMetadata.faces[i].leftEye[k] = metadata->faces[i].left_eye[k]; - } - for (int k = 0; k < 2; k++) { - hidlMetadata.faces[i].rightEye[k] = metadata->faces[i].right_eye[k]; - } - for (int k = 0; k < 2; k++) { - hidlMetadata.faces[i].mouth[k] = metadata->faces[i].mouth[k]; - } - } - } - CameraHeapMemory* mem = static_cast<CameraHeapMemory *>(data->handle); - object->mDeviceCallback->dataCallback( - (DataCallbackMsg) msg_type, mem->handle.mId, index, hidlMetadata); +#ifdef QTI_CAMERA_DEVICE + if(object->mQDeviceCallback != nullptr) { + vendor::qti::hardware::camera::device::V1_0::QCameraFrameMetadata hidlMetadata; + if (metadata) { + hidlMetadata.faces.resize(metadata->number_of_faces); + for (size_t i = 0; i < hidlMetadata.faces.size(); i++) { + hidlMetadata.faces[i].score = metadata->faces[i].score; + hidlMetadata.faces[i].id = metadata->faces[i].id; + for (int k = 0; k < 4; k++) { + hidlMetadata.faces[i].rect[k] = metadata->faces[i].rect[k]; + } + for (int k = 0; k < 2; k++) { + hidlMetadata.faces[i].leftEye[k] = metadata->faces[i].left_eye[k]; + } + for (int k = 0; k < 2; k++) { + hidlMetadata.faces[i].rightEye[k] = metadata->faces[i].right_eye[k]; + } + for (int k = 0; k < 2; k++) { + hidlMetadata.faces[i].mouth[k] = metadata->faces[i].mouth[k]; + } + hidlMetadata.faces[i].smile_degree = metadata->faces[i].smile_degree; + hidlMetadata.faces[i].smile_score = metadata->faces[i].smile_score; + hidlMetadata.faces[i].blink_detected = metadata->faces[i].blink_detected; + hidlMetadata.faces[i].face_recognised = metadata->faces[i].face_recognised; + hidlMetadata.faces[i].gaze_angle = metadata->faces[i].gaze_angle; + hidlMetadata.faces[i].updown_dir = metadata->faces[i].updown_dir; + hidlMetadata.faces[i].leftright_dir = metadata->faces[i].leftright_dir; + hidlMetadata.faces[i].roll_dir = metadata->faces[i].roll_dir; + hidlMetadata.faces[i].left_right_gaze = metadata->faces[i].left_right_gaze; + hidlMetadata.faces[i].top_bottom_gaze = metadata->faces[i].top_bottom_gaze; + hidlMetadata.faces[i].leye_blink = metadata->faces[i].leye_blink; + hidlMetadata.faces[i].reye_blink = metadata->faces[i].reye_blink; + } + } + CameraHeapMemory* mem = static_cast<CameraHeapMemory *>(data->handle); + object->mQDeviceCallback->QDataCallback( + (DataCallbackMsg) msg_type, mem->handle.mId, index, hidlMetadata); + } else { +#endif + if (object->mDeviceCallback != nullptr) { + CameraFrameMetadata hidlMetadata; + if (metadata) { + hidlMetadata.faces.resize(metadata->number_of_faces); + for (size_t i = 0; i < hidlMetadata.faces.size(); i++) { + hidlMetadata.faces[i].score = metadata->faces[i].score; + hidlMetadata.faces[i].id = metadata->faces[i].id; + for (int k = 0; k < 4; k++) { + hidlMetadata.faces[i].rect[k] = metadata->faces[i].rect[k]; + } + for (int k = 0; k < 2; k++) { + hidlMetadata.faces[i].leftEye[k] = metadata->faces[i].left_eye[k]; + } + for (int k = 0; k < 2; k++) { + hidlMetadata.faces[i].rightEye[k] = metadata->faces[i].right_eye[k]; + } + for (int k = 0; k < 2; k++) { + hidlMetadata.faces[i].mouth[k] = metadata->faces[i].mouth[k]; + } + } + } + CameraHeapMemory* mem = static_cast<CameraHeapMemory *>(data->handle); + object->mDeviceCallback->dataCallback( + (DataCallbackMsg) msg_type, mem->handle.mId, index, hidlMetadata); +#ifdef QTI_CAMERA_DEVICE + } +#endif } } @@ -667,6 +709,13 @@ Return<Status> CameraDevice::open(const sp<ICameraDeviceCallback>& callback) { initHalPreviewWindow(); mDeviceCallback = callback; +#ifdef QTI_CAMERA_DEVICE + mQDeviceCallback = + vendor::qti::hardware::camera::device::V1_0::IQCameraDeviceCallback::castFrom(callback); + if(mQDeviceCallback == nullptr) { + ALOGI("could not cast ICameraDeviceCallback to IQCameraDeviceCallback"); + } +#endif if (mDevice->ops->set_callbacks) { mDevice->ops->set_callbacks(mDevice, diff --git a/camera/device/1.0/default/CameraDevice_1_0.h b/camera/device/1.0/default/CameraDevice_1_0.h index 2c980f0a8..2b35a730d 100644 --- a/camera/device/1.0/default/CameraDevice_1_0.h +++ b/camera/device/1.0/default/CameraDevice_1_0.h @@ -24,6 +24,9 @@ #include "HandleImporter.h" #include <android/hardware/camera/device/1.0/ICameraDevice.h> +#ifdef QTI_CAMERA_DEVICE +#include <vendor/qti/hardware/camera/device/1.0/IQCameraDeviceCallback.h> +#endif #include <android/hidl/allocator/1.0/IAllocator.h> #include <android/hidl/memory/1.0/IMemory.h> #include <hidl/MQDescriptor.h> @@ -44,6 +47,9 @@ using ::android::hardware::camera::common::V1_0::helper::HandleImporter; using ::android::hardware::camera::device::V1_0::CameraInfo; using ::android::hardware::camera::device::V1_0::CommandType; using ::android::hardware::camera::device::V1_0::ICameraDevice; +#ifdef QTI_CAMERA_DEVICE +using ::vendor::qti::hardware::camera::device::V1_0::IQCameraDeviceCallback; +#endif using ::android::hardware::camera::device::V1_0::ICameraDeviceCallback; using ::android::hardware::camera::device::V1_0::ICameraDevicePreviewCallback; using ::android::hardware::camera::device::V1_0::MemoryId; @@ -164,6 +170,9 @@ private: const SortedVector<std::pair<std::string, std::string>>& mCameraDeviceNames; sp<ICameraDeviceCallback> mDeviceCallback = nullptr; +#ifdef QTI_CAMERA_DEVICE + sp<IQCameraDeviceCallback> mQDeviceCallback = nullptr; +#endif mutable Mutex mMemoryMapLock; // gating access to mMemoryMap // must not hold mLock after this lock is acquired diff --git a/camera/provider/2.4/default/Android.bp b/camera/provider/2.4/default/Android.bp index cb78fcb85..be8446a5c 100644 --- a/camera/provider/2.4/default/Android.bp +++ b/camera/provider/2.4/default/Android.bp @@ -68,6 +68,14 @@ cc_library_shared { "libtinyxml2", "libutils", ], + product_variables: { + lineage: { + uses_qti_camera_device: { + cppflags: ["-DQTI_CAMERA_DEVICE"], + shared_libs: ["vendor.qti.hardware.camera.device@1.0"], + }, + }, + }, static_libs: [ "android.hardware.camera.common@1.0-helper", ], @@ -222,4 +230,12 @@ cc_binary { "camera.device@3.5-external-impl_headers", "camera.device@3.5-impl_headers", ], + product_variables: { + lineage: { + uses_qti_camera_device: { + cppflags: ["-DQTI_CAMERA_DEVICE"], + shared_libs: ["vendor.qti.hardware.camera.device@1.0"], + }, + }, + }, } diff --git a/graphics/mapper/2.1/utils/passthrough/include/mapper-passthrough/2.1/Gralloc0Hal.h b/graphics/mapper/2.1/utils/passthrough/include/mapper-passthrough/2.1/Gralloc0Hal.h index 8540068a4..13df3bcbc 100644 --- a/graphics/mapper/2.1/utils/passthrough/include/mapper-passthrough/2.1/Gralloc0Hal.h +++ b/graphics/mapper/2.1/utils/passthrough/include/mapper-passthrough/2.1/Gralloc0Hal.h @@ -49,7 +49,12 @@ class Gralloc0HalImpl : public V2_0::passthrough::detail::Gralloc0HalImpl<Hal> { mModule, bufferHandle, descriptorInfo.width, descriptorInfo.height, static_cast<int32_t>(descriptorInfo.format), static_cast<uint64_t>(descriptorInfo.usage), stride); - return static_cast<Error>(ret); + if (ret == -EINVAL) { + return Error::BAD_BUFFER; + } else if (ret < 0) { + return Error::BAD_VALUE; + } + return Error::NONE; } Error getTransportSize(const native_handle_t* bufferHandle, uint32_t* outNumFds, uint32_t* outNumInts) override { diff --git a/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h b/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h index 97dab6821..6b02a7fff 100644 --- a/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h +++ b/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h @@ -73,6 +73,9 @@ namespace V4_0 { static const int32_t KM_TAG_DIGEST_OLD = static_cast<int32_t>(TagType::ENUM) | 5; static const int32_t KM_TAG_PADDING_OLD = static_cast<int32_t>(TagType::ENUM) | 7; +static const int32_t KM_TAG_FBE_ICE = static_cast<int32_t>(TagType::BOOL) | 16201; +static const int32_t KM_TAG_KEY_TYPE = static_cast<int32_t>(TagType::UINT) | 16202; + constexpr TagType typeFromTag(Tag tag) { return static_cast<TagType>(static_cast<uint32_t>(tag) & static_cast<uint32_t>(0xf0000000)); } diff --git a/wifi/1.3/default/Android.mk b/wifi/1.3/default/Android.mk index 0a3809cce..0fb42177b 100644 --- a/wifi/1.3/default/Android.mk +++ b/wifi/1.3/default/Android.mk @@ -36,6 +36,9 @@ endif ifdef WIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION LOCAL_CPPFLAGS += -DWIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION endif +ifdef QC_WIFI_HIDL_FEATURE_DUAL_AP +LOCAL_CPPFLAGS += -DQC_WIFI_HIDL_FEATURE_DUAL_AP +endif # Allow implicit fallthroughs in wifi_legacy_hal.cpp until they are fixed. LOCAL_CFLAGS += -Wno-error=implicit-fallthrough LOCAL_SRC_FILES := \ diff --git a/wifi/1.3/default/wifi_chip.cpp b/wifi/1.3/default/wifi_chip.cpp index e9991dcee..2b137498b 100644 --- a/wifi/1.3/default/wifi_chip.cpp +++ b/wifi/1.3/default/wifi_chip.cpp @@ -21,6 +21,7 @@ #include <cutils/properties.h> #include <sys/stat.h> #include <sys/sysmacros.h> +#include <net/if.h> #include "hidl_return_util.h" #include "hidl_struct_util.h" @@ -626,6 +627,8 @@ void WifiChip::invalidateAndRemoveAllIfaces() { invalidateAndClearAll(nan_ifaces_); invalidateAndClearAll(p2p_ifaces_); invalidateAndClearAll(sta_ifaces_); + invalidateAndClearAll(created_ap_ifaces_); + invalidateAndClearAll(created_sta_ifaces_); // Since all the ifaces are invalid now, all RTT controller objects // using those ifaces also need to be invalidated. for (const auto& rtt : rtt_controllers_) { @@ -805,10 +808,24 @@ std::pair<WifiStatus, sp<IWifiApIface>> WifiChip::createApIfaceInternal() { if (!canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType::AP)) { return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; } + + bool iface_created = false; std::string ifname = allocateApIfaceName(); + if (!if_nametoindex(ifname.c_str())) { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->QcAddInterface(getWlanIfaceName(0), ifname, + (uint32_t)IfaceType::AP); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to add interface: " << ifname << " " + << legacyErrorToString(legacy_status); + return {createWifiStatusFromLegacyError(legacy_status), {}}; + } + iface_created = true; + } sp<WifiApIface> iface = new WifiApIface(ifname, legacy_hal_, iface_util_, feature_flags_); ap_ifaces_.push_back(iface); + if (iface_created) created_ap_ifaces_.push_back(iface); for (const auto& callback : event_cb_handler_.getCallbacks()) { if (!callback->onIfaceAdded(IfaceType::AP, ifname).isOk()) { LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; @@ -840,6 +857,16 @@ WifiStatus WifiChip::removeApIfaceInternal(const std::string& ifname) { if (!iface.get()) { return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); } + + if (findUsingName(created_ap_ifaces_, ifname) != nullptr) { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->QcRemoveInterface(getWlanIfaceName(0), ifname); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to remove interface: " << ifname << " " + << legacyErrorToString(legacy_status); + } + invalidateAndClear(created_ap_ifaces_, iface); + } // Invalidate & remove any dependent objects first. // Note: This is probably not required because we never create // nan/rtt objects over AP iface. But, there is no harm to do it @@ -952,9 +979,22 @@ std::pair<WifiStatus, sp<IWifiStaIface>> WifiChip::createStaIfaceInternal() { if (!canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType::STA)) { return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; } + bool iface_created = false; std::string ifname = allocateStaIfaceName(); + if (!if_nametoindex(ifname.c_str())) { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->QcAddInterface(getWlanIfaceName(0), ifname, + (uint32_t)IfaceType::STA); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to add interface: " << ifname << " " + << legacyErrorToString(legacy_status); + return {createWifiStatusFromLegacyError(legacy_status), {}}; + } + iface_created = true; + } sp<WifiStaIface> iface = new WifiStaIface(ifname, legacy_hal_, iface_util_); sta_ifaces_.push_back(iface); + if (iface_created) created_sta_ifaces_.push_back(iface); for (const auto& callback : event_cb_handler_.getCallbacks()) { if (!callback->onIfaceAdded(IfaceType::STA, ifname).isOk()) { LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; @@ -986,6 +1026,15 @@ WifiStatus WifiChip::removeStaIfaceInternal(const std::string& ifname) { if (!iface.get()) { return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); } + if (findUsingName(created_sta_ifaces_, ifname) != nullptr) { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->QcRemoveInterface(getWlanIfaceName(0), ifname); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to remove interface: " << ifname << " " + << legacyErrorToString(legacy_status); + } + invalidateAndClear(created_sta_ifaces_, iface); + } // Invalidate & remove any dependent objects first. invalidateAndRemoveDependencies(ifname); invalidateAndClear(sta_ifaces_, iface); diff --git a/wifi/1.3/default/wifi_chip.h b/wifi/1.3/default/wifi_chip.h index 153ca6a62..2af6ebe04 100644 --- a/wifi/1.3/default/wifi_chip.h +++ b/wifi/1.3/default/wifi_chip.h @@ -269,6 +269,9 @@ class WifiChip : public V1_3::IWifiChip { hidl_callback_util::HidlCallbackHandler<V1_2::IWifiChipEventCallback> event_cb_handler_; + std::vector<sp<WifiApIface>> created_ap_ifaces_; + std::vector<sp<WifiStaIface>> created_sta_ifaces_; + DISALLOW_COPY_AND_ASSIGN(WifiChip); }; diff --git a/wifi/1.3/default/wifi_feature_flags.cpp b/wifi/1.3/default/wifi_feature_flags.cpp index 7212cfac3..a0ffab790 100644 --- a/wifi/1.3/default/wifi_feature_flags.cpp +++ b/wifi/1.3/default/wifi_feature_flags.cpp @@ -79,14 +79,28 @@ constexpr ChipModeId kMainModeId = chip_mode_ids::kV3; # define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{P2P}, 1}} # endif # else -# ifdef WIFI_HIDL_FEATURE_AWARE -// (1 STA + 1 AP) or (1 STA + 1 of (P2P or NAN)) -# define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{AP}, 1}},\ - {{{STA}, 1}, {{P2P, NAN}, 1}} +# ifdef QC_WIFI_HIDL_FEATURE_DUAL_AP +# ifdef WIFI_HIDL_FEATURE_AWARE +// (1 STA + 1 AP) or (1 STA + 1 of (P2P or NAN)) or (2 AP) +# define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{AP}, 1}},\ + {{{STA}, 1}, {{P2P, NAN}, 1}},\ + {{{AP}, 2}} +# else +// (1 STA + 1 AP) or (1 STA + 1 P2P) or (2 AP) +# define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{AP}, 1}},\ + {{{STA}, 1}, {{P2P}, 1}},\ + {{{AP}, 2}} +# endif # else -// (1 STA + 1 AP) or (1 STA + 1 P2P) -# define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{AP}, 1}},\ - {{{STA}, 1}, {{P2P}, 1}} +# ifdef WIFI_HIDL_FEATURE_AWARE +// (1 STA + 1 AP) or (1 STA + 1 of (P2P or NAN)) +# define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{AP}, 1}},\ + {{{STA}, 1}, {{P2P, NAN}, 1}} +# else +// (1 STA + 1 AP) or (1 STA + 1 P2P) +# define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{AP}, 1}},\ + {{{STA}, 1}, {{P2P}, 1}} +# endif # endif # endif #else diff --git a/wifi/1.3/default/wifi_legacy_hal.cpp b/wifi/1.3/default/wifi_legacy_hal.cpp index 485bd1663..5240d5bfc 100644 --- a/wifi/1.3/default/wifi_legacy_hal.cpp +++ b/wifi/1.3/default/wifi_legacy_hal.cpp @@ -1415,6 +1415,35 @@ WifiLegacyHal::getGscanCachedResults(const std::string& iface_name) { return {status, std::move(cached_scan_results)}; } +wifi_error WifiLegacyHal::QcAddInterface(const std::string& iface_name, + const std::string& new_ifname, + uint32_t type) { + wifi_error status = global_func_table_.wifi_add_or_remove_virtual_intf( + getIfaceHandle(iface_name), + new_ifname.c_str(), type, true); + + if (status == WIFI_SUCCESS) { + // refresh list of handlers now. + iface_name_to_handle_.clear(); + status = retrieveIfaceHandles(); + } + return status; +} + +wifi_error WifiLegacyHal::QcRemoveInterface(const std::string& iface_name, + const std::string& ifname) { + wifi_error status = global_func_table_.wifi_add_or_remove_virtual_intf( + getIfaceHandle(iface_name), + ifname.c_str(), 0, false); + + if (status == WIFI_SUCCESS) { + // refresh list of handlers now. + iface_name_to_handle_.clear(); + status = retrieveIfaceHandles(); + } + return status; +} + void WifiLegacyHal::invalidate() { global_handle_ = nullptr; iface_name_to_handle_.clear(); diff --git a/wifi/1.3/default/wifi_legacy_hal.h b/wifi/1.3/default/wifi_legacy_hal.h index 9cfa17240..f88728b9c 100644 --- a/wifi/1.3/default/wifi_legacy_hal.h +++ b/wifi/1.3/default/wifi_legacy_hal.h @@ -367,6 +367,13 @@ class WifiLegacyHal { wifi_error setCountryCode(const std::string& iface_name, std::array<int8_t, 2> code); + wifi_error QcAddInterface(const std::string& iface_name, + const std::string& new_ifname, + uint32_t type); + wifi_error QcRemoveInterface(const std::string& iface_name, + const std::string& ifname); + + private: // Retrieve interface handles for all the available interfaces. wifi_error retrieveIfaceHandles(); |
