Commit graph

13,045 commits

Message SHA1
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
Merge "Use the net-utils-device-common version of HexDump"
Aaron Huang   authored and   Gerrit Code Review   commited 2021-03-02 06:25:34 +00:00
92e767c065
Move OemNetworkPreferences aidl to connectivity
Move the IOnSetOemNetworkPreferenceListener aidl definition to
framework-connectivity.
The interface is an internal implementation detail of
framework-connectivity, so it should be built inside the jar.

Bug: 181512874
Test: m
Change-Id: I898049b50fc620ee629587a9303f058e0a6d0272

Remi NGUYEN VAN   commited 2021-03-02 13:56:38 +09:00
49c389926a
Merge changes I06ab0f2d,I8b146aa1
* changes:
  Use UserHandle#getIdentifier to get the userid
  Add test for getStartUser(), getEndUser() and createForUser()

Lucas Lin   authored and   Gerrit Code Review   commited 2021-03-02 04:13:32 +00:00
22c42d573e
Merge changes I35ed84fc,Ie6cfd77b,I4e4f929f,I751526e8
* changes:
  Fix comments left on aosp/1547454 and aosp/1556106
  Remove INetworkManagementService from ConnectivityService
  Remove unused INetworkManagementService
  Remove BaseNetworkObserver from Nat464Xlat

Lucas Lin   authored and   Gerrit Code Review   commited 2021-03-02 04:07:35 +00:00
51d01615d3
Use IDnsResolverUnsolicitedEventListener
Only part of events will report from DnsResolver through
INetdEventListener. So use IDnsResolverUnsolicitedEventListener
to get exactly supporting events from DnsResolver and it uses
Parcelable object to deliver data which can be more updateable
and extendable in the future.

Bug: 173485754
Test: atest FrameworksNetTests
      atest CtsNetTestCases
Change-Id: I8d2e700ae8861ed8ceccd287f3ca5bc2f1ed6dee

paulhu   commited 2021-03-02 11:37:47 +08:00
0a2aa80965
Add modules-utils-os to service-connectivity
service-connectivity needs the library so that module utilities are statically
linked, not picked up from the framework jar as hidden symbols.

Bug: 170598012
Change-Id: I1045b3784a4bdb902f44d848ccddb304986631c3
Test: m

Remi NGUYEN VAN   commited 2021-03-02 03:28:58 +00:00
1dd6922fda
Replace checkNetworkStackPermission in TestNetworkService
Use the underlying PermissionUtils directly instead.

Bug: 178352309
Change-Id: I840a7b7d53531604a214b73f1f518b2ebb10e71e
Test: atest FrameworksNetTests

Remi NGUYEN VAN   commited 2021-03-02 02:27:42 +00:00
b2a34f3db1
Use UserHandle#getIdentifier to get the userid
UidRange uses PER_USER_RANGE to calculate and get the userid,
but PER_USER_RANGE is a hidden API, so use getIdentifier to get
the userid instead.

Bug: 170598012
Test: atest FrameworksNetTests:UidRangeTest
Change-Id: I06ab0f2da8a33d2b718bbc3a609d3d6a5fe0a095

lucaslin   authored and   Lucas Lin   commited 2021-03-02 02:21:39 +00:00
cdda475652
Merge "Move QoS API classes to Connectivity" am: 32a606fe54
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1611876

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Idad1f51e7f269c2cef9e836efa668a5a0afd4c5a

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-03-02 01:28:59 +00:00
c02f9028be
Move Proxy, PacProxySelector out of Connectivity
PacProxySelector is tied to IProxyService, which does not have a formal
API.
Proxy is the interface with ConnectivityService, and all its methods are
public or module API.

Bug: 171540887
Test: m
Change-Id: I8ceba961a81661c3e11d8179955b594d3cab6ff7

Remi NGUYEN VAN   commited 2021-03-01 18:35:26 +09:00
3a142b99f1
Move QoS API classes to Connectivity
The classes were added in S and are used to back ConnectivityManager
APIs. Add them to the connectivity boundary as they belong together with
ConnectivityManager.

Bug: 181512874
Test: m
Change-Id: I03b5978949b200a72813d1ebc4812d851fe3df37

Remi NGUYEN VAN   commited 2021-03-01 18:09:30 +09:00
de9477571f
Move SocketUtils out of the connectivity module
SocketUtils contains system APIs for modules to interact for sockets,
wrapping internal APIs. It should be part of the platform to keep access
to the internal APIs.

This involves splitting NetworkUtils.protectVpn to NetworkUtilsInternal,
since SocketUtils and VpnService are the only users of that method.

The @UnsupportedAppUsage NetworkUtils.protectVpn has low usage
count, and is already available through VpnService.protect.

Bug: 181512874
Test: boots, VPN working
Change-Id: I7028d334975f7536c06afac7a22200c33db707ac

Remi NGUYEN VAN   commited 2021-03-01 16:50:08 +09:00
accf696b71
Merge "Split out the connectivity API surface" am: bdf98b8928 am: af71be4b0a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1552658

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iced065c53194f4c5bd54198e05ddc455a97ba50e

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-03-01 02:25:13 +00:00
4593c2db69
Merge "Split out the connectivity API surface" am: bdf98b8928
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1552658

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6e51465cfeab43ff5f154771e2e22a7cd981d066

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-03-01 02:10:04 +00:00
af71be4b0a
Merge "Split out the connectivity API surface"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-01 01:07:19 +00:00
bdf98b8928
Merge "[FUI08] Create NeworkStateSnapshot" am: dcd3962cbb am: f2f3c84c30
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1536328

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7a88984dbd2c8171837bd1cf2e58ed07c1d6c0d7

Junyu Lai   authored and   Automerger Merge Worker   commited 2021-02-26 12:43:58 +00:00
1793e94183
Merge "[FUI08] Create NeworkStateSnapshot" am: dcd3962cbb
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1536328

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If6f0e981228ef886496f55626b499f9c487af320

Junyu Lai   authored and   Automerger Merge Worker   commited 2021-02-26 11:30:53 +00:00
f2f3c84c30
Merge "[FUI08] Create NeworkStateSnapshot"
Junyu Lai   authored and   Gerrit Code Review   commited 2021-02-26 10:53:36 +00:00
dcd3962cbb
Split out the connectivity API surface
Split out connectivity APIs to connectivity module directories. This
prepares future move of the connectivity code into a mainline module,
but still keeps it implemented by framework-minus-apex for now: the API
stubs are moved to framework-connectivity.stubs, but the implementation
on device remains in the same place.

This allows moving the connectivity code in/out of APEX with minimal
changes.

BYPASS_INCLUSIVE_LANGUAGE_REASON=Moving files, can't modify released API

Bug: 171540887
Test: device boots, connectivity working

Merged-In: I21c42f032efa6c10e36c749df3183ce9679303a7
(cherry-pick from internal branch with API files conflicts)

Change-Id: I21c42f032efa6c10e36c749df3183ce9679303a7

Remi NGUYEN VAN   commited 2021-02-26 19:23:25 +09:00
2079e355ac
Use the net-utils-device-common version of HexDump
KeepaliveTracker is included in ConnectivityService mainline
module and it will not be able to access internal util class
com.android.internal.util.HexDump. Use the HexDump defined in
net-utils-device-common to remove dependency on internal util
class.

Bug: 177046265
Test: FrameworksNetTests
Change-Id: I1f5a6a749106b98e2baf22d6a290dcf8b51a6c36

Aaron Huang   commited 2021-02-26 07:10:19 +00:00
77eb53365b
Merge "Fix copyright license of VpnTransportInfo" am: 993c655bf3 am: 03a3a561b1
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1607313

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I1172acbf1f7cb693dd06db368fe5fe70dcc11858

Junyu Lai   authored and   Automerger Merge Worker   commited 2021-02-26 04:35:13 +00:00
a39f3727f9
Merge "Fix CaptivePortalDataTest on R" am: 32dbde1641 am: 24f7848d23
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1605013

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib748e01e114866042996e61383151c2500fa8868

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-02-26 04:16:35 +00:00
e753cb6d5b
Merge "Add public alternative for protectFromVpn" am: a68e748601 am: c9ba0260a3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1605094

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I95739021d8f70ce1d5371b21ab4357061082bf16

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-02-26 04:16:21 +00:00
e1cdb63453
[FUI08] Create NeworkStateSnapshot
Since NetworkState has UnsupportedAppUsage APIs that cannot
be changed, create another class for follow-up patches
to expose as system API.

Test: NetworkStateSnapshotTest
Bug: 174123988
Change-Id: I54ef872847f34166aa34a79f6178c90ac12b6c72

junyulai   commited 2021-02-26 11:57:06 +08:00
4b836cfb98
Merge "Fix copyright license of VpnTransportInfo" am: 993c655bf3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1607313

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ifed529b4a91bb3c52acb3d1ce708a5999a2bb595

Junyu Lai   authored and   Automerger Merge Worker   commited 2021-02-26 03:56:16 +00:00
03a3a561b1
Merge "Fix copyright license of VpnTransportInfo"
Junyu Lai   authored and   Gerrit Code Review   commited 2021-02-26 03:38:59 +00:00
993c655bf3
Merge "Fix CaptivePortalDataTest on R" am: 32dbde1641
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1605013

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ifbfed272ece8e1f4c437281fc6ca46de793520fe

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-02-26 03:25:46 +00:00
24f7848d23
Merge "Add public alternative for protectFromVpn" am: a68e748601
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1605094

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I759af534bdf50f647351056275857c056998bf14

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-02-26 03:22:03 +00:00
c9ba0260a3
Merge "Fix CaptivePortalDataTest on R"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-02-26 01:51:14 +00:00
32dbde1641
Merge "Add public alternative for protectFromVpn"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-02-26 01:50:32 +00:00
a68e748601
Merge "Update tests for PANS network usage metrics" am: e6b895b488 am: df390e2e8b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1578824

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic312169c70b34bb8a834efae5ebb6b1a6cbb0296

Chris Weir   authored and   Automerger Merge Worker   commited 2021-02-25 22:27:54 +00:00
82ba0376e5
Merge "Update tests for PANS network usage metrics" am: e6b895b488
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1578824

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I8ac8031b7e405226a1b055be3c80eb902d48338b

Chris Weir   authored and   Automerger Merge Worker   commited 2021-02-25 21:52:40 +00:00
df390e2e8b
Merge "Update tests for PANS network usage metrics"
Chris Weir   authored and   Gerrit Code Review   commited 2021-02-25 21:37:42 +00:00
e6b895b488
Support new IpSecAlgorithm AUTH_AES_CMAC
Bug: 161716062
Test: IpSecAlgorithmTest, verified with CTS
Change-Id: Ideaf4225bd851fad8c8072505c6ad99d85ba616e

Yan Yan   commited 2021-02-25 10:35:10 -08:00
7bd615ff95
Merge "Use alternative PhoneStateListener formal API" am: 4de7d07302 am: 6f12370cfc
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1554994

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2071765aba00d8520d3715831d267bcd35795d43

Paul Hu   authored and   Automerger Merge Worker   commited 2021-02-25 13:38:42 +00:00
340a4b0dc5
Merge "Use alternative PhoneStateListener formal API" am: 4de7d07302
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1554994

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I221f70b66e229c7209111227c40a0f4c0e616d85

Paul Hu   authored and   Automerger Merge Worker   commited 2021-02-25 13:04:23 +00:00
6f12370cfc