Commit graph android_packages_modules_Co.../framework-t/src/android
Message SHA1
Return sorted NetworkStatsHistory
NetworkStatsHistory internally assumes that bucketStart is
sorted at all times. However, in the fields, we've found there
are some buckets of NetworkStatsHistory do not preserve the
order of timestamp, which is caught by the IAE when addEntry
is called.

In order to provide backward compatibility, return sorted items
instead of throwing IAE when adding entry into
NetworkStatsHistory instance.

Ignore-AOSP-First: Base change not in AOSP, will cherry-pick
                   immediately after
Test: atest android.net.netstats.NetworkStatsHistoryTest#testBuilder
Bug: 233825704
Change-Id: If3187384bd1e90770ca5873b8ec73e852fff543d

Junyu Lai   commited 2022-05-26 22:04:43 +08:00
25c6d60f8a
Don't clobber existing history entries.
Currently, adding a history to a NetworkStatsCollection.Builder
will overwrite any history that was previously passed in with the
same key. This breaks the importer (which is the primary/only
caller of this code), because the importer re-uses the same
NetworkStatsCollection object to import multiple files.

Instead, simply add any passed-in entries after the ones that
were already there. Require the caller to pass in entries in
order, because NetworkStatsHistory internally assumes that
entris are always sorted.

Ignore-AOSP-First: in a topic with internal-only changes
Bug: 230289468
Test: manually verified this unbreaks the importer
Change-Id: Ic8647ff28fca78d579d5f759f96a864877f8158b

Lorenzo Colitti   authored and   Junyu Lai   commited 2022-05-18 23:51:03 +08:00
b36e57a004
Ensure NetworkStats migrated snapshot is identical
Read migration snapshot both from the platform API and the legacy
method, and Log.wtf if they are different. Use the legacy method data if
they are.

This ensures that using the migration API is a no-op, and that errors
are reported (through Log.wtf) if it would not have been if used as-is.

Ignore-AOSP-First: in a topic with internal-only changes
Test: NetworkStatsServiceTest
Bug: 230289468
Change-Id: I857ad18183d63d1aa16e89f89eb24009648720a2

Remi NGUYEN VAN   authored and   Junyu Lai   commited 2022-05-18 23:51:03 +08:00
3776d862e2
[MS81] Support remove history before cutoff timestamp
This is needed to ensure corrupted data can be clean up if
the data migration process dones't go well.

Test: NetworkStatsCollectionTest
Bug: 197717846
Change-Id: Ic76ad6f3e96f03791b48988fb2622c9c647ffc7c
(cherry picked from commit 306a00316c)
Merged-In: Ic76ad6f3e96f03791b48988fb2622c9c647ffc7c

Junyu Lai   authored and   Cherrypicker Worker   commited 2022-05-16 05:53:02 +00:00
108d20f84a
Unicast state of existing ethernet interfaces when registering new Ethernet Listener.
When adding a listener via the addInterfaceStateListener API, the
expectation is that ethernet service calls that listener immediately
with a list of all interfaces and their respective state. However,
this doesn't work as expectation due to the EthernetManager stores
all registered listeners within one global service listener class,
the new registered listener will be invoked until the state of any
interface has changed.

Instead of storing all registered listeners within one global service
listener class, associate each new registered listener to an instance
of IEthernetServiceListener, and pass it to the EthernetService, that
will be invoked when iterating the state of all existing interfaces.

In order to avoid the scanning of all registered listeners, that would
be slow if there are lots of registered callbacks, moving the service
listener to the ListenerInfo class, where the service listener can
access the executor and listener passed from the caller naturely,
unnecessary to iterate the whole list.

Bug: 229125889
Test: atest android.net.cts.EthernetManagerTest --iterations
Change-Id: I111eba78d1066794c414ab5fb4a31258ea311413
(cherry picked from commit bb9a49cf72)
Merged-In: I111eba78d1066794c414ab5fb4a31258ea311413

Xiao Ma   authored and   Cherrypicker Worker   commited 2022-04-30 14:42:45 +00:00
b60e77f257
Merge "Fix NullPointerException happens in dumpCheckin" am: 6b7e457988 am: 44a02af11a am: a4d60dd2ad
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2059628

Change-Id: If9933b6aad05abf79e85f9172ba6eb6f8492d648
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Aaron Huang   authored and   Automerger Merge Worker   commited 2022-04-20 06:12:50 +00:00
d79f543df0
Merge "Fix NetworkTemplate generates non-metered carrier template" am: 481b2649f7 am: d3a90fb206 am: e6616d1c7c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2064758

Change-Id: If215ccdeb8b7161939efb5d4bd3d9c7f994450bd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Junyu Lai   authored and   Automerger Merge Worker   commited 2022-04-20 06:08:16 +00:00
57fc24937a
Merge "Fix NullPointerException happens in dumpCheckin"
Aaron Huang   authored and   Gerrit Code Review   commited 2022-04-19 11:43:21 +00:00
6b7e457988
Merge "Fix NetworkTemplate generates non-metered carrier template"
Junyu Lai   authored and   Gerrit Code Review   commited 2022-04-19 10:18:26 +00:00
481b2649f7
Fix NullPointerException happens in dumpCheckin
Currently dumpCheckin passes a null object to create
the contructor of NetworkStatsCollection.Key but the
constructor requires non-null object. Thus, it caused
the NPE in dumpCheckin. To fix this exception, create
an NetworkIdentitySet() object instead of using an
null object.

Bug: 225131008
Bug: 226539404
Test: dumpsys netstats --checkin is fine
      FrameworksNetTests
Change-Id: I7f2dadf0647b3f42e0f667d96291d2ae37e23faf

Aaron Huang   commited 2022-04-19 17:49:30 +08:00
c3a43b4063
Fix NetworkTemplate generates non-metered carrier template
From current design, NetworkPolicyManagerService should only
creates metered carrier/mobile templates. However, if someone
calls the hidden API interface or the template was created
before NetworkTemplate#Builder is published. The caller may
create a non-metered carrier template and persist into the
storage.

This CL elimates this possibility and mark non-metered carrier
template non-persistable, so devices could auto-recover from
this symptom after reboot.

Fix: 222382637
Test: TH
Change-Id: I5265e371b0126ce65c32fb09a6e04223afb3d286

Junyu Lai   commited 2022-04-18 16:41:54 +08:00
74f7c8c907
Make some NetworkStats APIs system-current
Move iterator and NetworkStats.Entry getters to system-current
according to API council feedback. This reverts parts of
ag/17117903.

Test: TH
Fix: 225168182
  (cherry-picked from ag/17397294)
Change-Id: Ia7fdf8d31a96a26b0bf1682f462292b051560477
Merged-In: Ia7fdf8d31a96a26b0bf1682f462292b051560477

junyulai   commited 2022-04-11 18:45:36 +08:00
0f54d64db2
[MS83.1] Make some APIs module-lib instead of system current
Some of the internal classes are not available for priv-apps.
Thus, make them module-lib instead.

This change also adds some nullability annotations for existing
APIs according to go/android-api-guidelines.

Test: m
Test: m frameworks-base-api-system-current-compat
Fix: 217479745
  (cherry-picked from ag/17117903)
Change-Id: I18de46b11df7232ab82b9465856fdde621283156
Merged-In: I18de46b11df7232ab82b9465856fdde621283156
Merged-In: Ief3f2304f11b7940a18b98b8533fbca85ffa4dc1

junyulai   commited 2022-04-11 18:44:20 +08:00
44e61e2140
Merge changes from topic "MDns_AIDL" am: 09475308b7 am: 06e59627bb
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2049246

Change-Id: I16b7ec71fbfee1dd0de84b1f64d5e9fbbd62f4e3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Paul Hu   authored and   Automerger Merge Worker   commited 2022-04-07 03:10:55 +00:00
ac780d3bd0
Merge changes from topic "MDns_AIDL"
* changes:
  Use MDns aidl on NsdService
  Add MDnsManager

Paul Hu   authored and   Gerrit Code Review   commited 2022-04-07 02:06:35 +00:00
09475308b7
Merge changes Iafa8979d,I44eac159,I27ad3298 am: 6097358382 am: ec84e33d10
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2042596

Change-Id: I8f6867128057d092e916515049078c1d68b427a4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Maciej Å»enczykowski   authored and   Automerger Merge Worker   commited 2022-04-06 01:20:45 +00:00
8a43622447
Use MDns aidl on NsdService
- Use MDns aidl to communicate with mdns service and register
  event listener to receive callback.
- Remove all NDC relevant code on NsdService.
- Use MDns aidl on NsdServiceTest.

Bug: 209894875
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I65929dee3838fef753396e86c665abd66b6fec81

paulhu   commited 2022-04-04 15:18:27 +00:00
2b9ed95ae5
Add MDnsManager
- Have MDnsManager to manage mdns native service binder call.
- Register it as a system service for NsdService.
- NsdService will use aidl to communicate with mdns, so add the
  relevant lib to framework-connectivity
- Add jarjar rule for mdns-aidl-interface classes.

Bug: 209894875
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: Ibc8b726c01a15015b450caf94d0afed570117b7f

paulhu   commited 2022-04-04 15:02:17 +00:00
541b72d03b
Address EthernetManager javadoc review comments
Test: TH
Change-Id: Iafa8979d8e96ea4d078b017e56ee61334d33b5f5

Patrick Rohr   commited 2022-04-04 14:59:42 +02:00
50c470e308
Update javadoc to match expectation for UnsupportedOperationException
Test: builds
Change-Id: I44eac15972ed099fc12599a78a71557a7b16d593

Patrick Rohr   commited 2022-04-04 14:59:42 +02:00
0f2cbe92f1
Make some NetworkStats APIs system-current
Move iterator and NetworkStats.Entry getters to system-current
according to API council feedback. This reverts parts of
ag/17117903.

Ignore-AOSP-First: Parent CLs does not exist in aosp yet.
Test: TH
Fix: 225168182
Change-Id: Ia7fdf8d31a96a26b0bf1682f462292b051560477

junyulai   authored and   Junyu Lai   commited 2022-03-30 09:38:11 +00:00
6801690383
Merge "Add getInterfaceList module-lib API in EthernetManager."
Patrick Rohr   authored and   Gerrit Code Review   commited 2022-03-24 06:15:43 +00:00
e38626a4a2
Merge "Fix ethernet enable / disable API"
Patrick Rohr   authored and   Gerrit Code Review   commited 2022-03-24 06:09:28 +00:00
95738f7c18
Add getInterfaceList module-lib API in EthernetManager.
Bug: 171872016
Test: m
Merged-In: Ib0e6c8f67c6ded7d17bb9e0ff49e7ff495c8819d
Change-Id: I94fd147d0f8cf09cb7445fd2b5bc8e4528e8390e

Xiao Ma   commited 2022-03-22 13:59:40 +00:00
1edd4554e5
Add setEthernetEnabled and its listener API
Bug: 171872016
Test: atest EthernetServiceTests

Merged-In: Iefd24d955572589c5bd3ca9a8139ea6e44979e8a
Change-Id: Iefd24d955572589c5bd3ca9a8139ea6e44979e8a

markchien   authored and   Xiao Ma   commited 2022-03-22 13:58:14 +00:00
5912ab6906
Merge "Fix proto invalid write type"
Aaron Huang   authored and   Gerrit Code Review   commited 2022-03-22 12:18:39 +00:00
286f4e2c88
Fix ethernet enable / disable API
The ethernet APIs connectNetwork() / disconnectNetwork() are
inaccurately named. Physical link state cannot be changed by calling an
API. This change renames these functions to enableInterface and
disableInterface, respectively, to better reflect their intention and
behavior.

Test: atest EthernetManagerPermissionTest
Merged-In: I3361ad0e01e761ffd77faf6c55924fa4612ede90
Change-Id: I3361ad0e01e761ffd77faf6c55924fa4612ede90

Patrick Rohr   commited 2022-03-22 12:12:48 +00:00
3879cf1a78
Merge "Revert^2 "Change Ethernet API to use OutcomeReceiver""
Patrick Rohr   authored and   Gerrit Code Review   commited 2022-03-22 10:00:08 +00:00
4e6570c359
Merge "Add Executors to NSD callbacks" am: 009094b070 am: 34759d1685 am: 801152830c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2027063

Change-Id: Ief40c29dce0484983f95d66d8506a24b35a46b30

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2022-03-22 09:46:03 +00:00
d12566508b
Merge "Add Executors to NSD callbacks"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2022-03-22 08:33:48 +00:00
8d0fa1c2ad
Merge "Add Executors to NSD callbacks"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2022-03-22 08:33:48 +00:00
009094b070
Merge "Add getInterfaceList module-lib API in EthernetManager." into tm-dev
Xiao Ma   authored and   Android (Google) Code Review   commited 2022-03-18 13:00:01 +00:00
3abd1033d2
Merge "Add setEthernetEnabled and its listener API" into tm-dev
Mark Chien   authored and   Android (Google) Code Review   commited 2022-03-18 11:43:52 +00:00
7fd5a98d6a
Add Executors to NSD callbacks
Add Executor variants to all methods with callbacks.

Bug: 218752665
Test: atest NsdManagerTest
Change-Id: I4c31e2d7ae601ea808b1fd64df32d116c6fff97f

Remi NGUYEN VAN   commited 2022-03-18 09:26:11 +00:00
c7aa9e3c62
Add Executors to NSD callbacks
Add Executor variants to all methods with callbacks.

Bug: 218752665
Test: atest NsdManagerTest
Change-Id: I4c31e2d7ae601ea808b1fd64df32d116c6fff97f

Remi NGUYEN VAN   commited 2022-03-18 09:26:11 +00:00
1d36db9653
Add getInterfaceList module-lib API in EthernetManager.
Bug: 171872016
Test: m
Change-Id: Ib0e6c8f67c6ded7d17bb9e0ff49e7ff495c8819d

Xiao Ma   commited 2022-03-18 17:18:54 +09:00
217c99da20
Add setEthernetEnabled and its listener API
Bug: 171872016
Test: atest EthernetServiceTests

Change-Id: Iefd24d955572589c5bd3ca9a8139ea6e44979e8a

markchien   authored and   Xiao Ma   commited 2022-03-18 17:12:56 +09:00
db9e89aa7b
Fix ethernet enable / disable API
The ethernet APIs connectNetwork() / disconnectNetwork() are
inaccurately named. Physical link state cannot be changed by calling an
API. This change renames these functions to enableInterface and
disableInterface, respectively, to better reflect their intention and
behavior.

Test: atest EthernetManagerPermissionTest
Ignore-AOSP-First: CP to make automerger happy.
Change-Id: I3361ad0e01e761ffd77faf6c55924fa4612ede90

Patrick Rohr   authored and   Lorenzo Colitti   commited 2022-03-18 07:24:01 +00:00
dceb895995
Change Ethernet API to use OutcomeReceiver
This change addresses API review feedback. In addition, it changes the
returned result from Network to the interface name. The current API
returning a Network object is racy and cannot be implemented correctly.
Users should instead use the ConnectivityManager#requestNetwork() API to
get hold of the Network for a given interface.

Bug: 220017952
Test: TH
Ignore-AOSP-First: CP to make automerger happy.
Change-Id: I7c46545a47034be409071c2ec007d9e1480c6ed0

Patrick Rohr   authored and   markchien   commited 2022-03-18 12:19:52 +08:00
58b2dffa1c
Revert^2 "Change Ethernet API to use OutcomeReceiver"
369c79bca4

Merged-In: I7c46545a47034be409071c2ec007d9e1480c6ed0
Change-Id: If9b055e0862755f1d33b5ba6e026fd827bc1d0ea

Patrick Rohr   authored and   markchien   commited 2022-03-18 12:06:27 +08:00
d6156a930e
Merge "Revert "Change Ethernet API to use OutcomeReceiver"" am: 8efc170b0b am: 4f24e69879 am: 8ee0c2bbc4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2030086

Change-Id: I063096a6502f8b8536e797ab30b0be09ae7401b8

Quentin Perret   authored and   Automerger Merge Worker   commited 2022-03-17 17:02:48 +00:00
eac786e2ff
Revert "Change Ethernet API to use OutcomeReceiver"
Revert "Change network management listener to outcome receiver"

Revert submission 2028203-ethernet-outcomereceiver

Reason for revert: BuildMonitor investigating b/225169800
Reverted Changes:
I4c204a848:Change Ethernet API to use OutcomeReceiver
I7c46545a4:Change Ethernet API to use OutcomeReceiver
Id8fadfed9:Change network management listener to outcome rece...

Change-Id: I45af594f7233ed89113f4cf7f977092271980672

Quentin Perret   commited 2022-03-17 15:20:53 +00:00
369c79bca4
Revert "Change Ethernet API to use OutcomeReceiver"
Revert "Change network management listener to outcome receiver"

Revert submission 2028203-ethernet-outcomereceiver

Reason for revert: BuildMonitor investigating b/225169800
Reverted Changes:
I4c204a848:Change Ethernet API to use OutcomeReceiver
I7c46545a4:Change Ethernet API to use OutcomeReceiver
Id8fadfed9:Change network management listener to outcome rece...

Change-Id: I45af594f7233ed89113f4cf7f977092271980672

Quentin Perret   commited 2022-03-17 15:20:53 +00:00
7844d41513
Merge "Change Ethernet API to use OutcomeReceiver" am: a7b1911815 am: b12e08bdfe am: 7e9fe04fb9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2028164

Change-Id: I3161e6e7022eaa30e89e3322bcf6298f48753f00

Patrick Rohr   authored and   Automerger Merge Worker   commited 2022-03-17 14:53:24 +00:00
a5a7bd70c7
Merge "Add Nullable IpConfiguration to ethernet update request" am: bc1479af8f am: f95355f826 am: d520904a20
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2025283

Change-Id: Ib2e58c9e451b51ed80136bba585a098bc0ddb45a

Patrick Rohr   authored and   Automerger Merge Worker   commited 2022-03-17 08:13:57 +00:00
8d59ceeb28
Change Ethernet API to use OutcomeReceiver
This change addresses API review feedback. In addition, it changes the
returned result from Network to the interface name. The current API
returning a Network object is racy and cannot be implemented correctly.
Users should instead use the ConnectivityManager#requestNetwork() API to
get hold of the Network for a given interface.

Bug: 220017952
Test: TH
Change-Id: I7c46545a47034be409071c2ec007d9e1480c6ed0

Patrick Rohr   commited 2022-03-17 08:20:45 +01:00
cf01b8a4f7
Change Ethernet API to use OutcomeReceiver
This change addresses API review feedback. In addition, it changes the
returned result from Network to the interface name. The current API
returning a Network object is racy and cannot be implemented correctly.
Users should instead use the ConnectivityManager#requestNetwork() API to
get hold of the Network for a given interface.

Bug: 220017952
Test: TH
Change-Id: I7c46545a47034be409071c2ec007d9e1480c6ed0

Patrick Rohr   commited 2022-03-17 08:20:45 +01:00
77a3a8408b
Merge "[MS83.1] Make some APIs module-lib instead of system current" into tm-dev
Junyu Lai   authored and   Android (Google) Code Review   commited 2022-03-17 01:50:14 +00:00
7a01fb6c68
Add Nullable IpConfiguration to ethernet update request
This is not currently used by anyone, but will allow us to only update
NetworkCapabilities in the future. This could be useful for testing.

Test: atest EthernetServiceTests
Bug: 220017952
Change-Id: I9697399bad2bfe66c6f328064be75f4dfa10af81

Patrick Rohr   commited 2022-03-16 20:28:45 +01:00
746d082279
Add Nullable IpConfiguration to ethernet update request
This is not currently used by anyone, but will allow us to only update
NetworkCapabilities in the future. This could be useful for testing.

Test: atest EthernetServiceTests
Bug: 220017952
Change-Id: I9697399bad2bfe66c6f328064be75f4dfa10af81

Patrick Rohr   commited 2022-03-16 20:28:45 +01:00
7215598852