322810 Commits

Author SHA1 Message Date
Treehugger Robot
838ab94a0f Merge changes from topic "bt-fix-checkstyle-errors"
* changes:
  Fix checkstyle errors (2/2)
  Fix checkstyle errors (1/2)
2017-08-24 21:25:49 +00:00
Jack He
2992cd084c Fix checkstyle errors (2/2)
* 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
2017-08-24 19:09:58 +00:00
Jack He
a355e5efaf Fix checkstyle errors (1/2)
* Automatic style corrections through IDE

Bug: 63596319
Test: make checkbuild, no manual changes, no functional changes
Change-Id: I2397d55abc34c9b7a9b748bec6137778df3421a7
2017-08-24 19:09:48 +00:00
Treehugger Robot
b09cf3fbf1 Merge changes from topic "offload_cherrypick"
* changes:
  Send add/removeDownstream info to offload HAL
  Don't completely stop offload if setting data limit fails.
2017-08-24 05:18:23 +00:00
Erik Kline
b3bb26eaa7 Send add/removeDownstream info to offload HAL
Test: as follows
    - built
    - flashed
    - booted
    - "runtest frameworks-net" passed
Bug: 29337859
Bug: 32163131

Merged-In: I0cb81ac054fc2bf6c8b8bfe658e9404a15091d7a
Merged-In: I7abcdcc2d7d967179c47081a6db2b417164891f3
Change-Id: I6c59aa7cb80b54f376f294b24c1409710c553d74
(cherry picked from commit ed962a84122ab950a103fbbc0bf911f61b6b9500)
2017-08-23 20:55:47 -07:00
Lorenzo Colitti
ddce7ee20f Don't completely stop offload if setting data limit fails.
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)
2017-08-23 20:51:35 -07:00
Hugo Benichi
29b1826ff2 Merge "Make NetworkManagementServiceTest pass again." 2017-08-24 03:36:20 +00:00
Hugo Benichi
ff12ba9376 Merge "Tethering offload stats updates are eventually consistent" 2017-08-24 02:37:03 +00:00
Hall Liu
3f6a95e8b0 Merge "Embms adjustments for 7/28" 2017-08-23 20:18:15 +00:00
Hall Liu
8e47fe35c8 Embms adjustments for 7/28
* 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
2017-08-23 10:56:09 -07:00
Hall Liu
489dcb7cca Merge "Embms API adjustments for 7/21" 2017-08-23 16:37:50 +00:00
Hugo Benichi
752c1287bd Tethering offload stats updates are eventually consistent
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
2017-08-23 09:58:09 +09:00
Lorenzo Colitti
a086800e04 Make NetworkManagementServiceTest pass again.
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
2017-08-23 09:49:05 +09:00
Hall Liu
d5c955fcdc Embms API adjustments for 7/21
* 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
2017-08-22 17:07:48 -07:00
Treehugger Robot
899398113a Merge "Enable Checkstyle for "repo upload" for more projects." 2017-08-22 22:19:28 +00:00
Aurimas Liutikas
a422149ef1 Enable Checkstyle for "repo upload" for more projects.
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)
2017-08-22 14:03:46 -07:00
Treehugger Robot
6645fdad68 Merge "Make dun APNs as read-only by default." 2017-08-22 19:52:22 +00:00
Amit Mahajan
fd528886c4 Make dun APNs as read-only by default.
Test: Verified tethering manually for T-Mo and AT&T
Bug: 38186417
Change-Id: Iae2beede0e20810cba4d96f897756896adf77b30
2017-08-22 11:08:31 -07:00
Treehugger Robot
b056324630 Merge "Remove TTS symbols from NDK stub library." 2017-08-22 18:03:10 +00:00
Hall Liu
fa7e99ddf1 Merge "Fix lint errors in the streaming API" 2017-08-22 17:55:06 +00:00
Tobias Thierer
70b000e6e2 Merge "Network: Use HttpURLConnectionFactory rather than OkHttp APIs"
am: be87c9ca58

Change-Id: I79db2f0dc0870f71ec21397545e2e6abb5c7142b
2017-08-22 15:00:24 +00:00
Tobias Thierer
be87c9ca58 Merge "Network: Use HttpURLConnectionFactory rather than OkHttp APIs" 2017-08-22 14:07:16 +00:00
Dan Albert
3644edb0b6 Remove TTS symbols from NDK stub library.
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
2017-08-22 00:15:25 -07:00
Lorenzo Colitti
345a2f98a1 Merge "Fix transitioning between non-accept strict policies."
am: bef2c91bb5

Change-Id: Iacf9f43f88ac77cb2a6094348cf52107f7ef0817
2017-08-22 06:42:19 +00:00
Treehugger Robot
bef2c91bb5 Merge "Fix transitioning between non-accept strict policies." 2017-08-22 06:28:30 +00:00
Hugo Benichi
c6a9b5564a Merge "IpManager: use InitialConfiguration for provisioning"
am: 5b218bdc8e

Change-Id: I131589680b68222e4fda4e9165ac2f50894ee28e
2017-08-21 12:08:28 +00:00
Hugo Benichi
5b218bdc8e Merge "IpManager: use InitialConfiguration for provisioning" 2017-08-21 11:53:24 +00:00
Hugo Benichi
d00ddf5672 IpManager: use InitialConfiguration for provisioning
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
2017-08-21 16:00:31 +09:00
Lorenzo Colitti
26364f1dea Fix transitioning between non-accept strict policies.
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
2017-08-20 12:16:29 +09:00
Lorenzo Colitti
9335d2d0b1 Merge changes I325b13d5,I89719fe7
am: 23868e9c09

Change-Id: Iaced543ab17ea87c8f701975764d957bc1b17fc7
2017-08-19 03:15:08 +00:00
Treehugger Robot
23868e9c09 Merge changes I325b13d5,I89719fe7
* changes:
  Add tether offload traffic to interface stats as well.
  Tell the system when tethering offload hits a limit.
2017-08-19 03:05:14 +00:00
Lorenzo Colitti
f1912ca49a Add tether offload traffic to interface stats as well.
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
2017-08-19 10:12:05 +09:00
Hall Liu
ee19cfc386 Fix lint errors in the streaming API
Fix the errors that cropped up when trying to upload the unhide CL in
MR1.

Bug: 30981736
Test: manual, with testapps
Change-Id: If4a9a5533a235a8cc56762ab7a9e32ec89440f1d
2017-08-18 14:36:06 -07:00
Lorenzo Colitti
9f0baa94ca Tell the system when tethering offload hits a limit.
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
2017-08-19 00:15:31 +09:00
Hugo Benichi
461f4eb099 Merge "Really allow NetworkAgent immutable updates to NetworkCapabilities"
am: cb3c24e36b

Change-Id: Ifbdd005576b3f0fbf278ecec81ce3e4308c6276d
2017-08-18 11:59:02 +00:00
Hugo Benichi
cb3c24e36b Merge "Really allow NetworkAgent immutable updates to NetworkCapabilities" 2017-08-18 11:45:39 +00:00
Jack Yu
f7149eb698 resolve merge conflicts of d5cb58c693de to stage-aosp-master
Test: I solemnly swear I did not test this conflict resolution.

Merged-In: Ifc35306711dde39eb521dc015da931f4d5f2bf06
Change-Id: I9494087c5a90bccc4326c173bf6395996da357af
2017-08-17 23:20:59 -07:00
Treehugger Robot
d5cb58c693 Merge "Reduced the retry after disconnect delay" 2017-08-18 05:52:16 +00:00
Hugo Benichi
a60c6eab42 Really allow NetworkAgent immutable updates to NetworkCapabilities
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
2017-08-18 14:51:03 +09:00
Jack Yu
950d217406 Reduced the retry after disconnect delay
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)
2017-08-17 21:30:30 -07:00
Bill Yi
8cbdb54bb8 Import translations. DO NOT MERGE
Auto-generated-cl: translation import
Exempt-From-Owner-Approval: translation import

Bug: 64086495
Change-Id: I1d90eea9e876253b9ca99b4507e9e34b5ea9819e
2017-08-17 17:49:23 -07:00
Jakub Pawlowski
5d0f5f46ef Merge "Bluetooth: Don't throw exception when stopAdvertisingSet fails"
am: b7cbb2fe49

Change-Id: I5ccf67621134fe1ba9204e2a8f3502ffacef0315
2017-08-17 23:06:14 +00:00
Treehugger Robot
b7cbb2fe49 Merge "Bluetooth: Don't throw exception when stopAdvertisingSet fails" 2017-08-17 22:51:23 +00:00
Jakub Pawlowski
e9fe99571b Merge "Bluetooth: Fix startAdvertisingSet error handling"
am: ed12213b59

Change-Id: I093e849e910428c521e73072121dfdfdceb28e0d
2017-08-17 22:47:38 +00:00
Treehugger Robot
ed12213b59 Merge "Bluetooth: Fix startAdvertisingSet error handling" 2017-08-17 22:33:27 +00:00
Jakub Pawlowski
f73863dc29 Bluetooth: Don't throw exception when stopAdvertisingSet fails
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
2017-08-17 07:39:02 -07:00
Jakub Pawlowski
f7bd6b26c7 Bluetooth: Fix startAdvertisingSet error handling
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
2017-08-17 07:36:37 -07:00
Hall Liu
cb63a47d41 Merge "Revert "Fix lint errors in the streaming API""
am: 42d3eadb37

Change-Id: I4229c1eb42edba2c2c7df08f87bfded5402c01c7
2017-08-17 01:30:56 +00:00
Hall Liu
42d3eadb37 Merge "Revert "Fix lint errors in the streaming API"" 2017-08-17 01:22:19 +00:00
Hall Liu
591fea2504 Revert "Fix lint errors in the streaming API"
This reverts commit e1f10cbd7ff6128171b6ab37b3afbfdc3d9f9f33.

Change-Id: Id3666b27b0d07b0a1d4f3179f2073aa75440f2ee
2017-08-17 00:46:24 +00:00