* Manual style corrections with IDE assistance
* Variable name refactors are done through IDE
* Corrected general style errors such as:
- "final private var" -> "private final var"
- "&&", "+", "||" should not be at the end of line
- Non-static private variable should be like "mVar"
- Private static variable should be like "sVar"
- Code file should always end with newline
- Inherited methods should be annotated with @Override
and no @hide tags
- Public methods should always have a JavaDoc entry
- "int[] array" is preferred over "int array[]"
- private methods should be accessed without "this."
when there is no name collisions.
- "boolean ? true : false" -> boolean
- "boolean ? false : true" -> !boolean
- "boolean == true" OR "boolean != false" -> boolean
- "boolean != true" OR "boolean == false" -> !boolean
Bug: 63596319
Test: make checkbuild, no functional changes
Change-Id: Iabdc2be912a32dd63a53213d175cf1bfef268ccd
* Automatic style corrections through IDE
Bug: 63596319
Test: make checkbuild, no manual changes, no functional changes
Change-Id: I2397d55abc34c9b7a9b748bec6137778df3421a7
Currently, if setting a data limit fails, we completely stop
offload in order to avoid data overages. However, the next thing
we do is try to fetch the stats and crash, because once offload
is stopped all our local state is cleared.
Fix this by fetching stats before we stop offload.
Bug: 29337859
Bug: 32163131
Bug: 64867836
Test: OffloadControllerTest passes
Test: no crash when disabling wifi tethering with BT tethering active
Merged-In: I7fc47e60b2da5f39c26fb22c1325618f9948dd38
Merged-In: I464dd2a6d1996b1cfb8bbf82b6ee453fd0747569
Change-Id: I260f5450f8b67f055983af68fb23a5f3cfc0bc69
(cherry picked from commit d743601a002ac12c02da58e92ebd0544ab0b77ea)
* Move some vendor intents and extras into a VendorIntents class
* Add a download result RESULT_IO_ERROR
* Add documentation noting that repeated calls to
setTempFileRootDirectory will not throw an error if the parameter is the
same.
* Add getTempFileRootDirectory method for app
* Hide AIDL classes from the public/system API surfaces for download
* Remove size and md5hash from FileInfo
Change-Id: I8c968a7d68db2588ee550167ed2693fe89c5925a
This patch removes the call to runWithScissors() in
OffloadController#getTetherStats() that was causing a deadlock when
NetworkStatsService would be polled for stats in certain threading
contexts.
Instead of trying to query the tethering offload HAL synchronously all
the time, this patch:
- changes getTetherStats() to only call into the offload HAL when it
detects that it is called on the same thread as the Tethering handler
thread.
- changes the map of interface to accumulated tethering forwarded stats
to be concurrent.
This makes stats reading from getTetherStats() eventually consistent.
From the point of view of getTetherStats(), it preserves the guarantees
that tethering stats are monotonically increasing, and also guarantees
no tearing between rx bytes and tx bytes.
Bug: 29337859
Bug: 32163131
Bug: 64771555
Test: runtest frameworks-net
Merged-In: Ibcd351ad0225ef146b00a807833f76d2a886f6c1
Merged-In: I61786d61fe1422e429c0dd9eadaff6f02eb850e7
Merged-In: I999d1d1bf72e7ab02c5d17f37aad00bc711d3fc5
(cherry pick from commit eb5e465edd78bea26289f779b635c7e94d934854)
Change-Id: I28646b962cee8c8a6efd66059f84873c02ac5810
1. Mock the service manager so that NMS can fetch mock versions
of INetd and IBatteryStats.
2. Call LocalServices.removeServiceForTest to avoid a duplicate
service registration error. // check this
3. Change the timeout from 100ms to 200ms, as otherwise the tests
that check for IfaceClass fail.
4. Convert NetworkManagementServiceTest to JUnit 4.
5. Move NetworkManagementServiceTest to tests/net
Bug: 29337859
Bug: 32163131
Bug: 32561414
Bug: 62918393
Test: runtest frameworks-net
Change-Id: Ic7371b427b35809ccd446addf35c9d8ae99ccfd3
* Enforce that only one instance of each manager can be active.
* Add a death receipient for both managers to notify the app of binder
death
* Add documentation informing the app that it may not call create()
multiple times
* Fix a collision in streaming state reason codes
* Add documentation in DownloadRequest to indicate which methods should
be called by the middleware.
Change-Id: Ie15283b5c34fee736e8023dbd4f889c2ca95299e
This CL enables Checkstyle for the following directories:
- core/java/android/
- core/tests/coretests/src/android/
Bug: 34746646
Test: None
Change-Id: Ib8b3f198000be19e9a7a61aa5abd61d827454eba
(cherry picked from commit e5abb866a56582ffc705c261a2cab20c2331e6a3)
These haven't actually existed in libandroid for some time. We can't
fix the past, so just remove the API from the NDK.
Test: make checkbuild
Bug: http://b/64572149
Change-Id: Ic68e81c63e738e6d341bcae6178cdcc080326da4
This patch changes IpManager to take into account static provisioning
information specified in the InitialConfiguration for IPv6 static
configuration.
When a valid InitialConfiguration with IPv6 content is specified,
IpManager will do the following things:
- at start(), it will push the IPv6 addresses in the config to netd
- it will observe all addresses be notified via Netlink
- when all addresses are there, it will patch in the associated IPv6
routes in the config, so that they get passed to ConnectivityService
through the usual mechanism
The logic triggering onProvisioningSuccess is also changed to take into
account InitialConfiguration: when all addresses and all routes in the
config are seen the provisioning is successful.
Bug: 62988545
Test: runtest frameworks-net, with newly added tests
Change-Id: I77ed7c576c4b198de7a4726be70c78b74689e98b
https://android-review.googlesource.com/438278/ attempted
to fix changing between two non-accept StrictMode policies (which
is not supported by netd) by ensuring that if neither the old nor
the new policy were accept, we'd first set an accept policy.
Unfortunately, while this is what the comment says, what the
code actually does is send the new policy twice. Fix the code to
match the comment and the intent of the CL.
While I'm at it, also move applyUidCleartextNetworkPolicy into
the synchronized block, so multiple concurrent calls to
setUidCleartextNetworkPolicy don't result in NMS state going out
of sync with netd state.
Bug: 28362720
Test: builds
Change-Id: I8d876ba0786c4d6325d26a84378fc6afcf47ab84
Currently, we only count add tethering traffic to per-UID
stats, but not to total data usage (i.e., dev and XT stats). This
is correct for software tethering, because all software forwarded
packets are already included in interface counters, but it is
incorrect for hardware offload, because such packets do not
increment interface counters.
To fix this:
1. Add an argument to ITetheringStatsProvider#getTetherStats to
indicate whether per-UID stats are requested. For clarity,
define integer constants STATS_PER_IFACE and STATS_PER_UID
to represent these operations.
2. Make NetdTetheringStatsProvider return stats only if per-UID
stats are requested. (Otherwise tethering traffic would be
double-counted).
3. Make OffloadController's stats provider return the same
stats regardless of whether per-UID stats were requested or
not.
4. Make NetworkStatsService add non-per-UID tethering stats to
the dev and XT snapshots. The per-UID snapshots were already
correctly adding in per-UID stats.
(cherry picked from commit 5356a35c3bcfcdf2d184c620af6bfbf9bddf35c5)
Bug: 29337859
Bug: 32163131
Test: runtest frameworks-net
Test: runtest frameworks-telephony
Change-Id: I325b13d50e88841dfb0db4c35e7e27f163ee72fe
Merged-In: I4e8e923d68dce1a4a68608dbd6c75a91165aa4ee
Fix the errors that cropped up when trying to upload the unhide CL in
MR1.
Bug: 30981736
Test: manual, with testapps
Change-Id: If4a9a5533a235a8cc56762ab7a9e32ec89440f1d
Add a new tetherLimitReached method to INetworkManagementService,
and call it when the HAL notifies OffloadController because the
limit has been reached.
Bug: 29337859
Bug: 32163131
Test: builds
Test: OffloadControllerTest passes
(cherry picked from commit d66cf56ba662f10f2da1d0f844116632ad0a0dbb)
Change-Id: I89719fe7ec8bfd3c85d6cdca9c0d449aea86ef9d
Merged-In: I026e6aa9e7b371f316c0d97c3cf5e78abc1f5263
Test: I solemnly swear I did not test this conflict resolution.
Merged-In: Ifc35306711dde39eb521dc015da931f4d5f2bf06
Change-Id: I9494087c5a90bccc4326c173bf6395996da357af
This patch completes commit bae105a5ccd11430bab14721d1325e2303a673da to
really allow updates of immutable capabilities to NetworkCapabilities of
NetworkAgents by using satisfiedByImmutableNetworkCapabilities instead
satisfiedByNetworkCapabilities.
Bug: 64125969
Test: runtest frameworks-net
Change-Id: I9beeb623792f0ee31abcd4ba9d0ba2451304fb2e
Reduced the delay from 20 seconds to 10 seconds. And created
a separate delay configuration for it.
Test: Manual
bug: 63633916
Merged-In: Ifc35306711dde39eb521dc015da931f4d5f2bf06
Change-Id: Ifc35306711dde39eb521dc015da931f4d5f2bf06
(cherry picked from commit 5523dc55d808998af4402431265e085e62bf6dd1)
When advertising is stopped while Bluetooth is disabled, we should not
throw any exceptions, just log the failure.
This was the default behaviour before the AdvertisingSet was introduced.
Bug: 63819108
Test: manual
Change-Id: I518e071b77b127973aee6f24fa6ced4f28bc9531
Calls to old advertising API (startAdvertising), should never throw
exceptions. Instead, it used to post failure callback. This behaviour
was accidentally modified when implementing new API. Right now, instead
of posting error callback, we throw IllegalArgumentException if we fail
to obtain BluetoothGatt object, or the call to startAdvertisingSet
fails.
This patch brings back the old behaviour to the API. It also makes new
API post callback instead of throwing exception in this error case.
Bug: 63819108
Test: manual
Change-Id: I897b99839f899ca3f3dc609918d665c8c327b777