Commit graph android_packages_modules_Co.../core/java/android
Message SHA1
Merge changes from topics "api-fix-networkagent", "satisfiedby"
* changes:
  Rename satisfiedBy into canBeSatisfiedBy
  Address further API council comments.

Chalard Jean   authored and   Gerrit Code Review   commited 2020-04-02 05:51:02 +00:00
9122e56202
Merge "Only apply VPN isolation if it's fully routed"
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2020-04-02 04:10:12 +00:00
5c5d1a1282
Rename satisfiedBy into canBeSatisfiedBy
Test: FrameworksNetTests NetworkStackTests
Bug: 152238712
Change-Id: I076876a6662bde143ef7d315ce3767acafff93c1
Merged-In: I076876a6662bde143ef7d315ce3767acafff93c1

Chalard Jean   authored and   Aaron Huang   commited 2020-04-01 20:38:30 +08:00
c62f9a53d8
Only apply VPN isolation if it's fully routed
VPN is considered fully routed if both IPv4 and IPv6 have
either a default route or a prohibit route.

Bug: 145332510
Test: atest FrameworksNetTests
Change-Id: I59cf48552bca98092d1212e3d718fd420add5458

Rubin Xu   commited 2020-04-01 09:36:29 +01:00
ab8cf306ea
Address further API council comments.
Test: FrameworksNetTests NetworkStackTests
Bug: 152238712
Copy from ag/10866511
Change-Id: I8a785ae0e74e659c317deaaa28c203356c7766ed
Merged-In: I8a785ae0e74e659c317deaaa28c203356c7766ed

Chalard Jean   authored and   Aaron Huang   commited 2020-04-01 16:01:04 +08:00
691a34d96b
Merge changes from topics "networkagent_api", "networkprovider_api"
* changes:
  Update the NetworkProvider API for council comments
  Update NetworkAgentConfig API for council comments
  Update the NetworkAgent API for council comments

Aaron Huang   authored and   Gerrit Code Review   commited 2020-04-01 05:33:28 +00:00
f210e24871
Merge "Clarify comments for Connectivity Diagnostics reports."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-31 17:43:44 +00:00
87ce14f328
Merge "Sort administrator UIDs for NetworkCapabilities."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-31 17:43:02 +00:00
c350963548
Merge "Add combine() and equals() for NetworkCapabilities admin UIDs."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-31 17:42:18 +00:00
e4df39ba4b
Update the NetworkProvider API for council comments
Bug: 152238712
Test: FrameworksNetTests NetworkStackTests
Copy from ag/10826397
Change-Id: I6b086572cfc72a0727f4510351cff0e74cbc4302
Merged-In: I6b086572cfc72a0727f4510351cff0e74cbc4302

Chalard Jean   authored and   Aaron Huang   commited 2020-03-31 11:57:59 +00:00
5f12f81206
Update NetworkAgentConfig API for council comments
Bug: 152238712
Test: FrameworksNetTests NetworkStackTests
Copy from ag/10826396
Change-Id: Idca9f243a5c955f4caa30921ee520e1a93b0d11a
Merged-In: Idca9f243a5c955f4caa30921ee520e1a93b0d11a

Chalard Jean   authored and   Aaron Huang   commited 2020-03-31 11:51:05 +00:00
aea539a13e
Update the NetworkAgent API for council comments
Bug: 152238712
Test: FrameworksNetTests NetworkStackTests
Copy from ag/10824609
Change-Id: I9a2691f783f4449348c3f767568e05620f0b9df5
Merged-In: I9a2691f783f4449348c3f767568e05620f0b9df5

Chalard Jean   authored and   Aaron Huang   commited 2020-03-31 11:34:42 +00:00
f5d1bfd77f
Merge "Invoke onConnectivityReport on registering ConnectivityDiagnostics."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-31 00:06:26 +00:00
a365c81bfa
Merge "Clean up handling of NetworkCapabilities#administratorUids."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-30 22:04:43 +00:00
eb0b80c9e5
Clarify comments for Connectivity Diagnostics reports.
Clarify when
ConnectivityDiagnosticsCallback#onConnectivityReportAvailable will be
invoked. Clarify when NetworkAgentInfo#mConnectivityReport will be null
vs non-null.

Bug: 147849853
Test: atest FrameworksNetTests
Change-Id: I748bd9ded72a34d89f13bd4362d6d4da62b910b8

Cody Kesting   commited 2020-03-30 14:51:24 -07:00
9a4168bd3b
Sort administrator UIDs for NetworkCapabilities.
Administrator UIDs stored in NetworkCapabilities should be sorted. This
allows for easier equals checks and hashCode computation. Additionally,
duplicate UIDs should be prevented.

Bug: 147903575
Test: atest FrameworksNetTests
Change-Id: Ia5387ca2ce7c3fcbd04dc7fbff5266f7bcc71694

Cody Kesting   commited 2020-03-30 14:51:24 -07:00
ec5a0cb0ff
Add combine() and equals() for NetworkCapabilities admin UIDs.
NetworkCapabilities#mAdministratorUids should be checked for equality
when combining NetworkCapabilities. Administrator UIDs should also be
included in NetworkCapabilities equals() and hashCode().

Bug: 147903575
Test: FrameworksNetTests
Change-Id: I803bdec80e27ee80d3a39844c5fb7aed584ab07d

Chalard Jean   authored and   Cody Kesting   commited 2020-03-30 14:27:20 -07:00
20e92eca29
Invoke onConnectivityReport on registering ConnectivityDiagnostics.
This change updates the behavior for registering
ConnectivityDiagnosticsCallbacks. Now, after a successful register()
call, callbacks will receive cached ConnectivityReports for all
matching, permissioned networks. This allows registrants to be updated
with the network state for their networks without having to wait for the
next network validation.

Bug: 147849853
Test: atest FrameworksNetTests
Change-Id: I924ba8fdcc847f453557021591bde38602fe089c

Cody Kesting   commited 2020-03-30 11:10:46 -07:00
b77bf707c6
Clean up handling of NetworkCapabilities#administratorUids.
Update ConnectivityService's check for administrator UIDs to use
ArrayUtils to check for UID inclusion. Update the NetworkCapabilities
annotation on the administrator UIDs field to clarify that it is
NonNull.

Bug: 147903575
Test: atest FrameworksNetTests
Change-Id: Id630fe9d76aacdaf038fdaa5360f0327520ee0c3

Cody Kesting   commited 2020-03-30 16:55:21 +00:00
7b987276db
Merge "Create a builder for NetworkCapabilities."
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2020-03-30 02:58:45 +00:00
e3aade0a30
Merge "API review: access field by method"
Aaron Huang   authored and   Gerrit Code Review   commited 2020-03-27 07:03:25 +00:00
a09a992749
Merge "Allow MANAGE_TEST_NETWORKS to register limited agents"
Chalard Jean   authored and   Gerrit Code Review   commited 2020-03-25 09:47:03 +00:00
a982d12943
Allow MANAGE_TEST_NETWORKS to register limited agents
This puts in force some restrictions against test networks,
and in exchange relaxes the restrictions around registering
a network agent that provides a test network.
Test networks can only ever have transport TEST, and have
only a few capabilities available to them.

This is useful in particular to test CTS. See aosp/1253423
for first, basic usage of this capability.

Test: IpSecManagerTunnelTest
Test: new CTS aosp/1253423
Bug: 139268426
Change-Id: I47600e6097e8519e50ae771daa13bb6bb7640451

Chalard Jean   commited 2020-03-25 16:28:50 +09:00
5b63976366
Create a builder for NetworkCapabilities.
Bug: 151322799
Test: FrameworksWifiTests
Change-Id: I69c00c9e3963950e55d7105d8825f7d3a3ec9b2f
Merged-In: I06eb97e50d5583579b3c26d1365d2dbaec8bfc99
(cherry picked from commit 9771f34dae9cdeb857636cac2b3c2d473713914e)

Chalard Jean   commited 2020-03-25 13:27:04 +09:00
542e60001a
Merge "Expose netId by adding getter API"
Chalard Jean   authored and   Gerrit Code Review   commited 2020-03-25 02:23:03 +00:00
461f81faac
API review: access field by method
- InvalidPacketException, public field should be a method so
  add getter to get error code.
- KeepalivePacketData, public fields should be methods so
   add getter for fields.

Bug: 151322799
Test: atest FrameworksNetTests
      atest FrameworksWifiTests
      atest FrameworksTelephonyTests: some failure in CarrierAppUtilsTest
Copy from ag/10731108
Change-Id: Id01e6135193716cc21bba11da529bf1507a954f7
Merged-In: Id01e6135193716cc21bba11da529bf1507a954f7

Aaron Huang   commited 2020-03-24 10:55:18 +00:00
005f9d10ae
Expose netId by adding getter API
Bug: 151156820
Test: m
      atest TetetheringTests

Clean CP from ag/10747732

Change-Id: Ieb1483c146aa2f7d8f251157e6e81d71c44ae899
Merged-In: Ieb1483c146aa2f7d8f251157e6e81d71c44ae899

markchien   authored and   Chalard Jean   commited 2020-03-24 09:19:26 +00:00
9d26f92289
Merge "Fix addRoute replace default route unexpectedly"
Treehugger Robot   authored and   Gerrit Code Review   commited 2020-03-24 05:51:30 +00:00
56d39d3251
Fix addRoute replace default route unexpectedly
In aosp/1203789, if two routes are with the same destination,
it will be replaced instead of added when calling addRoute.
This breaks scenarios which rely on the ability to add multiple
default routes, such as multiple IPv6 default routes learned
via address autoconfiguration.

This change treats the route is an update if the destination
and nexthop are the same, but different in other properties.

Test: atest OffloadControllerTest#testSetUpstreamLinkPropertiesWorking
Test: atest LinkPropertiesUtilsTest#testLinkPropertiesIdenticalEqual
Test: atest ConnectivityServiceTest#testStackedLinkProperties
Test: atest ConnectivityServiceTest#testRouteAddDeleteUpdate
  (only directly related tests are listed)
Fix: 152170074
Fix: 151911339
Bug: 142892223

Change-Id: I7153ec9866f14a109ba8155c905e5d9e4f85eb64

junyulai   commited 2020-03-24 10:27:01 +08:00
a1493a52d0
Refactor Network's use of mUrlConnectionFactory.
1.) Replace maybeInitUrlConnectionFactory() with a static method
    createUrlConnectionFactory(Dns) and move the logic to acquire
    the lock and initialize mUrlConnectionFactory out into
    openConnection. This makes it a bit clearer that the lock
    is acquired during openConnection().
2.) Use @GuardedBy("mLock") rather than a human readable comment
    on mUrlConnectionFactory.
3.) Make mUrlConnectionFactory non-volatile (since it's guarded by
    mLock), as recommended by Narayan on the review thread for
    http://r.android.com/370652
    Alternatively, the field could have remained volatile
    and we could have used double-checked locking to avoid
    acquiring the lock in the common case.
    The lock is only acquired during getSocketFactory() and
    openConnection(), so it shouldn't usually be contended.

This CL is a pure refactoring that shouldn't have any observable
behavior change.

Bug: 38311512
Test: Treehugger
Exempt-From-Owner-Approval: refactoring only, owner didn't respond in time
Change-Id: I1cf6075dc7cd994657b11d6a82de3ec63235fb1e

Tobias Thierer   commited 2020-03-23 11:34:32 +00:00
47c0d852da
Merge "Change NetworkCapabilties administrator UIDs to be stored as int[]."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-19 18:09:26 +00:00
1a78f835eb
Merge "TetheringManager API clean up"
Mark Chien   authored and   Gerrit Code Review   commited 2020-03-19 16:09:21 +00:00
bc91f858e6
Merge "Move NetworkCallback to last parameter for new exposed requestNetwork"
Treehugger Robot   authored and   Gerrit Code Review   commited 2020-03-19 15:51:32 +00:00
f0da719ed1
Move NetworkCallback to last parameter for new exposed requestNetwork
Bug: 151243698
Test: atest TetheringTests
Change-Id: I87ef1d451eefa6998b9793c4eacabae978376d24
Merged-In: I87ef1d451eefa6998b9793c4eacabae978376d24

markchien   authored and   Mark Chien   commited 2020-03-19 11:36:07 +00:00
fac84a2be1
TetheringManager API clean up
Per API review:
- @IntDef defined on the type integer parameter
- have getters on each parameter that is set in the
  TetheringRequest.Builder
- new added API should not be deprecated
Below APIs is moved from system-current to module-lib-current that only
plafrom code(e.g. ConnectivityManager and Settings) can use them.
TetheringRequest.
onTetherableInterfaceRegexpsChanged, TetheringInterfaceRegexps:
Only platform code can use them because interfaces by regular
expressions are a mechanism which is planning to be deprecated.

Also rename some constants for easier to understand.

Bug: 149858697
Bug: 151243337
Test: m doc-comment-check-docs
      atest TetheringTests
Change-Id: I45cb21d5bc919f6d32c42650326597d5173ea028
Merged-In: Idd041f0fbeca411ea23e49786a50dd7feb77ef45

markchien   commited 2020-03-19 19:32:50 +08:00
f47d83448c
Merge "Make Ethernet interfaces more testable."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2020-03-19 11:12:09 +00:00
cabe5e5615
Merge "Kill ConnectivityManager.CONNECTIVITY_ACTION_SUPL"
Paul Hu   authored and   Gerrit Code Review   commited 2020-03-19 01:10:55 +00:00
57b993bfb5
Make Ethernet interfaces more testable.
This CL adds a setIncludeTestInterfaces method to EthernetManager
that, when called, causes the Ethernet service to recognize and
manage test interfaces created by TestNetworkManager.

Bug: 150644681
Test: Tested by EthernetTetheringTest in same topic
Change-Id: I86eef7a93267f800dbfc8eafd307effa76a344ca

Lorenzo Colitti   commited 2020-03-19 09:46:37 +09:00
965434afab
Change NetworkCapabilties administrator UIDs to be stored as int[].
NetworkCapabilities#mAdministratorUids is used to track the UIDs that
are administrators of the given Network. This value was previously
stored as List<Integer>. However, general Android API Council guidelines
recommend using Arrays for primitive values. In order to be consistent
with the guidelines, updating the field to use an Array.

Bug: 147903575
Test: atest FrameworksNetTests
Change-Id: I2652a5b0f276b8944454af5cb4b1383a3e054cfa
Merged-In: I2652a5b0f276b8944454af5cb4b1383a3e054cfa

Cody Kesting   commited 2020-03-18 15:18:47 -07:00
5ab1f55d1f
Merge "mtu: Add MTU parameter to Routes"
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2020-03-18 07:20:01 +00:00
9839a4311a
Merge "Update ConnectivityDiagnosticsCallback function name."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-17 19:00:39 +00:00
5596ba1619
Update ConnectivityDiagnosticsCallback function name.
API Council feedback suggests renaming ConnectivityDiagnosticsCallback
'onConnectivityReport' function to be 'onConnectivityReportAvailable'.

Bug: 150598997
Test: atest FrameworksNetTests
Change-Id: Ieea727ecee6cf358a53a215fd4b06233dfe967ea
Merged-In: Ieea727ecee6cf358a53a215fd4b06233dfe967ea

Cody Kesting   commited 2020-03-17 17:10:38 +00:00
fa1ef5eb1b
Merge "Shorten the output of NetworkAgentInfo#toString()."
Treehugger Robot   authored and   Gerrit Code Review   commited 2020-03-17 15:29:39 +00:00
d498a01647
Shorten the output of NetworkAgentInfo#toString().
Currently, printing a NetworkAgentInfo results in a very long
string. Make it a bit shorter by:

- Not printing a number of fields in NetworkInfo that are no
  longer used.
- Instead of printing flags regardless of whether they are true
  false, only print ones that are true. For example, this changes
    everCaptivePortalDetected{true} lastCaptivePortalDetected{false} captivePortalValidationPending{false}
  to:
    everCaptivePortalDetected
- Only printing clat information if clatd is started.

Also, put the long and variable-length fields lp and nc at the
end of the output.

Test: manual
Change-Id: I3312286be307ef1762890cbc6b717f12ce5b2b92

Lorenzo Colitti   commited 2020-03-17 22:29:37 +09:00
08707366d0
Merge "Removing some of the API don't have to be @SystemApi"
Treehugger Robot   authored and   Gerrit Code Review   commited 2020-03-17 12:51:25 +00:00
b0863e0f5b
Merge changes I97015365,Ic9db4b9b
* changes:
  Add NattKeepalivePacketDataTest
  Add KeepalivePacketDataTest

Chiachang Wang   authored and   Gerrit Code Review   commited 2020-03-17 09:38:41 +00:00
4d08f370af
Merge "services.net: Add a static library needed by wifi module"
Treehugger Robot   authored and   Gerrit Code Review   commited 2020-03-17 09:22:12 +00:00
d7a6ba0cbb
Add NattKeepalivePacketDataTest
Add test for constructor and parcel

Test: atest CtsNetTestCasesLatestSdk:android.net.NattKeepalivePacketDataTest
      on both Q and R devices
Bug: 151402211
Change-Id: I97015365604be1846e3ecbaf60ac99e334705565

Chiachang Wang   commited 2020-03-17 15:48:02 +08:00
5b710612a2
Move sensitive field parceling bool to constructor
This addresses API review comments recommending to use a copy
constructor with additional parameters instead of a dedicated method.
makeSensitiveFieldsParcelingCopy becomes LinkProperties(base, true).

Bug: 150877475
Test: atest FrameworksNetTests NetworkStackTests NetworkStackNextTests
Change-Id: Ib145ca7f36dcbee6ef47d09862a181fc04a28f03

Remi NGUYEN VAN   commited 2020-03-17 11:42:33 +09:00
8dd694d1d3
Merge "Add support for registering test networks with administrators."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-16 18:02:55 +00:00
5ec743bd25