Commit graph

13,045 commits

Message SHA1
Replace PackageManager @hide APIs
ConnectivityService is using
PackageManager#getApplicationInfoAsUser() to get application
info but this API is not able to call after CS becomes a
mainline module. Thus, replace it with formal API.

Bug: 170593746
Test: atest FrameworksNetTests
Test: atest CtsNetTestCasesLegacyApi22
Change-Id: Idd1269aa50e234801583097bb6f40b099bab8fba

paulhu   commited 2020-12-10 23:32:32 +08:00
667972157f
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 "Reimplement DumpUtils#checkDumpPermission() in ConnectivityService" am: 984653607c am: e70771ef74
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1519792

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I52b048b4ecd3f228c7d13aafeaa6bd852f564a46

Lucas Lin   authored and   Automerger Merge Worker   commited 2020-12-10 11:15:16 +00:00
cf8a782105
Merge "Reimplement DumpUtils#checkDumpPermission() in ConnectivityService" am: 984653607c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1519792

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ibd216cc83e539f202e01076b97fa2d981185dc49

Lucas Lin   authored and   Automerger Merge Worker   commited 2020-12-10 11:06:27 +00:00
e70771ef74
Merge "Reimplement DumpUtils#checkDumpPermission() in ConnectivityService"
Lucas Lin   authored and   Gerrit Code Review   commited 2020-12-10 10:57:58 +00:00
984653607c
Merge "[Mainline] Network netId to getNetId() migration" am: cd20ac9243 am: 249e8cab99
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1520637

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ifd1771c329d6b4c45f85d32cf44a7499efddcbfb

Treehugger Robot   authored and   Automerger Merge Worker   commited 2020-12-10 09:43:15 +00:00
e42273a5f7
Merge "[Mainline] Network netId to getNetId() migration" am: cd20ac9243
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1520637

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I65d8843281e3c3fe15141ad2583955e069339413

Treehugger Robot   authored and   Automerger Merge Worker   commited 2020-12-10 09:11:10 +00:00
249e8cab99
Merge changes I6eb6d92b,I638e29fd,I2348b7a3 am: 0da448710c am: 3ff54c739f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1521657

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6de299ec480f1a34042d2ef2ee86f00d030510e8

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2020-12-10 09:02:40 +00:00
5bbcd79710
Merge "[Mainline] Network netId to getNetId() migration"
Treehugger Robot   authored and   Gerrit Code Review   commited 2020-12-10 08:47:27 +00:00
cd20ac9243
Merge changes I6eb6d92b,I638e29fd,I2348b7a3 am: 0da448710c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1521657

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I87704813daaf2a0b4495a835abde950e683993e5

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2020-12-10 08:32:15 +00:00
3ff54c739f
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
Reimplement DumpUtils#checkDumpPermission() in ConnectivityService
ConnectivityService is going to be a part of mainline module, to
prevent using @hide method in ConnectivityService, reimplement
DumpUtils#checkDumpPermission() in ConnectivityService.

Bug: 175177794
Test: atest FrameworksNetTests
Test: adb shell dumpsys connectivity
Change-Id: I1e4bc023b39b40a717a3a0fd8cd60aa2f25e9bdb

lucaslin   authored and   Lucas Lin   commited 2020-12-10 07:12:05 +00:00
9d4b864916
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
[automerger skipped] Merge "DO NOT MERGE - Merge Android R QPR1" am: 0ee91db1db -s ours am: 13e5f8e80d -s ours
am skip reason: Change-Id Ib81ba3288a986546bc570c3759c55d026add591a with SHA-1 3cfbcbee16 is in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1520888

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic11fc264d783e729729854a5f7f7b03d38d43e3e

Xin Li   authored and   Automerger Merge Worker   commited 2020-12-10 03:47:00 +00:00
8fdc3926b5
[automerger skipped] Merge "DO NOT MERGE - Merge Android R QPR1" am: 0ee91db1db -s ours
am skip reason: Change-Id Ib81ba3288a986546bc570c3759c55d026add591a with SHA-1 3cfbcbee16 is in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1520888

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I1158b1e4f70b018504c963a76782c8773f698118

Xin Li   authored and   Automerger Merge Worker   commited 2020-12-10 03:05:40 +00:00
13e5f8e80d
Merge "DO NOT MERGE - Merge Android R QPR1"
Xin Li   authored and   Gerrit Code Review   commited 2020-12-10 02:18:27 +00:00
0ee91db1db
DO NOT MERGE - Merge Android R QPR1
Bug: 172690556
Merged-In: Ib81ba3288a986546bc570c3759c55d026add591a
Change-Id: I2acfeb6cfc83a80056a685355cc367a5514da069

Xin Li   commited 2020-12-09 17:55:44 -08:00
033b5e8ba3
Merge "[Mainline Migration] Migrate NetworkUtils" am: 8339b3ded3 am: 59f81edbdb
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1498168

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I4f91f6de3af919fff42383ba86617112624c8292

Serik Beketayev   authored and   Automerger Merge Worker   commited 2020-12-10 00:49:48 +00:00
402f439ac1
Merge "[Mainline Migration] Migrate NetworkUtils" am: 8339b3ded3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1498168

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Icc0a49e76f87a741f4410b53e9a40012e37fde36

Serik Beketayev   authored and   Automerger Merge Worker   commited 2020-12-10 00:08:03 +00:00
59f81edbdb
Merge "[Mainline Migration] Migrate NetworkUtils"
Serik Beketayev   authored and   Gerrit Code Review   commited 2020-12-09 23:47:05 +00:00
8339b3ded3
Add a convenience method to update a network's capabilities.
Almost all calls to ConnectivityService#updateCapabilities use
all the current data in the network, and thus call the method
like this:

    updateCapabilities(nai.getCurrentScore(), nai, nai.networkCapabilities);

Introduce a convenience method to simplify this frequent use case.

Bug: 173331190
Test: passes existing ConnectivityService tests
Change-Id: I6eb6d92bd159f2575d10a929bd59f6dd1b7a4b4e

Lorenzo Colitti   commited 2020-12-10 00:41:06 +09:00
00e0f5af3e
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
Expose TcpRepairWindow as module-lib API
Connectivity service is going to become a mainline module which
will not be able to access hidden APIs. TcpKeepaliveController
is a part of CS mainline module, it uses TcpRepairWindow to
store tcp repair window info. Thus, expose TcpRepairWindow as
module-lib API to support the usage.

Bug: 172183305
Test: atest FrameworksNetTests
Change-Id: I1b6f5ae698f4b6e030a0f776aeafc774fa9f1437

paulhu   authored and   Paul Hu   commited 2020-12-09 08:25:13 +00:00
e4a2c6ad2e
Fix testDeclareNetworkRequestUnfulfillable on R
NetworkProvider does not require ConnectivityService to be started at
creation time after R, but on R it is queried in the constructor.

Fixes: 175164957
Test: atest FrameworksNetTests
Change-Id: I435ace581668970a7d88e68f11cb37814edb79ea

Remi NGUYEN VAN   commited 2020-12-09 11:35:58 +09:00
4f0a840771
[Mainline] Network netId to getNetId() migration
Bug: 175085315
Test: atest
Change-Id: I3d7366ba1e60be3ff7c6dd6c589db760b182136b

Serik Beketayev   commited 2020-12-08 16:34:38 -08:00
284cb871fa
[automerger skipped] Merge "Allow the System UID to unregister ConnDiags CBs." into rvc-qpr-dev am: 07dd48319d -s ours
am skip reason: Change-Id I20d0cad5f902708d366aa703c2893b0ea3e55052 with SHA-1 054451e170 is in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13169565

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I9cdd7edda3f94d66aa7e0bdc6daaaf5a08b360c0

Cody Kesting   authored and   Automerger Merge Worker   commited 2020-12-08 19:52:11 +00:00
1338b6c158
Merge "Test for the current behaviour of updating a network's owner UID." am: aafcaa9fb5 am: 62976a3a26
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1512690

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7ed6c0ba300b34e84db911cbe9554f63712e2a1c

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2020-12-08 10:47:15 +00:00
8e44d9d778
Remove support for legacy network agents
Test: FrameworksNetTests NetworkStackTests
Bug: 167544279
Change-Id: Ia950e16d991cd08d4b609d71aad61a4a4f7fda39

Chalard Jean   commited 2020-12-08 19:43:11 +09:00
74c32e10ab
Remove deprecated constructors for NetworkAgent
Finally.

Now that mLegacy is always false, removing the support
for legacy agents, a follow-up change will remove
the member and all the associated code.

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

Chalard Jean   commited 2020-12-08 19:43:11 +09:00
855c9c8f88
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." am: aafcaa9fb5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1512690

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I35a50be2f748177cde9400449386465d77a21556

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2020-12-08 09:55:56 +00:00
62976a3a26
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
Cleanup TestNetworkService
Very small cleanup where arguments to TestNetworkAgent should
have the same order as the callee. Also remove an unused member.

Test: FrameworksNetTests NetworkStackTests
Change-Id: I9da16bc81be8524e227a7f7e83760882bc4d77e5

Chalard Jean   commited 2020-12-08 16:03:59 +09:00
d43d92fcab
Merge "Add comments to the process*FromAgent methods." am: 300f6e7669 am: cba9e716fc
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1519518

Change-Id: I9d3d9d49fe6118edc4357edc1350d1f2b89f4b2a

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2020-12-07 17:34:04 +00:00
4c0f2da4ea
Merge "Add comments to the process*FromAgent methods." am: 300f6e7669
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1519518

Change-Id: Ia90b3ae008561b2ec3723770802815b46937022e

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2020-12-07 17:07:08 +00:00
cba9e716fc
Merge "Add comments to the process*FromAgent methods."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2020-12-07 16:44:11 +00:00
300f6e7669
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
Add comments to the process*FromAgent methods.
Test: comment-only change
Change-Id: I5ebf6e21d79ed669f85ddf9bf466236d4bd59243

Lorenzo Colitti   commited 2020-12-08 01:17:17 +09:00
3c75ca829e
Split NetworkUtils and NetworkUtilsInternal
NetworkUtils is planned to move to a dedicated JAR for connectivity
classes, while NetworkUtilsInternal would stay in the
frameworks-minus-apex JAR, in the com.android.internal.net package.

Bug: 171540887
Test: m, boots, wifi working
      atest FrameworksNetTests
Change-Id: I3d38d72ad23a4bf84af823c7baeb6fed25c0665f

Remi NGUYEN VAN   commited 2020-12-07 19:41:49 +09:00
689c673aab
[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 "Add a test for TcpKeepalivePacketDataParcelable.toString()." am: ee3c193706 am: 4f4ac4840d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1502382

Change-Id: Id6951382cd12dff2e4f1bd2fe47d063c8998fc2f

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2020-12-07 05:18:13 +00:00
964daa1a04
Merge "Add a test for TcpKeepalivePacketDataParcelable.toString()." am: ee3c193706
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1502382

Change-Id: Ib92977574ffb28cd2e455328260f215352f24b32

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2020-12-07 04:43:19 +00:00
4f4ac4840d
Merge "Add a test for TcpKeepalivePacketDataParcelable.toString()."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2020-12-07 04:38:53 +00:00
ee3c193706
Allow the System UID to unregister ConnDiags CBs.
This CL updates ConnectivityService to allow the System's UID to
unregister ConnectivityDiagnostics callbacks. Preivously, only the
registrant was allowed to unregister them - this caused problems for
callbacks that were attempted to be unregistered via binderDied() when
the registrant app dies.

Bug: 159912975
Bug: 174713659
Test: manually verified
Change-Id: I20d0cad5f902708d366aa703c2893b0ea3e55052
Merged-In: I20d0cad5f902708d366aa703c2893b0ea3e55052
(cherry picked from commit 6d675b48b2)

Cody Kesting   commited 2020-12-04 20:46:52 +00:00
8a1fc4cc51
Merge "Allow the System UID to unregister ConnDiags CBs." am: 636f8cbced am: 5d0cc85448
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1515688

Change-Id: I5b6a900611b727ee58a5b1f2762ed10b5a24fe44

Cody Kesting   authored and   Automerger Merge Worker   commited 2020-12-04 18:01:04 +00:00
785ef9b4cd
Merge "Allow the System UID to unregister ConnDiags CBs." am: 636f8cbced
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1515688

Change-Id: Ia82d68661c99ed5123f2a0668aec4afd5ea48cf5

Cody Kesting   authored and   Automerger Merge Worker   commited 2020-12-04 17:47:45 +00:00
5d0cc85448
Merge "Allow the System UID to unregister ConnDiags CBs."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-12-04 17:35:28 +00:00
636f8cbced
Merge "Use IPV6_MIN_MTU from NetworkConstants in Ikev2Vpn" am: ab2944488f am: 1ebf8bfe18
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1512879

Change-Id: I516719d803ccd2b4cda91eb38ecd108babab50b8

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2020-12-04 04:12:18 +00:00
0249d5b5fa