Commit Graph

12404 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
8fe76964f5 Replace user with debuggable check in ConnectivityService
IS_USER is a hidden symbol, whereas IS_DEBUGGABLE is part
of the module API.
The check is generally equivalent, as non-user builds are eng or
userdebug, which are debuggable.

Bug: 170598012
Change-Id: I7d09939652844eb2e3a6f0200b1ba50691a147da
Test: atest FrameworksNetTests
2021-03-04 13:12:34 +00:00
Chalard Jean
d803d6f423 Merge changes Ide2567b2,I0ee0ce92,Iac3f55af
* changes:
  Fix a bug where callbacks would see blips
  Fix a bug where a request would not be refcounted
  Fix a bug where UID ranges would not be removed
2021-03-04 13:12:20 +00:00
Chalard Jean
a8ac23070b Fix a bug where callbacks would see blips
When a new OemPreference object is set, the requests
tracking that default will be re-created to track the
new default. This is true regardless of whether that
particular default has changed.

Because the new copied request doesn't know about the
old satisfier, the rematch code will mistakenly think
this callback didn't have a network and will send a
spurious onAvailable to it.

This patch fixes this by simply copying the satisfier
together with the rest of the NRI. The matching code
will then understand the correct previous status.

As a drive-by fix, this also fixes the annotations on
the reassignment contents that can be null. They have
more complex interactions (not everything can be null
at the same time), but the old annotations were just
putting @NonNull on nullable stuff.
In the same line, while there used to be a case with
a satisfier but no request when the satisfier is the
no-service network, there may now be a case where the
old satisfier is known but the old request isn't.

Test: FrameworksNetTests
Test: TODO : need a unit test for this
Change-Id: Ide2567b226722ea9d35ebd8205943363e27647a2
2021-03-04 13:11:59 +00:00
Chalard Jean
2d235fbe33 Fix a bug where a request would not be refcounted
This ends up crashing the system when the request
is unregistered, because the ref counter finds the
count associated with the relevant UID is zero.

Test: FrameworksNetTests
Test: TODO : this needs a new unit test
Change-Id: I0ee0ce925a826d35d8fd58cefb8a870e98ce9add
2021-03-04 22:08:09 +09:00
Chalard Jean
738c5bf0a1 Fix a bug where UID ranges would not be removed
When a new preferences object is sent that no longer contains
a particular app, a new set of requests will be generated. All
requests corresponding to that app will be unregistered, and
no new ones will be filed since the preferences no longer
contain that app.

The place where the UID ranges are removed however is in
makeDefaultForApps(), which takes a request. As there no
longer is a default request for this app, makeDefaultForApps()
will never be called with a request for it, and the UID ranges
will never be removed.

This change applies an emergency fix with some side effects
when setting a new preference. This is acceptable, but should
ideally be fixed ; see TODO in the code for details.

Test: FrameworksNetTests
Test: TODO : Need a unit test for this
Change-Id: Iac3f55af5d00d174460e1d4cdd31f581835dbaa6
2021-03-04 22:08:09 +09:00
Aaron Huang
82d58d9e4d Use NetworkCallback in BatteryStatsService to get connectivity change
Currently, battery stats service uses noteConnectivityChanged in
connectivity service(CS) to pass connection state and the type of
connection for BatteryStats. However, CS is going to be a mainline
module which can only access formal API. noteConnectivityChanged
is a hidden API and it pass LegacyNetworkType which has been
deprecated years ago, so it should avoid to expose this API with
a deprecated argument. Thus, register a NetworkCallback in
BattyeryStatsService to listen the network capabilities changed to
remove the noteConnectivityChanged from connectivity service.
Besides, let noteConnectivityChanged take display transport instead
of legacy network type.

Bug: 171686421
Test: atest FrameworksNetTests
      atest FrameworksCoreTests:BatteryStatsTests
(cherry-picked from ag/13749983)
Change-Id: I3dac94ec06f673aa719e124f1ef3d8169f68f9fb
Merged-In: I3dac94ec06f673aa719e124f1ef3d8169f68f9fb
2021-03-04 13:06:06 +00:00
Treehugger Robot
75f450ab9e Merge changes Ie8d98359,I4d5cadfd
* changes:
  Fix a bug in RequestReassignment#toString
  Cleanup some of the PANS code
2021-03-04 12:39:04 +00:00
Remi NGUYEN VAN
db59856886 Fix CaptivePortalTest before R
The last change broke the test on Q and R. Fix it to check
Q and R behavior properly, so the test can be run in presubmit
on such devices too.

Bug: 181844595
Change-Id: I99847ea30d49d690d9011d4763a7345126807119
Test: atest CtsNetTestCasesLatestSdk
2021-03-04 10:45:02 +00:00
junyulai
ebd15164e9 [FUI22] Support getAllNetworkStateSnapshot
Currently, ConnectivityService has getAllNetworkState but it is
not ideal to expose as system API since the plan is to get rid
of NetworkState. Thus, create a new one that returns
NetworkStateSnapshot to fulfill the needs.

Note the original getAllNetworkState cannot be deleted now since
it has @UnsupportedAppUsage annotation.

Test: atest FrameworksNetTests
Bug: 174123988
Change-Id: Icddd434552b0e9ecbc8299e7242ec88cf3145aca
2021-03-04 18:41:09 +08:00
Chiachang Wang
003521569e Have the DataConnectionStat started from BSS
ConnectivityService is going to becoming a mainline module.
The DataConnectionStat is used to listen the telephony status
change and report to BSS. This does not really relate to
connectivity. DataConnectionStat was created in
ConnectivityService and use some hidden APIs which is not
allowed for a mainline module. Thus, move the creation and
monitor to BSS directly which is more appropriate place from
its functional perspective.

Also, move the DataConnectionStat out from module scope since
it does have too much relationship with connectivity module.

Bug: 171183530
Test: m ; verify the behavior with cellular state change
Change-Id: I0c2c1b90df7a107ee75e81fd49d39d65678204c0
Merged-In: I0c2c1b90df7a107ee75e81fd49d39d65678204c0
2021-03-04 16:21:25 +08:00
Janis Danisevskis
463c2d5292 Keystore 2.0: Make VPN Keystore 2.0 ready.
* Use public stable API to load certificates from keystore.
* Also use grants to allow racoon to use keystore keys without
  special exceptions in keystore.
* Use LegacyProfileStore instead of Keystore for storing VPN profiles.

Bug: 175068876
Bug: 171305607
Test: atest android.net.cts.Ikev2VpnTest
      atest android.net.cts.IpSecManagerTest
      atest com.android.server.connectivity.VpnTest
      atest com.android.server.ConnectivityServiceTest
Merged-In: I27975113896ea137260a9f94a34fb1c3ca173fe3
Change-Id: I27975113896ea137260a9f94a34fb1c3ca173fe3
2021-03-03 22:14:41 -08:00
Treehugger Robot
33e7f16a5d Merge "Remove @hide CollectionUtils in QosCallbackTracker" 2021-03-04 04:22:18 +00:00
Aaron Huang
a3ece1e428 Merge "Remove PersistableBundle(Bundle) usage from ConnectivityService" 2021-03-04 03:50:50 +00:00
Treehugger Robot
3e6896bf30 Merge "Use Log instead of Slog in QosCallbackAgentConnection" 2021-03-04 02:58:37 +00:00
Treehugger Robot
87548dfac7 Merge "Address comments on aosp/1612040." 2021-03-04 02:04:36 +00:00
lucaslin
c6170bb2f3 Replace withCleanCallingIdentity with [clear|restore]CallingIdentity
To prevent using @hide method - withCleanCallingIdentity() from
mainline module, use clearCallingIdentity() &
restoreCallingIdentity() instead.

Bug: 172183305
Test: FrameworksNetTests, CtsNetTestCasesLatestSdk
Change-Id: I8221bb8717ba6809c5087ea2808cd4ccef948cfd
2021-03-04 09:38:21 +08:00
Frank Li
130dfbe8ba Merge "[CS05]Remove the hidden API usage of MetricsLogger" 2021-03-04 01:34:53 +00:00
lucaslin
4bc26fabd1 Use ArraySet#add() instead of ArraySet#append()
ArraySet#append() is a hidden API which is not accessible for
mainline module, use public one - ArraySet#add() instead.

Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: I0742e2ec7aff008141b1de6d10eeca2910df71b1
2021-03-04 09:29:30 +08:00
Junyu Lai
87a6d6acd2 Merge "[FUI19] Migrate ConnectivityService to use NetworkStatsManager" 2021-03-04 01:24:57 +00:00
Xin Li
56aeeffd0c Merge "Merge RQ2A.210305.007" 2021-03-03 21:41:39 +00:00
Sarah Chin
0f46c91ee5 Merge "APIs for 5G slicing" 2021-03-03 18:42:20 +00:00
James Mattis
bd78571c32 Merge "Adding additional docs for OemNetworkPreferences" 2021-03-03 17:25:01 +00:00
junyulai
e7c7d2a9e1 [FUI19] Migrate ConnectivityService to use NetworkStatsManager
Test: atest FrameworksNetTests
Bug: 174123988
Change-Id: Iaefd99f87ae96bc9d97d139bcd92a3fe8de917d2
2021-03-03 20:01:51 +08:00
lifr
a9f5551cf5 [CS05]Remove the hidden API usage of MetricsLogger
Legacy metrics are unused and deprecated, so they are being removed.
Therefore, delete the usage of the hidden MetricsLogger API.

Bug: 157966864
Test: atest CtsNetTestCases
      atest CaptivePortalTest
      atest ConnectivityServiceTest
Change-Id: I51241f5d50ec580015882c84dd917b015c700c7c
2021-03-03 10:17:52 +00:00
Treehugger Robot
93c4f353b9 Merge "Extend timeout for receiving broadcasts" 2021-03-03 07:52:41 +00:00
Aaron Huang
959d36435b Remove PersistableBundle(Bundle) usage from ConnectivityService
Because the constuctor PersistableBundle(Bundle) is a hidden
API which is not visible to connectivity mainline module.
Currently, EVENT_NETWORK_TESTED and EVENT_DATA_STALL_SUSPECTED
are two events sent by ConnectivityService so they can build a
PersistableBundle directly and send PersistableBundle instead of
setting Bundle in the data field of the Message.

For EVENT_NETWORK_TESTED, add a new PersistableBundle member in
ConnectivityReportEvent so that the PersistableBundle can be
passed with ConnectivityReportEvent.

For EVENT_DATA_STALL_SUSPECTED, create a Pair<Long, PersistableBundle>
and put this in .obj of the Message, then the PersistableBundle can be
sent with timestampMillis together.

Bug: 177865050
Test: FrameworksNetTests
Change-Id: Ia2220f33f000e7c9439d97617cc08014dc4478a3
2021-03-03 15:43:30 +08:00
Remi NGUYEN VAN
74ba6de40f Extend timeout for receiving broadcasts
The test is currently flaky as broadcasts can take a long time
to be delivered, often more than 500ms.
Extend the timeout for broadcasts to 30s.

Historically the test would wait for broadcasts for at most 500ms,
but not verify that they were received before proceeding. This was
fixed recently by adding an assertion, but the assertion needs to
give enough time for the broadcast to be received.

Bug: 173331190
Change-Id: I0760f3418c635aa4d68de5aefdb7120a9d3e930b
Test: atest FrameworksNetTests
2021-03-03 06:26:16 +00:00
Lorenzo Colitti
3da6f1bd6d Address comments on aosp/1612040.
Bug: 174123988
Test: atest FrameworksNetTests
Change-Id: I550fe428d640aab6264aface21fbafb1fd268bff
2021-03-03 14:39:09 +09:00
Lorenzo Colitti
df25b4e591 Merge changes Idfb5e149,Ia52b24c5
* changes:
  Stop using NetworkState internally in ConnectivityService.
  Isolate an ad-hoc legacy API codepath.
2021-03-03 05:35:28 +00:00
Chalard Jean
d490b2d8b9 Fix a bug in RequestReassignment#toString
This fixes a small bug in debug code where the wrong
request would be displayed for RequestReassignment#toString.

Test: manual
Change-Id: Ie8d983593e67082eb818ef65bd8708e97596bce2
2021-03-03 14:24:13 +09:00
Sarah Chin
223bc35f3b APIs for 5G slicing
Create TrafficDescriptor class
Create new APN ENTERPRISE
Update setupDataCall and DataCallResponse to take TrafficDescriptor and
matchAllRuleAllowed
Move ApnTypes from Annotation to ApnSetting

Bug: 179312227
Test: atest FrameworksTelephonyTests
Change-Id: I7433976bfe25bcb2af85ffb9338959cbcc9f42f3
Merged-In: I7433976bfe25bcb2af85ffb9338959cbcc9f42f3
2021-03-03 14:16:21 +09:00
Chalard Jean
5d6e23bdfb Cleanup some of the PANS code
Test: FrameworksNetTests
Change-Id: I4d5cadfdd8e30a179948302e8c0c45f4d42b59ea
2021-03-03 14:16:21 +09:00
Remi NGUYEN VAN
570207cc75 Remove @hide CollectionUtils in QosCallbackTracker
Instead of using hidden symbols in the internal CollectionUtils, use the
CollectionUtils in libs/net that are intended for that usage.

Bug: 174541037
Test: m
Change-Id: Icb282bf2f38eb553eebc7d499bf92f22fae723cc
2021-03-03 13:12:27 +09:00
Remi NGUYEN VAN
b389fcb466 Use Log instead of Slog in QosCallbackAgentConnection
Replace the hidden API Slog with the Log public API. Log is the utility
used by connectivity modularized code, which QosCallbackAgentConnection
is part of.

Change-Id: Ia50ec1cd3b8253ede010ec4fd1c37d9aa731d032
Test: m
Bug: 172050541
2021-03-03 03:13:34 +00:00
Frank Li
a3073a34d8 Merge "[REIP01]Remove the IP connectivty metrics" 2021-03-03 01:28:31 +00:00
Paul Hu
0957fc8681 Merge "Use IDnsResolverUnsolicitedEventListener" 2021-03-03 01:08:27 +00:00
Paul Hu
f0755886c5 Merge "Implement Settings#checkAndNoteChangeNetworkStateOperation on CS" 2021-03-03 01:07:20 +00:00
Yan Yan
119eb7d56f Merge "Support new IpSecAlgorithm AUTH_AES_CMAC" am: 5bab9c0448
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1579251

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic9cc8508fb44e10371bc76bb31f20340f8663b18
2021-03-02 21:08:15 +00:00
Treehugger Robot
6e281a3241 Merge "[FUI09] Expose NetworkStateSnapshot as system API" am: aaa0b58b76
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1536708

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I8eb6681328ad1f4a85bcc8c6c4b9446c23616b7a
2021-03-02 20:52:02 +00:00
Treehugger Robot
f147fdffb1 Merge "[FUI17] Migrate NetworkStatsService to use NetworkStateSnapshot" am: ed0127ce3d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1556553

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2b19538843007e38e170163120f38477e4b76be8
2021-03-02 20:47:52 +00:00
Remi NGUYEN VAN
f8fd33cf04 Merge "Move OemNetworkPreferences aidl to connectivity" am: 3c943ca0f6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1612038

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I11b9be22935b9fd7cf53b268103a1ce4635a6afd
2021-03-02 20:27:29 +00:00
Remi NGUYEN VAN
3ee3263696 Merge "Move UidRange to connectivity" am: 1c5e8b1def
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1612295

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I672615b0804b9a9de4befa1ba5aea2efb9c962df
2021-03-02 20:24:20 +00:00
Treehugger Robot
bec11d94d5 Merge "Add modules-utils-os to service-connectivity" am: 512857e29a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1612195

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I22df4afec8f8b5024d099966c0ca0f78b55ff08a
2021-03-02 20:19:24 +00:00
Treehugger Robot
89fbd41617 Merge "Replace checkNetworkStackPermission in TestNetworkService" am: 770e767210
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1612194

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I5dd6577a57be2234014527e3bd517b60c4fecb48
2021-03-02 20:16:39 +00:00
Remi NGUYEN VAN
0d78fe6fd8 Merge "Move Proxy, PacProxySelector out of Connectivity" am: ae0eb0a9a6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1598157

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Id81273b33752ff353dfebdd2cd3faf43429f1a29
2021-03-02 19:52:58 +00:00
Remi NGUYEN VAN
8f88985427 Merge "Move SocketUtils out of the connectivity module" am: d856834f40
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1592273

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib2d4b5574ba710eb50c438144e2b87f6c8954336
2021-03-02 19:48:26 +00:00
Aaron Huang
72271fc971 Merge "Use the net-utils-device-common version of HexDump" am: aad33493a2
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1607954

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I1085391b5649df72b6664d5cdf1756c5110287dc
2021-03-02 19:42:02 +00:00
Lucas Lin
3292a54588 Merge changes I06ab0f2d,I8b146aa1 am: 125200718e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1596513

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0332bf0bf07a0a958c2e75b464d577021fd57746
2021-03-02 19:13:55 +00:00
Lucas Lin
9618198105 Merge changes I35ed84fc,Ie6cfd77b,I4e4f929f,I751526e8 am: 6a2bb12457
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1607733

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia438f937106645eb0d6cb91772d437676bf716fd
2021-03-02 19:08:57 +00:00
Yan Yan
5bab9c0448 Merge "Support new IpSecAlgorithm AUTH_AES_CMAC" 2021-03-02 18:24:27 +00:00