Loading contexthub/1.0/default/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ cc_binary { proprietary: true, init_rc: ["android.hardware.contexthub@1.0-service.rc"], srcs: ["service.cpp"], cflags: ["-Wall", "-Werror"], shared_libs: [ "libbase", Loading graphics/composer/2.1/default/Hwc.cpp +11 −3 Original line number Diff line number Diff line Loading @@ -35,10 +35,8 @@ namespace composer { namespace V2_1 { namespace implementation { HwcHal::HwcHal(const hw_module_t* module) : mDevice(nullptr), mDispatch(), mAdapter() { : mDevice(nullptr), mDispatch(), mMustValidateDisplay(true), mAdapter() { // Determine what kind of module is available (HWC2 vs HWC1.X). hw_device_t* device = nullptr; int error = module->methods->open(module, HWC_HARDWARE_COMPOSER, &device); Loading Loading @@ -283,6 +281,8 @@ void HwcHal::refreshHook(hwc2_callback_data_t callbackData, hwc2_display_t display) { auto hal = reinterpret_cast<HwcHal*>(callbackData); hal->mMustValidateDisplay = true; auto client = hal->getClient(); if (client != nullptr) { client->onRefresh(display); Loading @@ -302,6 +302,8 @@ void HwcHal::vsyncHook(hwc2_callback_data_t callbackData, void HwcHal::enableCallback(bool enable) { if (enable) { mMustValidateDisplay = true; mDispatch.registerCallback(mDevice, HWC2_CALLBACK_HOTPLUG, this, reinterpret_cast<hwc2_function_pointer_t>(hotplugHook)); mDispatch.registerCallback(mDevice, HWC2_CALLBACK_REFRESH, this, Loading Loading @@ -549,6 +551,8 @@ Error HwcHal::validateDisplay(Display display, uint32_t reqs_count = 0; int32_t err = mDispatch.validateDisplay(mDevice, display, &types_count, &reqs_count); mMustValidateDisplay = false; if (err != HWC2_ERROR_NONE && err != HWC2_ERROR_HAS_CHANGES) { return static_cast<Error>(err); } Loading Loading @@ -609,6 +613,10 @@ Error HwcHal::acceptDisplayChanges(Display display) Error HwcHal::presentDisplay(Display display, int32_t* outPresentFence, std::vector<Layer>* outLayers, std::vector<int32_t>* outReleaseFences) { if (mMustValidateDisplay) { return Error::NOT_VALIDATED; } *outPresentFence = -1; int32_t err = mDispatch.presentDisplay(mDevice, display, outPresentFence); if (err != HWC2_ERROR_NONE) { Loading graphics/composer/2.1/default/Hwc.h +3 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #ifndef ANDROID_HARDWARE_GRAPHICS_COMPOSER_V2_1_HWC_H #define ANDROID_HARDWARE_GRAPHICS_COMPOSER_V2_1_HWC_H #include <atomic> #include <condition_variable> #include <memory> #include <mutex> Loading Loading @@ -215,6 +216,8 @@ private: std::condition_variable mClientDestroyedWait; wp<ComposerClient> mClient; std::atomic<bool> mMustValidateDisplay; // If the HWC implementation version is < 2.0, use an adapter to interface // between HWC 2.0 <-> HWC 1.X. std::unique_ptr<HWC2On1Adapter> mAdapter; Loading tetheroffload/control/1.0/vts/functional/VtsHalTetheroffloadControlV1_0TargetTest.cpp +43 −25 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <linux/netfilter/nfnetlink.h> #include <linux/netlink.h> #include <log/log.h> #include <net/if.h> #include <sys/socket.h> #include <unistd.h> #include <set> Loading @@ -52,6 +53,8 @@ enum class ExpectBoolean { True = 1, }; constexpr const char* TEST_IFACE = "rmnet_data0"; // We use #defines here so as to get local lamba captures and error message line numbers #define ASSERT_TRUE_CALLBACK \ [&](bool success, std::string errMsg) { \ Loading Loading @@ -240,6 +243,18 @@ TEST_F(OffloadControlHidlTestBase, MultipleStopsWithoutInitReturnFalse) { stopOffload(ExpectBoolean::False); } // Check whether the specified interface is up. bool interfaceIsUp(const char* name) { if (name == nullptr) return false; struct ifreq ifr = {}; strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); int sock = socket(AF_INET6, SOCK_DGRAM, 0); if (sock == -1) return false; int ret = ioctl(sock, SIOCGIFFLAGS, &ifr, sizeof(ifr)); close(sock); return (ret == 0) && (ifr.ifr_flags & IFF_UP); } // Check that calling stopOffload() after a complete init/stop cycle returns false. TEST_F(OffloadControlHidlTestBase, AdditionalStopsWithInitReturnFalse) { initOffload(true); Loading @@ -249,8 +264,11 @@ TEST_F(OffloadControlHidlTestBase, AdditionalStopsWithInitReturnFalse) { const hidl_string v4Gw("192.0.0.1"); const vector<hidl_string> v6Gws{hidl_string("fe80::db8:1"), hidl_string("fe80::db8:2")}; const Return<void> upstream = control->setUpstreamParameters("rmnet_data0", v4Addr, v4Gw, v6Gws, ASSERT_TRUE_CALLBACK); control->setUpstreamParameters(TEST_IFACE, v4Addr, v4Gw, v6Gws, ASSERT_TRUE_CALLBACK); EXPECT_TRUE(upstream.isOk()); if (!interfaceIsUp(TEST_IFACE)) { return; } stopOffload(ExpectBoolean::True); // balance out initOffload(true) stopOffload(ExpectBoolean::False); stopOffload(ExpectBoolean::False); Loading @@ -266,14 +284,14 @@ TEST_F(OffloadControlHidlTestBase, SetLocalPrefixesWithoutInitReturnsFalse) { // Check that calling getForwardedStats() without first having called initOffload() // returns zero bytes statistics. TEST_F(OffloadControlHidlTestBase, GetForwardedStatsWithoutInitReturnsZeroValues) { const hidl_string upstream("rmnet_data0"); const hidl_string upstream(TEST_IFACE); const Return<void> ret = control->getForwardedStats(upstream, ASSERT_ZERO_BYTES_CALLBACK); EXPECT_TRUE(ret.isOk()); } // Check that calling setDataLimit() without first having called initOffload() returns false. TEST_F(OffloadControlHidlTestBase, SetDataLimitWithoutInitReturnsFalse) { const hidl_string upstream("rmnet_data0"); const hidl_string upstream(TEST_IFACE); const uint64_t limit = 5000ULL; const Return<void> ret = control->setDataLimit(upstream, limit, ASSERT_FALSE_CALLBACK); EXPECT_TRUE(ret.isOk()); Loading @@ -282,7 +300,7 @@ TEST_F(OffloadControlHidlTestBase, SetDataLimitWithoutInitReturnsFalse) { // Check that calling setUpstreamParameters() without first having called initOffload() // returns false. TEST_F(OffloadControlHidlTestBase, SetUpstreamParametersWithoutInitReturnsFalse) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string v4Addr("192.0.2.0/24"); const hidl_string v4Gw("192.0.2.1"); const vector<hidl_string> v6Gws{hidl_string("fe80::db8:1")}; Loading @@ -294,7 +312,7 @@ TEST_F(OffloadControlHidlTestBase, SetUpstreamParametersWithoutInitReturnsFalse) // Check that calling addDownstream() with an IPv4 prefix without first having called // initOffload() returns false. TEST_F(OffloadControlHidlTestBase, AddIPv4DownstreamWithoutInitReturnsFalse) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string prefix("192.0.2.0/24"); const Return<void> ret = control->addDownstream(iface, prefix, ASSERT_FALSE_CALLBACK); EXPECT_TRUE(ret.isOk()); Loading @@ -303,7 +321,7 @@ TEST_F(OffloadControlHidlTestBase, AddIPv4DownstreamWithoutInitReturnsFalse) { // Check that calling addDownstream() with an IPv6 prefix without first having called // initOffload() returns false. TEST_F(OffloadControlHidlTestBase, AddIPv6DownstreamWithoutInitReturnsFalse) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string prefix("2001:db8::/64"); const Return<void> ret = control->addDownstream(iface, prefix, ASSERT_FALSE_CALLBACK); EXPECT_TRUE(ret.isOk()); Loading @@ -312,7 +330,7 @@ TEST_F(OffloadControlHidlTestBase, AddIPv6DownstreamWithoutInitReturnsFalse) { // Check that calling removeDownstream() with an IPv4 prefix without first having called // initOffload() returns false. TEST_F(OffloadControlHidlTestBase, RemoveIPv4DownstreamWithoutInitReturnsFalse) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string prefix("192.0.2.0/24"); const Return<void> ret = control->removeDownstream(iface, prefix, ASSERT_FALSE_CALLBACK); EXPECT_TRUE(ret.isOk()); Loading @@ -321,7 +339,7 @@ TEST_F(OffloadControlHidlTestBase, RemoveIPv4DownstreamWithoutInitReturnsFalse) // Check that calling removeDownstream() with an IPv6 prefix without first having called // initOffload() returns false. TEST_F(OffloadControlHidlTestBase, RemoveIPv6DownstreamWithoutInitReturnsFalse) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string prefix("2001:db8::/64"); const Return<void> ret = control->removeDownstream(iface, prefix, ASSERT_FALSE_CALLBACK); EXPECT_TRUE(ret.isOk()); Loading Loading @@ -394,10 +412,10 @@ TEST_F(OffloadControlHidlTest, GetForwardedStatsInvalidUpstreamIface) { EXPECT_TRUE(ret.isOk()); } // The "rmnet_data0" is presumed to exist on the device and be up. No packets // TEST_IFACE is presumed to exist on the device and be up. No packets // are ever actually caused to be forwarded. TEST_F(OffloadControlHidlTest, GetForwardedStatsDummyIface) { const hidl_string upstream("rmnet_data0"); const hidl_string upstream(TEST_IFACE); const Return<void> ret = control->getForwardedStats(upstream, ASSERT_ZERO_BYTES_CALLBACK); EXPECT_TRUE(ret.isOk()); } Loading @@ -414,19 +432,19 @@ TEST_F(OffloadControlHidlTest, SetDataLimitEmptyUpstreamIfaceFails) { EXPECT_TRUE(ret.isOk()); } // The "rmnet_data0" is presumed to exist on the device and be up. No packets // TEST_IFACE is presumed to exist on the device and be up. No packets // are ever actually caused to be forwarded. TEST_F(OffloadControlHidlTest, SetDataLimitNonZeroOk) { const hidl_string upstream("rmnet_data0"); const hidl_string upstream(TEST_IFACE); const uint64_t limit = 5000ULL; const Return<void> ret = control->setDataLimit(upstream, limit, ASSERT_TRUE_CALLBACK); EXPECT_TRUE(ret.isOk()); } // The "rmnet_data0" is presumed to exist on the device and be up. No packets // TEST_IFACE is presumed to exist on the device and be up. No packets // are ever actually caused to be forwarded. TEST_F(OffloadControlHidlTest, SetDataLimitZeroOk) { const hidl_string upstream("rmnet_data0"); const hidl_string upstream(TEST_IFACE); const uint64_t limit = 0ULL; const Return<void> ret = control->setDataLimit(upstream, limit, ASSERT_TRUE_CALLBACK); EXPECT_TRUE(ret.isOk()); Loading @@ -436,10 +454,10 @@ TEST_F(OffloadControlHidlTest, SetDataLimitZeroOk) { * Tests for IOffloadControl::setUpstreamParameters(). */ // The "rmnet_data0" is presumed to exist on the device and be up. No packets // TEST_IFACE is presumed to exist on the device and be up. No packets // are ever actually caused to be forwarded. TEST_F(OffloadControlHidlTest, SetUpstreamParametersIPv6OnlyOk) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string v4Addr(""); const hidl_string v4Gw(""); const vector<hidl_string> v6Gws{hidl_string("fe80::db8:1"), hidl_string("fe80::db8:2")}; Loading @@ -448,10 +466,10 @@ TEST_F(OffloadControlHidlTest, SetUpstreamParametersIPv6OnlyOk) { EXPECT_TRUE(ret.isOk()); } // The "rmnet_data0" is presumed to exist on the device and be up. No packets // TEST_IFACE is presumed to exist on the device and be up. No packets // are ever actually caused to be forwarded. TEST_F(OffloadControlHidlTest, SetUpstreamParametersAlternateIPv6OnlyOk) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string v4Addr; const hidl_string v4Gw; const vector<hidl_string> v6Gws{hidl_string("fe80::db8:1"), hidl_string("fe80::db8:3")}; Loading @@ -460,10 +478,10 @@ TEST_F(OffloadControlHidlTest, SetUpstreamParametersAlternateIPv6OnlyOk) { EXPECT_TRUE(ret.isOk()); } // The "rmnet_data0" is presumed to exist on the device and be up. No packets // TEST_IFACE is presumed to exist on the device and be up. No packets // are ever actually caused to be forwarded. TEST_F(OffloadControlHidlTest, SetUpstreamParametersIPv4OnlyOk) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string v4Addr("192.0.2.2"); const hidl_string v4Gw("192.0.2.1"); const vector<hidl_string> v6Gws{}; Loading @@ -472,10 +490,10 @@ TEST_F(OffloadControlHidlTest, SetUpstreamParametersIPv4OnlyOk) { EXPECT_TRUE(ret.isOk()); } // The "rmnet_data0" is presumed to exist on the device and be up. No packets // TEST_IFACE is presumed to exist on the device and be up. No packets // are ever actually caused to be forwarded. TEST_F(OffloadControlHidlTest, SetUpstreamParametersIPv4v6Ok) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string v4Addr("192.0.2.2"); const hidl_string v4Gw("192.0.2.1"); const vector<hidl_string> v6Gws{hidl_string("fe80::db8:1"), hidl_string("fe80::db8:2")}; Loading Loading @@ -511,7 +529,7 @@ TEST_F(OffloadControlHidlTest, SetUpstreamParametersBogusIfaceFails) { // Test that setUpstreamParameters() fails when given unparseable IPv4 addresses. TEST_F(OffloadControlHidlTest, SetUpstreamParametersInvalidIPv4AddrFails) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string v4Gw("192.0.2.1"); const vector<hidl_string> v6Gws{hidl_string("fe80::db8:1")}; for (const auto& bogus : {"invalid", "192.0.2"}) { Loading @@ -525,7 +543,7 @@ TEST_F(OffloadControlHidlTest, SetUpstreamParametersInvalidIPv4AddrFails) { // Test that setUpstreamParameters() fails when given unparseable IPv4 gateways. TEST_F(OffloadControlHidlTest, SetUpstreamParametersInvalidIPv4GatewayFails) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string v4Addr("192.0.2.2"); const vector<hidl_string> v6Gws{hidl_string("fe80::db8:1")}; for (const auto& bogus : {"invalid", "192.0.2"}) { Loading @@ -539,7 +557,7 @@ TEST_F(OffloadControlHidlTest, SetUpstreamParametersInvalidIPv4GatewayFails) { // Test that setUpstreamParameters() fails when given unparseable IPv6 gateways. TEST_F(OffloadControlHidlTest, SetUpstreamParametersBadIPv6GatewaysFail) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string v4Addr("192.0.2.2"); const hidl_string v4Gw("192.0.2.1"); for (const auto& bogus : {"", "invalid", "fe80::bogus", "192.0.2.66"}) { Loading Loading
contexthub/1.0/default/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ cc_binary { proprietary: true, init_rc: ["android.hardware.contexthub@1.0-service.rc"], srcs: ["service.cpp"], cflags: ["-Wall", "-Werror"], shared_libs: [ "libbase", Loading
graphics/composer/2.1/default/Hwc.cpp +11 −3 Original line number Diff line number Diff line Loading @@ -35,10 +35,8 @@ namespace composer { namespace V2_1 { namespace implementation { HwcHal::HwcHal(const hw_module_t* module) : mDevice(nullptr), mDispatch(), mAdapter() { : mDevice(nullptr), mDispatch(), mMustValidateDisplay(true), mAdapter() { // Determine what kind of module is available (HWC2 vs HWC1.X). hw_device_t* device = nullptr; int error = module->methods->open(module, HWC_HARDWARE_COMPOSER, &device); Loading Loading @@ -283,6 +281,8 @@ void HwcHal::refreshHook(hwc2_callback_data_t callbackData, hwc2_display_t display) { auto hal = reinterpret_cast<HwcHal*>(callbackData); hal->mMustValidateDisplay = true; auto client = hal->getClient(); if (client != nullptr) { client->onRefresh(display); Loading @@ -302,6 +302,8 @@ void HwcHal::vsyncHook(hwc2_callback_data_t callbackData, void HwcHal::enableCallback(bool enable) { if (enable) { mMustValidateDisplay = true; mDispatch.registerCallback(mDevice, HWC2_CALLBACK_HOTPLUG, this, reinterpret_cast<hwc2_function_pointer_t>(hotplugHook)); mDispatch.registerCallback(mDevice, HWC2_CALLBACK_REFRESH, this, Loading Loading @@ -549,6 +551,8 @@ Error HwcHal::validateDisplay(Display display, uint32_t reqs_count = 0; int32_t err = mDispatch.validateDisplay(mDevice, display, &types_count, &reqs_count); mMustValidateDisplay = false; if (err != HWC2_ERROR_NONE && err != HWC2_ERROR_HAS_CHANGES) { return static_cast<Error>(err); } Loading Loading @@ -609,6 +613,10 @@ Error HwcHal::acceptDisplayChanges(Display display) Error HwcHal::presentDisplay(Display display, int32_t* outPresentFence, std::vector<Layer>* outLayers, std::vector<int32_t>* outReleaseFences) { if (mMustValidateDisplay) { return Error::NOT_VALIDATED; } *outPresentFence = -1; int32_t err = mDispatch.presentDisplay(mDevice, display, outPresentFence); if (err != HWC2_ERROR_NONE) { Loading
graphics/composer/2.1/default/Hwc.h +3 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #ifndef ANDROID_HARDWARE_GRAPHICS_COMPOSER_V2_1_HWC_H #define ANDROID_HARDWARE_GRAPHICS_COMPOSER_V2_1_HWC_H #include <atomic> #include <condition_variable> #include <memory> #include <mutex> Loading Loading @@ -215,6 +216,8 @@ private: std::condition_variable mClientDestroyedWait; wp<ComposerClient> mClient; std::atomic<bool> mMustValidateDisplay; // If the HWC implementation version is < 2.0, use an adapter to interface // between HWC 2.0 <-> HWC 1.X. std::unique_ptr<HWC2On1Adapter> mAdapter; Loading
tetheroffload/control/1.0/vts/functional/VtsHalTetheroffloadControlV1_0TargetTest.cpp +43 −25 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <linux/netfilter/nfnetlink.h> #include <linux/netlink.h> #include <log/log.h> #include <net/if.h> #include <sys/socket.h> #include <unistd.h> #include <set> Loading @@ -52,6 +53,8 @@ enum class ExpectBoolean { True = 1, }; constexpr const char* TEST_IFACE = "rmnet_data0"; // We use #defines here so as to get local lamba captures and error message line numbers #define ASSERT_TRUE_CALLBACK \ [&](bool success, std::string errMsg) { \ Loading Loading @@ -240,6 +243,18 @@ TEST_F(OffloadControlHidlTestBase, MultipleStopsWithoutInitReturnFalse) { stopOffload(ExpectBoolean::False); } // Check whether the specified interface is up. bool interfaceIsUp(const char* name) { if (name == nullptr) return false; struct ifreq ifr = {}; strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); int sock = socket(AF_INET6, SOCK_DGRAM, 0); if (sock == -1) return false; int ret = ioctl(sock, SIOCGIFFLAGS, &ifr, sizeof(ifr)); close(sock); return (ret == 0) && (ifr.ifr_flags & IFF_UP); } // Check that calling stopOffload() after a complete init/stop cycle returns false. TEST_F(OffloadControlHidlTestBase, AdditionalStopsWithInitReturnFalse) { initOffload(true); Loading @@ -249,8 +264,11 @@ TEST_F(OffloadControlHidlTestBase, AdditionalStopsWithInitReturnFalse) { const hidl_string v4Gw("192.0.0.1"); const vector<hidl_string> v6Gws{hidl_string("fe80::db8:1"), hidl_string("fe80::db8:2")}; const Return<void> upstream = control->setUpstreamParameters("rmnet_data0", v4Addr, v4Gw, v6Gws, ASSERT_TRUE_CALLBACK); control->setUpstreamParameters(TEST_IFACE, v4Addr, v4Gw, v6Gws, ASSERT_TRUE_CALLBACK); EXPECT_TRUE(upstream.isOk()); if (!interfaceIsUp(TEST_IFACE)) { return; } stopOffload(ExpectBoolean::True); // balance out initOffload(true) stopOffload(ExpectBoolean::False); stopOffload(ExpectBoolean::False); Loading @@ -266,14 +284,14 @@ TEST_F(OffloadControlHidlTestBase, SetLocalPrefixesWithoutInitReturnsFalse) { // Check that calling getForwardedStats() without first having called initOffload() // returns zero bytes statistics. TEST_F(OffloadControlHidlTestBase, GetForwardedStatsWithoutInitReturnsZeroValues) { const hidl_string upstream("rmnet_data0"); const hidl_string upstream(TEST_IFACE); const Return<void> ret = control->getForwardedStats(upstream, ASSERT_ZERO_BYTES_CALLBACK); EXPECT_TRUE(ret.isOk()); } // Check that calling setDataLimit() without first having called initOffload() returns false. TEST_F(OffloadControlHidlTestBase, SetDataLimitWithoutInitReturnsFalse) { const hidl_string upstream("rmnet_data0"); const hidl_string upstream(TEST_IFACE); const uint64_t limit = 5000ULL; const Return<void> ret = control->setDataLimit(upstream, limit, ASSERT_FALSE_CALLBACK); EXPECT_TRUE(ret.isOk()); Loading @@ -282,7 +300,7 @@ TEST_F(OffloadControlHidlTestBase, SetDataLimitWithoutInitReturnsFalse) { // Check that calling setUpstreamParameters() without first having called initOffload() // returns false. TEST_F(OffloadControlHidlTestBase, SetUpstreamParametersWithoutInitReturnsFalse) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string v4Addr("192.0.2.0/24"); const hidl_string v4Gw("192.0.2.1"); const vector<hidl_string> v6Gws{hidl_string("fe80::db8:1")}; Loading @@ -294,7 +312,7 @@ TEST_F(OffloadControlHidlTestBase, SetUpstreamParametersWithoutInitReturnsFalse) // Check that calling addDownstream() with an IPv4 prefix without first having called // initOffload() returns false. TEST_F(OffloadControlHidlTestBase, AddIPv4DownstreamWithoutInitReturnsFalse) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string prefix("192.0.2.0/24"); const Return<void> ret = control->addDownstream(iface, prefix, ASSERT_FALSE_CALLBACK); EXPECT_TRUE(ret.isOk()); Loading @@ -303,7 +321,7 @@ TEST_F(OffloadControlHidlTestBase, AddIPv4DownstreamWithoutInitReturnsFalse) { // Check that calling addDownstream() with an IPv6 prefix without first having called // initOffload() returns false. TEST_F(OffloadControlHidlTestBase, AddIPv6DownstreamWithoutInitReturnsFalse) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string prefix("2001:db8::/64"); const Return<void> ret = control->addDownstream(iface, prefix, ASSERT_FALSE_CALLBACK); EXPECT_TRUE(ret.isOk()); Loading @@ -312,7 +330,7 @@ TEST_F(OffloadControlHidlTestBase, AddIPv6DownstreamWithoutInitReturnsFalse) { // Check that calling removeDownstream() with an IPv4 prefix without first having called // initOffload() returns false. TEST_F(OffloadControlHidlTestBase, RemoveIPv4DownstreamWithoutInitReturnsFalse) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string prefix("192.0.2.0/24"); const Return<void> ret = control->removeDownstream(iface, prefix, ASSERT_FALSE_CALLBACK); EXPECT_TRUE(ret.isOk()); Loading @@ -321,7 +339,7 @@ TEST_F(OffloadControlHidlTestBase, RemoveIPv4DownstreamWithoutInitReturnsFalse) // Check that calling removeDownstream() with an IPv6 prefix without first having called // initOffload() returns false. TEST_F(OffloadControlHidlTestBase, RemoveIPv6DownstreamWithoutInitReturnsFalse) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string prefix("2001:db8::/64"); const Return<void> ret = control->removeDownstream(iface, prefix, ASSERT_FALSE_CALLBACK); EXPECT_TRUE(ret.isOk()); Loading Loading @@ -394,10 +412,10 @@ TEST_F(OffloadControlHidlTest, GetForwardedStatsInvalidUpstreamIface) { EXPECT_TRUE(ret.isOk()); } // The "rmnet_data0" is presumed to exist on the device and be up. No packets // TEST_IFACE is presumed to exist on the device and be up. No packets // are ever actually caused to be forwarded. TEST_F(OffloadControlHidlTest, GetForwardedStatsDummyIface) { const hidl_string upstream("rmnet_data0"); const hidl_string upstream(TEST_IFACE); const Return<void> ret = control->getForwardedStats(upstream, ASSERT_ZERO_BYTES_CALLBACK); EXPECT_TRUE(ret.isOk()); } Loading @@ -414,19 +432,19 @@ TEST_F(OffloadControlHidlTest, SetDataLimitEmptyUpstreamIfaceFails) { EXPECT_TRUE(ret.isOk()); } // The "rmnet_data0" is presumed to exist on the device and be up. No packets // TEST_IFACE is presumed to exist on the device and be up. No packets // are ever actually caused to be forwarded. TEST_F(OffloadControlHidlTest, SetDataLimitNonZeroOk) { const hidl_string upstream("rmnet_data0"); const hidl_string upstream(TEST_IFACE); const uint64_t limit = 5000ULL; const Return<void> ret = control->setDataLimit(upstream, limit, ASSERT_TRUE_CALLBACK); EXPECT_TRUE(ret.isOk()); } // The "rmnet_data0" is presumed to exist on the device and be up. No packets // TEST_IFACE is presumed to exist on the device and be up. No packets // are ever actually caused to be forwarded. TEST_F(OffloadControlHidlTest, SetDataLimitZeroOk) { const hidl_string upstream("rmnet_data0"); const hidl_string upstream(TEST_IFACE); const uint64_t limit = 0ULL; const Return<void> ret = control->setDataLimit(upstream, limit, ASSERT_TRUE_CALLBACK); EXPECT_TRUE(ret.isOk()); Loading @@ -436,10 +454,10 @@ TEST_F(OffloadControlHidlTest, SetDataLimitZeroOk) { * Tests for IOffloadControl::setUpstreamParameters(). */ // The "rmnet_data0" is presumed to exist on the device and be up. No packets // TEST_IFACE is presumed to exist on the device and be up. No packets // are ever actually caused to be forwarded. TEST_F(OffloadControlHidlTest, SetUpstreamParametersIPv6OnlyOk) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string v4Addr(""); const hidl_string v4Gw(""); const vector<hidl_string> v6Gws{hidl_string("fe80::db8:1"), hidl_string("fe80::db8:2")}; Loading @@ -448,10 +466,10 @@ TEST_F(OffloadControlHidlTest, SetUpstreamParametersIPv6OnlyOk) { EXPECT_TRUE(ret.isOk()); } // The "rmnet_data0" is presumed to exist on the device and be up. No packets // TEST_IFACE is presumed to exist on the device and be up. No packets // are ever actually caused to be forwarded. TEST_F(OffloadControlHidlTest, SetUpstreamParametersAlternateIPv6OnlyOk) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string v4Addr; const hidl_string v4Gw; const vector<hidl_string> v6Gws{hidl_string("fe80::db8:1"), hidl_string("fe80::db8:3")}; Loading @@ -460,10 +478,10 @@ TEST_F(OffloadControlHidlTest, SetUpstreamParametersAlternateIPv6OnlyOk) { EXPECT_TRUE(ret.isOk()); } // The "rmnet_data0" is presumed to exist on the device and be up. No packets // TEST_IFACE is presumed to exist on the device and be up. No packets // are ever actually caused to be forwarded. TEST_F(OffloadControlHidlTest, SetUpstreamParametersIPv4OnlyOk) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string v4Addr("192.0.2.2"); const hidl_string v4Gw("192.0.2.1"); const vector<hidl_string> v6Gws{}; Loading @@ -472,10 +490,10 @@ TEST_F(OffloadControlHidlTest, SetUpstreamParametersIPv4OnlyOk) { EXPECT_TRUE(ret.isOk()); } // The "rmnet_data0" is presumed to exist on the device and be up. No packets // TEST_IFACE is presumed to exist on the device and be up. No packets // are ever actually caused to be forwarded. TEST_F(OffloadControlHidlTest, SetUpstreamParametersIPv4v6Ok) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string v4Addr("192.0.2.2"); const hidl_string v4Gw("192.0.2.1"); const vector<hidl_string> v6Gws{hidl_string("fe80::db8:1"), hidl_string("fe80::db8:2")}; Loading Loading @@ -511,7 +529,7 @@ TEST_F(OffloadControlHidlTest, SetUpstreamParametersBogusIfaceFails) { // Test that setUpstreamParameters() fails when given unparseable IPv4 addresses. TEST_F(OffloadControlHidlTest, SetUpstreamParametersInvalidIPv4AddrFails) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string v4Gw("192.0.2.1"); const vector<hidl_string> v6Gws{hidl_string("fe80::db8:1")}; for (const auto& bogus : {"invalid", "192.0.2"}) { Loading @@ -525,7 +543,7 @@ TEST_F(OffloadControlHidlTest, SetUpstreamParametersInvalidIPv4AddrFails) { // Test that setUpstreamParameters() fails when given unparseable IPv4 gateways. TEST_F(OffloadControlHidlTest, SetUpstreamParametersInvalidIPv4GatewayFails) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string v4Addr("192.0.2.2"); const vector<hidl_string> v6Gws{hidl_string("fe80::db8:1")}; for (const auto& bogus : {"invalid", "192.0.2"}) { Loading @@ -539,7 +557,7 @@ TEST_F(OffloadControlHidlTest, SetUpstreamParametersInvalidIPv4GatewayFails) { // Test that setUpstreamParameters() fails when given unparseable IPv6 gateways. TEST_F(OffloadControlHidlTest, SetUpstreamParametersBadIPv6GatewaysFail) { const hidl_string iface("rmnet_data0"); const hidl_string iface(TEST_IFACE); const hidl_string v4Addr("192.0.2.2"); const hidl_string v4Gw("192.0.2.1"); for (const auto& bogus : {"", "invalid", "fe80::bogus", "192.0.2.66"}) { Loading