Commit graph android_packages_modules_Co.../tests/net/java/com/android/server
Message SHA1
Merge "Generalize support for underlying networks." am: ca830d9239 am: 51c973d4b7 am: 2be66008a0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1513052

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ida4e4d7b6d607d6c9f6efc2d06732f7826f7942e

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2020-12-14 06:40:27 +00:00
50c30ed67f
Merge "Fix a crash in eng builds" am: 26d146ff7f am: 99890b486d am: f65b271328
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1527538

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6e1c20b4c1004e8205d65f318939ee7d8b006f00

Treehugger Robot   authored and   Automerger Merge Worker   commited 2020-12-14 06:39:50 +00:00
1e7b9bca3d
Merge "Generalize support for underlying networks."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2020-12-14 05:19:49 +00:00
ca830d9239
Merge "Fix a crash in eng builds"
Treehugger Robot   authored and   Gerrit Code Review   commited 2020-12-14 05:17:15 +00:00
26d146ff7f
Merge "Resolve UidRange dependency between NMS and CS module" am: c5be33af21 am: 8a3181b166 am: 2ec8e8071a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1495869

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6c3474e6522fc67aec5333b323768692619019ee

Chiachang Wang   authored and   Automerger Merge Worker   commited 2020-12-14 04:23:43 +00:00
83e35e70c4
Merge "Resolve UidRange dependency between NMS and CS module"
Chiachang Wang   authored and   Gerrit Code Review   commited 2020-12-14 02:55:41 +00:00
c5be33af21
Fix a crash in eng builds
CAPTIVE_PORTAL is a CS-managed capability, and causes CS to log a wtf.
When this test is run on an eng build, this sends SIGSEGV to the test,
which is pretty difficult to debug.

Test: FrameworksNetTests NetworkStackTests
Change-Id: I72fc46a6daa4e886425b4dc967318cca9f1a5302

Chalard Jean   commited 2020-12-13 23:02:08 +09:00
8fb84150bf
Generalize support for underlying networks.
Currently, ConnectivityService assumes that only VPNs can have
underlying networks. Make the code decide this based only on the
return value of NetworkAgentInfo#supportsUnderlyingNetworks.
This allows non-VPN network types to support underlying networks
in the future.

This requires storing the original agent's capabilities in
NetworkAgentInfo so that applyUnderlyingCapabilities can mix in
the underlying network capabilities without overwriting the
capabilities of the network itself. Currently, the only
information that applyUnderlyingCapabilities takes from the
original agent's capabilities are the metered bit (stored in
NetworkAgentInfo#declaredMetered) and the transports (assumed to
be exactly {TRANSPORT_VPN}. Store the full capabilities instead.
This is more state than needed but it ensures that we do not need
to make any changes if in the future we want to propagate new
types of information from the underlying networks.

This should have no impact on current use cases (i.e., VPNs).

There is a change in ordering: in disconnectAndDestroyNetwork,
the new code propagates underlying network capabilities before
removing the network from LegacyTypeTracker, instead of after.

This is done to simplify the new code. When the new code
propagates underlying network capabilities in response to a
change for a particular network (e.g., connect, disconnect,
capabilities change), it only considers networks that have the
changed network as underlying. Because determining the
underlying networks requires knowing the default network,
the new code runs before the default network is changed and
LegacyTypeTracker is updated.

This shouldn't have app implications because the connectivity
broadcasts sent by LegacyTypeTracker and the callbacks cannot be
ordered, since they run on separate threads with unpredictable
delays. The capability change callbacks resulting from
propagation of underlying network capabilities were already
sent before the rematch, so the callbacks themselves are not
reordered in any way.

Bug: 173331190
Test: atest FrameworksNetTests \
            CtsNetTestCases:NetworkAgentTest \
	    CtsNetTestCases:Ikev2VpnTest \
	    CtsNetTestCases:VpnServiceTest \
	    CtsNetTestCases:android.net.cts.ConnectivityDiagnosticsManagerTest \
	    HostsideVpnTests com.android.server.connectivity.VpnTest
Change-Id: Ic5353a928a3a3541dcf953c35f47277c5e295db8

Lorenzo Colitti   commited 2020-12-13 00:10:56 +09:00
01d3763c5e
Merge changes from topic "remove_legacy_NA" am: 71ab824707 am: a698a47ada am: 7ba18da6b6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1456097

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If9cd6ce929a7103d2d6b7195a71ee64ea0a4ee0a

Chalard Jean   authored and   Automerger Merge Worker   commited 2020-12-11 11:03:36 +00:00
d2c548d880
Merge "Use getUserHandles() instead of getUsers() to get user id" am: df93f1c06c am: 7936252059 am: 865683a998
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1513050

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7fa8802614bf28453501cdc2bc1989b3531b2280

Lucas Lin   authored and   Automerger Merge Worker   commited 2020-12-11 11:02:48 +00:00
1061b76b27
Merge "Add a mutability flag to the PendingIntent" am: e5046ca23b am: 590c8766b6 am: a97a84a6cf
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1505734

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2d71235f8a61e617f95094da1154342c00e9b8d5

Treehugger Robot   authored and   Automerger Merge Worker   commited 2020-12-11 10:53:02 +00:00
b7f07a5371
Merge "Address leftover comments" am: 6e253df579 am: 3b29da5cf7 am: 3bd18cce4a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1495899

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3f46b0c6d5c2dcce540fcb1f9d7f2cc22c934f93

Paul Hu   authored and   Automerger Merge Worker   commited 2020-12-11 10:51:37 +00:00
91c64b9b11
Merge changes from topic "remove_legacy_NA"
* changes:
  Remove support for legacy network agents
  Remove deprecated constructors for NetworkAgent
  Migrate NetworkAgentWrapper to the new NA API
  Cleanup TestNetworkService

Chalard Jean   authored and   Gerrit Code Review   commited 2020-12-11 02:32:57 +00:00
71ab824707
Merge "Use getUserHandles() instead of getUsers() to get user id"
Lucas Lin   authored and   Gerrit Code Review   commited 2020-12-11 02:02:37 +00:00
df93f1c06c
Merge "Add a mutability flag to the PendingIntent"
Treehugger Robot   authored and   Gerrit Code Review   commited 2020-12-10 16:27:58 +00:00
e5046ca23b
Merge "Address leftover comments"
Paul Hu   authored and   Gerrit Code Review   commited 2020-12-10 15:47:27 +00:00
6e253df579
Resolve UidRange dependency between NMS and CS module
ConnectivityService is going to become a mainline module which
cannot access hidden APIs. Thus, replace the VPN uid range
controlling APIs from NMS to INetd directly.

Bug: 170598012
Test: atest FrameworksNetTests
Test: atest HostsideVpnTests
Test: manually test to connect to VPN and check the uid range
Change-Id: Ie6656ef36f54c2f14d5a2899e763a29b70a30f5d

Chiachang Wang   commited 2020-12-10 22:24:47 +08:00
1f50ae5c28
Add a mutability flag to the PendingIntent
From S, it's required to specify explicitly either FLAG_MUTABLE
or FLAG_IMMUTABLE when creating a PendingIntent. Thus, add a
mutability flag to the PendingIntent in ConnectivityServiceTest
that doesn't specify it before.

Bug: 173157160
Test: atest FrameworksNetTests
Change-Id: I755c53b90d709dfbac576dc076722476c3edee35

paulhu   authored and   Paul Hu   commited 2020-12-10 12:28:14 +00:00
58333ae5bf
Merge "Revert "ConnectivityServiceTest: Mark unaudited PendingIntents with FLAG_MUTABLE_UNAUDITED""
Paul Hu   authored and   Android (Google) Code Review   commited 2020-12-10 12:27:07 +00:00
9a0d7d2933
Merge changes I6eb6d92b,I638e29fd,I2348b7a3 am: 0da448710c am: 3ff54c739f am: 5bbcd79710
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1521657

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I430d7069e1dfbe89780cb459fff9e1eb63daa349

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2020-12-10 09:18:35 +00:00
358aeea9d3
Merge changes I6eb6d92b,I638e29fd,I2348b7a3
* changes:
  Add a convenience method to update a network's capabilities.
  Disallow NetworkAgents from changing the owner UID.
  Observe mOwnerUID in NetworkCapabilities#equals.

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2020-12-10 08:11:52 +00:00
0da448710c
Use getUserHandles() instead of getUsers() to get user id
UserManager#getUsers() is a hidden API, use getUserHandles() to
get user id instead in PermissionMonitor.

Bug: 171529940
Test: atest FrameworksNetTests
Change-Id: Ic304627688de8e49505a95ebc99628b2e0eafab9

lucaslin   commited 2020-12-10 13:58:39 +08:00
907cb16762
Revert "ConnectivityServiceTest: Mark unaudited PendingIntents with FLAG_MUTABLE_UNAUDITED"
This reverts commit 7d6a49c959.

Reason for revert: Merge conflicts, should have been merged in AOSP

Change-Id: Iee0a3e76c42858bcca45517e3ca02c65bc8eac0c

Remi NGUYEN VAN   commited 2020-12-10 04:42:06 +00:00
11119f7461
Merge "[Mainline Migration] Migrate NetworkUtils" am: 8339b3ded3 am: 59f81edbdb am: 402f439ac1
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1498168

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Id0749108e03d88af0b8c50a36f1a4ca28b9a40ce

Serik Beketayev   authored and   Automerger Merge Worker   commited 2020-12-10 01:05:32 +00:00
8a826845a3
Merge "[Mainline Migration] Migrate NetworkUtils"
Serik Beketayev   authored and   Gerrit Code Review   commited 2020-12-09 23:47:05 +00:00
8339b3ded3
Disallow NetworkAgents from changing the owner UID.
The current behaviour with regards to changing the owner UID is
bizarre and arguably incorrect. A NetworkAgent can change the
owner to whatever other app it wants, regardless of signatures,
at any time. This includes, for example, transferring ownership
to another UID and then recovering it.

Fortunately no existing NetworkAgent appears to do this:
- ClientModeImpl sets it to the UID of the app that created the
  configuration. It doesn't look like it can change while the
  network is connected.
- Vpn sets it to the UID of the VPN owner. That also can't change.
- Telephony does not appear to set it at all, it only sets the
  administrator UIDs (and updates them whenever it gets
  EVENT_CARRIER_PRIVILEGED_UIDS_CHANGED).

Disallow this now before code is written that depends on it.

Bug: 175188445
Test: modified tests in ConnectivityServiceTest
Change-Id: I638e29fda2481ec3bf4fff562ea66a73322881df

Lorenzo Colitti   commited 2020-12-09 19:47:17 +09:00
39b4c5b2da
Observe mOwnerUID in NetworkCapabilities#equals.
Currently, NetworkCapabilities's equals and hashCode methods
ignore mOwnerUID. This is confusing because it is inconsistent
with pretty much every other member of this class.

Bug: 175188445
Test: atest CtsNetTestCases:NetworkAgentTest \
            CtsNetTestCases:Ikev2VpnTest \
	    CtsNetTestCases:VpnServiceTest HostsideVpnTests \
	    CtsNetTestCases:android.net.cts.ConnectivityDiagnosticsManagerTest \
	    ConnectivityServiceTest com.android.server.connectivity.VpnTest
Change-Id: I2348b7a35f32a931687f2d3c2fa57620a12fe06f

Lorenzo Colitti   commited 2020-12-09 19:33:32 +09:00
cb9bbf2c80
Merge "Test for the current behaviour of updating a network's owner UID." am: aafcaa9fb5 am: 62976a3a26 am: 8e44d9d778
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1512690

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic97c893a17dcf7ce18fe31ff05828d4fe9a5e929

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2020-12-08 11:02:46 +00:00
4eb55bc947
Migrate NetworkAgentWrapper to the new NA API
Test: FrameworksNetTests NetworkStackTests
Bug: 167544279
Change-Id: I5d53a938572682dea827ea681596226b1e271aa6

Chalard Jean   commited 2020-12-08 19:43:10 +09:00
b274feac5c
Merge "Test for the current behaviour of updating a network's owner UID."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2020-12-08 09:10:08 +00:00
aafcaa9fb5
Merge "ConnectivityServiceTest: Mark unaudited PendingIntents with FLAG_MUTABLE_UNAUDITED"
Ashwini Oruganti   authored and   Android (Google) Code Review   commited 2020-12-07 19:41:50 +00:00
cc1039b7c7
Test for the current behaviour of updating a network's owner UID.
The current behaviour is at least bizarre and arguably incorrect.
Add a test to document the current behaviour so we can check that
any changes we make to this behaviour are correct.

Test: test-only change
Change-Id: I345bd320eced96316d92e520f576ae06b8020d9f

Lorenzo Colitti   commited 2020-12-08 01:40:47 +09:00
76a1031d33
[Mainline Migration] Migrate NetworkUtils
Migrating makeStrings(), numericToInetAddress() APIs

Bug: 173089079
Test: atest FrameworksNetTests
Change-Id: Ie914fd41bc3ce16d07f5d2768b89ce805b9245a9

Serik Beketayev   commited 2020-12-06 22:33:04 -08:00
88bf984e07
Merge changes from topic "restricted-networking-mode" am: 1d156cb04e am: 83711b9a0b am: 5fda0bd0af
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1505234

Change-Id: Ia175efd2e152ea4b04feddf3bdc159adca2edab5

Patrick Rohr   authored and   Automerger Merge Worker   commited 2020-12-03 12:39:44 +00:00
bbef873e3e
Clean Up NetworkManagementService Tests am: e7c4a3e7b5 am: 34d43318e1 am: 9653c209c6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1505233

Change-Id: I24c7401ae08da82ad8e03db1b507abe50e92dd1b

Patrick Rohr   authored and   Automerger Merge Worker   commited 2020-12-03 12:39:27 +00:00
66978d1090
Clean Up NetworkManagementService Tests am: e7c4a3e7b5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1505233

Change-Id: Ia14b1784f36d54f0ba73d5841afedcf8a55a18f2

Patrick Rohr   authored and   Automerger Merge Worker   commited 2020-12-03 11:36:15 +00:00
34d43318e1
Merge changes from topic "restricted-networking-mode"
* changes:
  Add Restricted Mode Firewall Chain
  Clean Up NetworkManagementService Tests

Patrick Rohr   authored and   Gerrit Code Review   commited 2020-12-03 10:50:25 +00:00
1d156cb04e
Merge changes Ic5a3e169,I76daa3ab am: fac6ce5e4d am: 642fe3bb2b am: 4a0fe09eec
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1512888

Change-Id: If54ea6526d4426e6e52eec40c72f3ddd625842fe

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2020-12-02 06:42:39 +00:00
d58b4ea78c
Merge changes Ic5a3e169,I76daa3ab
* changes:
  Refactor applyUnderlyingCapabilities and its test.
  Move applyUnderlyingCapabilities to ConnectivityService.

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2020-12-02 04:55:12 +00:00
fac6ce5e4d
Refactor applyUnderlyingCapabilities and its test.
This reduces verbose assertions and makes the test more compact.
I'm not sure whether it's actually more valuable, since the
current code, while more verbose, is probably more
straightforward to understand.

Also add a test for passing in a null underlying network (i.e.,
follow default network). This requires a minor refactoring in
ConnectivityService because the applyUnderlyingCapabilities does
not currently treat null specially.

Bug: 173331190
Test: test-only change
Change-Id: Ic5a3e16969ea9e1a529706850f148cb0d5fd8e09

Lorenzo Colitti   commited 2020-12-02 00:45:57 +09:00
8750be0016
Move applyUnderlyingCapabilities to ConnectivityService.
This is essentially a straighforward move of code from Vpn to
ConnectivityService, and from VpnTest to ConnectivityServiceTest.

Bug: 173331190
Test: passes existing tests, moved tests pass
Change-Id: I76daa3abcc777e9c3ba57efb750de0e2e2f3bb74

Lorenzo Colitti   commited 2020-12-01 23:23:47 +09:00
cd6d42bd1e
Deprecated UserManager.getUsers(excludeDying) / added getAliveUsers()
The existing method is confusing (the argument used to be called
includeDying) and it puts the burden on the caller (which need to
understand what the parameter means).

Furthermore:

- The majority of calls are for getUsers(excludeDying=true).
- The calls for getUsers(excludeDying=false) are equivalent to
  calls to getUsers()

Test: m
Test: a VpnTest ConnectivityServiceTest PermissionMonitorTest

Bug: 157921703
Change-Id: Ife767a40b7b7790ba28b5377046de822ddbf275c
Merged-In: Ife767a40b7b7790ba28b5377046de822ddbf275c
(cherry picked from commit 72eeb557e7)

Felipe Leme   authored and   lucaslin   commited 2020-12-01 15:25:52 +08:00
ed14cda477
Add Restricted Mode Firewall Chain
Adding new allowlist firewall chain to support restricted networking
mode. See go/restricted-networking-mode.

Bug: b/157505406
Bug: b/170323408
Test: atest NetworkManagementServiceTest
Change-Id: I8e39b3d7b129ad74224d0c1311135b7b48f6514f

Patrick Rohr   commited 2020-11-30 18:36:02 +01:00
7146229936
Clean Up NetworkManagementService Tests
Cleaning up tests, so I can easily add more for restricted networking
mode.
I merged the NetworkManagementInternalTests with the
NetworkManagementServiceTests.

Test: atest NetworkManagementServiceTest
Change-Id: If8c3cc1883cfb2524eeb78e23165fc868130f0e7

Patrick Rohr   commited 2020-11-30 18:35:44 +01:00
e7c4a3e7b5
Merge changes If2201f39,Ia1c366c5 am: fd0e9821fb am: 95e7eba65a am: 8ff435aced
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1509889

Change-Id: Ic2857aae38dfa7ccf9996689e198f9e175045462

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2020-11-30 15:59:20 +00:00
c1e4f02f37
Merge changes I982543cd,I41c3bf6c,Id3e5f6e1 am: 4fe79a3ff9 am: db7c229729 am: d5450e378b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1511316

Change-Id: I91ccdc9a5f4426d9c1623b869c0411b9af203c36

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2020-11-30 15:05:48 +00:00
c8f90ba551
Merge changes If2201f39,Ia1c366c5
* changes:
  Stop calling Vpn#updateCapabilities in CS.
  Stop accessing VPNs in checkConnectivityDiagnosticsPermissions.

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2020-11-30 14:14:38 +00:00
fd0e9821fb
Add a provider to VPN
Test: FrameworksNetTests NetworkStackTests
Change-Id: I982543cdee358bb62d3b56a7fd9d71dc18908b65

Chalard Jean   commited 2020-11-30 16:15:19 +09:00
8c7cb6449c
Migrate VPN to the public NetworkAgent API.
On top of being a cleanup this is useful for the S Network
Selection project that will need to enrich the Network
Agent API, and as such should not have to support legacy
agents.

Test: FrameworksNetTests NetworkStackTests
Bug: 167544279
Change-Id: Id3e5f6e19829c64074cd6a52c5f950cee56b860b

Chalard Jean   commited 2020-11-30 16:15:18 +09:00
fd64bac5b6
Move applying underlying caps from Vpn to ConnectivityService. am: 220987b38d am: a27c332849 am: ed3589c104
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1501815

Change-Id: I924998ffa45ba630d8688007878f339264e7108e

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2020-11-28 04:50:46 +00:00
3286928783