summaryrefslogtreecommitdiff
path: root/tests/vcn/java/com/android/server/VcnManagementServiceTest.java
AgeCommit message (Collapse)Author
2021-07-16Limit VCNs to one running at a given timeBenedict Wong
This change ensures that there is only ever one VCN running at a given point in time, and that if the device has switched to using a subscription in a different subscription group, the VCN will immediately tear down. This ensures that when on a DSDS device, when the VCN-enabled subscription is not the default/active subscription, the other subscription's network will never be outscored by the VCN, and thus get torn down. Bug: 190761448 Test: atest FrameworksVcnTests Test: Manual testing to ensure common functionality Original-Change: https://android-review.googlesource.com/1767050 Merged-In: I8031fab7502880d38420058451df41f47567c458 Change-Id: I8031fab7502880d38420058451df41f47567c458
2021-06-14Allow MANAGE_TEST_NETWORKS to register and get VCN policies.Cody Kesting
This CL updates VcnManagementService to allow permission MANAGE_TEST_NETWORKS to register/unregister VCN policy listers as well as apply VCN policies. Previously, only permission NETWORK_FACTORY was allowed to perform this operations. Bug: 189125789 Test: atest FrameworksVcnTests CtsVcnTestCases Change-Id: I6ad3a58f4ef87d931917fbd772a810af81b27da1 Merged-In: I6ad3a58f4ef87d931917fbd772a810af81b27da1 (cherry picked from commit f658c7f394adc2af459afd60c8a6dbe7e20c0584)
2021-05-11Specify if a VCN is in 'test-mode' in VcnContext.Cody Kesting
This CL updates VcnContext to include whether the VCN instance it is created for is in test-mode (as specified by the VcnConfig). This also changes the lifetime of VcnContext to be created uniquely for each VCN instance (as opposed to a single VcnContext created in VcnManagementService and used for all VCNs). Bug: 182291467 Test: atest FrameworksVcnTests CtsVcnTestCases Change-Id: I6fc6a266bf67ab2aa64202153c3c109ee98a16ca
2021-05-11Create test-mode for VcnConfig.Cody Kesting
This CL creates a test-mode for VcnConfig so that they will only match with Test Networks. This is necessary for CTS testing so that VCNs can run on test networks and IKE negotiations can be injected over the Test Networks. Bug: 182291467 Test: atest FrameworksVcnTests CtsVcnTestCases Change-Id: I5cc340e5aaa34c5de8efafa52de49185a18d4bd3
2021-05-04Notify policy listeners when VCN subIds change.Cody Kesting
This CL updates VcnManagementService to notify policy listeners when the subIds for any VCN instances change. This is necessary to ensure that NetworkFactories properly update their Networks in the event that a Network comes up under an existing VCN are properly marked as VCN-managed. Bug: 187112989 Test: atest FrameworksVcnTests CtsVcnTestCases Change-Id: Iecab1226119c8fd876131c381647267f18339db2
2021-04-22Merge "[VCN19] Rename get/setSubIds to get/setSubscriptionIds"Treehugger Robot
2021-04-22Merge changes I64b56575,I40553a7bBenedict Wong
* changes: Expose API for retrieval of subscription groups with VCN configured Add support for retrieval of configured VCNs by carrier privilege
2021-04-21Add support for retrieval of configured VCNs by carrier privilegeBenedict Wong
This change adds support for retrieval of a list of subscription groups that have a VCN configured. Bug: 184612525 Test: atest FrameworksVcnTests Change-Id: I40553a7bb45d9b1f948c7d0a791f1b22a422d55c
2021-04-19Remove hidden connectivity method access in FrameworksVcnTestsChiachang Wang
Due to connectivity modularization work, hidden connectivity methods and members are not accessible outside the module. Remove the corresponding usage. The test case in VcnNetworkProviderTest are not able to create NetworkRequests with request id assigned. The loop to create different request is removed. After that, the test does not provide more test coverage than other tests. Thus, Remove the test case directly. Bug: 182859030 Test: atest FrameworksVcnTests Merged-In: I488f62089d1dbe93c232f892885d944bef896df6 Change-Id: I488f62089d1dbe93c232f892885d944bef896df6 (cherry picked from commit 18f3a26efad77c1da290c01e67f38b88ca4156d8)
2021-04-19[VCN19] Rename get/setSubIds to get/setSubscriptionIdsjunyulai
Test: atest FrameworksNetTests FrameworksVcnTests Fix: 185215036 Merged-In: I9d90df5fc13b36d2cdc4920b456dcc87fcd2b3a7 Change-Id: I9d90df5fc13b36d2cdc4920b456dcc87fcd2b3a7 (cherry-picked from ag/14198665)
2021-04-07Remove location-permission check from VcnStatusCallbacks.Cody Kesting
This CL updates VcnManagementService to not require location permissions for receiving VcnStatusCallback invocations. This change is safe to make because these callbacks are not capable of leaking any location-related information. Bug: 180556279 Test: atest FrameworksVcnTests CtsVcnTestCases Change-Id: I38600aeb2489f139b3479b07de77facc2ae838c5
2021-04-05Allow soft-start and opportunistic safe modeBenedict Wong
This change adds support for opportunistic safe mode, where the VCN will continue to provide networks, but not restrict underlying networks. Similarly, this change allows for soft-starting of the VCN, where VCN underlying networks can be selected without restricting them directly. Additionally, this change ensures networks are torn down when VcnGatewayConnections enter safe mode. This change is required due to changes in the lifecycle of the VcnGatwayConnection, where in safe mode they are NOT torn down, but allowed to continue retrying. During these broken-connectivity windows, the VCN network should be torn down to prevent blackholing traffic. Bug: 183174340 Test: atest FrameworksVcnTests Change-Id: I50f2c0e92552281731c843db89e9a9a1ccff5346
2021-04-01Prevent changes to immutable capabilities for carrier wifiBenedict Wong
This change prevents carrier wifi from having changes to the RESTRICTED network capability, which is an immutable capability. Bug: 184101137 Test: atest FrameworksVcnTests Change-Id: I802d36a754d961c9928a2e642e25f1b25b8be12d
2021-04-01Switch to using status codes for VcnBenedict Wong
This change adds status codes, and switches the Vcn class to use these to signal safe mode status. Additionally, this allows a distinction between a VCN that is quitting and one that is simply in safe mode, providing potential for an opportunistic safe mode where the VCN will continue to attempt to serve NetworkRequests while not restricting underlying networks. Bug: 183174340 Bug: 181789060 Test: atest FrameworksVcnTests Change-Id: I9f2b2d0d8d7b3ade19ca5adcd48cc920171bf8c3
2021-03-30Switch to using list of subIds for policy generationBenedict Wong
Bug: 183174340 Test: atest FrameworksVcnTests Change-Id: I2d30b75c282cf619d81b0f6dc06638566af61a33
2021-03-23Trigger re-evaluation of privileged apps upon app install/uninstallBenedict Wong
This change registers listeners for package installs and uninstalls, ensuring that changes to app install statuses are reflected in the VCN Bug: 183465258 Test: atest FrameworksVcnTests Change-Id: I8d2afd351208cac12392bf945439845cc521b7ec
2021-03-23Check carrier privilege permissions with package nameBenedict Wong
This change ensures that carrier privileges for the right packages are always checked. Bug: 183465199 Test: atest FrameworksVcnTests Change-Id: If46c660e54870529868a7b4b1e271c9009b81d45
2021-03-19TransportInfo: Add a generic redaction mechanismRoshan Pius
This replaces the existing mechanism for redacting location sensitive fields with a more extensible mechanism. Currently supported redactions are for the following permissions: i. ACCESS_FINE_LOCATION ii. LOCAL_MAC_ADDRESS iii. NETWORK_SETTINGS Also, removed WifiInfo from ConnectivityServiceTest to reduce cross dependencies on wifi code. Bug: 156867433 Bug: 162602799 Test: atest android.net Test: atest com.android.server Change-Id: I2bb980c624667a55c1383f13ab71b9b97ed6eeab
2021-03-17Merge "Move LocationPermissionChecker to libs/net"Remi NGUYEN VAN
2021-03-11Update Policy Listener API naming.Cody Kesting
This CL changes the policy listener API to be VcnNetworkPolicyChangeListener (it was previously VcnNetworkPolicyListener) per API Council guidance. This CL also requires permission NETWORK_FACTORY for removing registered policy listeners. Bug: 181562364 Test: atest FrameworksVcnTests Change-Id: I026eaefa62d8f64b9180fc182a7cf0605d83bf97 Merged-In: I026eaefa62d8f64b9180fc182a7cf0605d83bf97 (cherry picked from commit a96ec13821b9888b4a1b8232e808b74b5449d2c8)
2021-03-09Move LocationPermissionChecker to libs/netRemi NGUYEN VAN
LocationPermissionChecker was written to be used by multiple connectivity modules, so it belongs in the frameworks/libs/net library. The file is moved as-is with minor modifications in the test to avoid usage of the privileged ActivityManager.getCurrentUser API. Bug: 181837977 Test: atest NetworkStaticLibTests Change-Id: I63bce35ba87c45138b3aaf6244367e982dfec455
2021-03-08Notify VcnStatusCallbacks for VCN start/stop.Cody Kesting
This CL updates VcnManagementService to notify VcnStatusCallbacks when a VCN is started or stopped. VcnStatusCallbacks will also be notified for config changes that cause a VCN to exit Safe Mode. Bug: 180659281 Test: atest FrameworksVcnTests Change-Id: I4168c868185880621333855dfcb51e46cb662741
2021-03-03Call VcnStatusCallback#onVcnStatusChanged on register.Cody Kesting
This CL updates VcnMangementService to notify VcnStatusCallbacks on registration with the current status of the VCN for the specified subscription group. Bug: 180659281 Test: atest FrameworksVcnTests Change-Id: Id2c74e855fa12d21d292ee94a72ad047f2d56aca
2021-02-22Notify VcnStatusCallback#onVcnStatusChanged for Safe Mode.Cody Kesting
This CL updates VcnManagementService to notify callbacks when VCNs enter Safe Mode via #onVcnStatusChanged. Callbacks were previously notified via #onEnteredSafeMode - however, VcnStatusCallbacks were changed to provide more status information by defining onVcnStatusChanged(int) per API Council feedback. Bug: 1597023 Test: atest FrameworksVcnTests Change-Id: I34ef76ec29f4369390449b70b37bc3cf99c09c77
2021-02-17Implement VCN error callback use.Cody Kesting
This CL updates VcnGatewayConnection to notify VcnManagementService (through Vcn) when errors occur with a gateway. VcnManagementService then notifies registered, permissioned VcnStatusCallbacks via Bug: 163433613 Test: atest FrameworksVcnTests Change-Id: I3be3cac4b591b19a0b0075767fde0ba2eb6e12a2
2021-02-16Notify status callbacks when a VCN enters Safemode.Cody Kesting
This CL updates VcnManagementService to notify VcnStatusCallbacks when the VCN for their specified subscription group enters Safemode. In order to be notified, the registering app must also have permissions for the specified permission. Bug: 163433613 Test: atest FrameworksVcnTests Change-Id: I3242ad0ee1dc406aef56253f884c2544a994869e
2021-02-16Define VcnStatusCallback register/unregister.Cody Kesting
This CL defines VcnStatusCallbacks, which are callbacks used to register for status updates to a specific subscription group. These Callbacks may be registered with VcnManager at any time, but will only be invoked for the specifies subscription group and only if the registering app has carrier privileges for that subscription. Bug: 163433613 Test: atest FrameworksVcnTests Change-Id: Iefd284ae2d09676d195e2a12bf660be3596da59b
2021-02-09Restrict Carrier Wifi while VCN is configured & privilegedBenedict Wong
This change removes the NOT_RESTRICTED capability for Carrier Wifi. This is done even if a VCN is in safe mode, but will ONLY be performed if the VCN is provisioned, and has the appropriate carrier privileges to run. This change also fixes a test bug where the NOT_VCN_MANAGED capability was not present in the query to getUnderlyingNetworkPolicy(), and therefore was incorrectly passing. Bug: 163432273 Test: atest FrameworksVcnTests Change-Id: Iecb827b5341bdeb93ef8692c1d62f0eaf9d416ba
2021-02-04Support Safemode for VCNs.Cody Kesting
This CL updates VcnManagementService to support Safemode for VCN instances. Specifically, VcnGatewayConnections will notify their Vcn instance when they enter Safemode. Vcn instances will in-turn notify VcnManagementService, which notifies all registered UnderlyingNetworkPolicyListeners to update their policies. Bug: 178140973 Test: atest FrameworksVcnTests Change-Id: I3336c150e9406b3eb2330d2e86cae2ed835730bb
2021-02-03Fix test method naming in VcnManagementServiceTest.Cody Kesting
Bug: 175914059 Test: atest FrameworksVcnTests Change-Id: I03be15d63adfccc357000ee670e373d0359a3c06
2021-02-03Notify PolicyListeners to refresh their policy on VCN changes.Cody Kesting
This CL updates VcnManagementService to notify all registered VcnUnderlyingNetworkPolicyListeners to refresh their UnderlyingNetworkPolicy when any VCN is added or removed. Bug: 175914059 Test: atest FrameworksVcnTests Change-Id: Ie87f4aa3401c6c4ba9f932130a1d475e35f59d4e
2021-02-03Unit test TelephonySubscriptionSnapshot changes for VCNs.Cody Kesting
This CL adds unit testing for TelephonySubscriptionSnapshot updates in UnderlyingNetworkTracker, Vcn, and VcnManagementService. Bug: 177364490 Test: atest FrameworksVcnTests Change-Id: I244744194a1360c7c7dee062a302e04f9b5efc32
2021-02-03Notify UnderlyingNetworkTracker for Subscription changes.Cody Kesting
This CL updates VcnManagementService to notify active VCNs when it is notified of subscription changes by TelephonySubscriptionTracker. These subscription changes are passed down to each VCN's UnderlyingNetworkTracker, which determines whether it needs to register or unregister bringup NetworkRequests based on subIds within that VCN's Subscription Group. Bug: 177364490 Test: atest FrameworksVcnTests Change-Id: I15bc9aaf3d5f97046d0ce9fcf1e12c9b1e0e1446
2021-02-01Implement Network policy in VcnManagementService.Cody Kesting
This CL implements #getUnderlyingNetworkPolicy() for VcnManagementService. Specifically, it takes the provided NetworkCapabilities and checks for a corresponding VCN. If one exists, a VcnUnderlyingNetworkPolicy will be returned with a copy of the original NetworkCapabilities without the capability NOT_VCN_MANAGED and with the unwanted capability NOT_VCN_MANAGED. Any NetworkCapabilities without a corresponding VCN will be returned a VcnUnderlyingNetworkPolicy with the original NetworkCapabilities intact. Bug: 175914059 Test: atest FrameworksVcnTests Change-Id: Icdffc4f586f58a0e5b6290d5c6449e2bbed5cab0
2021-01-28Allow system components to request underlying network policies.Cody Kesting
This CL updates VcnManager to allow system components with permission NETWORK_FACTORY to request the current VcnUnderlingNetworkPolicy for a specific Network's NetworkCapabilities and LinkProperties. Bug: 175900686 Test: atest FrameworksVcnTests Change-Id: I16416e619bdb03630582f5660260b0090730e9eb
2021-01-25Merge "Implement Disconnected state"Benedict Wong
2021-01-20Implement Disconnected stateBenedict Wong
This change implements the signal handling for the Disconnected state. Bug: 165827287 Test: atest FrameworksVcnTests Change-Id: I4853b0801b82fddc4ef9e9c6e6a659f9b81e2ac3
2021-01-19Implement Policy Listener add/remove in VcnService.Cody Kesting
This CL updates VcnManagementService to implement VcnUnderlyingNetworkPolicyListener add and remove operations. It also adds functionality to remove any listeners if the registering app dies without unregistering. Bug: 175739863 Test: atest FrameworksVcnTests Change-Id: I9db2729d404f232b84577d2d90909b9152d53b5a
2021-01-07Pull VcnNetworkProvider out into a separate classBenedict Wong
This change makes the VcnNetworkProvider a separate class, and caches all NetworkRequest(s) to ensure that VcnTunnel(s) satisfy all requests that they can accept. Bug: 163431879 Test: atest FrameworksVcnTests Change-Id: I3b7695628d0153a33f7e7f40d839df1463d58b07
2021-01-07Verify carrier privileges for VCN-providing packagesBenedict Wong
This change adds and verifies packages in the VcnManagmentService, ensuring that carrier privilege gain/loss correctly starts/tears down VCN instances. Bug: 163431877 Test: atest FrameworksNetTests Change-Id: I63203188c57fdde1cfc58aaf1108aa3e70eb4a50
2021-01-07Add TelephonySubscriptionTracker to VcnMgmtSvcBenedict Wong
This changes adds the TelephonySubscriptionTracker to VcnManagementService, ensuring that VCN Instances are only ever started once a relevant Subscription has been loaded in Telephony Bug: 163430955 Test: New VcnManagementService tests added, passing Change-Id: Ia9396d66b41fadc0a5ed7aa66306e6223a2d29b8
2021-01-07Add basic VcnMgmtSvc --> Vcn signals (startup, teardown, NetworkReq)Benedict Wong
This change adds the relevant calls to ensure that the VcnMgmtSvc starts, updates and stops a Vcn instance when configs are set/removed Additionally, this change ensures that upon new network requests, the Vcn instance is notified. Bug: 163432852 Test: atest FrameworksVcnTests Change-Id: Ifec34fad8282a3d64b540d24f643f546463f4379
2020-12-17Add persistence for VcnConfig objects by Subscription GroupBenedict Wong
This commit adds the ability for the VcnManagementService to track/store VCN profiles by subscription groups, and saving/loading to/from disk. Bug: 163611304 Test: New tests added, passing Change-Id: Ifabf5e2be090d529cd29e2c68d55ece4858b2aad
2020-12-16Implement basic VcnConfig and VcnGatewayConnectionConfigBenedict Wong
This change adds some of the basic fields in VcnConfig and VcnGatewayConnectionConfig, plus adds a persistability layer to ensure all VcnConfig(s) are disk-stable. Bug: 163602123 Bug: 163594033 Test: New tests added, passing Change-Id: I2e632532809e7768b284be376f2b0a77f634fef5
2020-12-08Enforce carrier privileges when setting/clearing VCN configsBenedict Wong
This change ensures that only carrier-privileged apps can modify VCN configs. Since carrier privilege is checked per-subId, we iterate through all subIds in the group, and check if any of them grant the calling app carrier privileges. Bug: 165670724 Test: New tests added, passing. Change-Id: Iac032136d9c1975e6b95a2d2ad9b811ce45c9a53
2020-11-16Add NetworkProvider to VcnManagementServiceBenedict Wong
This change adds a skeleton VcnNetworkProvider, and registers it with ConnectivityService upon system startup. Bug: 163431879 Test: FrameworksVcnTests passing Change-Id: I7720db1cea805cbdca052a2e37cb2d754189ea05