3839 Commits

Author SHA1 Message Date
Erik Kline
5eba88cf44 Merge "Start of UpstreamNetworkMonitor unittests" am: f9a28d7ba4
am: 4bb6f5a418

Change-Id: I6a9106fd4fef85451104593ab8c37d4539cb9223
2017-01-17 04:51:48 +00:00
Treehugger Robot
5511f7cfc2 Merge "Move tests added in n-mr2 into new aosp location." 2017-01-17 04:49:08 +00:00
Erik Kline
4bb6f5a418 Merge "Start of UpstreamNetworkMonitor unittests"
am: f9a28d7ba4

Change-Id: I2dade79427530a04c8e222e4ab2bf26e79ddd578
2017-01-17 04:46:17 +00:00
Erik Kline
885a9098cf Start of UpstreamNetworkMonitor unittests
Test only the ConnectivityManager request and callback registering
and releasing.  Testing behaviour triggered by activating these
callbacks will be in a separate change.

Test: runtest frameworks-net
Bug: 32163131
Change-Id: Ibfe66bbe2e61d81e8f13ac3b98e000d0d4534efa
2017-01-17 11:08:29 +09:00
Hugo Benichi
84f43a3e15 Merge "IP connectivity metrics: fix tests" 2017-01-16 08:28:47 +00:00
Erik Kline
e446acf954 Move tests added in n-mr2 into new aosp location.
Test: runtest frameworks-net
Change-Id: I3ca0d7e01a3f31be05d4a1a72a95c7e37a0a567e
2017-01-16 15:24:31 +09:00
Hugo Benichi
a5bf819216 Stricter NetworkNotificationManagerTest
This patch changes NetworkNotificationManagerTest to populate extraInfo
of NetworkInfo in order to catch regressions in malformed format Strings
of log statements in NetworkNotificationManager.

Test: verified that the test fails when reintroducing the format String
bug.
Bug: 33737715

(cherry picked from commit a865790a5b30a2d5e29e3d443e7b02a5d8aa01a4)

Change-Id: Ic2f23e860a17cb83b90edcfd2ba365134cacfe36
2017-01-16 15:15:26 +09:00
Hugo Benichi
1af06a6e09 IP connectivity metrics: fix tests
Change 4e89a026292338761838b33fc83b250f3519819c did not update the unit
tests checking serialization of ipconnectivity.proto protobufs.

This patch updates the tests expectations to make them pass again

Test: $ runtest frameworks-net
Bug: 34232829
Change-Id: Iccc4e1a7714c9ce1eba995dc47a2961216efc87d
2017-01-16 14:42:56 +09:00
Hugo Benichi
4e1619f034 ConnectivityServiceTest: some fixes in CallbackInfo
- CallbackInfo becomes a static class so that it can be instantiated
  and looked at more easily than before.
- CallbackInfo gains hashCode() because it has equals().
- effectively final field are qualified final
- fixes bug when polling the next callback: poll() on a LinkedBlockingQueue
  returns null when timing out, which was not failing the test cleanly.

Test: ConnectivityServiceTest passes
Bug: 32561414
Change-Id: I64d382a35fe83f21bded98e6906c1ec70a8f1085
2017-01-16 11:15:04 +09:00
TreeHugger Robot
ec4e0b075f Merge "Create a new jank test to measure HW layer resize performance" 2017-01-09 18:50:56 +00:00
Stan Iliev
6337f4fb27 Create a new jank test to measure HW layer resize performance
Write a jank test that is animating height and width of a View
backed by a HW layer.

Test: built angler-userdebug and ran UiBench jank tests.
Change-Id: I69eccb73b6fb887549506c80590892665051ee2f
2017-01-06 14:28:56 -05:00
Wale Ogunwale
26c0dfed7a Support for WindowContainer controllers and listeners
- WindowContainerController class allows a component outside window manager
to create a window container and communicate directly with it to make
changes. For example, the ActivityRecord class in activity manager uses the
AppWindowContainerController class to create and communicate with
AppWindowToken window container class which is its counterpart on the window
manager side.
- WindowContainerListener interface allows a component outside WM to get
notified of changes to a window container. For example, the ActivityRecord
class in AM implements the AppWindowContainerListener interface to get
notified of changes to the AppWindowToken container.

Bug: 30060889
Test: Existing tests pass and manual testing.
Test: bit FrameworksServicesTests:com.android.server.wm.WindowContainerControllerTests
Test: bit FrameworksServicesTests:com.android.server.wm.WindowContainerTests
Change-Id: I2896bfa46a80b227052528c7da8cf4e56beab4bc
2017-01-06 09:11:02 -08:00
TreeHugger Robot
87a66afec2 Merge "IP Connectivity metrics: add connect() statistics" 2016-12-15 16:09:18 +00:00
Hugo Benichi
0d4a398b78 IP Connectivity metrics: add connect() statistics
This patch adds a ConnectStats class to aggregate connect() statistics
gathered in NetdEventListenerService. ConnectStats is uploaded once a
day by IpConnectivityMetrics.

Test: $ runtest frameworks-net + new unit test
Bug: 32198976
Change-Id: Iea63339035415513a5ba0ff4b8f4d79f75fc652d
2016-12-15 22:53:53 +09:00
Hugo Benichi
fb2609d3ee Network notifications: revamp keying scheme
This patch changes the (tag: String, id: Int) keying scheme for network
notifications so that TRON notification counters can count network
related notifications unambiguously.

TRON instruments all notifications shown for package "android" as well
as user interactions with these Notifications. These counters are
grouped by id. However the network notifications ("no internet" dialog,
"captive portal sign in" dialog, ...) use a static tag and a dynamic id
for keying notifications, preventing the counters to correctly
aggregate. In addition there is also the risk of collision with other
SystemUi notification ids not managed by NetworkNotificationManager.

In order to make the TRON counters useful for network notifications,
the id is now encoding the network notification type in a stable way
while the tag is used to uniquely identify network notifications.

Test: change covered by previously added new unit tests.
Bug: 32198726
Bug: 33030620
Change-Id: I1201d1d4fab8183dd83449c2afb2c35cfece883f
2016-12-15 10:31:38 +09:00
Hugo Benichi
28d240c72d Merge "Fix IP connectivity metrics tests" 2016-12-13 03:56:53 +00:00
Hugo Benichi
74b45cd4dc Merge "Unit tests for NetworkNotificationManager" 2016-12-13 02:23:05 +00:00
TreeHugger Robot
2894d0ac51 Merge "Untangle creation of Task from addition of AppToken in WM." 2016-12-13 00:56:09 +00:00
Wale Ogunwale
72919d2c31 Untangle creation of Task from addition of AppToken in WM.
Makes it easier to follow what is going on and also clean-up in
preparation of stand way for AM to interact with containers in WM.

Test: Existing tests pass and manual testing
Change-Id: I91754b6d974dce2f696453cdaed175efb0f10c73
2016-12-12 15:09:03 -08:00
Chad Brubaker
5297f03d90 Merge "Default to not allowing cleartext traffic for ephemeral apps" 2016-12-12 18:19:02 +00:00
Hugo Benichi
cfcc1cb7bf DO NOT MERGE: frameworks-test: adding missing @SmallTest
This activates all frameworks-test tests in runs of the continuous
platform tests.

Test: $ runtest frameworks-net passes (expect Tether
Bug: 32561414
(cherry picked from commit fa8a6f6220d1a0027ba7969c2d3f72690ddc6495)

Change-Id: I7b0706a7e3368f971d508388e8ad4afc5de9d646
2016-12-09 14:35:05 +09:00
Hugo Benichi
5d0f28c7fd DO NOT MERGE: Netd events: record connect() success/errno
Test: $ runtest frameworks-net pass
Bug: 32198976

(cherry picked from commit 8b06bcdfd24100302818ae0e11ee751dd813d5cf)
2016-12-09 14:34:39 +09:00
Tony Mak
de7f7d195e DO NOT MERGE: Show notification for always-on app VPN
This is the same notification as the one shown during legacy lockdown
mode, sans the 'reset' button.

The notification is only shown during times when VPN has not yet
established or has failed, for example during boot or after a crash.

Bug: 29123115

(cherry picked from commit 1a405fe300950d6ceae2166fd074b596d8110dbe)

Change-Id: I929a05c24df01e21415535a333bb14ac4b790a9d
2016-12-09 14:23:10 +09:00
Hugo Benichi
02428988ad DO NOT MERGE: APF: also drop any ICMPv6 RSs
Test: new unit test + $ runtest franeworks-net
Bug: 32833400

(cherry picked from commit f98182ef5e80ede5de7f2c2a5f40fc92a46c9704)

Change-Id: Ifaf6e778c811c7d865c790a293b1fce3f43cad1c
2016-12-09 13:59:19 +09:00
Hugo Benichi
53d83d5142 DO NOT MERGE: ConnectivityServiceTest: fix testAvoidBadWifiSettings
This patch introduces an assertEventuallyThat helper function in
ConnectivityServiceTest which given a boolean function retries until the
function returns true or until a maximum retry time is reached.

This function is used to fix flakyness of testAvoidBadWifiSetting where
the Message posted by reevaluate() could reach the Handler's
MessageQueue after waitForIdle takes effect, resulting in the test to
fail.

Instead of fixing the flakyness by introdcing hard sleep times,
assertEventuallyThat is used to reduce the overall test time.

With this change the test has been observed to pass with 100% success
rate over 50000 invocations.

Test: $ runtest frameworks-net
Bug: 32561414

(cherry picked from commit 99c8294ef0c7a720364abb5884063e0a9d1bb5fe)

Change-Id: If41a24989d5f65aeb439f68741f511b5eb53b18d
2016-12-09 13:59:19 +09:00
Hugo Benichi
cbf8ff83a8 DO NOT MERGE: Fix ConnectivityServiceTest testRequestBenchmark
This patch fixes flakyness of testRequestBenchmark by adjusting time
limit for callback registration from 100ms to 180ms, and time limits for
onAvailable and onLost triggers from 30ms to 40ms.

With these timeouts the test succeeds 100% over 5000 iterations.

When using 150ms for registration timeout, running the test 5000 times
fails 2 times.

When using 30ms for onLost timeout, running the test 5000 times fails
1 times.

In addition, this patch also cleans testRequestBenchmark and uses the
more stable SystemClock.elapsedRealtime() for duration measurements.

Test: $ runtest frameworks-net
Bug: 32561414

(cherry picked from commit 38be57b438a0c1754091f045317db2049304e16f)

Change-Id: I196ab9ef7f5abe456a783eed65db09279d2ecb8c
2016-12-09 13:59:18 +09:00
Hugo Benichi
f99a33a1b4 DO NOT MERGE: IpConnectivityMetrics: rate limit ApfProgramEvents
This patch uses the previously introduced TokenBucket to rate limit
ApfProgramEvents, still allowing for burst of ApfProgramEvents when a
new interface is set up (due to ipv4 provisioning, multicast lock, ipv6 RAs
triggering new APF program events in short amounts of time).

Test: new test in IpConnectivityMetricsTest
Bug: 1550402

(cherry picked from commit e1c173d2240a8eedf7685c9371087dc047a6931f)

Change-Id: Idb640dec13ba64180985544b9709a586af66eb6e
2016-12-09 11:21:31 +09:00
Hugo Benichi
8c9e4b68f0 DO NOT MERGE: IpConnectivityMetrics reads buffer size in settings
Test: IpConnectivityMetricsTest passes. Also manually changed the new
setting and verified the buffer size is as expected after flushing the
buffer.
Bug: 32198637

(cherry picked from commit 05686dbb6b965eb1a54591d2ed2334337886c6ee)

Change-Id: Iefbeac3a688b260fb3f92dfe0bfd9db28e26749d
2016-12-09 11:21:26 +09:00
Hugo Benichi
9df2ae138b DO NOT MERGE: IpConnectivity metrics: add version number
This patch adds a version field to ipconnectivity.proto and populates it
to 2, which is the logical version number for NYC-MR2.

Test: IpConnectivity{EventBuilder,Metrics}Test pass
Bug: 32127906

(cherry picked from commit d680d4c856f54bea0c60dea74ba4204822391e49)

Change-Id: If8f167c0dc4c1abe0e235e2adfd131168a4ddc52
2016-12-09 11:21:11 +09:00
John Reck
912bebeb74 Fix window copy for rotation = 90/270
Bug: 33421965
Test: Manual via PixelCopyWindow test in HwAccelerationTest
Change-Id: I2a59fd6a26499635a22444e124cd1ec6f82f6e31
2016-12-08 11:22:31 -08:00
Etan Cohen
bf3b1bad15 DO NOT MERGE: [CS] Remove timeout event after first available
Guarantees that timeouts are only delivered if a network never
becomes available. Once a network is available the timeout is
canceled.

Bug: 31402633
Test: all timeout related unit tests pass (new one added)

(cherry picked from commit 681fcda5896fd6c94f8a543ef9983c0a0644e87e)

Change-Id: I7cd3086544c881915fc6dbf14b87a24ab0cd8748
2016-12-08 17:13:37 +09:00
Hugo Benichi
5d2654124e DO NOT MERGE: ApfTest: tag tests with @SmallTest or @MediumTest
Test methods not tagged with @{Small,Medium,Large}Test will not appear
in the Android Platform Continuous Testing dashboard.

Test methods tagged with @LargeTest will not be run in the Android
Platform Continuous Testing dashboard.

Test: ApfTest passes ($runtest frameworks-net)
Bug: 31479480

(cherry picked from commit 4195c28347cc100954f83c3c92b4dde4673f8608)

Change-Id: Ia215fc8e2ccc61f6223c24fdf390e1e759de302f
2016-12-08 17:13:36 +09:00
Lorenzo Colitti
5bce5a16b1 DO NOT MERGE: Unbreak TetherInterfaceStateMachineTest.
This was broken by the implementation of IPv6 tethering, which
relies on various private classes which end up calling unmockable
final classes like NetworkInterface.

Making everything public like this is almost certainly not the
best way of fixing this test, but on the other hand there is
value to the test continuing to pass.

Test: runtest frameworks-net  # Everything passes.
Test: IPv6 tethering continues to work.

(cherry picked from commit 7e0eeca8ba4063d0d35dda9a8dfcc612e45efb87)

Change-Id: I8a3cf466871c026f4ae0f5cfa73071338cdf5b7e
2016-12-08 17:13:36 +09:00
Lorenzo Colitti
7ceef950a0 DO NOT MERGE: Move the connectivity tests to frameworks/base/tests/net.
This will give us a good place to put all the networking tests.

Fix: 31479480
Test: adb  shell am instrument -w -e notClass com.android.server.connectivity.tethering.TetherInterfaceStateMachineTest 'com.android.frameworks.tests.net/android.support.test.runner.AndroidJUnitRunner'  # PASS

(cherry picked from commit ecc986d430f4b8158f177ed97d2edb741f11ff71)

Change-Id: I993eeaa5dec001c39389023f355f506129b356e7
2016-12-08 17:13:35 +09:00
Lorenzo Colitti
3c295b59f5 DO NOT MERGE: De-guava BroadcastInterceptingContext and move it to testutils.
Removing the static dependency on guava reduces test compile time
by about 20 seconds on a Z840, thus substantially speeding up the
compile/test cycle.

Make FutureIntent public instead of package-private because it is
used directly by NetworkPolicyManagementServiceTest, which as of
this CL is now in a different package.

(cherry picked from commit 281a17c9580de5c9898be7d9654d428801976511)

Test: runtest frameworks-services -c com.android.server.ConnectivityServiceTest  # PASS
Test: runtest frameworks-services -c com.android.server.NetworkPolicyManagerServiceTest  # PASS
Test: runtest frameworks-services -c com.android.server.net.NetworkStatsServiceTest  # PASS
Test: runtest frameworks-services -c com.android.server.NetworkManagementServiceTest  # Already failing.
Bug: 31479480
Change-Id: Ifab32c9214e9caab71dbf93b3d3ca88df6f49636
2016-12-08 17:13:35 +09:00
Lorenzo Colitti
b8df76e413 DO NOT MERGE: Move FakeSettingsProvider to a common location.
(cherry picked from commit 7df1a82802cdf842d07a86a80383c7d5ea7ae53a)

Test: runtest frameworks-util -c com.android.internal.util.test.FakeSettingsProviderTest
Test: runtest frameworks-services -c com.android.server.ConnectivityServiceTest
Test: runtest frameworks-services -c com.android.server.retaildemo.PreloadAppsInstallerTest
Test: runtest frameworks-services -c com.android.server.retaildemo.RetailDemoModeServiceTest
Bug: 31479480
Change-Id: I8d4d4de2937012dd33924f53e68f96241a9b2b4f
2016-12-08 17:13:34 +09:00
Hugo Benichi
74264329da Unit tests for NetworkNotificationManager
Test: new unit test, no functional changes.
Bug: 32198726
Change-Id: I7c371ee547b36531924df34846c26f56a7f2dd7a
2016-12-08 09:54:49 +09:00
Chad Brubaker
b8feba10f4 Default to not allowing cleartext traffic for ephemeral apps
Test: NetworkSecurityPolicy.isCleartextTraffic permitted returns the
expected defaults.
Change-Id: I7d6577f8461bbf1f44eb21b4d813dba1746449fa
2016-12-07 13:17:41 -08:00
John Reck
579e3667e3 DO NOT MERGE: Add TouchLatency test
am: 91e2e7f460

Change-Id: I1eeed0e4aea8dbe2d963b38cfe9d79449e1a17d2
2016-12-06 20:13:49 +00:00
Hugo Benichi
80df43ea8a Fix IP connectivity metrics tests
So that test assumptions match previous changes in ipconnectivity.proto.

This patch also tags metrics tests with @SmallTest.

Test: $ runtest frameworks-net
Bug: 32561414
Bug: 32198976
Change-Id: Id58baf6eb9ddf0e10266e9150cb7688dd3136953
2016-12-06 11:56:23 +09:00
John Reck
91e2e7f460 DO NOT MERGE: Add TouchLatency test
Change-Id: Ic3a788f6b06bf6477ab23b183fb8c76ae8870b6b
(cherry picked from commit d136ce902c0be4a0cfb8e9d1288ba931ceaf88b4)
2016-12-06 01:23:43 +00:00
Hugo Benichi
f98182ef5e APF: also drop any ICMPv6 RSs
Test: new unit test + $ runtest franeworks-net
Bug: 32833400
Change-Id: Ibd7ce2e3565eab74043fe9604fe2b23abd53a2eb
2016-12-03 14:38:58 +09:00
TreeHugger Robot
42e55d81bd Merge "ConnectivityServiceTest: fix testAvoidBadWifiSettings" 2016-11-24 03:57:01 +00:00
TreeHugger Robot
81981fe852 Merge "Fix ConnectivityServiceTest testRequestBenchmark" 2016-11-23 11:24:15 +00:00
Hugo Benichi
99c8294ef0 ConnectivityServiceTest: fix testAvoidBadWifiSettings
This patch introduces an assertEventuallyThat helper function in
ConnectivityServiceTest which given a boolean function retries until the
function returns true or until a maximum retry time is reached.

This function is used to fix flakyness of testAvoidBadWifiSetting where
the Message posted by reevaluate() could reach the Handler's
MessageQueue after waitForIdle takes effect, resulting in the test to
fail.

Instead of fixing the flakyness by introdcing hard sleep times,
assertEventuallyThat is used to reduce the overall test time.

With this change the test has been observed to pass with 100% success
rate over 50000 invocations.

Test: $ runtest frameworks-net
Bug: 32561414
Change-Id: Ib20f4656620b119456c2cb1c709a7fe8195fe44d
2016-11-23 18:29:52 +09:00
Hugo Benichi
38be57b438 Fix ConnectivityServiceTest testRequestBenchmark
This patch fixes flakyness of testRequestBenchmark by adjusting time
limit for callback registration from 100ms to 180ms, and time limits for
onAvailable and onLost triggers from 30ms to 40ms.

With these timeouts the test succeeds 100% over 5000 iterations.

When using 150ms for registration timeout, running the test 5000 times
fails 2 times.

When using 30ms for onLost timeout, running the test 5000 times fails
1 times.

In addition, this patch also cleans testRequestBenchmark and uses the
more stable SystemClock.elapsedRealtime() for duration measurements.

Test: $ runtest frameworks-net
Bug: 32561414
Change-Id: I7601b2f1f11f83914f885a74c8a376173eed186b
2016-11-23 18:27:05 +09:00
Etan Cohen
681fcda589 [CS] Remove timeout event after first available
Guarantees that timeouts are only delivered if a network never
becomes available. Once a network is available the timeout is
canceled.

Bug: 31402633
Test: all timeout related unit tests pass (new one added)
Change-Id: I2b7adffd82173cf8b99084cbfe5399961d51e148
2016-11-21 19:15:10 +00:00
Ben Weiss
e0c37bdea3
Extract and unhide TransitionListenerAdapter
Test: CTS tested

Change-Id: I8db99d5f212b15db70ee5a6d6debf25d7ad7922d
2016-11-17 10:50:34 +00:00
Sudheer Shanka
dc589ac82b Update usage of ActivityManagerNative.
- Remove references to ActivityManagerProxy.
- Add isSystemReady to ActivityManager.

Bug: 30977067
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test android.server.cts
      adb shell am instrument -e class com.android.server.am.ActivityManagerTest,com.android.server.am.TaskStackChangedListenerTest \
          -w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I07390b6124fb1515821f5c0b37baf6ae74adc8fa
2016-11-14 11:27:12 -08:00
Lorenzo Colitti
667f31278e Merge "Unbreak TetherInterfaceStateMachineTest." 2016-11-10 08:37:58 +00:00