Merge "Add vts test for setCarrierInfoForImsiEncryption" into oc-dr1-dev
diff --git a/camera/device/3.2/default/CameraDeviceSession.cpp b/camera/device/3.2/default/CameraDeviceSession.cpp
index f33adf8..fcd134f 100644
--- a/camera/device/3.2/default/CameraDeviceSession.cpp
+++ b/camera/device/3.2/default/CameraDeviceSession.cpp
@@ -923,6 +923,7 @@
status = Status::INTERNAL_ERROR;
} else {
convertToHidl(stream_list, &outStreams);
+ mFirstRequest = true;
}
_hidl_cb(status, outStreams);
@@ -1022,7 +1023,13 @@
if (!converted) {
ALOGE("%s: capture request settings metadata is corrupt!", __FUNCTION__);
- return Status::INTERNAL_ERROR;
+ return Status::ILLEGAL_ARGUMENT;
+ }
+
+ if (mFirstRequest && halRequest.settings == nullptr) {
+ ALOGE("%s: capture request settings must not be null for first request!",
+ __FUNCTION__);
+ return Status::ILLEGAL_ARGUMENT;
}
hidl_vec<buffer_handle_t*> allBufPtrs;
@@ -1031,6 +1038,12 @@
request.inputBuffer.bufferId != 0);
size_t numOutputBufs = request.outputBuffers.size();
size_t numBufs = numOutputBufs + (hasInputBuf ? 1 : 0);
+
+ if (numOutputBufs == 0) {
+ ALOGE("%s: capture request must have at least one output buffer!", __FUNCTION__);
+ return Status::ILLEGAL_ARGUMENT;
+ }
+
status = importRequest(request, allBufPtrs, allFences);
if (status != Status::OK) {
return status;
@@ -1102,6 +1115,7 @@
return Status::INTERNAL_ERROR;
}
+ mFirstRequest = false;
return Status::OK;
}
diff --git a/camera/device/3.2/default/CameraDeviceSession.h b/camera/device/3.2/default/CameraDeviceSession.h
index fb3fc02..2fe189f 100644
--- a/camera/device/3.2/default/CameraDeviceSession.h
+++ b/camera/device/3.2/default/CameraDeviceSession.h
@@ -148,6 +148,7 @@
static HandleImporter sHandleImporter;
bool mInitFail;
+ bool mFirstRequest = false;
common::V1_0::helper::CameraMetadata mDeviceInfo;
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index 35df042..a27fd66 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -132,22 +132,34 @@
const char *kHAL1_0 = "1.0";
bool matchDeviceName(const hidl_string& deviceName,
- const hidl_string &providerType, std::smatch& sm) {
+ const hidl_string &providerType,
+ std::string* deviceVersion,
+ std::string* cameraId) {
::android::String8 pattern;
pattern.appendFormat(kDeviceNameRE, providerType.c_str());
std::regex e(pattern.string());
std::string deviceNameStd(deviceName.c_str());
- return std::regex_match(deviceNameStd, sm, e);
+ std::smatch sm;
+ if (std::regex_match(deviceNameStd, sm, e)) {
+ if (deviceVersion != nullptr) {
+ *deviceVersion = sm[1];
+ }
+ if (cameraId != nullptr) {
+ *cameraId = sm[2];
+ }
+ return true;
+ }
+ return false;
}
int getCameraDeviceVersion(const hidl_string& deviceName,
const hidl_string &providerType) {
- std::smatch sm;
- bool match = matchDeviceName(deviceName, providerType, sm);
+ std::string version;
+ bool match = matchDeviceName(deviceName, providerType, &version, nullptr);
if (!match) {
return -1;
}
- std::string version = sm[1].str();
+
if (version.compare(kHAL3_2) == 0) {
// maybe switched to 3.4 or define the hidl version enumlater
return CAMERA_DEVICE_API_VERSION_3_2;
@@ -2982,6 +2994,9 @@
//Empty settings should be supported after the first call
//for repeating requests.
request.settings.setToExternal(nullptr, 0, true);
+ // The buffer has been registered to HAL by bufferId, so per
+ // API contract we should send a null handle for this buffer
+ request.outputBuffers[0].buffer = nullptr;
mInflightMap.clear();
inflightReq = {1, false, supportsPartialResults,
partialResultCount, resultQueue};
@@ -3078,7 +3093,7 @@
numRequestProcessed = n;
});
ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Status::INTERNAL_ERROR, status);
+ ASSERT_EQ(Status::ILLEGAL_ARGUMENT, status);
ASSERT_EQ(numRequestProcessed, 0u);
ret = session->close();
@@ -3139,7 +3154,7 @@
numRequestProcessed = n;
});
ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Status::INTERNAL_ERROR, status);
+ ASSERT_EQ(Status::ILLEGAL_ARGUMENT, status);
ASSERT_EQ(numRequestProcessed, 0u);
ret = session->close();
diff --git a/current.txt b/current.txt
index ffec165..2ad1e09 100644
--- a/current.txt
+++ b/current.txt
@@ -219,4 +219,4 @@
c3354ab0d381a236c12dc486ad4b6bec28c979d26748b4661f12ede36f392808 android.hardware.wifi.offload@1.0::IOffloadCallback
b18caefefcc765092412285d776234fcf213b73bdf07ae1b67a5f71b2d2464e3 android.hardware.wifi.offload@1.0::types
c26473e2e4a00af43e28a0ddf9002e5062a7d0940429e5efb6e5513a8abcb75c android.hardware.wifi@1.1::IWifi
-bfcf4856c7b6c66ebc56785ed3e5d181b7be859c2add672497a843b024518737 android.hardware.wifi@1.1::IWifiChip
+b056e1defab4071584214584057d0bc73a613081bf1152590549649d4582c13c android.hardware.wifi@1.1::IWifiChip
diff --git a/wifi/1.1/IWifiChip.hal b/wifi/1.1/IWifiChip.hal
index 50cd02d..1af1f71 100644
--- a/wifi/1.1/IWifiChip.hal
+++ b/wifi/1.1/IWifiChip.hal
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 The Android Open Source Project
+ * Copyright 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,24 +44,40 @@
};
/**
- * API to set TX power limit.
- * This is used for meeting SAR requirements while making VOIP calls for
- * example.
- *
- * @param powerInDbm Power level in dBm.
- * @return status WifiStatus of the operation.
- * Possible status codes:
- * |WifiStatusCode.SUCCESS|,
- * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
- * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
- * |WifiStatusCode.NOT_AVAILABLE|,
- * |WifiStatusCode.UNKNOWN|
+ * List of preset wifi radio TX power levels for different scenarios.
+ * The actual power values (typically varies based on the channel,
+ * 802.11 connection type, number of MIMO streams, etc) for each scenario
+ * is defined by the OEM as a BDF file since it varies for each wifi chip
+ * vendor and device.
*/
- setTxPowerLimit(int32_t powerInDbm) generates (WifiStatus status);
+ enum TxPowerScenario : uint32_t {
+ VOICE_CALL = 0,
+ };
/**
- * API to reset TX power limit.
- * This is used to set the power back to default values.
+ * API to select one of the preset TX power scenarios.
+ *
+ * The framework must invoke this method with the appropriate scenario to let
+ * the wifi chip change it's transmitting power levels.
+ * OEM's should define various power profiles for each of the scenarios
+ * above (defined in |TxPowerScenario|).
+ *
+ * @param scenario One of the preselected scenarios defined in
+ * |TxPowerScenario|.
+ * @return status WifiStatus of the operation.
+ * Possible status codes:
+ * |WifiStatusCode.SUCCESS|,
+ * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
+ * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
+ * |WifiStatusCode.NOT_AVAILABLE|,
+ * |WifiStatusCode.UNKNOWN|
+ */
+ selectTxPowerScenario(TxPowerScenario scenario) generates (WifiStatus status);
+
+ /**
+ * API to reset TX power levels.
+ * This is used to indicate the end of the previously selected TX power
+ * scenario and let the wifi chip fall back to the default power values.
*
* @return status WifiStatus of the operation.
* Possible status codes:
@@ -71,5 +87,5 @@
* |WifiStatusCode.NOT_AVAILABLE|,
* |WifiStatusCode.UNKNOWN|
*/
- resetTxPowerLimit() generates (WifiStatus status);
+ resetTxPowerScenario() generates (WifiStatus status);
};
diff --git a/wifi/1.1/default/hidl_struct_util.cpp b/wifi/1.1/default/hidl_struct_util.cpp
index 6b93b9e..c53cdc5 100644
--- a/wifi/1.1/default/hidl_struct_util.cpp
+++ b/wifi/1.1/default/hidl_struct_util.cpp
@@ -17,9 +17,6 @@
#include <android-base/logging.h>
#include <utils/SystemClock.h>
-#include <android/hardware/wifi/1.0/IWifiChip.h>
-#include <android/hardware/wifi/1.1/IWifiChip.h>
-
#include "hidl_struct_util.h"
namespace android {
@@ -260,6 +257,15 @@
return true;
}
+legacy_hal::wifi_power_scenario convertHidlTxPowerScenarioToLegacy(
+ V1_1::IWifiChip::TxPowerScenario hidl_scenario) {
+ switch (hidl_scenario) {
+ case V1_1::IWifiChip::TxPowerScenario::VOICE_CALL:
+ return legacy_hal::WIFI_POWER_SCENARIO_VOICE_CALL;
+ };
+ CHECK(false);
+}
+
bool convertLegacyFeaturesToHidlStaCapabilities(
uint32_t legacy_feature_set,
uint32_t legacy_logger_feature_set,
diff --git a/wifi/1.1/default/hidl_struct_util.h b/wifi/1.1/default/hidl_struct_util.h
index 7a840f9..747fd2f 100644
--- a/wifi/1.1/default/hidl_struct_util.h
+++ b/wifi/1.1/default/hidl_struct_util.h
@@ -20,6 +20,8 @@
#include <vector>
#include <android/hardware/wifi/1.0/types.h>
+#include <android/hardware/wifi/1.0/IWifiChip.h>
+#include <android/hardware/wifi/1.1/IWifiChip.h>
#include "wifi_legacy_hal.h"
@@ -51,6 +53,8 @@
bool convertLegacyWakeReasonStatsToHidl(
const legacy_hal::WakeReasonStats& legacy_stats,
WifiDebugHostWakeReasonStats* hidl_stats);
+legacy_hal::wifi_power_scenario convertHidlTxPowerScenarioToLegacy(
+ V1_1::IWifiChip::TxPowerScenario hidl_scenario);
// STA iface conversion methods.
bool convertLegacyFeaturesToHidlStaCapabilities(
diff --git a/wifi/1.1/default/wifi_chip.cpp b/wifi/1.1/default/wifi_chip.cpp
index 2beac26..2f40234 100644
--- a/wifi/1.1/default/wifi_chip.cpp
+++ b/wifi/1.1/default/wifi_chip.cpp
@@ -343,20 +343,20 @@
enable);
}
-Return<void> WifiChip::setTxPowerLimit(
- int32_t powerInDbm, setTxPowerLimit_cb hidl_status_cb) {
+Return<void> WifiChip::selectTxPowerScenario(
+ TxPowerScenario scenario, selectTxPowerScenario_cb hidl_status_cb) {
return validateAndCall(this,
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
- &WifiChip::setTxPowerLimitInternal,
+ &WifiChip::selectTxPowerScenarioInternal,
hidl_status_cb,
- powerInDbm);
+ scenario);
}
-Return<void> WifiChip::resetTxPowerLimit(
- resetTxPowerLimit_cb hidl_status_cb) {
+Return<void> WifiChip::resetTxPowerScenario(
+ resetTxPowerScenario_cb hidl_status_cb) {
return validateAndCall(this,
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
- &WifiChip::resetTxPowerLimitInternal,
+ &WifiChip::resetTxPowerScenarioInternal,
hidl_status_cb);
}
@@ -824,13 +824,14 @@
return createWifiStatusFromLegacyError(legacy_status);
}
-WifiStatus WifiChip::setTxPowerLimitInternal(int32_t powerInDbm) {
- auto legacy_status = legacy_hal_.lock()->setTxPowerLimit(powerInDbm);
+WifiStatus WifiChip::selectTxPowerScenarioInternal(TxPowerScenario scenario) {
+ auto legacy_status = legacy_hal_.lock()->selectTxPowerScenario(
+ hidl_struct_util::convertHidlTxPowerScenarioToLegacy(scenario));
return createWifiStatusFromLegacyError(legacy_status);
}
-WifiStatus WifiChip::resetTxPowerLimitInternal() {
- auto legacy_status = legacy_hal_.lock()->resetTxPowerLimit();
+WifiStatus WifiChip::resetTxPowerScenarioInternal() {
+ auto legacy_status = legacy_hal_.lock()->resetTxPowerScenario();
return createWifiStatusFromLegacyError(legacy_status);
}
diff --git a/wifi/1.1/default/wifi_chip.h b/wifi/1.1/default/wifi_chip.h
index b7dde50..e88100b 100644
--- a/wifi/1.1/default/wifi_chip.h
+++ b/wifi/1.1/default/wifi_chip.h
@@ -126,9 +126,11 @@
getDebugHostWakeReasonStats_cb hidl_status_cb) override;
Return<void> enableDebugErrorAlerts(
bool enable, enableDebugErrorAlerts_cb hidl_status_cb) override;
- Return<void> setTxPowerLimit(
- int32_t powerInDbm, setTxPowerLimit_cb hidl_status_cb) override;
- Return<void> resetTxPowerLimit(resetTxPowerLimit_cb hidl_status_cb) override;
+ Return<void> selectTxPowerScenario(
+ TxPowerScenario scenario,
+ selectTxPowerScenario_cb hidl_status_cb) override;
+ Return<void> resetTxPowerScenario(
+ resetTxPowerScenario_cb hidl_status_cb) override;
private:
void invalidateAndRemoveAllIfaces();
@@ -180,8 +182,8 @@
std::pair<WifiStatus, WifiDebugHostWakeReasonStats>
getDebugHostWakeReasonStatsInternal();
WifiStatus enableDebugErrorAlertsInternal(bool enable);
- WifiStatus setTxPowerLimitInternal(int32_t powerInDbm);
- WifiStatus resetTxPowerLimitInternal();
+ WifiStatus selectTxPowerScenarioInternal(TxPowerScenario scenario);
+ WifiStatus resetTxPowerScenarioInternal();
WifiStatus handleChipConfiguration(ChipModeId mode_id);
WifiStatus registerDebugRingBufferCallback();
diff --git a/wifi/1.1/default/wifi_legacy_hal.cpp b/wifi/1.1/default/wifi_legacy_hal.cpp
index 052aafb..7d683d3 100644
--- a/wifi/1.1/default/wifi_legacy_hal.cpp
+++ b/wifi/1.1/default/wifi_legacy_hal.cpp
@@ -752,13 +752,13 @@
oui_internal.data());
}
-wifi_error WifiLegacyHal::setTxPowerLimit(int32_t tx_level_dbm) {
- return global_func_table_.wifi_set_tx_power_limit(wlan_interface_handle_,
- tx_level_dbm);
+wifi_error WifiLegacyHal::selectTxPowerScenario(wifi_power_scenario scenario) {
+ return global_func_table_.wifi_select_tx_power_scenario(
+ wlan_interface_handle_, scenario);
}
-wifi_error WifiLegacyHal::resetTxPowerLimit() {
- return global_func_table_.wifi_reset_tx_power_limit(wlan_interface_handle_);
+wifi_error WifiLegacyHal::resetTxPowerScenario() {
+ return global_func_table_.wifi_reset_tx_power_scenario(wlan_interface_handle_);
}
std::pair<wifi_error, uint32_t> WifiLegacyHal::getLoggerSupportedFeatureSet() {
diff --git a/wifi/1.1/default/wifi_legacy_hal.h b/wifi/1.1/default/wifi_legacy_hal.h
index 8d9144d..caa1bd5 100644
--- a/wifi/1.1/default/wifi_legacy_hal.h
+++ b/wifi/1.1/default/wifi_legacy_hal.h
@@ -205,8 +205,8 @@
uint32_t period_in_ms);
wifi_error stopSendingOffloadedPacket(uint32_t cmd_id);
wifi_error setScanningMacOui(const std::array<uint8_t, 3>& oui);
- wifi_error setTxPowerLimit(int32_t tx_level_dbm);
- wifi_error resetTxPowerLimit();
+ wifi_error selectTxPowerScenario(wifi_power_scenario scenario);
+ wifi_error resetTxPowerScenario();
// Logger/debug functions.
std::pair<wifi_error, uint32_t> getLoggerSupportedFeatureSet();
wifi_error startPktFateMonitoring();
diff --git a/wifi/1.1/default/wifi_legacy_hal_stubs.cpp b/wifi/1.1/default/wifi_legacy_hal_stubs.cpp
index 24ed548..c02e3ba 100644
--- a/wifi/1.1/default/wifi_legacy_hal_stubs.cpp
+++ b/wifi/1.1/default/wifi_legacy_hal_stubs.cpp
@@ -132,8 +132,8 @@
populateStubFor(&hal_fn->wifi_get_roaming_capabilities);
populateStubFor(&hal_fn->wifi_enable_firmware_roaming);
populateStubFor(&hal_fn->wifi_configure_roaming);
- populateStubFor(&hal_fn->wifi_set_tx_power_limit);
- populateStubFor(&hal_fn->wifi_reset_tx_power_limit);
+ populateStubFor(&hal_fn->wifi_select_tx_power_scenario);
+ populateStubFor(&hal_fn->wifi_reset_tx_power_scenario);
return true;
}
} // namespace legacy_hal
diff --git a/wifi/1.1/vts/functional/wifi_chip_hidl_test.cpp b/wifi/1.1/vts/functional/wifi_chip_hidl_test.cpp
index 839b6c4..d3a983c 100644
--- a/wifi/1.1/vts/functional/wifi_chip_hidl_test.cpp
+++ b/wifi/1.1/vts/functional/wifi_chip_hidl_test.cpp
@@ -37,7 +37,8 @@
using ::android::hardware::wifi::V1_0::IWifiStaIface;
namespace {
-constexpr int32_t kFakePowerInDbm = -56;
+constexpr IWifiChip::TxPowerScenario kFakePowerScenario =
+ IWifiChip::TxPowerScenario::VOICE_CALL;
}; //namespace
/**
@@ -66,12 +67,12 @@
};
/*
- * SetTxPowerLimit
+ * SelectTxPowerScenario
*/
-TEST_F(WifiChipHidlTest, SetTxPowerLimit) {
+TEST_F(WifiChipHidlTest, SelectTxPowerScenario) {
uint32_t caps = configureChipForStaIfaceAndGetCapabilities();
const auto& status =
- HIDL_INVOKE(wifi_chip_, setTxPowerLimit, kFakePowerInDbm);
+ HIDL_INVOKE(wifi_chip_, selectTxPowerScenario, kFakePowerScenario);
if (caps & IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT) {
EXPECT_EQ(WifiStatusCode::SUCCESS, status.code);
} else {
@@ -80,12 +81,12 @@
}
/*
- * SetTxPowerLimit
+ * ResetTxPowerScenario
*/
-TEST_F(WifiChipHidlTest, ResetTxPowerLimit) {
+TEST_F(WifiChipHidlTest, ResetTxPowerScenario) {
uint32_t caps = configureChipForStaIfaceAndGetCapabilities();
const auto& status =
- HIDL_INVOKE(wifi_chip_, resetTxPowerLimit);
+ HIDL_INVOKE(wifi_chip_, resetTxPowerScenario);
if (caps & IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT) {
EXPECT_EQ(WifiStatusCode::SUCCESS, status.code);
} else {