Commit graph android_packages_modules_Co.../services/core/java
Message SHA1
Unit tests for avoid bad wifi networks setting. am: 71b4d66e16 am: 58a33b9656
am: f131f80e0a

Change-Id: I1c0f4549545ff9f1836154ef65661395835ad756

Lorenzo Colitti   authored and   android-build-merger   commited 2016-09-15 16:20:27 +00:00
eccdb24d89
Support displaying a dialog when wifi becomes unvalidated. am: 477bf5caa9 am: 8591027b21
am: 56e32083b5

Change-Id: Id908683dce15ffbafc042d506a38ec26d5e9a6ee

Lorenzo Colitti   authored and   android-build-merger   commited 2016-09-15 16:18:42 +00:00
4b06c53661
Unit tests for avoid bad wifi networks setting.
am: 71b4d66e16

Change-Id: I6491f1a93f93f222e23ef6e5e437631556637e44

Lorenzo Colitti   authored and   android-build-merger   commited 2016-09-15 16:05:45 +00:00
58a33b9656
Support displaying a dialog when wifi becomes unvalidated.
am: 477bf5caa9

Change-Id: I8b8e2b652510ca75407a9ad3c29ed111367941e0

Lorenzo Colitti   authored and   android-build-merger   commited 2016-09-15 16:04:03 +00:00
8591027b21
Support ignoring penalty for bad wifi networks am: 4fc79c45d2 am: 03b25a12c7
am: edabb8e617

Change-Id: Ib9a60eb528eb62ebf26d5d5a1941bfed0bb21163

Hugo Benichi   authored and   android-build-merger   commited 2016-09-15 15:36:58 +00:00
89b552d5dd
resolve merge conflicts of 810f491 to nyc-mr1-dev am: d1d74d350f
am: 886df309be

Change-Id: I0fd163898bb51e11bc2a21ae8ba7761691a737ce

Lorenzo Colitti   authored and   android-build-merger   commited 2016-09-15 15:30:24 +00:00
909fc4719d
Support ignoring penalty for bad wifi networks
am: 4fc79c45d2

Change-Id: I6666ee45e9a08c02444c6268b2232bbe8aa2adec

Hugo Benichi   authored and   android-build-merger   commited 2016-09-15 15:23:57 +00:00
03b25a12c7
Unit tests for avoid bad wifi networks setting.
Bug: 31075769
Change-Id: I21ba20df59ddce5731ef1ebe8846b3f00578a674

Lorenzo Colitti   commited 2016-09-15 23:45:07 +09:00
71b4d66e16
Support displaying a dialog when wifi becomes unvalidated.
Bug: 31075769
Change-Id: I7a6e7580769365bea930f638bd44edcaa28df134

Lorenzo Colitti   commited 2016-09-15 23:33:34 +09:00
477bf5caa9
resolve merge conflicts of 810f491 to nyc-mr1-dev
Change-Id: Ib1294563c6ae20454e44bfa5fc9fb2797864b8f5

Lorenzo Colitti   commited 2016-09-15 22:47:08 +09:00
d1d74d350f
Support ignoring penalty for bad wifi networks
This patch adds a way to configure devices so that a validated network
that becomes unvalidated is not penalized in the network scoring and
selection logic.

The intent is to prevent devices configured to do so from switching to a
lower scoring network such as cellular networks when a higher scoring
network such as wifi networks loses internet connectivity.

Bug: 31075769
Change-Id: Ie7e0f2607d214a178367fedfbef6c44768fa00a4

Hugo Benichi   commited 2016-09-15 18:34:13 +09:00
4fc79c45d2
Explicitly pass old score to updateCapabilities
This allows simplification of getCurrentScore function in
NetworkAgentInfo and its return value to depend on everValidated and
lastValidated.

Bug: 31075769
Change-Id: I0b3c85e3a61b006733e900e0a231424878317476

Hugo Benichi   commited 2016-09-15 18:33:23 +09:00
810f4917c2
Add a NET_CAPABILITY_FOREGROUND capability. am: 32237c7a69
am: aaec66110d

Change-Id: I78d6aa21f8e4c6bbd9cefb4a36f1b77f4bbe4104

Lorenzo Colitti   authored and   android-build-merger   commited 2016-09-13 16:23:10 +00:00
27e1fd3169
Add a NET_CAPABILITY_FOREGROUND capability.
Bug: 23113288
Change-Id: I90cb9ffb5751f0d9ec822933f37680c401e49966

Lorenzo Colitti   commited 2016-09-13 12:02:13 +09:00
32237c7a69
Add a background NetworkRequest type for mobile data always on. am: b5b725df0c
am: 9396da4e10

Change-Id: I4b0e05e8bb87e37bf2564fd255b8be7a2b20118a

Lorenzo Colitti   authored and   android-build-merger   commited 2016-09-12 13:48:53 +00:00
18328033db
Rematch requests first and listens second. am: 5d8b6bdb6e
am: 836a5db809

Change-Id: Ia57cd548b2920efaee733f5cb0df66139a6e55e6

Lorenzo Colitti   authored and   android-build-merger   commited 2016-09-12 13:46:48 +00:00
6fb1ebeb50
Add a background NetworkRequest type for mobile data always on.
Like a normal (foreground) request, a background request is only
satisfied by one network and will keep that network up. Unlike a
foreground request, when a network only has background requests,
it will linger, and after lingering is complete, it will become
a background network.

Future CLs will cause the system to treat background networks
differently, e.g., by requiring different permissions.

Bug: 23113288
Change-Id: I40f735269dad1042eb04fea15e64584fc903ccb3

Lorenzo Colitti   commited 2016-09-09 18:49:24 +09:00
b5b725df0c
Rematch requests first and listens second.
This CL splits rematching in two parts: first rematch requests,
then rematch listens. This will allow us to change a network's
capabilities depending on what requests are on that network, and
properly dispatch callbacks depending on those capabilities.

The behaviour changes are as follows:

- Before this CL, callbacks for requests and listens were sent
  intermingled. After this CL, all request callbacks will be
  grouped together, and all listen callbacks will be grouped
  together.
- Before this CL, the order was:
    1. Send onLost callbacks.
    2. If applicable, switch the default network.
    3. Send onAvailable callbacks.
  After this CL, the order is:
    1. Send onLost callbacks for requests.
    2. If applicable, switch the default network.
    3. Send onLost callbacks for listens.
    4. Send onAvailable callbacks for listens.
    5. Send onAvailable callbacks for requests.

These changes shouldn't affect any apps because:

1. The order of callbacks continues to be first all onLost,
   then all onAvailable.
2. Both the old and the new code send callbacks in no particular
   order. Thus, the possible ordering combinations of callbacks
   in the new code are a strict subset of the possible ordering
   combinations of the old code.
3. The default network is switched before any onAvailable
   callback is sent.
4. Even though the new code does not send all onLost callbacks
   before switching the default network, even before this CL
   there was no guarantee that those callbacks would be received
   before the default network switch anyway, because callbacks
   are asynchronous.

Bug: 23113288
Change-Id: Ia08900c50db9ff43895047e2f4f36b6c6c31a1f9

Lorenzo Colitti   commited 2016-09-09 18:28:00 +09:00
5d8b6bdb6e
Network switch notifications: rate & daily limits am: e5ebb71a81 am: 858499b2c0
am: 2c535a4f7c

Change-Id: I166dd693345ed9a63411f5f1ed6bdf33015b1957

Lorenzo Colitti   authored and   android-build-merger   commited 2016-08-30 20:32:52 +00:00
20a701cbc6
Network Switching Notifications: add unit tests am: 550ad8d1d0 am: 56f1281888
am: cf5f5785c9

Change-Id: I978e49ba1302ca3d791c59555b5a143cefb62c06

Hugo Benichi   authored and   android-build-merger   commited 2016-08-30 20:31:34 +00:00
ed9a34a936
Network switch notifications: rate & daily limits
This patch adds a daily limit to the maximum number of notifications
shown when switching networks.

It also adds a rate limit to prevent rapid successive notifications in
flapping scenarios.

Bug: 31132499
Change-Id: Iccb6d0899646ea6df3cfad32a421922263e0eb85

Lorenzo Colitti   authored and   Hugo Benichi   commited 2016-08-31 00:36:11 +09:00
e5ebb71a81
Network Switching Notifications: add unit tests
BUG: 31132499
Change-Id: I9c50a59fe48efdcb51d2517f0a756691700c3ebe

Hugo Benichi   commited 2016-08-31 00:35:16 +09:00
550ad8d1d0
Don't notify on network switch if source network is validated. am: 673e80f021 am: b301283d57
am: a0a41b1e3d

Change-Id: I047a0040798223c163d333996e6bc06e206129a0

Lorenzo Colitti   authored and   android-build-merger   commited 2016-08-30 11:02:33 +00:00
1b5c43a0d3
Don't notify on network switch if source network is validated.
Sometimes we switch away from a network to another (e.g., wifi to
cell data) not because the old network is unvalidated, but
because the score is lowered by a low signal strength.

In this case, don't notify the user of a network switch.

Bug: 31132499
Change-Id: I996a6e00096f8cb864fa9b00b36921725a4edb53

Lorenzo Colitti   commited 2016-08-29 16:30:21 +09:00
673e80f021
Support notifying network switches via notifications and toasts. am: b268f9f554 am: 4549d8b4aa
am: 10acdf7ad1

Change-Id: I0324cfdb7c070464c2caa73fa5fad8d1031c1e76

Lorenzo Colitti   authored and   android-build-merger   commited 2016-08-25 09:36:13 +00:00
9c231f7179
Support notifying network switches via notifications and toasts.
Bug: 31025214
Change-Id: If1578f422f38a1dcfaec529882aed01ae5e8d53c

Lorenzo Colitti   commited 2016-08-25 18:14:18 +09:00
b268f9f554
Refactor NetworkNotificationManager. am: eb166f447b am: a6dcb89e6d
am: 4e0916b416

Change-Id: I548b311ab8dc1d7e08f17a6b31573262c8a4518e

Lorenzo Colitti   authored and   android-build-merger   commited 2016-08-23 17:21:39 +00:00
9a0d4e6590
Move notification code out of ConnectivityService. am: 7d31cc0021 am: 622b5fbbf5
am: 28707247f4

Change-Id: I6e3290891f322c1caca3ff70a3aa39dd140d6256

Lorenzo Colitti   authored and   android-build-merger   commited 2016-08-23 17:20:59 +00:00
2caa412d20
Refactor NetworkNotificationManager.
1. Move from deprecated network types to transport types.
2. Rename and simplify (by passing in a NetworkAgentInfo object)
   the call signature of the method that displays notifications.
3. Add a method to clear notification, and unindent lots of code.
4. Move the legacy DcTracker-issued notification code to
   NetworkNotificationManager.

Bug: 31025214
Change-Id: Ie49c60126d0ed5bac620bc47e84fe038791b2d6c

Lorenzo Colitti   commited 2016-08-23 17:57:46 +09:00
eb166f447b
Move notification code out of ConnectivityService.
Bug: 31025214
Change-Id: I4190be6b57f92298b79bea8868f1876ecbfd2d75

Lorenzo Colitti   commited 2016-08-23 15:31:59 +09:00
7d31cc0021
IpConnectivityMetrics: no metrics upload in tests am: 638621a1f9
am: ae048d8363

Change-Id: I4171f72e27f39f2c10e4607b84934676337c1b4e

Hugo Benichi   authored and   android-build-merger   commited 2016-07-29 09:34:35 +00:00
89218fdd83
IpConnectivityMetrics: no metrics upload in tests
Similarly to ApfTest, this patch changes ConnectivityServiceTest to use
a mock object instead of IpConnectivityLog so that running
ConnectivityServiceTest does not generate android.net.metrics events.

Bug: 30450301
Change-Id: Ibc0479f381f26e60baefbae15407c62aecbf6666

Hugo Benichi   commited 2016-07-29 16:58:35 +09:00
638621a1f9
resolve merge conflicts of c489935 to nyc-mr1-dev-plus-aosp
Change-Id: Ib1c01241fece36f660d27f3450ba8059b3b2809f

Hugo Benichi   commited 2016-07-26 13:08:14 +09:00
8850477c85
Add CONNECTIVITY_USE_RESTRICTED_NETWORKS permission
This patch creates a new permission used by ConnectivityService to give
access to restricted networks without the NET_CAPABILITY_NOT_RESTRICTED
capability bit on.

Bug: 24497316
Change-Id: I5b6c8a9ef14395b2f1ab26cb17b24d7876ec79f1

Hugo Benichi   commited 2016-07-25 10:24:42 +09:00
c4899354b0
Merge \"Add an isListen method to NetworkRequests.\" into nyc-mr1-dev
am: b5239329b1

Change-Id: Ib712c3c7b44d3a623d5f5facf0c7f6844c3ebb82

Lorenzo Colitti   authored and   android-build-merger   commited 2016-07-18 15:08:54 +00:00
56b3b700f2
Add an isListen method to NetworkRequests.
This allows simplification of the ConnectivityService code.

Bug: 23113288
Change-Id: I124544b99c5a920124e9a3d31cda8c6d2abc21fd

Lorenzo Colitti   commited 2016-07-18 18:42:26 +09:00
6737b64741
ConnectivityService dump: add apps blocked logs
am: 7b3bf37ac3

Change-Id: I50c87dc35ef219844a5337768ec2526aeff4f1ca

Hugo Benichi   authored and   android-build-merger   commited 2016-07-12 04:39:05 +00:00
6fef6d72f2
ConnectivityService dump: add apps blocked logs
This patch adds NetworkInfo BLOCKED/UNBLOCKED status of apps to
ConnectivityService's dump logs.

The BLOCKED or UNBLOCKED status of an app is logged with the app uid
when the app calls getActiveNetworkInfo().

Examples:
mNetworkInfoBlockingLogs (most recent first):
  07-11 11:04:43.139 - BLOCKED 10060
  07-11 11:04:39.056 - UNBLOCKED 10061
  07-11 11:04:38.851 - BLOCKED 10061

Bug: 29981766
Change-Id: I6e2fde446702b92b0964ed894409b5d733d8f8a7

Hugo Benichi   commited 2016-07-12 11:39:48 +09:00
7b3bf37ac3
Support requesting async LinkProperties/NetworkCapabilities updates
am: aec3f5ef5b

Change-Id: Icc048323debbbe641941c5c0d993f4c9782c5d3e

Erik Kline   authored and   android-build-merger   commited 2016-07-11 11:01:42 +00:00
95d433f07a
Support requesting async LinkProperties/NetworkCapabilities updates
Bug: 9580643
Change-Id: I1d7ba7645c20d7d53f6eef777dfce43727940f13

Erik Kline   commited 2016-07-11 19:17:41 +09:00
aec3f5ef5b
Merge \"Rewrite lingering.\" into nyc-mr1-dev
am: 49b4492b33

Change-Id: I62d69f20101318b42d4d333b104dcf4f64dc1725

Lorenzo Colitti   authored and   android-build-merger   commited 2016-07-07 11:01:19 +00:00
d1cf630685
Merge \"Prepare to delete useless loop in handleReleaseNetworkRequest.\" into nyc-mr1-dev
am: 540ee120e5

Change-Id: I8cd95575e7758ee94417ec15e407f396434f4c04

Lorenzo Colitti   authored and   android-build-merger   commited 2016-07-07 07:40:46 +00:00
bebd1cf7fe
Rewrite lingering.
The two major changes here are:

- Move lingering out of NetworkMonitor. The fact that lingering
  is currently its own state in NetworkMonitor complicates the
  logic there: while a network is lingering it cannot be in any
  other state, we have to take care not to leave LingeringState
  for the wrong reason, etc.
- Instead of keeping a single per-network boolean to indicate
  whether a network is lingered or not, keep a linger timer for
  every request. This allows us to fix various corner-case bugs
  in lingering.

The changes in behaviour compared to the current code can be seen
in the unit test changes. Specifically:

1. Bug fix: when a network is lingered, and a request is added
   and removed to it, the existing code tears the network down
   immediately. The new code just sends another CALLBACK_LOSING
   and resumes lingering with the original timeout.
2. Bug fix: if cell is unvalidated and wifi comes up and
   validates before cell does (as might happen on boot), the
   existing code immediately tears down cell. The new code
   lingers cell, which is correct because unvalidated cell was
   the default network, so an app might have been using it.
3. Correctness improvement: always send CALLBACK_AVAILABLE for
   the new network before sending CALLBACK_LOSING. This was not
   really an issue in practice, because the usual flow is:
    - Network A is the default.
    - Network B connects, CALLBACK_AVAILABLE.
    - Network B validates, CALLBACK_LOSING.

Bug: 23113288
Change-Id: I2f1e779ff6eb869e62921a95aa9d356f380cf30a

Lorenzo Colitti   commited 2016-07-07 16:18:57 +09:00
70c70fa7e2
Prepare to delete useless loop in handleReleaseNetworkRequest.
As explained in the TODO, the loop serves no purpose since only
one network can be satisfying a given request at a time.

Instead of looping, look up the nai in the mNetworkForRequestId
array that exists for this purpose.

Keep the loop around with an Slog.wtf statement on it so we can
see if we ever hit it, and add a TODO to delete it if we don't.

Bug: 23113288
Change-Id: I173de4bd45c5a4169b7a062a981f2ecccaa44143

Lorenzo Colitti   commited 2016-07-07 14:50:12 +09:00
daeb6109e1
Merge \"Unbreak unregisterNetworkCallback.\" into nyc-mr1-dev
am: 04401f0e0f

Change-Id: I35ee16554e17c503b1f5628629c2c0a48d85d399

Lorenzo Colitti   authored and   android-build-merger   commited 2016-07-05 02:19:18 +00:00
3e1d024327
Merge "Unbreak unregisterNetworkCallback." into nyc-mr1-dev
Lorenzo Colitti   authored and   Android (Google) Code Review   commited 2016-07-05 02:07:06 +00:00
04401f0e0f
Unbreak unregisterNetworkCallback.
http://ag/1194313 broke unregisterNetworkCallback because the
system does not parcel the type of the request back to the app.
So when the app calls unregisterNetworkCallback, the
NetworkRequest that's passed in does not have a type and thus
doesn't match the request in mNetworkRequests.

Fix this by parceling over the type as well.

This was not caught by the unit test because the unit test all
runs in the same process with no parceling.

Bug: 23113288
Change-Id: I58b2ed651b9bf5cbdcca5b25c3ca24db53cffdf1

Lorenzo Colitti   commited 2016-07-05 01:59:49 +09:00
cef9c490ad
Merge \"Annotate public methods in ConnectivityService.\" into nyc-mr1-dev
am: ad7755209c

Change-Id: I065e2ceb351ea8af4310f6ef11f1af232fa2fc79

Lorenzo Colitti   authored and   android-build-merger   commited 2016-07-04 16:21:10 +00:00
aa9dd65e57
Merge "Annotate public methods in ConnectivityService." into nyc-mr1-dev
TreeHugger Robot   authored and   Android (Google) Code Review   commited 2016-07-04 16:07:33 +00:00
ad7755209c
Make registerDefaultNetwork work on metered networks.
am: 34eda2aa6f

Change-Id: I2d5edc273df22e5c787f227820c1ce956adfe42c

Lorenzo Colitti   authored and   android-build-merger   commited 2016-07-04 16:06:51 +00:00
005ce5a697