Commit graph

12,290 commits

Message SHA1
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

Aaron Huang   commited 2021-03-04 13:06:06 +00:00
fdffbaecb4
Merge "Remove @hide CollectionUtils in QosCallbackTracker"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-03-04 04:22:18 +00:00
e93b5d9bf3
Merge "Remove PersistableBundle(Bundle) usage from ConnectivityService"
Aaron Huang   authored and   Gerrit Code Review   commited 2021-03-04 03:50:50 +00:00
a1e34b2d6e
Merge "Use Log instead of Slog in QosCallbackAgentConnection"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-03-04 02:58:37 +00:00
9c6d3c889f
Merge "Address comments on aosp/1612040."
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-03-04 02:04:36 +00:00
0f6df3ba7d
Merge "[CS05]Remove the hidden API usage of MetricsLogger"
Frank Li   authored and   Gerrit Code Review   commited 2021-03-04 01:34:53 +00:00
6ef08c36a7
Merge "[FUI19] Migrate ConnectivityService to use NetworkStatsManager"
Junyu Lai   authored and   Gerrit Code Review   commited 2021-03-04 01:24:57 +00:00
f9d8415ef7
Merge "Merge RQ2A.210305.007"
Xin Li   authored and   Gerrit Code Review   commited 2021-03-03 21:41:39 +00:00
dd3848d115
Merge "APIs for 5G slicing"
Sarah Chin   authored and   Gerrit Code Review   commited 2021-03-03 18:42:20 +00:00
564ab64fab
Merge "Adding additional docs for OemNetworkPreferences"
James Mattis   authored and   Gerrit Code Review   commited 2021-03-03 17:25:01 +00:00
f13bcb0899
[FUI19] Migrate ConnectivityService to use NetworkStatsManager
Test: atest FrameworksNetTests
Bug: 174123988
Change-Id: Iaefd99f87ae96bc9d97d139bcd92a3fe8de917d2

junyulai   commited 2021-03-03 20:01:51 +08:00
c9a235aadc
[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

lifr   authored and   Frank Li   commited 2021-03-03 10:17:52 +00:00
f1b0ca6ef8
Merge "Extend timeout for receiving broadcasts"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-03-03 07:52:41 +00:00
08ef7ddaff
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

Aaron Huang   commited 2021-03-03 15:43:30 +08:00
0d1be6406d
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

Remi NGUYEN VAN   commited 2021-03-03 06:26:16 +00:00
27ed37105b
Address comments on aosp/1612040.
Bug: 174123988
Test: atest FrameworksNetTests
Change-Id: I550fe428d640aab6264aface21fbafb1fd268bff

Lorenzo Colitti   commited 2021-03-03 14:39:09 +09:00
3656709632
Merge changes Idfb5e149,Ia52b24c5
* changes:
  Stop using NetworkState internally in ConnectivityService.
  Isolate an ad-hoc legacy API codepath.

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-03-03 05:35:28 +00:00
cfdaa84e64
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

Sarah Chin   authored and   Chalard Jean   commited 2021-03-03 14:16:21 +09:00
ce85c4c118
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

Remi NGUYEN VAN   commited 2021-03-03 13:12:27 +09:00
29324f3d7a
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

Remi NGUYEN VAN   commited 2021-03-03 03:13:34 +00:00
1cc4f38770
Merge "[REIP01]Remove the IP connectivty metrics"
Frank Li   authored and   Gerrit Code Review   commited 2021-03-03 01:28:31 +00:00
2c1989a672
Merge "Use IDnsResolverUnsolicitedEventListener"
Paul Hu   authored and   Gerrit Code Review   commited 2021-03-03 01:08:27 +00:00
3503759a6f
Merge "Implement Settings#checkAndNoteChangeNetworkStateOperation on CS"
Paul Hu   authored and   Gerrit Code Review   commited 2021-03-03 01:07:20 +00:00
3f250d1da0
Merge "Support new IpSecAlgorithm AUTH_AES_CMAC" am: ca72617385
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1579251

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic9cc8508fb44e10371bc76bb31f20340f8663b18

Yan Yan   authored and   Automerger Merge Worker   commited 2021-03-02 21:08:15 +00:00
7d67dda5c3
Merge "[FUI09] Expose NetworkStateSnapshot as system API" am: 7a593e640d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1536708

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I8eb6681328ad1f4a85bcc8c6c4b9446c23616b7a

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-03-02 20:52:02 +00:00
d73af919b6
Merge "[FUI17] Migrate NetworkStatsService to use NetworkStateSnapshot" am: ebfdaa502f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1556553

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2b19538843007e38e170163120f38477e4b76be8

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-03-02 20:47:52 +00:00
15c7e774c2
Merge "Move OemNetworkPreferences aidl to connectivity" am: d795b61a56
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1612038

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I11b9be22935b9fd7cf53b268103a1ce4635a6afd

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-03-02 20:27:29 +00:00
695e5f6f62
Merge "Move UidRange to connectivity" am: ea3a01abf9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1612295

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I672615b0804b9a9de4befa1ba5aea2efb9c962df

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-03-02 20:24:20 +00:00
beb3822e20
Merge "Add modules-utils-os to service-connectivity" am: d55697b5e2
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1612195

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I22df4afec8f8b5024d099966c0ca0f78b55ff08a

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-03-02 20:19:24 +00:00
dec716d6d3
Merge "Replace checkNetworkStackPermission in TestNetworkService" am: e7b360f9f5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1612194

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I5dd6577a57be2234014527e3bd517b60c4fecb48

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-03-02 20:16:39 +00:00
7afcfc90ee
Merge "Move Proxy, PacProxySelector out of Connectivity" am: 14bcef6a65
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1598157

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Id81273b33752ff353dfebdd2cd3faf43429f1a29

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-03-02 19:52:58 +00:00
b7f911ad07
Merge "Move SocketUtils out of the connectivity module" am: 24e5bceac5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1592273

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib2d4b5574ba710eb50c438144e2b87f6c8954336

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-03-02 19:48:26 +00:00
f0b2caa08b
Merge "Use the net-utils-device-common version of HexDump" am: 92e767c065
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1607954

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I1085391b5649df72b6664d5cdf1756c5110287dc

Aaron Huang   authored and   Automerger Merge Worker   commited 2021-03-02 19:42:02 +00:00
600550be2f
Merge changes I06ab0f2d,I8b146aa1 am: 22c42d573e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1596513

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0332bf0bf07a0a958c2e75b464d577021fd57746

Lucas Lin   authored and   Automerger Merge Worker   commited 2021-03-02 19:13:55 +00:00
cf985cf03e
Merge changes I35ed84fc,Ie6cfd77b,I4e4f929f,I751526e8 am: 51d01615d3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1607733

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia438f937106645eb0d6cb91772d437676bf716fd

Lucas Lin   authored and   Automerger Merge Worker   commited 2021-03-02 19:08:57 +00:00
25d2ee9e66
Merge "Support new IpSecAlgorithm AUTH_AES_CMAC"
Yan Yan   authored and   Gerrit Code Review   commited 2021-03-02 18:24:27 +00:00
ca72617385
Merge "[FUI09] Expose NetworkStateSnapshot as system API"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-03-02 16:08:03 +00:00
7a593e640d
Stop using NetworkState internally in ConnectivityService.
NetworkState is used by many methods that take or return legacy
network types. It is used because it contains most of the state
related to a network.

This code is not easy to follow and is more expensive than it
needs to be: most of the methods that construct a NetworkState
only really need one of its members (e.g., LinkProperties, or
NetworkInfo), but constructing a NetworkState requires making
defensive copies of all its other members as well.

- Instead of using NetworkState, use NetworkAgentInfo, which
  already contains all the same data.
- Replace calls to getUnfilteredActiveNetworkState with calls to
  getNetworkAgentInfoForUid. When getUnfilteredActiveNetworkState
  returned NetworkState.EMPTY, return a null nai, which causes
  any caller to see return null LinkProperties/NetworkInfo/etc.
- Rename filterNetworkStateForUid to getFilteredNetworkInfo,
  because that's the only thing it actually filters.
- Rename getFilteredNetworkInfo to getFilteredNetworkInfoForType
  to avoid having two methods with the same name perform two
  different operations. That method was only introduced recently
  in aosp/1552503, so it's probably fine to rename it.

Bug: 174123988
Test: passes existing ConnectivityServiceTest
Change-Id: Idfb5e149967266a442b268de6f13a521884dbb8f

Lorenzo Colitti   commited 2021-03-03 01:02:45 +09:00
cb1d6a17bc
Isolate an ad-hoc legacy API codepath.
The legacy API getNetworkInfo(int type) is expected to return
NetworkInfo objects for all network types supported by the device
even when those network types are not connected.

This requires a lot of fabrication because all the data
structures in ConnectivityService store information about
connected networks, not networks that don't exist.

Worse, the current behaviour is to return BLOCKED instead of
DISCONNECTED if background data is restricted. This obviously
makes no sense, because a disconnected network cannot be
blocked, and because if that network type did connect and was
unmetered (e.g., Wi-Fi), it would no longer be BLOCKED.
This complicates the code, forcing several methods to deal with
a special case of null NetworkCapabilities, no NetworkAgentInfo,
etc.

Fix this by isolating this outlandish behaviour to its own
method. This allows the main codepaths not to have to support
this unusual and not very useful edge case.

Bug: 174123988
Test: pure refactoring, passes existing tests
Change-Id: Ia52b24c59024c8f6e63e584b864e0225cb572090

Lorenzo Colitti   commited 2021-03-03 01:02:35 +09:00
998a02f226
[FUI09] Expose NetworkStateSnapshot as system API
This is needed by NetworkStatsService and
NetworkPolicyManagerService to utilize the snapshots of
information of networks that grabbed from ConnectivityService.

Test: atest FrameworksNetTests NetworkPolicyManagerServiceTest
Bug: 174123988
Change-Id: I7e974ef7b23ba9ba6ee775eed9899b0c0e2eca55

junyulai   commited 2021-03-02 23:09:16 +08:00
c6e8355dbd
Merge "[FUI17] Migrate NetworkStatsService to use NetworkStateSnapshot"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-03-02 13:21:32 +00:00
ebfdaa502f
[FUI17] Migrate NetworkStatsService to use NetworkStateSnapshot
This change migrates NetworkStatsService and related code to use
NetworkStateSnapshot which is used for replacing the NetworkState.

This patch also changes some formating which is suggested by
the linter.

Test: FrameworksNetTests NetworkPolicyManagerServiceTest
Bug: 174123988
Change-Id: I547da8f411cb45bdadc376ac3cadf3f3c55bb282

junyulai   commited 2021-03-02 20:08:53 +08:00
527859f7a4
Merge "Move OemNetworkPreferences aidl to connectivity"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-02 09:29:07 +00:00
d795b61a56
Merge "Move UidRange to connectivity"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-02 09:27:50 +00:00
ea3a01abf9
[REIP01]Remove the IP connectivty metrics
The IPconnectivty metrics was deprecated.
So, remove the usage of the IPconnectivty metrics code in android.

Bug: 157966864
Test: atest CtsNetTestCases
Change-Id: I9ed4d29bf868902f3222aff980758512233b0b0a

lifr   authored and   Frank Li   commited 2021-03-02 09:03:28 +00:00
567c0d7adb
Merge "Add modules-utils-os to service-connectivity"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-03-02 08:59:35 +00:00
d55697b5e2
Merge "Replace checkNetworkStackPermission in TestNetworkService"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-03-02 08:55:28 +00:00
e7b360f9f5
Merge "Move Proxy, PacProxySelector out of Connectivity"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-02 07:49:00 +00:00
14bcef6a65
Merge "Move SocketUtils out of the connectivity module"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-02 06:44:01 +00:00
24e5bceac5
Move UidRange to connectivity
UidRange is a data class that is an implementation detail of
Connectivity. Move it to the connectivity boundary.

Remaining usages of UidRange outside of Connectivity (in VPN) should be
migrated to other classes, like Range<Integer> or UidRangeParcel.

Bug: 181512874
Test: m
Change-Id: I6f2e3685ad1c07171dd90480d1e546329de8732d

Remi NGUYEN VAN   commited 2021-03-02 15:35:36 +09:00
4e85d98a6f