Commit Graph

607 Commits

Author SHA1 Message Date
Nazanin Bakhshi
35c18e14f9 Merge "Security fix: enforce read privilege permission to check package privileges in TelephonyManager" into sc-dev 2021-04-21 22:04:04 +00:00
Nazanin
6468b0d17e Security fix: enforce read privilege permission to check package
privileges in TelephonyManager

Bug: 180938364
Test: cts
Change-Id: I08c346c46b9e87dceaa1faf35fa36b954d88f9b0
2021-04-20 14:27:20 -07:00
Aaron Huang
444fcb9d56 Add getters to NetworkStateSnapshot
Address API council feedback, add getters to NetworkStateSnapshot
instead of exposing the bare fields directly.

Bug: 183972826
Test: FrameworksNetTests
Change-Id: Id1707753b42ae88d2b95e4bd00a792609434e4f5
2021-04-20 21:55:56 +08:00
Junyu Lai
9dfe83449a Merge "Support Dual ViLTE stats" am: df875106a7 am: 4ea19cf4b0 am: 175a1d4e49
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1540920

Change-Id: I5739265c2747055b0252da7d1fb9e47d61ca111c
2021-03-29 09:05:02 +00:00
Junyu Lai
df875106a7 Merge "Support Dual ViLTE stats" 2021-03-29 06:59:19 +00:00
Lucas Lin
0cf3234045 Merge changes I6d5dd0a8,I106b3e4f
* changes:
  Use public API Network#getNetId() to get netid
  Remove unused import IConnectivityManager
2021-03-25 10:49:35 +00:00
lucaslin
20966d9193 Use public API Network#getNetId() to get netid
Network class will be a part of mainline module, external callers
cannot call its hidden constant. Use public API - getNetId() to
get netid instead.

Bug: 182963397
Test: m
Change-Id: I6d5dd0a8c3879df7bdc1d58e36022045c303bb40
Merged-In: I6d5dd0a8c3879df7bdc1d58e36022045c303bb40
  (cherry-picked from ag/13927649)
2021-03-25 10:48:55 +00:00
lucaslin
11e8857033 Use getAllInterfaceNames to get all interface names
The current design is using hidden API - getStackedLinks() to
get LinkProperties then call getInterfaceName() to get the
interface name. In fact, this behavior could be replaced by
system API - getAllInterfaceNames().

Bug: 182963397
Test: atest FrameworksNetTests
Test: atest CtsNetTestCases
Change-Id: Id2b19dc5099355af69d23a6d99d2b7e6c0e1e88a
Merged-In: Id2b19dc5099355af69d23a6d99d2b7e6c0e1e88a
  (cherry-picked from ag/13927660)
2021-03-25 08:10:28 +00:00
junyulai
df6726cac7 [SP29] Send interface warning bytes to NetworkStatsProvider
This change contains necessary modification in NPMS and NSS
to send warning bytes to NetworkStatsProvider. But since
no any provider has been upgraded to handle such parameter.
Thus, no behavior change is made in this patch.

Test: atest NetworkPolicyManagerServiceTest NetworkStatsServiceTest
Test: atest NetworkPolicyManagerServiceTest#testStatsProviderWarningAndLimitReached
Bug: 149467454
Bug: 170699770
Bug: 170179169
Ignore-AOSP-First: avoid long automerger delay
Change-Id: I6c4863030c36328db571294fd12a40e59864def5
2021-03-24 22:02:52 +08:00
junyulai
cc6bc70bbf [SP28] Add API for set data warning
To have better control and race-free of set data warning
to tether offload hardware, an interface of set warning and
limit at the same time in the NetworkStatsProvider is needed.

This is a no-op change which expose such interface with minimum
changes in service side to get build pass. The implementation
would be included in follow-up patches.

Test: atest NetworkStatsServiceTest
Test: atest NetworkPolicyManagerServiceTest
Test: atest GtsNetworkStackHostTestCases
Test: m doc-comment-check-docs
Bug: 149467454
Bug: 170699770
Bug: 170179169
Ignore-AOSP-First: avoid long automerger delay
Change-Id: I6ee661497f7dedb871c85786d1950cab951d8aa2
2021-03-23 23:43:10 +08:00
Aaron Huang
cbe8076a23 Fix IpConfigStore dependencies on framework-connectivity
This change fixes IpConfigStore dependencies on framework-connectivity
hidden APIs.
- Use the version of SystemApi to new RouteInfo.
- Inline the implementation of isIPv4Default() directly because
  isDefaultRoute() is a public API so it can be used in this class.

Bug: 178777253
Test: FrameworksServicesTests:IpConfigStoreTest
Change-Id: I5ed1bc8bc8bee5b0c795fd8577a2d64628998e51
2021-03-22 18:59:41 +08:00
Aaron Huang
f19fea861c Migrate hidden API in IpConfigStore to formal API
IpConfiguration and StaticIpConfiguration are included
in framework-connectivity which cannot have external
hidden API usages dependencies on them. IpConfiguration
and StaticIpConfiguration provide builder and getter
methods for the fields of the objects which are formal APIs.
So, replace the usages in IpConfigStore with those formal
APIs to remove the dependencies.

Bug: 178777253
Test: FrameworksServicesTests:IpConfigStoreTest
Change-Id: Ie9e6af0efe2c39667bb8faa1e3a498b1f61e1432
2021-03-22 18:59:37 +08:00
lucaslin
1dc565df71 Use getAllInterfaceNames to get all interface names
The current design is using hidden API - getStackedLinks() to
get LinkProperties then call getInterfaceName() to get the
interface name. In fact, this behavior could be replaced by
system API - getAllInterfaceNames().

Bug: 182963397
Test: atest FrameworksNetTests
Test: atest CtsNetTestCases
Change-Id: Id2b19dc5099355af69d23a6d99d2b7e6c0e1e88a
2021-03-19 23:08:33 +08:00
lucaslin
3aec12c6a9 Use public API Network#getNetId() to get netid
Network class will be a part of mainline module, external callers
cannot call its hidden constant. Use public API - getNetId() to
get netid instead.

Bug: 182963397
Test: m
Change-Id: I6d5dd0a8c3879df7bdc1d58e36022045c303bb40
2021-03-19 08:08:20 +00:00
Zhengyu Zhan
63a5820b4f Support Dual ViLTE stats
Some operator supports multiple VILTE,
both two SIM cards can make VILTE call.
We need to record VILTE data to different interface.
Now NetworkStatsService has only one VILTE data
interface: "vt_data0". All VILTE data stats will
be recorded in this interface.

Bug: 130871087
Test: NetworkStatsServiceTest#testDualVilteProviderStats
Change-Id: I000ec756827bc42cac88dd0a2ca6b7999252357e
2021-03-15 10:00:59 +08:00
Lucas Lin
b326170cac Merge changes Ib80f814f,Ic605e489 am: 02929bde11 am: 39e98823a3 am: a7baeed6a6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1626209

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I47862eeec4f74a0901b8b866dd6ffa906bd9e62f
2021-03-12 04:58:40 +00:00
lucaslin
7eb76590b8 Use new API - getIpSecNetIdRange() in IpSecService
Use new API - getIpSecNetIdRange() to get the network ID range
of IPSec tunnel interface.

Bug: 172183305
Test: atest FrameworksNetTests:IpSecServiceTest
Change-Id: Ib80f814f991e9f000a68f5c539d15d97cf56930e
2021-03-11 17:30:18 +00:00
Chiachang Wang
0923f0fd41 Merge "Replace ConnectivityManager.isNetworkTypeMobile usage in NSS" am: 874aefac33 am: 2155c3400e am: 341f30c018
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1612298

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6030cf153aa76f666cafc1b4f28fa17d57a5da3e
2021-03-09 05:56:30 +00:00
Chiachang Wang
055165000e Replace ConnectivityManager.isNetworkTypeMobile usage in NSS
ConnectivityManager is a part of connectivity mainline. The
hidden methods dependency in ConnectivityManager should be
removed to make it a moudle. NSS use isNetworkTypeMobile to
check if the NetworkState belongs to a cellular network or not.
It should be replaced by the NetworkCapabilities inside the
NetworkState.

The result of isNetworkTypeMobile relies on the legacy network
type. The legacy network type comes from the network type
of its network info. The replacement should consider VPN active
case because the network type will not be TYPE_MOBILE. Thus,
replace it with Networkcapabilities.getDisplayTransport() to
get a transport that can be used to classify a network when
displaying its info to users, i.e. it will return TRANSPORT_VPN
for a vpn network on cellular network.

Bug: 172183305
Test: atest FrameworksNetTests
Change-Id: I2132a7288a93e4430cbd9efabc33ae56ce8bdd9b
2021-03-08 09:11:24 +00:00
Paul Hu
fc189c4f14 Merge "Replace ConnectivityManager hidden symbols on framework" am: 1984fb1cb0 am: 27612f4a2d am: f0ff9b845c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1607955

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ifd0d0d57bc74aaf9590dcdd4aa76919da8ccb7d0
2021-03-04 05:10:48 +00:00
Paul Hu
1984fb1cb0 Merge "Replace ConnectivityManager hidden symbols on framework" 2021-03-04 03:07:08 +00:00
junyulai
f72320776d [FUI18] Expose notifyNetworkStatus as system API
Test: m -j doc-comment-check-docs
Bug: 174123988
Merged-In: I11d4c9ab24de87fb2ad120e3787b78b73133e874
Change-Id: I11d4c9ab24de87fb2ad120e3787b78b73133e874
  (cherry-picked from ag/13749978)
2021-03-03 20:01:46 +08:00
junyulai
537b8cfe68 [FUI18] Expose notifyNetworkStatus as system API
Test: m -j doc-comment-check-docs
Bug: 174123988
Change-Id: I11d4c9ab24de87fb2ad120e3787b78b73133e874
2021-03-03 15:34:42 +08:00
Treehugger Robot
695093e745 Merge "[FUI17] Migrate NetworkStatsService to use NetworkStateSnapshot" am: 1ad27ef2a1 am: 8e8f318c1f am: 8396dbf036
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1556553

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2207873ffb549f26026e33f14440be494e4b4175
2021-03-02 21:10:19 +00:00
junyulai
125631330d [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
2021-03-02 20:08:53 +08:00
Chris Weir
37eedbac6e Merge "Add support for tracking PANS data usage" am: dbedad0dd5 am: 16e2ef942a am: 24e858dc96
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1578684

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3d586ff455baccbf87f0ffb835af83c90735ba56
2021-03-01 07:59:54 +00:00
paulhu
da479fa1a4 Replace ConnectivityManager hidden symbols on framework
Connectivity is becoming a mainline module in S, so
ConnectivityManager hidden symbols can not be used for outside
components. Besides, most Tethering relevant methods or variables
on CM are migrated to TetheringManager. So replace all these
methods or variables from ConnectivityManager to TetheringManager
on Telephony on framework.

Bug: 180693313
Test: atest FrameworksNetTests
Change-Id: I14e032ad6f278a36e8756aa7045d73a403f8f059
2021-02-26 11:19:41 +08:00
Jeff Sharkey
0917f5d15f Merge "Pivot network statistics to use DataInput/Output." into sc-dev 2021-02-26 01:19:45 +00:00
Chris Weir
dbedad0dd5 Merge "Add support for tracking PANS data usage" 2021-02-25 21:37:42 +00:00
Jeff Sharkey
daa23607be Pivot network statistics to use DataInput/Output.
The majority of this refactoring has already landed in AOSP, and this
small CL is the remaining piece needed to begin using the new
optimized classes which only exist in the internal tree.

This is a no-op refactoring.

Bug: 176777285
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: Ifd7ac95c6cd6761e7d03cbf381dcc9e32b6406aa
2021-02-24 13:54:20 -07:00
Lucas Lin
fbfb9b924a Merge changes I852e3a53,I86755647,I0ed8b0c6 am: 1e70c22af9 am: d1f4d2881f am: 0c0ca691f1
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1553736

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I032e3d8f16b164f067dba02bde950b93f4e54b83
2021-02-23 22:56:46 +00:00
Lucas Lin
1e70c22af9 Merge changes I852e3a53,I86755647,I0ed8b0c6
* changes:
  Remove unused INetworkManagementService from IpSecService
  Use NetdUtils instead of NetworkManagementService in Vpn
  Use NetdUtils instead of NetworkManagementService in IpSecService
2021-02-22 06:49:39 +00:00
Chris Weir
f8f291cb7b Add support for tracking PANS data usage
Adds support for tracking oemManagedNetwork types (OEM_PAID and
OEM_PRIVATE).

Bug: 174485293
Test: atest NetworkTemplateTest NetworkStatsCollectionTest
NetworkStatsObserversTest NetworkStatsServiceTest NetworkIdentityTest
Test: verify that the bytes go up in PansTest app only when
`ping -I eth2 8.8.8.8` is run as root.

Change-Id: I78660a835f16265ba8e44bb84332c6633dd72b84
2021-02-17 20:32:53 -08:00
Yan Yan
015c1706e7 Merge changes Ifc8ad902,I6d1b8d0e am: 8d659bb1ec am: 488687d11f am: e669fe43cd
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1453730

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6f3235dd38e4c4912f986cbb27867ff14fe38e81
2021-02-12 22:46:32 +00:00
Yan Yan
a2f3b49f10 Update underlying network of IpSecTunnelInterface
Bug: 169855650
Test: atest IpSecManagerTunnelTest
Change-Id: I6d1b8d0e49f89c67ddc2caf4ba63fb0b1eb062c0
2021-02-10 14:51:43 -08:00
Junyu Lai
fe5b645d52 Merge changes from topic "removeNI" am: 5e1ec81e2f am: ecb34129dc am: 925f60252b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1536707

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3553ff41d85f44c481ea065e6cbda5d286f9e1fa
2021-02-09 05:49:15 +00:00
junyulai
64b1cfb7db [FUI06] Stop using NetworkInfo in NetworkState from external callers
This is achieved by:
  1. Use legacy network type inside NetworkState to replace the
     needs of referencing NetworkInfo.getType().
  2. Let getAllNetworkState only return networks with isConnected()
     equals true. This allows callers such as NPMS or NSS does not
     have to reference to NetworkInfo.isConnected().

Test: atest FrameworksNetTests NetworkPolicyManagerServiceTest
Bug: 174123988
Change-Id: I1c4eb08d18ca973eb8f41d06258872eabc0006b8
2021-02-08 21:40:49 +08:00
lucaslin
d66e608a5d Remove unused INetworkManagementService from IpSecService
IpSecService is no longer using any methods of
INetworkManagementService, so remove it from IpSecService
and related files.

Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: I852e3a534e0ffd26b4b22420754f3ec8a6f153ad
2021-02-08 08:05:00 +00:00
lucaslin
ff6fe7ba53 Use NetdUtils instead of NetworkManagementService in IpSecService
NetdUtils has the same method(e.g. setInterfaceUp) as
NetworkManagementService so using the one inside NetdUtils instead
and try to remove NetworkManagementService from IpSecService in
the following commit.

Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: I0ed8b0c678b067a655b51b938b6b40eadd985321
2021-02-08 16:01:56 +08:00
Junyu Lai
5905a23e64 Merge "[FUI04] Refactor VpnInfo" am: 561626b20d am: a109d80a47 am: f9445c8a07
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1537211

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Icfa9918e41fc3f952a23956108df4db449741364
2021-01-29 23:38:06 +00:00
junyulai
0592b920cb [FUI04] Refactor VpnInfo
As a preparation of exposing system API. This patch does some
harmless refactoring, which includes:
  1. Change raw arrays into lists according to API guidelines.
  2. Write test.
  3. Rename class to UnderlyingNetworkInfo.
  4. Rename vpnIface to iface.
  5. Make underlyingIfaces @NonNull in order to adapt new
     unparceling code.
  6. implement equals and hashCode for testing.

Test: atest android.net.UnderlyingNetworkInfoTest
Bug: 174123988

Change-Id: I405c21e57c4af8a12a9dd0a1749b9e6690f87045
2021-01-29 17:44:32 +08:00
Treehugger Robot
a3eaf95b98 Merge "[FUI03] No-op refactoring of VpnInfo" am: f9dbe61693 am: 9a9c17579a am: 9f37e0e929
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1547637

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I05e6b14fca44919610317831c147413b0a431224
2021-01-27 14:16:00 +00:00
junyulai
67c69ad73f [FUI03] No-op refactoring of VpnInfo
As a preparation of exposing system API. This patch does some
harmless refactoring, which includes:
  1. Move VpnInfo to android.net
  2. Add nullability annotations
  3. Make members final

Bug: 174123988
Test: TH
Change-Id: I1530bb45d0e84c28c6deac33596bc686058afc0d
2021-01-27 15:03:06 +08:00
Treehugger Robot
526490e269 Merge "Pivot network statistics to use DataInput/Output." am: 5b322f10be am: 84dee682ac am: 62876cef3d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1540224

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I44be7ea64d012f35d312ae3b039b0fd7e37e9d60
2021-01-08 11:49:37 +00:00
Jeff Sharkey
1f69d15939 Pivot network statistics to use DataInput/Output.
Using these generalized interfaces is more flexible, since it enables
us to pivot the implementation being used internally.  In particular,
an upcoming CL will pivot them to use a more efficient alternative.

This is a no-op refactoring.

Bug: 176777285
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: Ibd4717174cf1f136e9d5d80172ecb6e493265306
2021-01-06 18:48:12 -07:00
Serik Beketayev
524f7c0edc Merge "[Mainline] Migrate ProxyInfo" am: 3c3711dffd am: 9b3f669024 am: 51c010aacd
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1506616

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia6f5bf74bf461f762472ea1d88553db3b9719c80
2020-12-25 09:58:40 +00:00
Serik Beketayev
c809f6176b [Mainline] Migrate ProxyInfo
Bug: 173455434
Test: atest FrameworksNetTests
Change-Id: I924aed710b62a0c91b888a9e04ac2c90cdfd88d0
2020-12-23 22:15:51 -08:00
Remi NGUYEN VAN
e3b99f106a Merge "Split NetworkUtils and NetworkUtilsInternal" am: 7adf0e84b8 am: d095d82c85 am: 9c2a2705c7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1513140

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ief9d6a1fae360dbe1c43d5d6bac4dad5850c004b
2020-12-23 02:22:35 +00:00
Remi NGUYEN VAN
7adf0e84b8 Merge "Split NetworkUtils and NetworkUtilsInternal" 2020-12-23 01:19:27 +00:00
Chalard Jean
1c1883133b Move module utils to the module package.
Test: FrameworksWifiTest FrameworksNetTest
Change-Id: If5d1e4a58fb2d6d9544e6d01995dabe445cf1f25
Merged-In: I067eeecd458c34b7f2fbfa439072682661ac750c
2020-12-16 11:44:22 +09:00