Commit Graph

42377 Commits

Author SHA1 Message Date
Hungming Chen
40f4665fad [automerger skipped] Dump the unused IPv4 BPF rule age correctly am: 59f422694a -s ours
am skip reason: Merged-In Ie771becd2f72518cf02a86e5ae228315785752a5 with SHA-1 e7dff2f955 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15164992

Change-Id: I0e030089ec2fc5fe2ff70615af98d64ebf1f99cc
2021-07-01 04:45:41 +00:00
Chiachang Wang
9d172cc795 [automerger skipped] Trigger the network score update after setting test allow bad wifi am: 6339ec22ad -s ours
am skip reason: Merged-In Ie0f777d0030b66dd306332496192c74f6c183284 with SHA-1 f1e09ef031 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15164990

Change-Id: Ibeb036ebb9672e753721da2b064158d66dd4233d
2021-07-01 03:26:31 +00:00
Hungming Chen
59f422694a Dump the unused IPv4 BPF rule age correctly
Print a dash for the unused "lastUsed" of the rule.

The age should not equal the bootime if the rule has never been
updated the "lastUsed" field.

Format:
[inDstMac] iif(iface) src -> nat -> dst [outDstMac] age
[00:00:00:00:00:00] 14(rmnet0) 140.112.8.116:443
-> 30(30) 10.170.56.233:43720
-> 192.168.45.236:43720 [be:34:40:28:33:5f] -

Bug: 190783768
Test: dumpsys tethering
Original-Change: https://android-review.googlesource.com/1751022
Merged-In: Ie771becd2f72518cf02a86e5ae228315785752a5
Change-Id: Ie771becd2f72518cf02a86e5ae228315785752a5
2021-07-01 03:23:01 +00:00
Lucas Lin
b278aac2a3 Merge "Simplify the return condition in stop()" am: 584ab08627 am: c955dcc84d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1729690

Change-Id: I2dcd10df1d339a1a24e31632b399f960f749d44a
2021-07-01 02:13:04 +00:00
Lucas Lin
c955dcc84d Merge "Simplify the return condition in stop()" am: 584ab08627
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1729690

Change-Id: Ie0701cb9c61afde51b04c902bd9f13f1e0559841
2021-07-01 01:55:56 +00:00
Lucas Lin
584ab08627 Merge "Simplify the return condition in stop()" 2021-07-01 01:46:59 +00:00
Remi NGUYEN VAN
4a980eebf5 Merge "Apply jarjar rules on coverage tests" am: d590b30f72 am: 073f6e299a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749680

Change-Id: I80209723541bdfb8f5b08cd5e9cf0e76afa3593e
2021-07-01 01:08:32 +00:00
Remi NGUYEN VAN
073f6e299a Merge "Apply jarjar rules on coverage tests" am: d590b30f72
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749680

Change-Id: Ibd6a0d86d9e70e2cdc83ac0de2f3507902bf8299
2021-07-01 00:52:11 +00:00
Chiachang Wang
6339ec22ad Trigger the network score update after setting test allow bad wifi
Avoid bad wifi design has to apply in both wifi and cellular
networks. Cellular network should contain POLICY_YIELD_TO_BAD_WIFI
policy, then system default network could stay in the wifi after
wifi becomes unvalidated.

The testing API only update the value but not trigger the avoid
bad wifi callback to update the score in the existing cellular
network. Thus, if the cellular network is connected before
setting the overridden value, the yield to bad wifi policy will
not updated to cellular network. The system default network will
still switch from unvalidated wifi network to cellular network
even wifi network is connected with the avoid bad wifi policy.

Update to trigger a reevaluation to update the score in each
NetworkAgent in the ConnectivityService.

Bug: 192149168
Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest\
      #testSetAvoidUnvalidated --rerun-until-failure 100
Original-Change: https://android-review.googlesource.com/1751588
Merged-In: Ie0f777d0030b66dd306332496192c74f6c183284
Change-Id: Ie0f777d0030b66dd306332496192c74f6c183284
2021-07-01 00:32:08 +00:00
Remi NGUYEN VAN
d590b30f72 Merge "Apply jarjar rules on coverage tests" 2021-06-30 23:53:57 +00:00
Treehugger Robot
8711b078ff Merge "Fix network callback with the same PendingIntent does not release" am: 6d908a513a am: e6517c060f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1727470

Change-Id: I2a27b0f3d3204fcfc3cb2d787fa5c998d45e54de
2021-06-30 22:12:04 +00:00
Treehugger Robot
e6517c060f Merge "Fix network callback with the same PendingIntent does not release" am: 6d908a513a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1727470

Change-Id: I37b87ca482c8b77444bcb0d0ba575be61ab7d3ad
2021-06-30 21:59:16 +00:00
Treehugger Robot
6d908a513a Merge "Fix network callback with the same PendingIntent does not release" 2021-06-30 21:43:15 +00:00
lucaslin
40d931c474 Simplify the return condition in stop()
Previously, the return condition in stop() will check if the state
is STOPPING and the reason is ERROR_INVALID_NETWORK. The condition
is too restricted so that if another event is happened after binder
died, the exception will be thrown and crash the system.
Since calling stop() twice doesn't make sense, so relax the condition
of return when the state is STOPPING.

Bug: 182586681
Test: atest FrameworksNetTests
Change-Id: I2454c1c080d8954dd3785d4ac6e96fc4131fdb47
2021-07-01 02:29:53 +08:00
Chiachang Wang
4143a2f97b Merge "Trigger the network score update after setting test allow bad wifi" am: 4bb141787b am: 91693952de
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1751588

Change-Id: I3e544434c4ffeda7eab183f64f9c212ae162588f
2021-06-30 14:33:06 +00:00
Chiachang Wang
91693952de Merge "Trigger the network score update after setting test allow bad wifi" am: 4bb141787b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1751588

Change-Id: Ic9949766b84c1003f7f542aa9ca78d5535d01577
2021-06-30 14:24:32 +00:00
Chiachang Wang
4bb141787b Merge "Trigger the network score update after setting test allow bad wifi" 2021-06-30 14:14:03 +00:00
WeiZhang
1cc3f17413 Fix network callback with the same PendingIntent does not release
Currently, ConnectivityService uses EVENT_REGISTER_NETWORK_LISTENER
to dispatch registering network callback with pending intent, this
is wrong since the code flow will not check if the pending intent
is duplicated. Thus, the registration will be duplicated if the
caller uses the same pending intent and register multiple times.

This change fixes the logic by using
EVENT_REGISTER_NETWORK_LISTENER_WITH_INTENT instead of
EVENT_REGISTER_NETWORK_LISTENER when dispatching register network
callback with pending intent.

Test: atest android.net.cts.ConnectivityManagerTest#testRegisterNetworkRequest_identicalPendingIntents
Test: atest android.net.cts.ConnectivityManagerTest#testRegisterNetworkCallback_identicalPendingIntents
Test: atest ConnectivityServiceTest#testNetworkCallbackMaximum
Test: 1. Use test app to file callback with same PendingIntent
       2. Check dumpsys output
Bug: 189868426
Change-Id: I38bdea3a026a78a6dc34b5200d43a75b3cd1ac0c
2021-06-30 12:05:43 +00:00
Paul Hu
cee2b58834 [automerger skipped] Merge "Use appId instead of uid" into sc-dev am: eefacbcb5c -s ours
am skip reason: Merged-In Ib8ea2185d8056bddb2ca5a8006f83afb3cffc9f4 with SHA-1 1e5d742596 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15123902

Change-Id: Ie9e95f2b7d166033b0ee2189ad63a380604c2d59
2021-06-30 09:50:42 +00:00
Paul Hu
eefacbcb5c Merge "Use appId instead of uid" into sc-dev 2021-06-30 09:38:26 +00:00
Paul Duffin
1ee498841d [automerger skipped] Merge "Enable tethering to perform its own hidden API processing" am: d8a8041ffc am: dd5ece3d19 -s ours
am skip reason: Merged-In I4d9621325c7fcea5043cbca4c577ba2ac6125c0c with SHA-1 b28cb44e4b is already in history

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1748800

Change-Id: Ibca4e880a1455257517525d26277247b2c493acb
2021-06-30 08:45:25 +00:00
Chiachang Wang
f1e09ef031 Trigger the network score update after setting test allow bad wifi
Avoid bad wifi design has to apply in both wifi and cellular
networks. Cellular network should contain POLICY_YIELD_TO_BAD_WIFI
policy, then system default network could stay in the wifi after
wifi becomes unvalidated.

The testing API only update the value but not trigger the avoid
bad wifi callback to update the score in the existing cellular
network. Thus, if the cellular network is connected before
setting the overridden value, the yield to bad wifi policy will
not updated to cellular network. The system default network will
still switch from unvalidated wifi network to cellular network
even wifi network is connected with the avoid bad wifi policy.

Update to trigger a reevaluation to update the score in each
NetworkAgent in the ConnectivityService.

Bug: 192149168
Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest\
      #testSetAvoidUnvalidated --rerun-until-failure 100
Change-Id: Ie0f777d0030b66dd306332496192c74f6c183284
2021-06-30 16:41:59 +08:00
Paul Duffin
dd5ece3d19 Merge "Enable tethering to perform its own hidden API processing" am: d8a8041ffc
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1748800

Change-Id: I7885f619b84bc9a998697f2b68e8059c59476494
2021-06-30 08:36:42 +00:00
Paul Duffin
d8a8041ffc Merge "Enable tethering to perform its own hidden API processing" 2021-06-30 08:19:02 +00:00
Remi NGUYEN VAN
aec0e35349 Merge "Re-skip connectivity unit tests before S" am: a9230c1bf7 am: 1f3d8dc5e8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749684

Change-Id: I5ce3c5b7dc333c802890831daf8289985c61301d
2021-06-30 08:18:57 +00:00
Remi NGUYEN VAN
1f3d8dc5e8 Merge "Re-skip connectivity unit tests before S" am: a9230c1bf7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749684

Change-Id: I4e3f42424fd76fdfae2c87af91bc4eaaf5c296d8
2021-06-30 08:02:50 +00:00
Remi NGUYEN VAN
a9230c1bf7 Merge "Re-skip connectivity unit tests before S" 2021-06-30 07:43:08 +00:00
Remi NGUYEN VAN
8ea5ee6d33 Apply jarjar rules on coverage tests
Apply their respective jarjar rules on tethering and general
connectivity tests, then merge both into the coverage tests suite.
This is necessary to ensure that classes covered by tests have names
matching classes used in code.

Also fix IpConnectivityLogTest to use the module utility instead of the
hidden BitUtils, as the test would fail after internal utils are
jarjared.

Bug: 187935317
Test: atest ConnectivityCoverageTests TetheringCoverageTests
Change-Id: Ib95b58dab93f7adebc445b662a6d15db1ce0e7c2
2021-06-30 16:00:26 +09:00
Remi NGUYEN VAN
1032563615 [automerger skipped] Merge "Add option to make sign-in notification ongoing" am: ea395bf6a0 am: 4154629272 -s ours
am skip reason: Merged-In I3c2563d4ae4e3715d0c6270344ba8f7ef067872f with SHA-1 2afd0986d3 is already in history

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1751960

Change-Id: I8d70b9c29b518e60e7d9753393f66a7eac6eb91c
2021-06-30 05:42:22 +00:00
Remi NGUYEN VAN
4154629272 Merge "Add option to make sign-in notification ongoing" am: ea395bf6a0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1751960

Change-Id: I61e852037ee8f38ebe89eab21e82df9a7b7c5810
2021-06-30 05:27:40 +00:00
Remi NGUYEN VAN
ea395bf6a0 Merge "Add option to make sign-in notification ongoing" 2021-06-30 05:12:09 +00:00
Remi NGUYEN VAN
154cf1da20 Re-skip connectivity unit tests before S
The tests are packaged together with other tests in a common coverage
suite, so need to be individually annotated so that they are skipped
before S.

They do not need to pass on platforms older than S, because such
platforms will not updated with the code that is tested.

This applies a previous change, this time using DevSdkIgnoreRunner,
as SdkSuppress does not work as expected in branches that have a
codename 2 versions above the SDK version, as is the case in AOSP.

Bug: 187935317
Test: atest ConnectivityCoverageTests on R
      atest FrameworksNetTests on S
Change-Id: I5808d34459a4c19238baf8873afa7cf942828460
2021-06-30 12:00:28 +09:00
Remi NGUYEN VAN
57c0380135 Add option to make sign-in notification ongoing
Add an overlay boolean that allows setting the SIGN_IN notification as
an ongoing notification.

This can be useful to make sure users can always easily find the
notification to sign in to a captive portal, as studies have found that
some users have a tendency to dismiss notifications before reading them.
At the same time the notification shade is generally too crowded, which
is what causes such behaviors in the first place, so this option is not
enabled by default and should generally not be enabled without proper
user studies or metrics.

Bug: 173171709
Test: atest NetworkNotificationManagerTest
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Ic187d2a2b7e49ad152ea2aa35bb784864b97473c
2021-06-30 11:59:11 +09:00
Paul Duffin
f9a0c868c4 Enable tethering to perform its own hidden API processing
Previously, the hidden API encoding of the tethering boot dex jars,
i.e. those dex jars that tethering contributes to the bootclasspath
were done as part of the monolithic hidden API processing. This change
causes the encoding to be done by the tethering's
bootclasspath_fragment.

This change involves the following:
* Addition of the fragments property to the tethering's
  bootclasspath_fragment module to list all the other
  bootclasspath_fragment modules on which this depends.
* Addition of the additional_stubs property to add stubs for APIs that
  are not provided by another bootclasspath_fragment.

The build automatically checks that the hidden API flags which are
computed by tethering and encoded into its boot dex jars match those
that are generated by the monolithic processing so this is guaranteed
to be safe.

Bug: 179354495
Test: m com.android.tethering
      - ensure that the generated APEX is byte-for-byte identical
        before and after these changes.
      m out/soong/hiddenapi/hiddenapi-flags.csv
      - make sure that they are not changed by this.
(cherry picked from b28cb44e4b)

Merged-In: I4d9621325c7fcea5043cbca4c577ba2ac6125c0c
Change-Id: I4d9621325c7fcea5043cbca4c577ba2ac6125c0c
2021-06-30 00:00:41 +01:00
Hungming Chen
a2a34a90d7 Dump the unused IPv4 BPF rule age correctly am: e7dff2f955 am: e9deba21ad
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1751022

Change-Id: I3704db91381858a88f51972692af78f14e6d2e0c
2021-06-29 16:22:38 +00:00
Hungming Chen
e9deba21ad Dump the unused IPv4 BPF rule age correctly am: e7dff2f955
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1751022

Change-Id: I8370822cd5c96e28b51a54759bced40d556fde84
2021-06-29 16:09:55 +00:00
TreeHugger Robot
1c4e80dfa3 [automerger skipped] Merge "Fix null PendingIntent in network listens" into sc-dev am: 4fd9dfef2d -s ours
am skip reason: Merged-In Id7343a4cc020aba16b7979b16334721c56b2839c with SHA-1 1e238a87e9 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15136918

Change-Id: I8971f72c545af5e2417ec7b23411c38abcbeed47
2021-06-29 13:48:23 +00:00
TreeHugger Robot
4fd9dfef2d Merge "Fix null PendingIntent in network listens" into sc-dev 2021-06-29 13:36:15 +00:00
Treehugger Robot
6da2b28e57 Merge "Revert "Skip connectivity unit tests before S"" am: b0c9e64d33 am: af5ae307f2
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749498

Change-Id: Ibacbb3f4ca829931b723893a1dd84a2d21de914e
2021-06-29 08:57:56 +00:00
Treehugger Robot
af5ae307f2 Merge "Revert "Skip connectivity unit tests before S"" am: b0c9e64d33
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749498

Change-Id: I33d31263acb4447d9ed730a4ec6d67fce77472fc
2021-06-29 08:42:14 +00:00
Victor Chang
f898bfefee [automerger skipped] Merge "Partial cherry-pick to remove IoUtils#deleteContents usage in FrameworksNetTests" into sc-dev am: e4132c8ca0 -s ours
am skip reason: Merged-In I5366e1cc9cd6ddb41f24718246381cc2b1cc1383 with SHA-1 fe20e1317d is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15108481

Change-Id: I166c928f4b71d14bdda3f7f7697883f3bcefb42c
2021-06-29 08:40:54 +00:00
Hungming Chen
e7dff2f955 Dump the unused IPv4 BPF rule age correctly
Print a dash for the unused "lastUsed" of the rule.

The age should not equal the bootime if the rule has never been
updated the "lastUsed" field.

Format:
[inDstMac] iif(iface) src -> nat -> dst [outDstMac] age
[00:00:00:00:00:00] 14(rmnet0) 140.112.8.116:443
-> 30(30) 10.170.56.233:43720
-> 192.168.45.236:43720 [be:34:40:28:33:5f] -

Test: dumpsys tethering
Change-Id: Ie771becd2f72518cf02a86e5ae228315785752a5
2021-06-29 16:21:49 +08:00
Treehugger Robot
b0c9e64d33 Merge "Revert "Skip connectivity unit tests before S"" 2021-06-29 08:14:26 +00:00
Victor Chang
e4132c8ca0 Merge "Partial cherry-pick to remove IoUtils#deleteContents usage in FrameworksNetTests" into sc-dev 2021-06-29 08:12:04 +00:00
Paul Hu
dca7230c1d Use appId instead of uid
Multiple user's ares of mApps are not initialized in startMonitoring(),
so mApps.get(uid) of multi-user's app returns null in onPackageAdded().
As the result, permission of system uid is updated to "Network" and
any system application cannot use dedicated apn like IMS.
Using appId avoids this problem.

Bug: 168932048
Test: atest FrameworksNetTests

Signed-off-by: Sangcheol Lee <goodsc.lee@samsung.com>
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1733212
Merged-In: Ib8ea2185d8056bddb2ca5a8006f83afb3cffc9f4

Change-Id: Ib8ea2185d8056bddb2ca5a8006f83afb3cffc9f4
2021-06-29 16:07:54 +08:00
Remi NGUYEN VAN
4cb6189802 Fix null PendingIntent in network listens
In S ConnectivityService was changed to use getActiveRequest() to fill
EXTRA_NETWORK_REQUEST, but there is no active request in the case of
listens.

When getActiveRequest() is missing, use the first mRequest instead. This
should match previous behavior.

Bug: 191713869
Test: atest android.net.cts.ConnectivityManagerTest
Original-Change: https://android-review.googlesource.com/1748153
Merged-In: Id7343a4cc020aba16b7979b16334721c56b2839c
Change-Id: Id7343a4cc020aba16b7979b16334721c56b2839c
2021-06-29 07:07:28 +00:00
Remi NGUYEN VAN
eceaeb3ea3 [automerger skipped] Merge "Fix flakes in tests running after testIsPrivateDnsBroken" into sc-dev am: 64168015f1 -s ours
am skip reason: Merged-In Id9beba94e0fed85bd26c0509ad61369be794f3c3 with SHA-1 582770ce68 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15135741

Change-Id: Ic7c46d121b83eb531a8870a93f071bb1d0d1fcfb
2021-06-29 06:57:10 +00:00
Paul Duffin
65c5f4205b Merge "Enable tethering to perform its own hidden API processing" into sc-dev am: 4c94d16ced
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15106963

Change-Id: Ia64cc9a69cea5a79861a5245447908f302ab4d24
2021-06-29 06:57:03 +00:00
Remi NGUYEN VAN
64168015f1 Merge "Fix flakes in tests running after testIsPrivateDnsBroken" into sc-dev 2021-06-29 06:51:25 +00:00
Paul Duffin
4c94d16ced Merge "Enable tethering to perform its own hidden API processing" into sc-dev 2021-06-29 06:43:40 +00:00