summaryrefslogtreecommitdiff
path: root/framework-t/src/android
Commit message (Collapse)AuthorAgeFilesLines
* Ensure callbacks are run properly on executorRemi NGUYEN VAN2022-06-031-22/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | NsdManager callbacks were run on a provided executor by capturing the handler message in a lambda, but the message will be recycled immediately after handleMessage returns. This means that any non-inline executor would see bogus callbacks, as they have an empty Message. Fix it by not capturing the Message in the lambda, but capturing its contents instead. This was broken when updating the class to support executors in change ID: I4c31e2d7ae601ea808b1fd64df32d116c6fff97f; before that, callbacks were all run on the NsdManager handler. Also, DelegatingDiscoveryListener is being run on the NsdManager handler thread for notifyAllServicesLost, causing onServiceLost to be run there, but other methods are run on the provided Executor, even though they access maps maintained on the handler thread, like mPerNetworkListeners. Revert DelegatingDiscoveryListener to run on the handler thread as before, and only use the provided executor to execute any app-facing callback instead. Bug: 234419509 Test: atest NsdManagerTest Change-Id: Icca64511b02dad2f725a2849d2a1e871135b3286 (cherry picked from commit 9133888e0c25208f7907cf4353bd4eaedc8ef9cd) Merged-In: Icca64511b02dad2f725a2849d2a1e871135b3286
* Hold wifi and mobile interfaces since boot in NetworkStatsServiceAaron Huang2022-06-031-0/+11
| | | | | | | | | | | | | | | In current design, the interface will be removed from the list if the network disconnected which will cause getUidStatsForTransport() returns unexpected snapshot to caller since the list is empty. This change also remove interface name from all entries before the method returns the result. Ignore-AOSP-First: non-AOSP CL is included in the same topic Bug: 231514741 Test: FrameworksNetTests manual test Change-Id: Ie60829a65d0d9b5b63ad353695a820c0586e3665
* Fix service resolve on tethering downstreamsRemi NGUYEN VAN2022-06-011-2/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | Tethering downstreams do not have NetworkAgents, and although they have a netid of 99, Networks with netId 99 are not usable by apps for most connectivity APIs. Recent refactoring in NsdService adds the Network of a found service into its NsdServiceInfo, and uses that network to resolve the service. In that case the Network has netId 99 and resolving the service fails. Avoid that problem by: - Keeping the Network field null when a service is found on a tethering downstream; this avoids giving apps a confusing and unusable Network with netId 99 - Using the interface index found during discovery to resolve the service, if the app uses the NsdServiceInfo that was obtained from discovery to resolve. If not, all interfaces will be used to resolve, as per legacy APIs. Bug: 233979892 Test: atest NsdServiceTest Also manual test with 2 devices connected via hotspot Change-Id: Idd176153b67ccbd1d4f1b1fd66dafaa2f3a9e27a (cherry picked from commit 1a8ee102d3cc9829b669b09685b17ea92815b671) Merged-In: Idd176153b67ccbd1d4f1b1fd66dafaa2f3a9e27a
* Return sorted NetworkStatsHistoryJunyu Lai2022-05-261-65/+61
| | | | | | | | | | | | | | | | | | 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
* Don't clobber existing history entries.Lorenzo Colitti2022-05-182-2/+47
| | | | | | | | | | | | | | | | | | 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
* Ensure NetworkStats migrated snapshot is identicalRemi NGUYEN VAN2022-05-181-0/+20
| | | | | | | | | | | | | | 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
* [MS81] Support remove history before cutoff timestampJunyu Lai2022-05-162-6/+28
| | | | | | | | | | | 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 306a00316cac03a0c61f995316c9c5682bec2a19) Merged-In: Ic76ad6f3e96f03791b48988fb2622c9c647ffc7c
* Unicast state of existing ethernet interfaces when registering new Ethernet ↵Xiao Ma2022-04-301-57/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 bb9a49cf72ff83cf969a86d3c51087fa77f08d69) Merged-In: I111eba78d1066794c414ab5fb4a31258ea311413
* Merge "Fix NullPointerException happens in dumpCheckin" am: 6b7e457988 am: ↵Aaron Huang2022-04-202-1/+2
|\ | | | | | | | | | | | | | | | | 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>
| * Merge "Fix NullPointerException happens in dumpCheckin"Aaron Huang2022-04-192-1/+2
| |\
| | * Fix NullPointerException happens in dumpCheckinAaron Huang2022-04-192-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge "Fix NetworkTemplate generates non-metered carrier template" am: ↵Junyu Lai2022-04-201-2/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | Merge "Fix NetworkTemplate generates non-metered carrier template"Junyu Lai2022-04-191-2/+3
| |\ \
| | * | Fix NetworkTemplate generates non-metered carrier templateJunyu Lai2022-04-181-2/+3
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | Make some NetworkStats APIs system-currentjunyulai2022-04-111-25/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | [MS83.1] Make some APIs module-lib instead of system currentjunyulai2022-04-114-45/+130
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge changes from topic "MDns_AIDL" am: 09475308b7 am: 06e59627bbPaul Hu2022-04-074-7/+215
|\| | | | | | | | | | | | | 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>
| * Merge changes from topic "MDns_AIDL"Paul Hu2022-04-074-7/+215
| |\ | | | | | | | | | | | | | | | * changes: Use MDns aidl on NsdService Add MDnsManager
| | * Use MDns aidl on NsdServicepaulhu2022-04-042-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
| | * Add MDnsManagerpaulhu2022-04-042-0/+211
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* | | Merge changes Iafa8979d,I44eac159,I27ad3298 am: 6097358382 am: ec84e33d10Maciej Żenczykowski2022-04-061-10/+9
|\| | | | | | | | | | | | | | | | | | | | 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>
| * | Address EthernetManager javadoc review commentsPatrick Rohr2022-04-041-9/+7
| | | | | | | | | | | | | | | Test: TH Change-Id: Iafa8979d8e96ea4d078b017e56ee61334d33b5f5
| * | Update javadoc to match expectation for UnsupportedOperationExceptionPatrick Rohr2022-04-041-1/+2
| |/ | | | | | | | | Test: builds Change-Id: I44eac15972ed099fc12599a78a71557a7b16d593
| * Merge "Add getInterfaceList module-lib API in EthernetManager."Patrick Rohr2022-03-242-0/+20
| |\
| | * Add getInterfaceList module-lib API in EthernetManager.Xiao Ma2022-03-222-0/+20
| | | | | | | | | | | | | | | | | | | | | Bug: 171872016 Test: m Merged-In: Ib0e6c8f67c6ded7d17bb9e0ff49e7ff495c8819d Change-Id: I94fd147d0f8cf09cb7445fd2b5bc8e4528e8390e
| * | Merge "Fix ethernet enable / disable API"Patrick Rohr2022-03-241-16/+13
| |\ \ | | |/ | |/|
| | * Fix ethernet enable / disable APIPatrick Rohr2022-03-221-16/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | Add setEthernetEnabled and its listener APImarkchien2022-03-223-25/+128
| | | | | | | | | | | | | | | | | | | | | | | | Bug: 171872016 Test: atest EthernetServiceTests Merged-In: Iefd24d955572589c5bd3ca9a8139ea6e44979e8a Change-Id: Iefd24d955572589c5bd3ca9a8139ea6e44979e8a
| * | Merge "Fix proto invalid write type"Aaron Huang2022-03-224-21/+21
| |\ \ | | |/ | |/|
| | * Fix proto invalid write typeAaron Huang2022-03-074-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While dumpProtoLocked is called, InvalidProtocolBufferException occurred because types are mismatched between platform side and module side. netstats.proto was moved into connectivity module, both the platform(incident.proto) and the module uses protoc-gen-javastream to generate the Java classes from it. It should be fine since platform includes the source of the proto, and jarjar the generated classess in the module to avoid conflict with platform. Bug: 218566849 Test: adb shell incident 3001 adb shell dumpsys netstats --proto atest CtsIncidentHostTestCases:IncidentdTest#testIncidentReportDumpAuto Change-Id: I4654350a59dc1ca1a925785ad37f34aa7b481235 Merged-In: I4654350a59dc1ca1a925785ad37f34aa7b481235
| * | Merge "Revert^2 "Change Ethernet API to use OutcomeReceiver""Patrick Rohr2022-03-223-52/+65
| |\ \
| | * | Revert^2 "Change Ethernet API to use OutcomeReceiver"Patrick Rohr2022-03-183-52/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 369c79bca47c17303d1e92bb155e556fa01619d1 Merged-In: I7c46545a47034be409071c2ec007d9e1480c6ed0 Change-Id: If9b055e0862755f1d33b5ba6e026fd827bc1d0ea
| * | | Merge "Add Executors to NSD callbacks"Remi NGUYEN VAN2022-03-221-33/+111
| |\ \ \ | | |/ / | |/| |
| | * | Add Executors to NSD callbacksRemi NGUYEN VAN2022-03-181-33/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add Executor variants to all methods with callbacks. Bug: 218752665 Test: atest NsdManagerTest Change-Id: I4c31e2d7ae601ea808b1fd64df32d116c6fff97f
| * | | Revert "Change Ethernet API to use OutcomeReceiver"Quentin Perret2022-03-173-65/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | | Change Ethernet API to use OutcomeReceiverPatrick Rohr2022-03-173-52/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | | Add Nullable IpConfiguration to ethernet update requestPatrick Rohr2022-03-161-9/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | | Merge "Split out the ethernet API surface and use framework-connectivity-t"Patrick Rohr2022-03-162-3/+13
| |\ \ \
| | * | | Split out the ethernet API surface and use framework-connectivity-tXiao Ma2022-03-142-3/+13
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ethernet framework and service source code is going to be moved to Connectivity mainline module, this CL contains below corresponding changes to adapt the migration in f/b side: 1. Split out ethernet module-lib APIs to Connectivity module. Add the ethernet resource filegroup to tiramisu-updatable-sources filegroup as well, build them together. Also update the module-lib and system api txt to reflect the APIs change. Remove the hidden APIs which are moved to Connectivity module. This removal fixes the api inconsistent issue with Tethering/apex/hidden/. 2. Remove EthernetService from SystemServer which will be registered from ConnectivityServiceInitializer. 3. Replace the BackgroundThread class(imported from f/b/core/java) with the one in the modules-utils-backgroundthread lib, which is visible to Connectivity module. Bug: 210586283 Test: m Test: atest FrameworksNetTests EthernetServiceTests Change-Id: I3e13cb9c0e348333af295c2537d459aa6700ff17 Merged-In: I1956848d3248cc56e9841d221e5e4c160bed65a4
| * | | Merge "[DU04-2]Appropriate changes to the NetworkPolicyManager API"Frank Li2022-03-162-4/+5
| |\ \ \
| | * | | [DU04-2]Appropriate changes to the NetworkPolicyManager APIFrank2022-03-162-4/+5
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Divide the NetworkPolicyManager API notifyStatsProviderWarningOrLimitReached into the following two APIs: 1. notifyStatsProviderWarningReached() 2. notifyStatsProviderLimitReached() Bug: 216474563 Test: atest NetworkStatsServiceTest NetworkPolicyManagerTest NetworkPolicyManagerServiceTest OffloadControllerTest Change-Id: Ic413eb532b5e24d4a7e2afabdcf643ab6607b1ed
| * | | Merge "Rename setUidForeground to noteUidForeground"Lorenzo Colitti2022-03-152-3/+3
| |\ \ \
| | * | | Rename setUidForeground to noteUidForegroundAaron Huang2022-03-102-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch addresses API review about the naming of NetworkStatsManager#setUidForeground and it would be more appropriate to rename it to noteUidForeground. Bug: 222291301 Test: atest FrameworksNetTests Change-Id: I952762872850889609c9808aa6e3cdfc04317806
| * | | | Merge "Let docs tool to list the newly-visible IntDef values"Aaron Huang2022-03-151-17/+8
| |\ \ \ \ | | |_|/ / | |/| | |
| | * | | Let docs tool to list the newly-visible IntDef valuesAaron Huang2022-03-111-17/+8
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some *_ALL constants are exposed in T and they should be mentioned in documentation. Because there are already defined InDef values for this kind of constants. Thus, remove the list in the javadoc and leave these up to the doc tool to list the InDef values. Bug: 222291452 Test: m doc-comment-check-docs Change-Id: Ibbaee5389a85bb3d696a518deea0897845553bfa
| * | | Merge "[DU09-2]Modify the NetworkStatsCollection Builder API"Frank Li2022-03-141-22/+24
| |\ \ \
| | * | | [DU09-2]Modify the NetworkStatsCollection Builder APIFrank2022-03-071-22/+24
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Adding the bucketDuration with unit as bucketDurationmillis 2. make the Key class be final 3. The Key set parameter be marked with an IntDef Bug: 220153505 Test: atest NetworkStatsCollectionTest Change-Id: Iab32b8fc129b77d6786c2f1f2339e515f2eb55f7
| * | | Merge "Remove restriction that limits updateConfiguration API to Auto"Xiao Ma2022-03-101-1/+0
| |\ \ \
| | * | | Remove restriction that limits updateConfiguration API to AutoPatrick Rohr2022-03-081-1/+0
| | |/ / | | | | | | | | | | | | | | | | Test: TH Change-Id: Ibd1b6493778b98fc765e6eebdfe8f9c1fef29a73
| * | | Merge "Allowing for null net caps in updateConfiguration"Patrick Rohr2022-03-091-17/+32
| |\ \ \ | | |/ / | |/| |