Commit Graph

62375 Commits

Author SHA1 Message Date
Jerry Zhang
11dc0eccfb Merge "Modify UsbDeviceManager stack to allow MtpServer to use FunctionFS drivers." am: 1975240f17 am: 830874dbe7
am: 88672d7d29

Change-Id: Ic083ac68e2a6acaa211cfb8baaf3b9ea0bbe47e2
2016-12-13 00:42:47 +00:00
Jerry Zhang
88672d7d29 Merge "Modify UsbDeviceManager stack to allow MtpServer to use FunctionFS drivers." am: 1975240f17
am: 830874dbe7

Change-Id: I930f006ffd7a429379638aa4f8268ed443a3696b
2016-12-13 00:37:12 +00:00
Hugo Benichi
a948fb6bdc DO NOT MERGE NetworkMonitor metrics: add first validation information
am: dd22982e25

Change-Id: I9540a8357fd44cfcb17b244c66e5883f3a1a100b
2016-12-13 00:34:19 +00:00
Jerry Zhang
830874dbe7 Merge "Modify UsbDeviceManager stack to allow MtpServer to use FunctionFS drivers."
am: 1975240f17

Change-Id: I4b6532719b848ba4b595c8069ecbbd42e855382b
2016-12-13 00:26:33 +00:00
Jerry Zhang
1975240f17 Merge "Modify UsbDeviceManager stack to allow MtpServer to use FunctionFS drivers." 2016-12-13 00:12:04 +00:00
sghuman
3339d5b120 Merge "Fix erroneous constructor in ScoredNetwork.java" am: 9d55f43719 am: eaed9ef0b7
am: 60a850b670

Change-Id: I2c3de5b2cb0d60fc4aef08256939b50e67d7aa53
2016-12-12 23:18:31 +00:00
sghuman
60a850b670 Merge "Fix erroneous constructor in ScoredNetwork.java" am: 9d55f43719
am: eaed9ef0b7

Change-Id: I0314c02497dcabd6f3fa1caeb665ff5ecb9a0f59
2016-12-12 23:12:36 +00:00
sghuman
eaed9ef0b7 Merge "Fix erroneous constructor in ScoredNetwork.java"
am: 9d55f43719

Change-Id: I6f24c92a9638f91197a4d17bfdc3fbeeede3daf4
2016-12-12 23:07:22 +00:00
Sundeep Ghuman
23f98ebe33 Fix erroneous constructor in ScoredNetwork.java
Test: Unit tests in ag/310934.
Change-Id: I0075b15f59796872ea9779c04373563607d2f883
2016-12-12 14:36:03 -08:00
Marie Janssen
47e1f497c0 Merge "DO NOT MERGE Add Bluetooth toggle prompts - framework" 2016-12-12 21:27:23 +00:00
Jeff Sharkey
8ad8c65c62 Merge "Catch all exceptions from installd, log codes." am: 9a10ca3f4c am: 6f7b136b40
am: 5226bbb5a6

Change-Id: I3a3903c4dfb9113bf9549504a1d9859fb6ee5687
2016-12-12 19:55:17 +00:00
Jeff Sharkey
5226bbb5a6 Merge "Catch all exceptions from installd, log codes." am: 9a10ca3f4c
am: 6f7b136b40

Change-Id: Ia62a8a11907fe5dd4e524fbe181a094500248850
2016-12-12 19:48:53 +00:00
Jeff Sharkey
6f7b136b40 Merge "Catch all exceptions from installd, log codes."
am: 9a10ca3f4c

Change-Id: Iee50cdea3115ff868f8ae29b7e0d0ab590a7cc34
2016-12-12 19:42:22 +00:00
Jerry Zhang
bb598ee16f Modify UsbDeviceManager stack to allow MtpServer to use FunctionFS drivers.
Functionfs requires MtpServer to write descriptors before the device can be
configured. This adds a new configure call that will occur only when
functions are changed (new argument added to updateUsbStateBroadcast for this)
and be called after sys.usb.config is changed but before the waitForState
call to ensure compatibility with configfs devices.

Bug: 30976142
Change-Id: I7e94a5847d3b19c0fd75139e1b15a3f2a1cea01d
Test: Manual
2016-12-12 11:05:32 -08:00
Svetoslav Ganov
c2ac5bde6f DO NOT MERGE Add Bluetooth toggle prompts - framework
If permission review is enabled toggling bluetoth on or off
results in a user prompt to collect consent. This applies
only to legacy apps, i.e. ones that don't support runtime
permissions as they target SDK 22.

Also added a configuration resource which controls whether
permission review mode is enabled. By default it is not and
an OEM can change this via an overlay. For now we also keep
the old mechanism to toggle review mode via a build property
which is still used and will be removed when clients have
transitioned.

bug:28715749
Change-Id: I77bca2305f9d0f20034b2c8fc5b58e0565d5e617
2016-12-12 09:50:24 -08:00
Jeff Sharkey
447a3ac16b Catch all exceptions from installd, log codes.
Now that installd is throwing both SecurityException and
IllegalArgumentException, it's time that we turned all these
into InstallerException.

Also extend ServiceSpecificException to include the contained
errorCode value when printing.

Test: builds, boots, apps install/uninstall fine
Bug: 13758960, 30944031
Change-Id: Ic9c1e99ae87f4442402ef528bf352c7978572c85
2016-12-12 10:16:32 -07:00
Fyodor Kupolov
ea3345d6a6 [DO NOT MERGE] Switch to using UMS.mUserStates
am: 7a1e682794

Change-Id: I666e7fe9602198b450c324b36d1ecebde8f1aedb
2016-12-12 17:15:44 +00:00
Jeremy Joslin
5364e2b82b Merge "Update registerNetworkScoreCache() to accept a filter type." am: a511a07fa3 am: 4150ec18e9
am: 9f38345a08

Change-Id: I13f01dbfa300463a34c34d7c49f3dc97e42391d8
2016-12-10 00:16:39 +00:00
Jeremy Joslin
9f38345a08 Merge "Update registerNetworkScoreCache() to accept a filter type." am: a511a07fa3
am: 4150ec18e9

Change-Id: I589bead5cf4e9f57f21c234d7d0b5d62cdb1e2b3
2016-12-10 00:11:12 +00:00
Jeremy Joslin
4150ec18e9 Merge "Update registerNetworkScoreCache() to accept a filter type."
am: a511a07fa3

Change-Id: I51983da8fe63db15d9b38e3ebe4a20cb95cb5f13
2016-12-10 00:06:37 +00:00
Fyodor Kupolov
7a1e682794 [DO NOT MERGE] Switch to using UMS.mUserStates
UserManager.isUserUnlocked/isUserRunning/isUserUnlockingOrUnlocked now
return state from UMS.mUserStates that is pushed from ActivityManager.

Test: create managed profile using TestDPC and check Launcher3
Test: manually create unstarted managed profile and check launchers
Bug: 33232933
Change-Id: I6b619ba1880188eabdd6e3e4cc7eb60d3a22a977
2016-12-09 21:23:57 +00:00
Doris Liu
046f615de8 Add API info about Keyframe and PropertyValuesHolder
am: 21b93c1f66

Change-Id: Id0e4795ad4a2aaa98dac85dd3f7ef18ab80b3f9c
2016-12-09 21:19:59 +00:00
Jeremy Joslin
823db059e4 Update registerNetworkScoreCache() to accept a filter type.
Defined a new IntDef in NetworkScoreManager named CacheUpdateFilter
with 3 values. Caches must be registered with a filter value and will
only receive updates based on their registered filter. Actual
filtering implementation will follow.

Test: runtest frameworks-services -c com.android.server.NetworkScoreServiceTest
BUG: 32912120
Change-Id: I3ce0bee171e6405176358479fa8a532fd5193824
Merged-In: I8940e0ed1a7bbcb5a81fb3b6a7fafe4fbbc33875
2016-12-09 13:15:15 -08:00
Paul Duffin
0e4fc20971 Merge "Move android.test classes from core/java to legacy-test/src" am: 2761ed124a am: 28b617bdea
am: 7e28011fea

Change-Id: I075483114837003014a68614ce9f55a5d199ec85
2016-12-09 15:15:06 +00:00
Paul Duffin
7e28011fea Merge "Move android.test classes from core/java to legacy-test/src" am: 2761ed124a
am: 28b617bdea

Change-Id: I83a6ce6c329e7eb18ee90689682c30d4a73d7f8e
2016-12-09 15:10:10 +00:00
Paul Duffin
28b617bdea Merge "Move android.test classes from core/java to legacy-test/src"
am: 2761ed124a

Change-Id: I0009b93ff096456d7f5fd5f83e71fd4b9bff31db
2016-12-09 15:05:06 +00:00
Paul Duffin
2761ed124a Merge "Move android.test classes from core/java to legacy-test/src" 2016-12-09 14:56:37 +00:00
Hugo Benichi
dd22982e25 DO NOT MERGE NetworkMonitor metrics: add first validation information
This patch adds first validation information to:
  - ValidationProbeEvent, by extending the probe_type int field of to
    also include a bit indicating if the probe was part of a first
    validation attempt or not.
  - NetworkMonitorEvent, by defining new contants for the event_type
    field.

Test: $ runtest frameworks-net
      + manually generating events and inspecting the
        output of $ adb shell dumpsys connmetrics list
Bug: b/32198726

(cherry picked from commit 147aa6d53b)

Change-Id: I7ed954dee006f8804a5bf8940eec180714bddd07
2016-12-09 16:14:41 +09:00
Stephen Chen
963e8ddf6d DO NOT MERGE: Implement metered tracking for NetworkStats summary queries.
Dependent on ag/1550196 where API is defined.

Bug: 31015360
Bug: 26545374
Test: runtest --path
frameworks/base/core/tests/coretests/src/android/net/NetworkStatsTest.java,
other test classes.

(cherry picked from commit 2514787897)

Change-Id: I46da93ba4afa968facf98f7c3d844fd0c469095a
2016-12-09 13:59:33 +09:00
Hugo Benichi
21680fd25d DO NOT MERGE: NetworkMonitor metrics: add first validation information
This patch adds first validation information to:
  - ValidationProbeEvent, by extending the probe_type int field of to
    also include a bit indicating if the probe was part of a first
    validation attempt or not.
  - NetworkMonitorEvent, by defining new contants for the event_type
    field.

Test: $ runtest frameworks-net
      + manually generating events and inspecting the
        output of $ adb shell dumpsys connmetrics list
Bug: b/32198726

(cherry picked from commit 147aa6d53b)

Change-Id: Ie7a62c4f62a13ce52806d3adaa9e627cb246073c
2016-12-09 13:59:20 +09:00
Jeff Sharkey
dda938a698 DO NOT MERGE: Switch over to new "time.android.com" NTP pool.
Also add logging to measure success/failure details.

Test: builds, boots, and NTP fix obtained
Bug: 32969463

(cherry picked from commit d3f689bf14)

Change-Id: I7da416099ae903fd92beb516251ef4e51673eecf
2016-12-09 13:59:18 +09:00
Stephen Chen
dadf6caf9f DO NOT MERGE: Define API for metering network stats buckets.
This is a continuation of b/26545374, since now we can also set the
metered bit with NetworkScorer. The tracking of metered state changes
will be implemented in a seperate CL.

Bug: 31015360
Bug: 26545374
Test: N/A

(cherry picked from commit 9ac251d116)

Change-Id: I6a2fcc8577d62daa8823dff9e0128a5cf39ede7b
2016-12-09 13:59:17 +09:00
Jeremy Joslin
ffe5a46b3e DO NOT MERGE: VPN network stat accounting changes.
Properly account for VPN apps that make heavy use of the tun
interface. Prior to this change a VPN app could be incorrectly charged
for more data than it actually used if it sent more traffic through
the tun interface than the underlying interface.

This change excludes VPN app traffic on the tun interface from the
adjustment pool and doesn't redistribute traffic to the VPN app.
Instead all of the redistributed traffic is deducted from the VPN app
which effectively represents any overhead incurred by the VPN app.

BUG: 30557871

(cherry picked from commit 8b436d865c)

Change-Id: I06f01aa8fe5fdc06b2d36cfb9c68feb244c2e5de
2016-12-09 13:42:29 +09:00
Hugo Benichi
ce765b7a51 DO NOT MERGE: ConnectivityThread: use lazy holder idiom
This patch changes the way that the ConnectivityThread is lazily
instantiated by using the "lazy initialization holder class idiom".

The first code point that tries to obtain a reference to the unique
ConnectivityThread instance will trigger the creation of the Singleton
class, which will guarantee a thread-safe initialization of the static
INSTANCE field inside Singleton according to the language specs.

This is the Item #71 of Effective Java.

The unique static instance of ConnectivityThread is not stored directly
inside ConnectivityThread class but is stored in a static nested class.
This is to avoid triggering the creation of that unique instance when
Zygote does class preloading at phone startup. Otherwise this would lead
to Zygote creating a new OS thread during preloading, which is a fatal
error.

Test: frameworks-wifi tests pass
Bug: 26749700
Bug: 28537383
Bug: 32130437

(cherry picked from commit c4fe5d373c)

Change-Id: If13b363889a8e9396273a90c3d9f9421a48aecbc
2016-12-09 13:42:26 +09:00
Hugo Benichi
1853f78d76 DO NOT MERGE: ConnectivityManager: use ConnectivityThread looper
This patch removes the static singleton looper used by
ConnectivityManager and instead uses the common ConnectivityThread.

This allows to removes the static atomic counter used to track
the number of registered NetworkCallback in ConnectivityManager, because
the looper is not turned off anymore when no callbacks are registered.

Also an overloaded version of sendRequestForNetwork is added taking as a
new parameter a Handler. This will allow to overload various callback
and request related API calls with user provided Handlers.

Test: ConnectivityServiceTest passes
Bug: 26749700
Bug: 28537383
Bug: 32130437

(cherry picked from commit 7724cdd8b9)

Change-Id: If956addbf8e7b11b36a4b966de7fca00e8f362c1
2016-12-09 13:42:24 +09:00
Hugo Benichi
4983e55853 DO NOT MERGE: ConnectivityManager: a simpler CallbackHandler
This patch simplifies CallbackHandler in the following way:
  - CallbackHandler directly uses the static references to
    sNetworkCallback and sCallbackRefCount. This allows to remove
    instance fields in CallbackHandler.
  - CallbackHandler does not have a reference to ConnectivityManager
    anymore
  - CallbackHandler.getObject() is now generic in a type-safe way.

Test: ConnectivityServiceTest passes
Bug: 28537383
Bug: 32130437

(cherry picked from commit d42650faaa)

Change-Id: I1b5fe2a361b5f623a8310ae698497c83d72f3034
2016-12-09 13:42:20 +09:00
Philip P. Moltmann
29154b000f DO NOT MERGE: Indicate the NsdServiceInfo attributes are only filled in for a resolved service.
Fixes: 28530428

(cherry picked from commit 7d5da4b044)

Change-Id: If2bfc06589adb361f11b89cd5923cb5c255cb680
2016-12-09 13:42:09 +09:00
Jeremy Klein
c8e4cc8e99 DO NOT MERGE: Add a null check for the OnStartTetheringCallback.
This avoids a NullPointerException when trying to call the callback
and gives a more readable error message.

(cherry picked from commit 5f277e1667)

Change-Id: Ia419ff68ef10f308f9e44be47420e27099ee6070
2016-12-09 13:42:02 +09:00
Hugo Benichi
f99a33a1b4 DO NOT MERGE: IpConnectivityMetrics: rate limit ApfProgramEvents
This patch uses the previously introduced TokenBucket to rate limit
ApfProgramEvents, still allowing for burst of ApfProgramEvents when a
new interface is set up (due to ipv4 provisioning, multicast lock, ipv6 RAs
triggering new APF program events in short amounts of time).

Test: new test in IpConnectivityMetricsTest
Bug: 1550402

(cherry picked from commit e1c173d224)

Change-Id: Idb640dec13ba64180985544b9709a586af66eb6e
2016-12-09 11:21:31 +09:00
Hugo Benichi
8c9e4b68f0 DO NOT MERGE: IpConnectivityMetrics reads buffer size in settings
Test: IpConnectivityMetricsTest passes. Also manually changed the new
setting and verified the buffer size is as expected after flushing the
buffer.
Bug: 32198637

(cherry picked from commit 05686dbb6b)

Change-Id: Iefbeac3a688b260fb3f92dfe0bfd9db28e26749d
2016-12-09 11:21:26 +09:00
Svetoslav Ganov
4d97c73eda Fix vulnerability in MemoryIntArray am: 1181f448c1 am: d08cf2b071 am: 385277305e
am: 69b9db8c5d

Change-Id: I06ce1c69064ff8c2c346877b9f834d412eba7829
2016-12-09 01:57:20 +00:00
Svetoslav Ganov
69b9db8c5d Fix vulnerability in MemoryIntArray am: 1181f448c1 am: d08cf2b071
am: 385277305e

Change-Id: I3d7222359d095d5e53f3e6fbfeda10352fa43f76
2016-12-09 01:52:56 +00:00
Svetoslav Ganov
ff112f6ad2 Fix vulnerability in MemoryIntArray am: 1181f448c1 am: d08cf2b071
am: 385277305e

Change-Id: Ie90f6504f26526256671b057dfbb0c93e8c193c5
2016-12-09 01:52:48 +00:00
Svetoslav Ganov
385277305e Fix vulnerability in MemoryIntArray am: 1181f448c1
am: d08cf2b071

Change-Id: I436a09f1e49626fa45a7f6cc6bff92b2e5486a97
2016-12-09 01:48:16 +00:00
Svetoslav Ganov
d08cf2b071 Fix vulnerability in MemoryIntArray
am: 1181f448c1

Change-Id: I4217066be49bb9525e945f110c22eb864ec6c212
2016-12-09 01:43:52 +00:00
Svetoslav Ganov
1181f448c1 Fix vulnerability in MemoryIntArray
MemoryIntArray was using the size of the undelying
ashmem region to mmap the data but the ashmem size
can be changed until the former is memory mapped.
Since we use the ashmem region size for boundary
checking and memory unmapping if it does not match
the size used while mapping an attacker can force
the system to unmap memory or to access undefined
memory and crash.

Also we were passing the memory address where the
ashmem region is mapped in the owner process to
support cases where the client can pass back the
MemoryIntArray instance. This allows an attacker
to put invalid address and cause arbitrary memory
to be freed.

Now we no longer support passing back the instance
to the owner process (the passed back instance is
read only), so no need to pass the memory adress
of the owner's mapping, thus not allowing freeing
arbitrary memory.

Further, we now check the memory mapped size against
the size of the underlying ashmem region after we do
the memory mapping (to fix the ahsmem size) and if
an attacker changed the size under us we throw.

Tests: Updated the tests and they pass.

bug:33039926
bug:33042690

Change-Id: Ibf56827209a9b791aa83ae679219baf829ffc2ac
2016-12-09 00:08:33 +00:00
Bill Napier
cf8f7b3aed Revert "Fix vulnerability in MemoryIntArray am: a97171ec49" am: 43966dafb3 am: 498547ec6c am: ef435f6780
am: 1c47e9e8f0

Change-Id: I7077f444b348e7ef31378c1a2ae6765dc6ad82ad
2016-12-08 22:49:06 +00:00
Bill Napier
1c47e9e8f0 Revert "Fix vulnerability in MemoryIntArray am: a97171ec49" am: 43966dafb3 am: 498547ec6c
am: ef435f6780

Change-Id: I6b879ca7e2c7c48885dcdbf791afcd914869df24
2016-12-08 22:40:09 +00:00
Bill Napier
31f2e91892 Revert "Fix vulnerability in MemoryIntArray am: a97171ec49" am: 43966dafb3 am: 498547ec6c
am: ef435f6780

Change-Id: Ib5c8b17acafa4a2c55666c2dbc1591bbbeac51a7
2016-12-08 22:40:05 +00:00
Bill Napier
ef435f6780 Revert "Fix vulnerability in MemoryIntArray am: a97171ec49" am: 43966dafb3
am: 498547ec6c

Change-Id: I8874250d553a7271305efc3f027c933e4aad3b1d
2016-12-08 22:34:34 +00:00