Existing NetworkCallback users will get NetworkCapabilities with
location sensitive data removed (except for ownerUid which will be
added for existing apps for backwards compatibility). Apps
have to opt-in to receive location sensitive data.
Note: This was chosen because WifiInfo is the only TransportInfo tha
has location sensitive info & that was added only in Android 12. If we
choose to default to true, all existings apps retrieving
NetworkCapabilities for wifi networks will be blamed for location access
unnecessarily.
Changes:
i) Add a flag in NetworkCallback creation to retrieve
NetworkCapabilities with location sensitive info in their callback.
(More flags are being planned for NetworkCallback for throttling
callback frequency, etc)
ii) For NetworkCapabilities.getOwnerUid(), we will continue to send the
data for apps targeting older SDK (since this is an existing field and
the new flag defaults location sensitive data to off).
Bug: 156867433
Test: atest android.net
Test: atest com.android.server
Change-Id: If70b5ea6f5c8885f0c353c8df08a826d55fe7f7a
- Add a new API to get the network ID range of IPSec tunnel
interface.
- Use the new API in IpSecServiceTest to make sure the result is
the same. Follow-up commit will change the logic in
IpSecService#reserveNetId(), the modified test can ensure the
correctness of the new change.
Bug: 172183305
Test: atest FrameworksNetTests:IpSecServiceTest
Change-Id: Ic605e48941fc9d6482cdcd01a8adcdc9b6d586a6
This is a generic way to request networks that has different
subId but belongs to the same carrier. For example, cellular
networks with different SIM card, or carrier Wifi that
provided by the operator.
Test: atest NetworkCapabilitiesTest#testSubIds
Test: m doc-comment-check-docs -j
Test: atest CtsNetTestCases
Bug: 175662146
Change-Id: Ifca766f5acc73c285948d6251ec31506d9bb0bcb
The common tests cannot reference EthernetNetworkSpecifier,
as it did not exist in Q and R yet.
Bug: 179329291
Merged-In: Iec8ef874a3ca6dcc65944bbbaa3575a5ae0f4989
Change-Id: Iec8ef874a3ca6dcc65944bbbaa3575a5ae0f4989
Test: atest CtsNetTestCasesLatestSdk
Rename StringNetworkSpecifier to EthernetNetworkSpecifier (its only
production user), and make it module-lib API.
The original StringNetworkSpecifier file is actually kept to satisfy
some invalid dependencies; it will be removed separately.
This allows specifying an Ethernet interface with a non-deprecated API:
until this change the only way to do so would be to use
NetworkRequest#setSpecifier(String), which is deprecated.
Similarly, add the TestNetworkSpecifier API for TestNetworkManager, to
replace previous usage of StringNetworkSpecifier. TestNetworkManager is
module API, so TestNetworkSpecifier should be module API too. This
allows tests to request the test interface specifically, without using
the deprecated NetworkRequest#setSpecifier(String).
Bug: 179329291
Test: m
Merged-In: Iee569f5c8bbdc4bc979610e1191308281f3d4620
Change-Id: Iee569f5c8bbdc4bc979610e1191308281f3d4620
Slog should not be used in unbundled jars as it is a hidden API; use the
standard Log utility instead.
Bug: 172050541
Test: m
Change-Id: I54b2b99b2aedbb5194e9ec24068d2f2ce46d67fc
The caller of AsyncChannel has been deleted in the last commit
(Remove legacy network factories), so the useless code of
AsyncChannel should also be deleted.
Bug: 170917042
Test: atest FrameworksNetTests
Change-Id: I6ce164fe5e3d592f1ed63753e8d3c0086bf61fa2
ParseException is a public API class used to support Connectivity APIs,
so it should be in the same API surface as connectivity.
Bug: 181512874
Test: m
Change-Id: Ie1213de0d0facc8f409f7b4c2553abb382e4afbf
- Replace the PackageManagerInternal#getPackageList() with
receiving PACKAGE_{ADDED|REMOVED} intent.
- Also remove the onPackageChanged method because the traffaic
permissions(INTERNET, UPDATE_DEVICE_STATS) are not changed after
package changed(Disable or enable package).
Bug: 176788468
Test: atest FrameworksNetTests
Change-Id: I5505d1c77db66a7e65fc336ea0e99846e78c6b36
Classes inside the incoming connectivity module will not be able
to access hidden APIs. The hidden DUMP_FLAG_PRIORITY_* flags
usage should be replaced. It was used to control the dump
priority. DEFAULT priority for services which is treated the
same as NORMAL priority. ConnectivityServiceInitializer took
both NORMAL and HIGH. It trigger different information dumped.
It's replaced with dumpsys that does not send "--dump-priority"
arguments to the service. Thus, design is replaced with
local parsing inside ConnectivitySerivce to provide equivalent
dump.
Bug: 172183305
Test: m ; flash and boot up
Test: adb bugreport ; adb dumpsys connectivity
Change-Id: Ib3c9d8692eb4382cd106734a1a716df6f48ffca4
These were broken by aosp/1553463, which made filterNetworkInfo
unconditionally call setDetailedState with a reason of "" and an
extraInfo of null.
Fix both synchronous getter APIs (e.g., getNetworkInfo) and
CONNECTIVITY_ACTION broadcasts by calling a new
filterForLegacyLockdown method that behaves similarly to how the
now-deleted LockdownVpnTracker#augmentNetworkInfo used to behave.
While I'm at it, move back to private a method that was public
only because LockdownVpnTracker used it.
Fix: 181855958
Test: new unit test coverage
Change-Id: I2c7b88fcec9dd36b45cb51db8d19b3ee8bad44a6
This makes the test more realistic, since telephony always puts
the APN name in the extraInfo field. It also makes it easy to
test that various APIs properly return the extra info without
plumbing a new parameter through TestNetworkAgentWrapper,
NetworkAgentWrapper, and InstrumentedNetworkAgent.
Also make the extraInfo and the legacyType available to tests.
This will be used in future tests that assert the contents of
extraInfo.
Bug: 181855958
Test: test-only change
Change-Id: If4eddb6cd9e70bb33e10d72aceebaea843244246
Adding a seperate test tag into postsubmit so as to identify which tests
we want to run for automotive builds.
Test: atest --test-mapping [src]:auto-postsubmit
bug: 179917339
Change-Id: I3860fb6bf4f4174fad26cce5f7d6b43fd6494c0f
Currently ConnectivityService calls the methods in
BatteryStatsService through BatteryStatsManager so
IBatteryStats can be removed from ConnectivityService.
Bug: 171686421
Test: FrameworksNetTests
Change-Id: I559369c9900e8100cdae187bc9cec603ed85a131
* changes:
[Telephony] Use TelephonyCallback instead of PhoneStateListener part1
[PhoneStateListener] Redesign PhoneStateListener: Use TelephonyCallback
NetworkAgentInfos cache the list of requests they satisfy,
and that list is used to send callbacks. Therefore, when
the TRACK_DEFAULTs are copied, this list needs to be
updated.
The best way to do this is to figure out what was the old
active request and find which requests corresponds to it
in the new list, and then upon registering adding the
active request to the relevant satisfier if present.
A few other ways can be considered like replacing the
request as it gets added, but this would temporarily
increase the number of callbacks allocated to the app
and risks crashing it for no good reason ; furthermore
the call to remove would have to be eschewed somehow
for those requests that are replaced. This is much
simpler.
Test: new test for this. This also passes the future
tests for per-profile default network preference.
Change-Id: I001351e5c478c2c77cbf2844abca77b205291778
Mainline connectivity service is only allowed to use formal
APIs. Use new system API in BatteryStatsManager instead of
calling BatteryStatsService directly.
Bug: 171686421
Test: FrameworksNetTests
Change-Id: I1d1f0d2d456003e842ad77519667c0532995610d
Merged-In: I1d1f0d2d456003e842ad77519667c0532995610d
Connectivity is becoming a mainline module in S but mainline
modules are not allowed to use non-formal APIs. Thus, replace
non-formal API PendingIntent#getIntent to new formal API
PendingIntent#intentFilterEquals.
Bug: 174237997
Test: FrameworksNetTests
Change-Id: Ic5e27f812bd42dbc80b9d29d81303df4dd5e8199
Since the redesign of PhoneStateListener, use TelephonyCallback to get the callback of EVENT_*
Bug: 167684594
Test: make
Change-Id: Ia3b777b12142b104b5798804f50b34748f9bf28c
Merged-In: Ia3b777b12142b104b5798804f50b34748f9bf28c
Connectivity is becoming a mainline module in S but mainline
modules are not allowed to use non-formal APIs. Thus, replace
non-formal API Inet[4|6]Address#ANY to
NetworkStackConstants#IPV[4|6]_ADDR_ANY.
Bug: 181756157
Test: FrameworksNetTests
Change-Id: Id4d2fc551c1384f549a586e87ab68356ba05b995
The data class supports a ConnectivityManager API, so it should be
together with the ConnectivityManager API surface.
Bug: 181512874
Test: m
Change-Id: I5642486ea0febcb08cadcbd4cd3f0c6056deae0e
The connection service will become the main line module.
It is difficult to include BitUtils in the module. and so
Move the hidden API needed in BitUtils to NetworkCapabilitiesUtils.
Bug: 170598012
Test: atest ConnectivityServiceTest
atest NetworkCapabilitiesTest
atest DnsUtilsTest
Change-Id: Ibc81827e25a54fc3ff94f78d810fe4f5073e3a98