Commit Graph

406 Commits

Author SHA1 Message Date
Chiachang Wang
7f46cda1aa Update APIs based on API review feedback
Update the usage in callers side for
  - Rename NetworkAgent#setTeardownDelayMs to
    NetworkAgent#setTeardownDelayMillis
  - Use getters instead of fields in VpnTransportInfo
  - Rename registerDefaultNetworkCallbackAsUid to
    registerDefaultNetworkCallbackForUid in ConnectiivityManager

Bug: 183972850
Bug: 185246410
Fix: 184735863
Test: atest FrameworksNetTests
Test: atest CtsNetTestCasesLatestSdk
Change-Id: Ie542e5ad631388d9948dd27de21bc218b5b5b8f2
Ignore-AOSP-First: Prevernt build break by automerger
2021-04-20 08:57:39 +00:00
Treehugger Robot
c7d350f66a Merge "Move CtsHostsideNetworkTests to group presubmit-large" am: c3bac64a94 am: b0e2855252 am: 45a26a4aa2
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1674227

Change-Id: Ice6daa7d9f5bfb3481fa7579398416cd42c6f3c8
2021-04-19 04:14:41 +00:00
Treehugger Robot
45a26a4aa2 Merge "Move CtsHostsideNetworkTests to group presubmit-large" am: c3bac64a94 am: b0e2855252
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1674227

Change-Id: I2ff565e0a753cd133972f34eff2fb9fc9bd27678
2021-04-19 03:53:58 +00:00
Treehugger Robot
c3bac64a94 Merge "Move CtsHostsideNetworkTests to group presubmit-large" 2021-04-19 03:05:59 +00:00
Treehugger Robot
15bc33f87d Merge "Fix CTS fail to register network callback since lack of permission" am: f7d188c8c9 am: 9da7347603 am: 0dc94a353e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1674237

Change-Id: I7564fa7cf1f8c5d9e73044ccf8411f08f42a3c77
2021-04-15 16:32:49 +00:00
Treehugger Robot
9e7affed67 Merge "Fix CTS fail to register network callback since lack of permission" am: f7d188c8c9 am: 9da7347603
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1674237

Change-Id: I76e3e4536e592f61243e1afa46811a8992996bb5
2021-04-15 16:05:01 +00:00
junyulai
3a7d92513f Fix CTS fail to register network callback since lack of permission
Currently, NetworkCallbackTest gets the capabilities of current
active network to track the network used for the tests. And
construct the request with the capabilities gets from the
network. This causes test fails if the capabilities contain
signal strength, since it requires NETWORK_SIGNAL_STRENGTH_WAKEUP
to be declared.

Thus, this patch null out several fields from capabilities
of the current active network to construct the new request
in order to prevent over-specifying the requirement.

Test: atest CtsHostsideNetworkTests:com.android.cts.net.HostsideNetworkCallbackTests
Bug: 182516128
Change-Id: Ib79b38e63ad2083c29fd71a24b8686b3f6f4e12f
2021-04-14 22:18:39 +08:00
easoncylee
942a988249 Move CtsHostsideNetworkTests to group presubmit-large
The test config takes longer than 15mins to run. Move it to a dedicated
group for running slow presubmit Test Mapping test.

Some more context is in the referenced bug, e.g, b/174495337
The group will work exactly the same as presubmit for now.

Bug: 174654670
Bug: 174495337
Test: none
Change-Id: I7fe1286ed952a6058c56c36f28b4832947edb69f
2021-04-13 22:26:06 +08:00
Chiachang Wang
b014b5fdef Merge "Update the method based on API feedback" am: 0a5d964242 am: 80a70a3679 am: 807d7f2e41
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1671535

Change-Id: I3e3c69bbef95a6a4303a94f69dfa4415bfc1d11c
2021-04-13 13:04:56 +00:00
Chiachang Wang
807d7f2e41 Merge "Update the method based on API feedback" am: 0a5d964242 am: 80a70a3679
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1671535

Change-Id: I13071221d470bd633ef8337889b803a388bcab05
2021-04-13 11:54:13 +00:00
Chiachang Wang
a31a9b6218 Update the method based on API feedback
UserHandle.getUid() is updated to a non-static API based on API
review feedback. Update the usage accordingly.

Bug: 184735865
Test: atest VpnTest
Change-Id: I884f427fae85b2b26973a0315b1ccf3d6f0824c6
2021-04-12 19:35:56 +08:00
Lorenzo Colitti
c7f7f5ada8 Merge changes from topic "peruidcallback-cts" am: 65bba3f6bc am: ab98c8119d am: 89d260c039
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1669609

Change-Id: I0a28ee62a63c4db0494cc51f69ab0b8468401f85
2021-04-09 17:12:08 +00:00
Lorenzo Colitti
a42e82e17f Ensure the HostsideVpnTests passes with keyguard locked. am: fd3b95c1f7 am: 16d841048e am: a8f8011851
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1669608

Change-Id: I707386cd46c2070762d50254629829173be80510
2021-04-09 17:12:08 +00:00
Lorenzo Colitti
02e2380c8a Add CTS tests for registerDefaultNetworkCallbackAsUid. am: ed26ffe92d am: 6cbdc19b2c am: 97384c0121
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1669267

Change-Id: If16f7076f47acec463cb288f5a88c0cb7ee6de03
2021-04-09 17:12:07 +00:00
Lorenzo Colitti
89d260c039 Merge changes from topic "peruidcallback-cts" am: 65bba3f6bc am: ab98c8119d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1669609

Change-Id: Ifbd2f1615f9db9c499edc7d75d2bc3865043e1dc
2021-04-09 16:45:30 +00:00
Lorenzo Colitti
a8f8011851 Ensure the HostsideVpnTests passes with keyguard locked. am: fd3b95c1f7 am: 16d841048e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1669608

Change-Id: I689f8a5e5028069753d377979eee14f97e611681
2021-04-09 16:45:29 +00:00
Lorenzo Colitti
97384c0121 Add CTS tests for registerDefaultNetworkCallbackAsUid. am: ed26ffe92d am: 6cbdc19b2c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1669267

Change-Id: I6983acf968da429a0c036aa7e13a406f27ba7278
2021-04-09 16:45:27 +00:00
Lorenzo Colitti
16d841048e Ensure the HostsideVpnTests passes with keyguard locked. am: fd3b95c1f7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1669608

Change-Id: Idabf4f50d54116d80dc349564bd9ab04cc7fd21a
2021-04-09 15:59:15 +00:00
Lorenzo Colitti
6cbdc19b2c Add CTS tests for registerDefaultNetworkCallbackAsUid. am: ed26ffe92d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1669267

Change-Id: Id8d968130a52d419c65a628fb93e47e5ac48c81e
2021-04-09 15:59:13 +00:00
Lorenzo Colitti
65bba3f6bc Merge changes from topic "peruidcallback-cts"
* changes:
  Cleanups to VPN hostside tests.
  Ensure the HostsideVpnTests passes with keyguard locked.
  Add CTS tests for registerDefaultNetworkCallbackAsUid.
2021-04-09 15:16:47 +00:00
junyulai
2ece9db0de Fix NetworkCallback expecting wrong network am: 2e74377464 am: cfd7518bdc
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1657299

Change-Id: I9f14fae14fcb7ed5b2e63b067e8ea14404b484a2
2021-04-09 09:38:26 +00:00
Remi NGUYEN VAN
0b137cb1aa Add back platform APIs to HostsideNetworkTestsApp
The "platform_apis: true" clause was removed by mistake and is actually
necessary.

Ignore-AOSP-First: original change not in AOSP
Fixes: 184844380
Test: atest HostsideVpnTests
Change-Id: I32bd4a7057a3eb167975fe9f51f1bc0d056c44a0
2021-04-09 04:51:16 +00:00
junyulai
2e74377464 Fix NetworkCallback expecting wrong network
By current wifi design, wifi will report disconnected and
re-connected when changing from non-metered to metered.
However, the cts test app listens for all network, which
will get mobile network as active network when wifi is
changing meteredness. This is not expected. And causes
test failures when DUT has both wifi and mobile connections.

Thus, this change pass request to track currently active
network to the test app and register only for transport
types of currently active network to prevent from getting
unexpected network.

Test: atest CtsHostsideNetworkTests:com.android.cts.net.HostsideNetworkCallbackTests
Bug: 182516128
Merged-In: I2dce6035b13472bbdc2609009d690aac96280033
Change-Id: I2dce6035b13472bbdc2609009d690aac96280033
  (cherry-picked from ag/14029457)
2021-04-09 10:16:18 +08:00
Junyu Lai
3ec79f9919 Merge "Fix NetworkCallback expecting wrong network" into sc-dev 2021-04-09 02:06:50 +00:00
Lorenzo Colitti
08b33ff7fb Cleanups to VPN hostside tests.
Use TestableNetworkCallback instead of a hand-rolled class.
Remove unnecessary runWithShellPermissionIdentity around
unregisterNetworkCallback calls.

Bug: 165835257
Test: test-only change
Change-Id: I4557dfc64136f9c0b4bdaa1248c33b13e96ba3ed
2021-04-08 22:09:10 +09:00
Lorenzo Colitti
fd3b95c1f7 Ensure the HostsideVpnTests passes with keyguard locked.
The test app used in CtsHostsideNetworkTests already dismisses
the keyguard for its own activity, but that doesn't work for the
VPN tests. This is because as soon as the VPN dialog appears, the
test activity is no longer in the foreground and the keyguard
comes back. As a result, the test cannot click on the VPN dialog.

Test: test-only change
Change-Id: I7be1d7fb46a2f9547bc5325d75b5bd5546e6dc18
2021-04-08 21:50:15 +09:00
Lorenzo Colitti
ed26ffe92d Add CTS tests for registerDefaultNetworkCallbackAsUid.
Bug: 165835257
Test: test-only change
Change-Id: Ib3266665735ee587f3f8ae82dadd1e4ca7ce4353
2021-04-08 21:44:30 +09:00
junyulai
bed32ff530 Fix NetworkCallback expecting wrong network
By current wifi design, wifi will report disconnected and
re-connected when changing from non-metered to metered.
However, the cts test app listens for all network, which
will get mobile network as active network when wifi is
changing meteredness. This is not expected. And causes
test failures when DUT has both wifi and mobile connections.

Thus, this change pass request to track currently active
network to the test app and register only for transport
types of currently active network to prevent from getting
unexpected network.

Test: atest CtsHostsideNetworkTests:com.android.cts.net.HostsideNetworkCallbackTests
Bug: 182516128
Ignore-AOSP-First: merge conflict with ag/13615939 which cannot
                   be cherry-picked.
Change-Id: I2dce6035b13472bbdc2609009d690aac96280033
2021-04-08 18:37:26 +08:00
Chiachang Wang
3fec2f13e1 Add framework-connectivity-test-defaults to hostside test
The defaults follow the same pattern as framework-wifi-test-defaults
to allow unit tests to build against hidden API in Connectivity.

Bug: 171540887
Test: m
Change-Id: I1a77278aa458e309d2772dd6ad84f4412b6e9387
Ignore-AOSP-First: Necessary code in internal only now
2021-03-31 10:04:35 +00:00
Sudheer Shanka
83b66e64c7 Check and skip certain operations if they are unsupported. am: b0f50c579b am: 7695f293a7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1658759

Change-Id: I4ececd442b6fab3ad4e6aefd0937226831a7b87b
2021-03-30 23:48:22 +00:00
Sudheer Shanka
b0f50c579b Check and skip certain operations if they are unsupported.
Fixes: 178334463
Test: com.android.cts.net.HostsideRestrictBackgroundNetworkTests#testMeteredNetworkAccess_expeditedJob
Change-Id: Ie68e17063454e7feeffc93b20b1b8fbb276e837f
Merged-In: Ie68e17063454e7feeffc93b20b1b8fbb276e837f
2021-03-30 16:22:43 +00:00
Sudheer Shanka
384fb5cb42 Revert NPMS threshold to BFGS.
Earlier, we changed the threshold to IMP_FG to allow
HPJs to bypass power saving network restrictions but
later we made a change to instead use network capability
for HPJs, so reverting the threshold to BGFS.

Bug: 177641226
Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Ignore-AOSP-First: This depends on an earlier cl which is not in AOSP
Change-Id: I6364ca04254bdbcc3d2081a70babfbd927e0084e
2021-03-26 13:25:58 -07:00
Treehugger Robot
d802f4898f Merge "Shorten the name for the dump file." am: a7542972b1 am: 3935ac08fd
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1648668

Change-Id: Ia73a8459e6bba6f24fc1f40cdb8cfb3177d9f9bb
2021-03-22 22:20:28 +00:00
Treehugger Robot
a7542972b1 Merge "Shorten the name for the dump file." 2021-03-22 21:34:02 +00:00
Sudheer Shanka
81330c83ce Try reconnecting to wifi if it doesn't automatically connect. am: 8bb9eb1912 am: bc0ca639a2
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1648670

Change-Id: Ief4defadb6e4f5b45a7ef3d3022953244eca4788
2021-03-22 21:14:50 +00:00
Sudheer Shanka
8bb9eb1912 Try reconnecting to wifi if it doesn't automatically connect.
When meteredness of wifi changes during test, wifi disconnects.
Try reconnecting if it automatically connects after this.
Also, change the way we update metereness so that we can
use callback mechanism to wait for the state change instead of
polling for it regularly.

Bug: 181686645
Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Merged-In: I31fb127ef333d39fe4697043876c7cef15d525e3
Change-Id: Icc0b37730201aebeab2713c6527a3195f6dcf97d
2021-03-22 17:26:46 +00:00
Sudheer Shanka
8d92650da9 Shorten the name for the dump file.
The file name is getting truncated by tradefed and
we are missing the information to actually idenity
the test. So, instead shorten the filename to preserve
the test name.

Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Ignore-AOSP-First: Submitting internally first to avoid merge conflicts.
Merged-In: Ic0f87b97bb58e115fe81e2d688ce0e633397da42
Change-Id: I6ce3fc662782de82d8cad95414e24204b5f7f130
2021-03-22 17:24:46 +00:00
Sudheer Shanka
0d8452ab81 Merge "Try reconnecting to wifi if it doesn't automatically connect." into sc-dev 2021-03-22 17:12:30 +00:00
Sudheer Shanka
2b5735165a Shorten the name for the dump file.
The file name is getting truncated by tradefed and
we are missing the information to actually idenity
the test. So, instead shorten the filename to preserve
the test name.

Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Ignore-AOSP-First: Submitting internally first to avoid merge conflicts.
Change-Id: Ic0f87b97bb58e115fe81e2d688ce0e633397da42
2021-03-21 12:24:09 +00:00
Sudheer Shanka
aae0d619ae Try reconnecting to wifi if it doesn't automatically connect.
When meteredness of wifi changes during test, wifi disconnects.
Try reconnecting if it automatically connects after this.
Also, change the way we update metereness so that we can
use callback mechanism to wait for the state change instead of
polling for it regularly.

Bug: 181686645
Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Ignore-AOSP-First: Submitting internally first to avoid merge conflicts
Change-Id: I31fb127ef333d39fe4697043876c7cef15d525e3
2021-03-20 04:36:47 -07:00
Sudheer Shanka
f3774740d1 Merge "Skipping printing AssumptionViolatedExceptions." am: b94021ab6e am: 188fa60f90 am: 391af8dda0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1620820

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If3858650d6c90212384c982a8d916e622d16f712
2021-03-10 15:44:15 +00:00
Sudheer Shanka
bc0bb0fe3f Merge "Skipping printing AssumptionViolatedExceptions." am: b94021ab6e am: 188fa60f90
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1620820

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7e5bbaf02285a87b9887301227ebe8f91f7d4dd2
2021-03-10 14:58:12 +00:00
Sudheer Shanka
c19cd34a35 Skipping printing AssumptionViolatedExceptions.
Right now, if there are any failures along with
the cases where we skip the test, we end up printing
failure exception and all AssumptionViolatedExceptions
which makes it hard to find the actual failures.

Bug: 181686645
Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Change-Id: Ib3f1622fc259ad4966789cfafdc54203c2559471
2021-03-05 09:30:34 +00:00
TreeHugger Robot
fc4ffdb4c5 Merge "Mark the test app as debuggable." into sc-dev 2021-03-04 08:22:33 +00:00
Sudheer Shanka
a723fbd612 Mark the test app as debuggable.
Accessing @TestApis is only allowed for
debuggable APKs on release builds.

Fixes: 181594072
Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Ignore-AOSP-First: Related CL http://ag/13615939 is not in AOSP yet.
Change-Id: I7777d70e3dc4217e7eb931060feb658d8943962a
2021-03-04 05:25:30 +00:00
Sudheer Shanka
9326a98dd9 Wait for the finish-component broadcasts to be handled.
Bug: 180533352
Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Ignore-AOSP-First: Expedited jobs are not available in AOSP
Change-Id: I564c15c2fd6caba61029f2b282e7a3c3afeca120
2021-02-28 19:01:31 -08:00
Junyu Lai
7b0fc6f309 Merge "Fix CTS test failed on R device" am: 75d28bee27 am: 3ec8882370 am: 0937250278
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1602480

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie091b95fd2dc27f2cd03aa45e316fc5f8af0188b
2021-02-26 11:13:44 +00:00
Junyu Lai
0937250278 Merge "Fix CTS test failed on R device" am: 75d28bee27 am: 3ec8882370
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1602480

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I9003eaba1c2548349904c5281cfaf0089320c56a
2021-02-26 10:01:40 +00:00
Junyu Lai
75d28bee27 Merge "Fix CTS test failed on R device" 2021-02-26 07:17:47 +00:00
Lorenzo Colitti
264d8e24bd Revert "Update tests to use Doze DeviceConfig flags."
This change went into internal after R branched, and did not
go to AOSP. Revert it in mainline-prod in order to ensure that
CtsHostsideNetworkTests builds.

These tests are developed in internal, not AOSP, so do not need
to automerge to mainline-prod.

Bug: 167645754
Test: treehugger
Ignore-AOSP-First: needed to sync mainline-prod with AOSP
Merged-In: Ib0ac49609e444a53a6fee4575f5078e15f364eef
Change-Id: I2b7d9855b81be5ef968a3de72bf9f7e7225075e1
2021-02-26 00:43:57 +09:00