71686 Commits

Author SHA1 Message Date
Hansong Zhang
ecd09fb952 Bluetooth HID Device: Fix a typo
Fixed a typo in BluetoothInputHost. "DIGITIZER_TABLED" should be
"DIGITIZER_TABLET".

Test: Not needed.
Change-Id: I06ffc536f5912d53319b4d325f77991d65ab04f2
2017-09-29 20:56:00 +00:00
Andreas Gampe
604bae849d Frameworks: Move Log holder to be preloaded
To avoid issues with late initialization, let the holder be
initialized in the zygote.

(cherry picked from commit 61a3e8c23a7c62c389433113802a0d74f4ab53cf)

Bug: 65927416
Test: m
Merged-In: I6f454df46d4c64d295e1f2510793d5087b74fb74
Change-Id: I6f454df46d4c64d295e1f2510793d5087b74fb74
2017-09-28 08:54:10 -07:00
Chalard Jean
092d50d1bd Do not throw on call to isTetheringSupported w/o permission
...just return false instead.

Test: Made an app to test this. Made sure it doesn't have
Test: the required permission. Checked it crashes with
Test: SecurityException without this change. Checked that it
Test: doesn't with it.

Merged-In: Ib5b17a7f68c1327f47fe1f54c0454c51f4226907
Change-Id: Id20d3c240ec5d70d085e0366b92ab3a514f3e7c8
(cherry picked from commit 8f76fc38ec1682667de2caf3940fbfb71744d368)
2017-09-28 16:34:39 +09:00
Treehugger Robot
f4ec2ab706 Merge "Modify Bluetooth Class of Device from Android stack" 2017-09-27 19:43:17 +00:00
Lorenzo Colitti
d1ae268081 Merge "Delete the legacy framework code for manipulating ND offload." 2017-09-27 10:46:36 +00:00
Lorenzo Colitti
59da962b9f Delete the legacy framework code for manipulating ND offload.
This only worked on broadcom devices, and was superseded in
M by a wifi HAL call made by IpManager.

Test: bullhead builds, boots
Change-Id: I711cae7dafe171c2c8b4e84a229adbcad27f3d14
2017-09-27 16:47:36 +09:00
Udam Saini
c3b640cf48 Adds necessary permissions to system apis
adds privileged permission for getCaptivePortalServerUrl
adds tether privileged permission for
startTethering,isTetheringSupported

bug:62348162

Test: make and manual testing
Change-Id: I8eb8e3c9dcd7201abe9ea303ee57fe99073d67eb
2017-09-27 12:14:37 +09:00
nharold
680525c742 Merge changes from topic "re-enable-ipsec"
* changes:
  Re-Expose IpSecService API Surface
  Re-Enable Starting of the IpSecService
2017-09-26 21:46:39 +00:00
Hans Boehm
3c03d5bd2b Merge "Naming fix and add comments" 2017-09-25 04:09:30 +00:00
Treehugger Robot
1ba697e29b Merge changes from topic "equalizer_1"
* changes:
  Fixing code formatting to comform to checkstyle
  Add sensor HAL process into dump list
2017-09-23 02:39:42 +00:00
Peng Xu
aad139a2d3 Merge changes from topic "equalizer"
* changes:
  Update Java doc of SensorManager.createDirectChannel
  sensors: pass sensor handle along with injected event
2017-09-23 00:17:10 +00:00
Peng Xu
62f2c87ee3 Fixing code formatting to comform to checkstyle
Fix following types of issue
  * over 100 char/line
  * missing space
  * trailing spaces
  * array bracket position
  * variable naming convention (some cases)
  * indentation
  * long expression wrapping operator position
  * missing curly brace for one line scope
  * function modifier order

Things not changed in this CL:
  * Redundant public modifiers.
  * A few local variable names.
  * Suggested @deprecate but function is actually @removed.

Test: m and m docs
Change-Id: I5c22648888487edaa5954026a166cfd810a8a912
2017-09-22 16:58:14 -07:00
Hans Boehm
eb6d62cd33 Naming fix and add comments
Also fix up imports to make repohooks happy and some whitespace issues.

A very small step towards making this code more understandable.

Bug: 65760710

Test: Builds.
Change-Id: I0396c06bb303e0b06ad0cbbbff4fdc1ac527ac6c
2017-09-22 15:49:48 -07:00
Christopher Schuster
42c3a6e6af fixed handling of data URI schemes in Intent.toUri
Data URIs in intents can use schemes with digits and some special
characters (see RFC 2396 and 3986). This patch fixes how these
data URIs are handled by Intent.toUri to support these schemes.

Bug: 63930680
Test: run cts android.content.cts.IntentTest#testUris
Change-Id: I0dbb72325f59f372abba83be9e14c59d5665a053
Signed-off-by: Christopher Schuster <levjj@google.com>
2017-09-21 15:20:16 +00:00
Peng Xu
9ee042efa8 Update Java doc of SensorManager.createDirectChannel
Java doc was left out when addressing API reviewer comments.
This CL fix the discrepancy between the actual logic and java doc.

Bug: 36550285
Test: compiles
Change-Id: I6406892ecdcc5d02f11966fa3fb0b81ed8d3b285
Merged-In: I6406892ecdcc5d02f11966fa3fb0b81ed8d3b285
2017-09-20 17:03:27 -07:00
Pulkit Bhuwalka
66d6123880 Modify Bluetooth Class of Device from Android stack
Bug: 36015415
Test: Modified Class of Device using sample app and verified device icon
change when discovering from a remote device.

Change-Id: Ie25f10be5560f9c090ebe489d5f3bb00cbca81ef
2017-09-20 15:51:49 -07:00
Alexey Polyudov
29ad6b3960 sensors: pass sensor handle along with injected event
Change-Id: I5e8eacfa940c082a14a9876f455c55b84b975086
Merged-In: I5e8eacfa940c082a14a9876f455c55b84b975086
2017-09-20 11:13:51 -07:00
Fyodor Kupolov
104501fa29 Merge "Fix AddAccountSettings memory leak" 2017-09-19 18:29:14 +00:00
Charles He
cc15c7f8c1 Merge changes from topic "always-on-vpn"
* changes:
  Opt-out for always-on VPN: rename API.
  Opt-out for always-on VPN
2017-09-19 07:50:13 +00:00
Hugo Benichi
175b574e27 Wakeup packet events: addressing a few comments
This patch addresses a few post-submit comment for
commits f562ac34a51dc and 60c9f63b66921.

Bug: 34901696
Bug: 62179647
Test: runtest frameworks-net
Change-Id: I4abec57e0c6bc869dc57b5eb54582dd977b64c30
2017-09-19 14:07:47 +09:00
Ruina Liu
044e0fe5c5 Fix extracting 32-bit uuid error via calling method uuidToBytes
A new defined method of uuidToBytes is used to convert
Bluetooth uuid to bytes in the case of BLE advertising.
But the most significant 16 bits of a 32-bit uuid
will be cleared after the and operations with
0X0000FFFF00000000L in the function of
getServiceIdentifierFromParcelUuid.
0XFFFFFFFF00000000L should be used as bit mask.

Change-Id: I83e22ffbecd718540e644289fee12bf9c3b66305
Test: Advertise with payload contains 32-bit uuid
2017-09-15 17:08:32 -07:00
Treehugger Robot
89c94f67b4 Merge changes Id931d441,I83faf974
* changes:
  Zygote: Improve logging and error handling during connections.
  Zygote: Fix race condition on package preloads.
2017-09-14 23:41:34 +00:00
Jakub Pawlowski
8dde5e1ce0 Fix included service parsing (3/3)
Bug: 65637368
Test: sl4a GattIncludedServiceTest
Change-Id: Idb967df9d5064b0532db7f5c250f677d1dbbc54c
2017-09-14 19:37:40 +00:00
Jakub Pawlowski
cf733cd020 Bluetooth: fix typo in comment
Test: none
Change-Id: I48c674049df88285268145d4140870eb4ab79a62
2017-09-14 19:24:28 +00:00
Jakub Pawlowski
14a381bc3e Bluetooth: fix parameter name in onConnectionUpdated
Test: compilation
Change-Id: I625e4ca63477b795310ebb42ca5e9a0549523cc5
2017-09-14 19:23:59 +00:00
Hugo Benichi
61901ddedd Merge changes Ie2676b20,Ie8db6f85
* changes:
  Connectivity metrics: add WakeupStats events
  Connectivity metrics: collect NFLOG wakeup events
2017-09-14 11:53:02 +00:00
Hugo Benichi
60c9f63b66 Connectivity metrics: add WakeupStats events
This patch defines a new WakeupStats event in ipconnectivity.proto and
populates these events from the NFLOG wakeup events stored in
NetdEventListenerService.

There is one WakeupStats object per known interface on which ingress
packets arrive and may wake the system up.

Example from $ adb shell dumpsys connmetrics list:

UPDATEME
...
WakeupStats(wlan0, total: 58, root: 0, system: 3, apps: 38, non-apps: 0, unrouted: 17, 6111s)
WakeupEvent(13:36:31.686, iface wlan0, uid -1)
WakeupEvent(13:38:50.846, iface wlan0, uid -1)
WakeupEvent(13:39:16.676, iface wlan0, uid 10065)
WakeupEvent(13:40:32.144, iface wlan0, uid 1000)
WakeupEvent(13:40:35.827, iface wlan0, uid 1000)
WakeupEvent(13:40:47.913, iface wlan0, uid 10004)
WakeupEvent(13:40:52.622, iface wlan0, uid 10014)
WakeupEvent(13:41:06.036, iface wlan0, uid 10004)
...

Bug: 34901696
Bug: 62179647
Test: runtest frameworks-net
Change-Id: Ie2676b20bfb411a1902f4942643df0c20e268d99
2017-09-14 13:29:56 +09:00
Narayan Kamath
a3d4230b92 Zygote: Fix race condition on package preloads.
Before this change, ZygoteProcess.preloadPackageForAbi returned
as soon as the command was written to the zygote socket and not
after the preload completed. This meant that there was a small
window of time before the server side of the socket polled its FDs
where a second command could be written to the zygote socket. This
would lead to only one of the commands being processed and the
other being dropped. The client side of that socket would then wait
forever for a response and bring down the system once the watchdog
timeout was hit.

Example failure case :
--------------
system_server:send command(preloadPackage)
system_server:send command(fork)
zygote:poll & process command(preloadPackage)  // the fork command is dropped.

Example of normal operation :
------------------
system_server:send command(preloadPackage)
zygote:poll & process command(preloadPackage)
system_server:send command(fork)
zygote:poll & process command(fork)

This change makes preloadPackageForAbi synchronous, which ensures
that each POLLIN event corresponds to precisely one command.

(cherry picked from commit 24a3306c32aa3860184025638f3abaab96cc9153)

Bug: 62886909
Bug: 13618569
Test: Manual
Contributed-By: yuqianyu@huawei.com

Merged-In: I83faf974c9a70a6ab18323f692c1981784e4c56a
Change-Id: I83faf974c9a70a6ab18323f692c1981784e4c56a
2017-09-13 18:37:05 -07:00
Jakub Pawlowski
3eb569fc72 Bluetooth: thread-safe callback invocation
Bug: 65596701
Test: manual
Change-Id: I92a436328a3070ea842e8e652891e485406c2ed7
2017-09-13 17:31:43 +00:00
Jakub Pawlowski
eb6b3da4fc Bluetooth: fix GATT race conditions when using Handler
Bug: 65596701
Test: manual
Change-Id: Id703cea0543626bdd5a583da95615b650bbcc331
2017-09-13 17:31:24 +00:00
Rubin Xu
60eae6e621 Merge "Refactor CompareResult<> class and its call sites" 2017-09-13 09:35:04 +00:00
Nathan Harold
d999d225a8 Re-Expose IpSecService API Surface
Note, This reverts commit bd62d6aff264b8e8ce4a06ca6417e69bcca3006b.

Bug: 64800246
Test: compilation
Change-Id: I709d4c476647cfe9f6b982fc373f8d76018b3922
2017-09-12 19:25:13 -07:00
Nathan Harold
b72821747c Re-Enable Starting of the IpSecService
This reverts commit 41004ff4113dc9175c993638a47af602af6d8a98.

Bug: 64800246
Test: compilation
Change-Id: I4f5e3cd23001b9d94b3f6dc9fcfe731a90650e6e
2017-09-12 19:25:09 -07:00
Nicolas Geoffray
81edac4037 Rename debugFlags to runtimeFlags.
Also now pass the flags to the forked process through --runtime-flags instead
of converting to command line arguments and converting back to an integer.

bug: 30972906
bug: 63920015

Test: builds

Change-Id: I7f10c43dd916ca2d3b9b5141f17261eb7b64f49a
2017-09-12 15:54:23 +01:00
Hugo Benichi
f562ac34a5 Connectivity metrics: collect NFLOG wakeup events
This patch stores NFLOG packet wakeup events sent by Netd to the system
server into a ring buffer inside NetdEventListenerService. The content
of this buffer is accessible by $ dumpsys connmetrics or $ dumpsys
connmetrics list, and is added to bug reports.

The wakeup event buffer stores currently uid and timestamps.

Bug: 34901696
Bug: 62179647
Test: runtest frameworks-net, new unit tests
Change-Id: Ie8db6f8572b1a929a20398d8dc03e189bc488382
2017-09-12 10:02:13 +09:00
tiansiming
f58793c5a1 Fix AddAccountSettings memory leak
The memory leak will always occur in AddAccoutSettings
when a null Bundle is returned in the addAccount we implement.

Bug: https://issuetracker.google.com/issues/65322371
Test: Install the app through the github i have offered in above link,
then press the "Test" item in ChooseAccountActivity (adb shell am start -n
'com.android.settings/.accounts.ChooseAccountActivity') serveal times.
Check the activity number by "adb shell dumpsys meminfo com.android.settings".

Change-Id: I3f139fe059e6094e9e5bf1660946ebc8bab6d090
Signed-off-by: tiansiming <tiansiming@xiaomi.com>
2017-09-11 10:19:11 +08:00
Vinay Kalia
8157ab2a0e Merge "Update ScanSettings documentation for scan modes" 2017-09-08 19:50:36 +00:00
Rubin Xu
2fc72f72e5 Refactor CompareResult<> class and its call sites
Move all corner case logic from call sites to CompareResult's implementation,
add a constructor to directly do the comparison.

Test: runtest frameworks-core -c android.net.LinkPropertiesTest
Change-Id: I95bba82ec38d295b18c49c025dffab5f17271cbd
2017-09-08 13:27:58 +01:00
Charles He
5da5ae3b96 Opt-out for always-on VPN: rename API.
Rename the opt-out flag in AndroidManifest to
SERVICE_META_DATA_SUPPORTS_ALWAYS_ON
as directed by the API Council.

Bug: 64331776
Bug: 36650087
Test: runtest --path java/com/android/server/connectivity/VpnTest.java
Change-Id: I24326fad7a89083a2409134640bda81ee0359d08
Merged-In: I24326fad7a89083a2409134640bda81ee0359d08
(cherry picked from commit c57a01c16616f938eaa84ae5349a53efdec6e4cc)
2017-09-08 10:47:34 +01:00
Charles He
a0a87e8108 Opt-out for always-on VPN
Always-on VPN is a feature introduced in N. Since then, all VPN apps
targeting N+ are assumed to support the feature, and the user or the DPC
can turn on / off always-on for any such VPN app. However, a few VPN
apps are not designed to support the always-on feature. Enabling
always-on for these apps will result in undefined behavior and confusing
"Always-on VPN disconnected" notification.

This feature provides a new manifest meta-data field through which a VPN
app can opt out of the always-on feature explicitly. This will stop the
always-on feature from being enabled for the app, both by the user and
by the DPC, and will clear its existing always-on state.

A @hide API is provided to check whether an app supports always-on VPN.
Documentation is updated to reflect the behavior change.

Bug: 36650087
Test: runtest --path java/com/android/server/connectivity/VpnTest.java
Test: cts-tradefed run cts --module CtsDevicePolicyManagerTestCases --test 'com.android.cts.devicepolicy.MixedDeviceOwnerTest#testAlwaysOnVpnUnsupportedPackage'
Test: cts-tradefed run cts --module CtsDevicePolicyManagerTestCases --test 'com.android.cts.devicepolicy.MixedDeviceOwnerTest#testAlwaysOnVpnUnsupportedPackageReplaced'
Test: cts-tradefed run cts --module CtsDevicePolicyManagerTestCases --test 'com.android.cts.devicepolicy.MixedProfileOwnerTest#testAlwaysOnVpnUnsupportedPackage'
Test: cts-tradefed run cts --module CtsDevicePolicyManagerTestCases --test 'com.android.cts.devicepolicy.MixedProfileOwnerTest#testAlwaysOnVpnUnsupportedPackageReplaced'
Test: cts-tradefed run cts --module CtsDevicePolicyManagerTestCases --test 'com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testAlwaysOnVpnUnsupportedPackage'
Test: cts-tradefed run cts --module CtsDevicePolicyManagerTestCases --test 'com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testAlwaysOnVpnUnsupportedPackageReplaced'

Change-Id: I477897a29175e3994d4ecf8ec546e26043c90f13
Merged-In: I477897a29175e3994d4ecf8ec546e26043c90f13
(cherry picked from commit 3673863f3b2ec692201b7fb3089a1c05973e08e4)
2017-09-08 10:18:36 +01:00
Hugo Benichi
faf8348ad3 NetworkStats: more robust subtraction for deltas
This patch ensures that subtract() between two NetworkStats object will
return a delta with no negative entries in all cases.

When the stats delta contains some negative values, there are clamped to
0. Some logging is added when this happens.

This is what's expected by NetworkStatsHistory#recordData().

Bug: 64365917
Bug: 65439160
Test: runtest frameworks-net
Merged-In: I16e97e73f600225f80e0ce517e80c07c6f399196
Merged-In: I2ac0bc3914cb65ae8ee27921856d698dc59624b2
Merged-In: I67d5dc4b52b254748ff17fe1e16c2eeb1d03c30d
Merged-In: Ib488fb034f72c92f19916490981342a3ef2eb33b

(cherry picked from commit ad5e2827ead7fa8ebafc291ceb6b4672e70c1775)

Change-Id: Ic86b65a65a2517c871221f8784088ec1de18f534
2017-09-08 13:39:44 +09:00
Rubin Xu
981228be38 Merge "Always add local subnet routes to the interface's routing table" 2017-09-07 12:12:09 +00:00
Rubin Xu
1bb5c0818f Always add local subnet routes to the interface's routing table
For some networks such as mobile data connections, its LinkProperties
does not contain routes for the local subnet so no such route is added
to the interface's routing table. This can be problematic especially
if the device is in VPN lockdown mode where there exists high-priority
PROHIBIT routing rule which in turn blocks the network's default gateway
route from being added (next hop address hitting the prohibit rule).

We fix this by patching LinkProperties to always include direct connected routes
when they are received by ConnectivityService. This has the added advantage that
when apps get LinkProperties, they see the directly connected routes as well.

Bug: 63662962
Test: runtest frameworks-core -c android.net.LinkPropertiesTest
Test: runtest frameworks-services -c com.android.server.ConnectivityServiceTest
Test: Start with device with mobile data, set up ics-OpenVPN in always-on
      lockdown mode. Turn off mobile data then turn it back on, observe
      mobile data connectivity is restored and VPN successfully reconnects.
Change-Id: I35b614eebccfd22c4a5270f40256f9be1e25abfb
2017-09-07 10:50:20 +01:00
Jack He
16eeac356c Bluetooth: Thread-safe binder invocation
* Binder object may become null between null check and actual invocation
  if using a instance private variable assignable by service connection
  callbacks
* The solution to this problem without locking is to assign existing
  binder variable to a local final variable before the null check
* Any further invocation to a disconnected binder object will result in
  RemoteException that is caught by the try-catch block
* Read and write to volatile variable is always atomic and hence thread-safe
* Removed unnecessary synchronization in BluetoothAdapter constructor
* Private mConnection objects should be final
* Simplfied several return statements where booleans can be returned
  directly
* Removed unnecessary catches for NPE since there won't be any

Bug: 64724692
Test: make, pair and use devices, no functional change
Change-Id: Ifc9d6337c0d451a01484b61243230725d5314f8e
2017-09-06 00:09:47 +00:00
Vinay Kalia
958154b5e2 Update ScanSettings documentation for scan modes
SCAN_MODE_LOW_POWER is enforced for applications running
in background.

Test: BLE scanning applications.
BUG: 38198694
BUG: 62491228
Change-Id: Ib2b6c297298e05f1b088411e94cfe4789dde0821
2017-09-05 13:51:58 -07:00
Vinay Kalia
875d27e45e Update documentation for startScan
With change c4a1e1, unfiltered BLE scans are stopped on screen off
and resumed when screen is turned back on. This is done to save power.
This change updates the documentation accordingly.

BUG: 62264269
Test: Documentation update.
Change-Id: I2d8e9f9f122f978c4d4f59d4139cb51cd4e4a123
2017-09-05 11:52:35 -07:00
Hugo Benichi
e062ae07f9 Network Service Discovery test: properly release resources
Bug: 32561414
Bug: 62918393
Bug: 62044295
Test: runtest frameworks-net
Change-Id: If23993b5e391947ecbdc01677f0a643144794b2b
2017-09-02 14:54:29 +09:00
Treehugger Robot
111c955d1d Merge changes I7218f17a,I96b7340a
* changes:
  ResourcesManager: correct @NonNull -> @Nullable
  AAPT2: Allow <overlay> in AndroidManifest.xml
2017-08-31 21:27:42 +00:00
Mårten Kongstad
7a242216a9 ResourcesManager: correct @NonNull -> @Nullable
To clear all overlay packages, the caller of
ResourcesManager#applyNewResourceDirsLocked will pass in null as the
second argument. Fix typo where the argument's annotation misspelled
@Nullable as @NonNull.

Change-Id: I7218f17ac8f121924e722d3e00d3ebdc4d6f3382
2017-08-31 14:50:10 +02:00
Andreas Gampe
a90534b551 Frameworks: Clean up SystemProperties
Clean up SystemProperties.java. Add annotations.

Clean up SystemProperties.cpp. Refactor for proper C++11.
Make sure C-string key construction is properly reused. Use
android::base functionality for actual reading.

Fix the test script to refer to the right location. Add some
test coverage.

(cherry picked from commit 2e6b9cb56320a86f0c33da890f667e5c76c8285d)

Test: m
Test: frameworks/base/core/tests/systemproperties/run_core_systemproperties_test.sh --rebuild
Merged-In: I490577370da985f600fb1117e3c818d3f68bad5f
Change-Id: I490577370da985f600fb1117e3c818d3f68bad5f
2017-08-30 18:37:48 -07:00