The testNotificationsShownAndCleared test was not doing anything
because the list of notification to show was always empty.
This patch fixes this issue and actually makes the test loop on
non-empty collections, and also fixes another ordering issue in
assertions themselves, hidden until now by the first issue.
Bug: 32561414
Test: runtest -x frameworks/base/tests/net/java/com/android/server/connectivity/NetworkNotificationManagerTest.java
Merged-In: I4837b1175d7c9133e9156e33acaa1e7e3341cc62
Change-Id: Ia30587bd68a87b83b62f57eeeb28fef7d95dbf81
(cherry picked from commit f8b804be5aeb5d0a36ff88649d7c5ecdc47c3ad1)
Introduce a SharedLog that can be shared among all Tethering
components. All log entries go to the same log, and each includes
its subsystem name. Additionally, all entries emitted to the
system log shared the same tag, so can easily be watched.
More subsystems can inherit a SharedLog, but to minimize cherry-pick
conflicts we limit ourselves to these changes only.
Test: as follows
- built
- flashed
- booted
- log output observed via dumpsys
- runtest frameworks-net passes
Bug: 32163131
Bug: 36988090
Bug: 38218697
Change-Id: I1229d4c55987402d84b0d4a2c8a595e0c829aa3e
Also, make all tests start with mobile data always on disabled.
This is because some tests only pass when mobile data always on
is disabled. This doesn't cause any problems when running all
the tests in the file, because these tests are always run after
one or more calls to tearDown, which disables mobile data always
on. However, it does cause issues when those tests are run alone.
Test: new test passes 50 times in a row
Test: ConnectivityServiceTest passes
Change-Id: I1eef5d7f5ec5464e0f9a1d7f1130d9ba6dea4557
Follow-up of commit c86013be936f36c61fa0cdfad95141f6de3c6ef7.
Also add @SmallTest annotation to classes moved to tests/net.
Test: no functional change
Bug: 32561414
Change-Id: I0a0e8865d37ba7bae06ce352d3fc385989adc300
This patch introduces between ConnectivityManager and
ConnectivityService a mechanism for propagating back to clients
informative errors in the form of error codes and associated custom
runtime exceptions.
Without error code, the service can only throw a limited number of
different exceptions over Binder. Furthermore the throw site stack
traces are always loss. Although for individual instances of a throw,
the error message can be inspected, aggregations of stack traces from
app crashes sanitize error messages and only leaves the stack traces.
This makes debugging dificult for some service calls such as
requestNetwork that can have a variety of failure modes.
In this patch only one failure mode is codified. More can be added later
at a light cost by: 1) defining an error code, 2) defining an
associated exception, 3) mapping the code to the exception. This patch
can serves as a template for doing so.
Test: $ runtest frameworks-net,
#testNetworkRequestMaximum() detects the new exception type.
Bug: 36556809, 36701874
Change-Id: I611fd7915575c9e418f7149fcdc8a879d2a3716d
For 464xlat scenarios on IPv6 networks, the clatd interface setup
introduces double counting of apps ipv4 traffic. NetworkStatsFactory was
accounting for this on the tx path, but not on the rx path. Also it did
not accounted for the 20 bytes added by the IPv6 header.
This patch subtract correctly the rx and tx traffic from the root uid on
the underlying interface, and also adds correctly the 20 bytes cost per
packet on the stacked interface for 464xlat traffic.
Test: added several new unit tests, based on synthetic data and real
data also.
Bug: 33681750
Change-Id: I2675643b220acbc6110179fa937d4c313b6f5e32
In preparation for removing junit and android.test classes from
the Android API this change adds explicit dependencies on junit
and/or legacy-android-test to ensure that modules will compile
properly once it is removed.
Care was taken to ensure that any targets that depended,
directly or indirectly, on android-support-test did not also
depend on junit or hamcrest as they conflict with the versions
embedded within android-support-test.
Bug: 30188076
Test: make checkbuild
Change-Id: Ice80a29b420061f5d0af6eb46426455abf890e5e
Merged-In: Ifc3ee3dc804074a3c572bf2600cfb1fe1b6fa749
This patch adds test coverage for NsdManager#registerService() and
NsdManager#unregisterService(). This test shows a potential defect in
the api: if unregisterService() fails, the associated listener is always
unregistered from NsdManager. If the service initially registered is
still registered, this potentially make it impossible to unregister.
Test: added new unit test
Bug: 37013369, 33298084
Change-Id: Ia089b6d2f2a349907a8b29d9a3acd7f59e177887
This patch disentangles the creation of NativeDaemonConnector from the
creation of NsdService by introducing a wrapper type DaemonConnection.
This allows to mock this dependency in unit tests.
Test: enhanced previously introduced new tests.
Bug: 37013369, 33298084
Change-Id: I894b7cddfc509f86d0134d214c88c063b81b5e0a