Merge "Add DRMO_MODULATION program identifier type."
diff --git a/broadcastradio/1.1/utils/Android.bp b/broadcastradio/1.1/utils/Android.bp
index df5e8e0..73c6680 100644
--- a/broadcastradio/1.1/utils/Android.bp
+++ b/broadcastradio/1.1/utils/Android.bp
@@ -16,7 +16,7 @@
cc_library_static {
name: "android.hardware.broadcastradio@1.1-utils-lib",
- vendor: true,
+ vendor_available: true,
relative_install_path: "hw",
cflags: [
"-Wall",
diff --git a/current.txt b/current.txt
index 2b57af9..e85920f 100644
--- a/current.txt
+++ b/current.txt
@@ -220,4 +220,4 @@
c3354ab0d381a236c12dc486ad4b6bec28c979d26748b4661f12ede36f392808 android.hardware.wifi.offload@1.0::IOffloadCallback
b18caefefcc765092412285d776234fcf213b73bdf07ae1b67a5f71b2d2464e3 android.hardware.wifi.offload@1.0::types
c26473e2e4a00af43e28a0ddf9002e5062a7d0940429e5efb6e5513a8abcb75c android.hardware.wifi@1.1::IWifi
-48adfb7259e3816a82a4c394ffaf56fb14628a542295b7a51f1311392d3f8769 android.hardware.wifi@1.1::IWifiChip
+bfcf4856c7b6c66ebc56785ed3e5d181b7be859c2add672497a843b024518737 android.hardware.wifi@1.1::IWifiChip
diff --git a/drm/1.0/default/CryptoPlugin.cpp b/drm/1.0/default/CryptoPlugin.cpp
index 591861a..fd75dbd 100644
--- a/drm/1.0/default/CryptoPlugin.cpp
+++ b/drm/1.0/default/CryptoPlugin.cpp
@@ -51,7 +51,11 @@
Return<void> CryptoPlugin::setSharedBufferBase(const hidl_memory& base,
uint32_t bufferId) {
- mSharedBufferMap[bufferId] = mapMemory(base);
+ sp<IMemory> hidlMemory = mapMemory(base);
+ ALOGE_IF(hidlMemory == nullptr, "mapMemory returns nullptr");
+
+ // allow mapMemory to return nullptr
+ mSharedBufferMap[bufferId] = hidlMemory;
return Void();
}
@@ -107,6 +111,10 @@
AString detailMessage;
sp<IMemory> sourceBase = mSharedBufferMap[source.bufferId];
+ if (sourceBase == nullptr) {
+ _hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, 0, "source is a nullptr");
+ return Void();
+ }
if (source.offset + offset + source.size > sourceBase->getSize()) {
_hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, 0, "invalid buffer size");
@@ -121,6 +129,11 @@
if (destination.type == BufferType::SHARED_MEMORY) {
const SharedBuffer& destBuffer = destination.nonsecureMemory;
sp<IMemory> destBase = mSharedBufferMap[destBuffer.bufferId];
+ if (destBase == nullptr) {
+ _hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, 0, "destination is a nullptr");
+ return Void();
+ }
+
if (destBuffer.offset + destBuffer.size > destBase->getSize()) {
_hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, 0, "invalid buffer size");
return Void();
diff --git a/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp b/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp
index 26641e8..eeee3c0 100644
--- a/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp
+++ b/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp
@@ -94,10 +94,10 @@
drmFactory =
::testing::VtsHalHidlTargetTestBase::getService<IDrmFactory>();
- ASSERT_NE(drmFactory, nullptr);
+ ASSERT_NE(nullptr, drmFactory.get());
cryptoFactory =
::testing::VtsHalHidlTargetTestBase::getService<ICryptoFactory>();
- ASSERT_NE(cryptoFactory, nullptr);
+ ASSERT_NE(nullptr, cryptoFactory.get());
}
virtual void TearDown() override {}
@@ -166,7 +166,7 @@
kClearKeyUUID, packageName,
[&](Status status, const sp<IDrmPlugin>& plugin) {
EXPECT_EQ(Status::OK, status);
- EXPECT_NE(plugin, nullptr);
+ EXPECT_NE(nullptr, plugin.get());
});
EXPECT_OK(res);
}
@@ -180,7 +180,7 @@
kClearKeyUUID, initVec,
[&](Status status, const sp<ICryptoPlugin>& plugin) {
EXPECT_EQ(Status::OK, status);
- EXPECT_NE(plugin, nullptr);
+ EXPECT_NE(nullptr, plugin.get());
});
EXPECT_OK(res);
}
@@ -194,7 +194,7 @@
kInvalidUUID, packageName,
[&](Status status, const sp<IDrmPlugin>& plugin) {
EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
- EXPECT_EQ(plugin, nullptr);
+ EXPECT_EQ(nullptr, plugin.get());
});
EXPECT_OK(res);
}
@@ -208,7 +208,7 @@
kInvalidUUID, initVec,
[&](Status status, const sp<ICryptoPlugin>& plugin) {
EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
- EXPECT_EQ(plugin, nullptr);
+ EXPECT_EQ(nullptr, plugin.get());
});
EXPECT_OK(res);
}
@@ -219,13 +219,13 @@
// Create factories
DrmHalClearkeyFactoryTest::SetUp();
- ASSERT_NE(drmFactory, nullptr);
+ ASSERT_NE(nullptr, drmFactory.get());
hidl_string packageName("android.hardware.drm.test");
auto res = drmFactory->createPlugin(
kClearKeyUUID, packageName,
[this](Status status, const sp<IDrmPlugin>& plugin) {
EXPECT_EQ(Status::OK, status);
- ASSERT_NE(plugin, nullptr);
+ ASSERT_NE(nullptr, plugin.get());
drmPlugin = plugin;
});
ASSERT_OK(res);
@@ -235,7 +235,7 @@
kClearKeyUUID, initVec,
[this](Status status, const sp<ICryptoPlugin>& plugin) {
EXPECT_EQ(Status::OK, status);
- ASSERT_NE(plugin, nullptr);
+ ASSERT_NE(nullptr, plugin.get());
cryptoPlugin = plugin;
});
ASSERT_OK(res);
@@ -866,7 +866,7 @@
sp<IMemory> DrmHalClearkeyPluginTest::getDecryptMemory(size_t size,
size_t index) {
sp<IAllocator> ashmemAllocator = IAllocator::getService("ashmem");
- EXPECT_NE(ashmemAllocator, nullptr);
+ EXPECT_NE(nullptr, ashmemAllocator.get());
hidl_memory hidlMemory;
auto res = ashmemAllocator->allocate(
@@ -878,6 +878,7 @@
EXPECT_OK(res);
sp<IMemory> mappedMemory = mapMemory(hidlMemory);
+ EXPECT_NE(nullptr, mappedMemory.get());
EXPECT_OK(cryptoPlugin->setSharedBufferBase(hidlMemory, index));
return mappedMemory;
}
diff --git a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
index 67b2c7d..6ce465f 100644
--- a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
+++ b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
@@ -113,7 +113,7 @@
test_info->test_case_name(), test_info->name(),
GetParam().c_str());
- ASSERT_NE(vendorModule, nullptr);
+ ASSERT_NE(nullptr, vendorModule.get());
// First try the binderized service name provided by the vendor module.
// If that fails, which it can on non-binderized devices, try the default
@@ -123,14 +123,14 @@
if (drmFactory == nullptr) {
drmFactory = VtsTestBase::getService<IDrmFactory>();
}
- ASSERT_NE(drmFactory, nullptr);
+ ASSERT_NE(nullptr, drmFactory.get());
// Do the same for the crypto factory
cryptoFactory = VtsTestBase::getService<ICryptoFactory>(name);
if (cryptoFactory == nullptr) {
cryptoFactory = VtsTestBase::getService<ICryptoFactory>();
}
- ASSERT_NE(cryptoFactory, nullptr);
+ ASSERT_NE(nullptr, cryptoFactory.get());
// If drm scheme not installed skip subsequent tests
if (!drmFactory->isCryptoSchemeSupported(getVendorUUID())) {
@@ -239,7 +239,7 @@
getVendorUUID(), packageName,
[&](Status status, const sp<IDrmPlugin>& plugin) {
EXPECT_EQ(Status::OK, status);
- EXPECT_NE(plugin, nullptr);
+ EXPECT_NE(nullptr, plugin.get());
});
EXPECT_OK(res);
}
@@ -254,7 +254,7 @@
getVendorUUID(), initVec,
[&](Status status, const sp<ICryptoPlugin>& plugin) {
EXPECT_EQ(Status::OK, status);
- EXPECT_NE(plugin, nullptr);
+ EXPECT_NE(nullptr, plugin.get());
});
EXPECT_OK(res);
}
@@ -269,7 +269,7 @@
kInvalidUUID, packageName,
[&](Status status, const sp<IDrmPlugin>& plugin) {
EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
- EXPECT_EQ(plugin, nullptr);
+ EXPECT_EQ(nullptr, plugin.get());
});
EXPECT_OK(res);
}
@@ -284,7 +284,7 @@
kInvalidUUID, initVec,
[&](Status status, const sp<ICryptoPlugin>& plugin) {
EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
- EXPECT_EQ(plugin, nullptr);
+ EXPECT_EQ(nullptr, plugin.get());
});
EXPECT_OK(res);
}
@@ -302,7 +302,7 @@
getVendorUUID(), packageName,
[this](Status status, const sp<IDrmPlugin>& plugin) {
EXPECT_EQ(Status::OK, status);
- ASSERT_NE(plugin, nullptr);
+ ASSERT_NE(nullptr, plugin.get());
drmPlugin = plugin;
});
ASSERT_OK(res);
@@ -312,7 +312,7 @@
getVendorUUID(), initVec,
[this](Status status, const sp<ICryptoPlugin>& plugin) {
EXPECT_EQ(Status::OK, status);
- ASSERT_NE(plugin, nullptr);
+ ASSERT_NE(nullptr, plugin.get());
cryptoPlugin = plugin;
});
ASSERT_OK(res);
@@ -1185,7 +1185,7 @@
sp<IMemory> DrmHalVendorPluginTest::getDecryptMemory(size_t size,
size_t index) {
sp<IAllocator> ashmemAllocator = IAllocator::getService("ashmem");
- EXPECT_NE(ashmemAllocator, nullptr);
+ EXPECT_NE(nullptr, ashmemAllocator.get());
hidl_memory hidlMemory;
auto res = ashmemAllocator->allocate(
@@ -1198,7 +1198,7 @@
EXPECT_OK(res);
sp<IMemory> mappedMemory = mapMemory(hidlMemory);
- EXPECT_NE(mappedMemory, nullptr);
+ EXPECT_NE(nullptr, mappedMemory.get());
res = cryptoPlugin->setSharedBufferBase(hidlMemory, index);
EXPECT_OK(res);
return mappedMemory;
diff --git a/wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp b/wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp
index 160fcd2..beac039 100644
--- a/wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp
+++ b/wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp
@@ -20,10 +20,16 @@
#include "wifi_hidl_test_utils.h"
+WifiHidlEnvironment* gEnv;
+
int main(int argc, char** argv) {
- ::testing::AddGlobalTestEnvironment(new WifiHidlEnvironment);
+ gEnv = new WifiHidlEnvironment();
+ ::testing::AddGlobalTestEnvironment(gEnv);
::testing::InitGoogleTest(&argc, argv);
- int status = RUN_ALL_TESTS();
- LOG(INFO) << "Test result = " << status;
+ int status = gEnv->initFromOptions(argc, argv);
+ if (status == 0) {
+ status = RUN_ALL_TESTS();
+ LOG(INFO) << "Test result = " << status;
+ }
return status;
}
diff --git a/wifi/1.0/vts/functional/wifi_chip_hidl_test.cpp b/wifi/1.0/vts/functional/wifi_chip_hidl_test.cpp
index 6c2372f..06e21ff 100644
--- a/wifi/1.0/vts/functional/wifi_chip_hidl_test.cpp
+++ b/wifi/1.0/vts/functional/wifi_chip_hidl_test.cpp
@@ -42,6 +42,8 @@
using ::android::hardware::wifi::V1_0::IWifiRttController;
using ::android::hardware::wifi::V1_0::IWifiStaIface;
+extern WifiHidlEnvironment* gEnv;
+
namespace {
constexpr WifiDebugRingBufferVerboseLevel kDebugRingBufferVerboseLvl =
WifiDebugRingBufferVerboseLevel::VERBOSE;
@@ -78,7 +80,8 @@
// to be first configured.
ChipModeId configureChipForIfaceType(IfaceType type, bool expectSuccess) {
ChipModeId mode_id;
- EXPECT_EQ(expectSuccess, configureChipToSupportIfaceType(wifi_chip_, type, &mode_id));
+ EXPECT_EQ(expectSuccess,
+ configureChipToSupportIfaceType(wifi_chip_, type, &mode_id));
return mode_id;
}
@@ -436,10 +439,14 @@
* succeeds. The 2nd iface creation should be rejected.
*/
TEST_F(WifiChipHidlTest, CreateNanIface) {
- configureChipForIfaceType(IfaceType::NAN, false);
+ configureChipForIfaceType(IfaceType::NAN, gEnv->isNanOn);
+ if (!gEnv->isNanOn) return;
sp<IWifiNanIface> iface;
- ASSERT_EQ(WifiStatusCode::ERROR_NOT_AVAILABLE, createNanIface(&iface));
+ ASSERT_EQ(WifiStatusCode::SUCCESS, createNanIface(&iface));
+ EXPECT_NE(nullptr, iface.get());
+
+ EXPECT_EQ(WifiStatusCode::ERROR_NOT_AVAILABLE, createNanIface(&iface));
}
/*
@@ -449,12 +456,30 @@
* iface name is returned via the list.
*/
TEST_F(WifiChipHidlTest, GetNanIfaceNames) {
- configureChipForIfaceType(IfaceType::NAN, false);
+ configureChipForIfaceType(IfaceType::NAN, gEnv->isNanOn);
+ if (!gEnv->isNanOn) return;
const auto& status_and_iface_names1 =
HIDL_INVOKE(wifi_chip_, getNanIfaceNames);
ASSERT_EQ(WifiStatusCode::SUCCESS, status_and_iface_names1.first.code);
EXPECT_EQ(0u, status_and_iface_names1.second.size());
+
+ sp<IWifiNanIface> iface;
+ EXPECT_EQ(WifiStatusCode::SUCCESS, createNanIface(&iface));
+ EXPECT_NE(nullptr, iface.get());
+
+ std::string iface_name = getIfaceName(iface);
+ const auto& status_and_iface_names2 =
+ HIDL_INVOKE(wifi_chip_, getNanIfaceNames);
+ EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_iface_names2.first.code);
+ EXPECT_EQ(1u, status_and_iface_names2.second.size());
+ EXPECT_EQ(iface_name, status_and_iface_names2.second[0]);
+
+ EXPECT_EQ(WifiStatusCode::SUCCESS, removeNanIface(iface_name));
+ const auto& status_and_iface_names3 =
+ HIDL_INVOKE(wifi_chip_, getNanIfaceNames);
+ EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_iface_names3.first.code);
+ EXPECT_EQ(0u, status_and_iface_names3.second.size());
}
/*
@@ -464,10 +489,24 @@
* doesn't retrieve an iface object.
*/
TEST_F(WifiChipHidlTest, GetNanIface) {
- configureChipForIfaceType(IfaceType::NAN, false);
+ configureChipForIfaceType(IfaceType::NAN, gEnv->isNanOn);
+ if (!gEnv->isNanOn) return;
sp<IWifiNanIface> nan_iface;
- ASSERT_EQ(WifiStatusCode::ERROR_NOT_AVAILABLE, createNanIface(&nan_iface));
+ EXPECT_EQ(WifiStatusCode::SUCCESS, createNanIface(&nan_iface));
+ EXPECT_NE(nullptr, nan_iface.get());
+
+ std::string iface_name = getIfaceName(nan_iface);
+ const auto& status_and_iface1 =
+ HIDL_INVOKE(wifi_chip_, getNanIface, iface_name);
+ EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_iface1.first.code);
+ EXPECT_NE(nullptr, status_and_iface1.second.get());
+
+ std::string invalid_name = iface_name + "0";
+ const auto& status_and_iface2 =
+ HIDL_INVOKE(wifi_chip_, getNanIface, invalid_name);
+ EXPECT_EQ(WifiStatusCode::ERROR_INVALID_ARGS, status_and_iface2.first.code);
+ EXPECT_EQ(nullptr, status_and_iface2.second.get());
}
/*
@@ -477,10 +516,21 @@
* doesn't remove the iface.
*/
TEST_F(WifiChipHidlTest, RemoveNanIface) {
- configureChipForIfaceType(IfaceType::NAN, false);
+ configureChipForIfaceType(IfaceType::NAN, gEnv->isNanOn);
+ if (!gEnv->isNanOn) return;
sp<IWifiNanIface> nan_iface;
- ASSERT_EQ(WifiStatusCode::ERROR_NOT_AVAILABLE, createNanIface(&nan_iface));
+ EXPECT_EQ(WifiStatusCode::SUCCESS, createNanIface(&nan_iface));
+ EXPECT_NE(nullptr, nan_iface.get());
+
+ std::string iface_name = getIfaceName(nan_iface);
+ std::string invalid_name = iface_name + "0";
+ EXPECT_EQ(WifiStatusCode::ERROR_INVALID_ARGS, removeNanIface(invalid_name));
+
+ EXPECT_EQ(WifiStatusCode::SUCCESS, removeNanIface(iface_name));
+
+ // No such iface exists now. So, this should return failure.
+ EXPECT_EQ(WifiStatusCode::ERROR_INVALID_ARGS, removeNanIface(iface_name));
}
/*
diff --git a/wifi/1.0/vts/functional/wifi_hidl_test_utils.h b/wifi/1.0/vts/functional/wifi_hidl_test_utils.h
index 39a0eba..c4a19dd 100644
--- a/wifi/1.0/vts/functional/wifi_hidl_test_utils.h
+++ b/wifi/1.0/vts/functional/wifi_hidl_test_utils.h
@@ -24,6 +24,8 @@
#include <android/hardware/wifi/1.0/IWifiRttController.h>
#include <android/hardware/wifi/1.0/IWifiStaIface.h>
+#include <getopt.h>
+
// Helper functions to obtain references to the various HIDL interface objects.
// Note: We only have a single instance of each of these objects currently.
// These helper functions should be modified to return vectors if we support
@@ -46,10 +48,46 @@
void stopWifi();
class WifiHidlEnvironment : public ::testing::Environment {
- public:
- virtual void SetUp() override {
- stopWifi();
- sleep(5);
- }
- virtual void TearDown() override {}
-};
\ No newline at end of file
+ protected:
+ virtual void SetUp() override {
+ stopWifi();
+ sleep(5);
+ }
+
+ public:
+ // Whether NaN feature is supported on the device.
+ bool isNanOn = false;
+
+ void usage(char* me, char* arg) {
+ fprintf(stderr,
+ "unrecognized option: %s\n\n"
+ "usage: %s <gtest options> <test options>\n\n"
+ "test options are:\n\n"
+ "-N, --nan_on: Whether NAN feature is supported\n",
+ arg, me);
+ }
+
+ int initFromOptions(int argc, char** argv) {
+ static struct option options[] = {{"nan_on", no_argument, 0, 'N'},
+ {0, 0, 0, 0}};
+
+ int c;
+ while ((c = getopt_long(argc, argv, "N", options, NULL)) >= 0) {
+ switch (c) {
+ case 'N':
+ isNanOn = true;
+ break;
+ default:
+ usage(argv[0], argv[optind]);
+ return 2;
+ }
+ }
+
+ if (optind < argc) {
+ usage(argv[0], argv[optind]);
+ return 2;
+ }
+
+ return 0;
+ }
+};
diff --git a/wifi/1.1/IWifiChip.hal b/wifi/1.1/IWifiChip.hal
index 7275412..50cd02d 100644
--- a/wifi/1.1/IWifiChip.hal
+++ b/wifi/1.1/IWifiChip.hal
@@ -32,7 +32,15 @@
/**
* Set/Reset Tx Power limits.
*/
- SET_TX_POWER_LIMIT = 1 << 8
+ SET_TX_POWER_LIMIT = 1 << 8,
+ /**
+ * Device to Device RTT.
+ */
+ D2D_RTT = 1 << 9,
+ /**
+ * Device to AP RTT.
+ */
+ D2AP_RTT = 1 << 10
};
/**
diff --git a/wifi/1.1/default/hidl_struct_util.cpp b/wifi/1.1/default/hidl_struct_util.cpp
index a413cbb..6b93b9e 100644
--- a/wifi/1.1/default/hidl_struct_util.cpp
+++ b/wifi/1.1/default/hidl_struct_util.cpp
@@ -75,6 +75,10 @@
switch (feature) {
case WIFI_FEATURE_SET_TX_POWER_LIMIT:
return HidlChipCaps::SET_TX_POWER_LIMIT;
+ case WIFI_FEATURE_D2D_RTT:
+ return HidlChipCaps::D2D_RTT;
+ case WIFI_FEATURE_D2AP_RTT:
+ return HidlChipCaps::D2AP_RTT;
};
CHECK(false) << "Unknown legacy feature: " << feature;
return {};
@@ -133,7 +137,9 @@
*hidl_caps |= convertLegacyLoggerFeatureToHidlChipCapability(feature);
}
}
- for (const auto feature : {WIFI_FEATURE_SET_TX_POWER_LIMIT}) {
+ for (const auto feature : {WIFI_FEATURE_SET_TX_POWER_LIMIT,
+ WIFI_FEATURE_D2D_RTT,
+ WIFI_FEATURE_D2AP_RTT}) {
if (feature & legacy_feature_set) {
*hidl_caps |= convertLegacyFeatureToHidlChipCapability(feature);
}
diff --git a/wifi/1.1/vts/functional/VtsHalWifiV1_1TargetTest.cpp b/wifi/1.1/vts/functional/VtsHalWifiV1_1TargetTest.cpp
index 160fcd2..9b92b57 100644
--- a/wifi/1.1/vts/functional/VtsHalWifiV1_1TargetTest.cpp
+++ b/wifi/1.1/vts/functional/VtsHalWifiV1_1TargetTest.cpp
@@ -20,10 +20,16 @@
#include "wifi_hidl_test_utils.h"
+WifiHidlEnvironment* gEnv;
+
int main(int argc, char** argv) {
- ::testing::AddGlobalTestEnvironment(new WifiHidlEnvironment);
+ gEnv = new WifiHidlEnvironment();
+ ::testing::AddGlobalTestEnvironment(gEnv);
::testing::InitGoogleTest(&argc, argv);
- int status = RUN_ALL_TESTS();
- LOG(INFO) << "Test result = " << status;
+ int status = gEnv->initFromOptions(argc, argv);
+ if (status == 0) {
+ int status = RUN_ALL_TESTS();
+ LOG(INFO) << "Test result = " << status;
+ }
return status;
}