6024 Commits

Author SHA1 Message Date
Steven Moreland
2f379ca7d9 Cleanup hwbinder getService code.
- Remove memory leaks.
- Make sure proper errors are getting thrown.
- Avoid SIGABRT

Test: hidl_test_java
Change-Id: Ia5680fd0ebf83d0f174bf0d8109bf60327be5f9d
2017-02-01 10:42:23 -08:00
George Burgess IV
974403a2c5 Fix a use-of-uninitialized-value warning
This is the result of running ./gen after applying
I90bea0c94cf8d7f92a0d9a4db4e64e7e563bfb09.

Bug: None
Test: Still builds; warning is now gone.
Change-Id: Ibcd5e8dcec96406b529c5790ba0a2822dace25c2
2017-01-31 16:23:25 -08:00
Tomasz Wasilczyk
aee690ffad Use the new radio_metadata wrapper for safer memory management.
Bug: b/34054813
Test: VTS, manual - both done in internal branch
Change-Id: I5f4962f86b7732e14c2584a562e9737c92310697
2017-01-27 09:40:35 -08:00
Josh Gao
273b886c49 Merge "zygote: don't drop CAP_SYS_PTRACE from the bounding set." 2017-01-25 21:16:58 +00:00
Josh Gao
59972218f8 zygote: don't drop CAP_SYS_PTRACE from the bounding set.
crash_dump needs to acquire CAP_SYS_PTRACE to be able to ptrace
processes with capabilities. selinux should hopefully be sufficient for
restricting ptrace to processes that should do it.

Bug: http://b/34694637
Test: debuggerd `pidof system_server`
Change-Id: If46f0b9baa54529780f7767f309f76b102a42ab4
2017-01-25 12:03:02 -08:00
George Burgess IV
2df0c67152 Fix a use-of-uninitialized-value warning.
Caught by clang's static analyzer:
frameworks/base/core/jni/android_hardware_SoundTrigger.cpp:660:20:
warning: Assigned value is garbage or undefined
        nHandle[0] = (jint)handle;

Given that we return an error code anyway, we can just set it to 0 and
move on.

Bug: None
Test: Still builds; static analyzer doesn't complain.
Change-Id: I9a5be562a0d96fd6c48bb98eca0867fc754bba63
2017-01-24 15:48:28 -08:00
Josh Gao
3ce369601e Switch android.os.Debug to libdebuggerd_client.
Bug: http://b/30705528
Test: m
Change-Id: Iac3860d0e63660b91a4b08075fca8a4a222ac913
2017-01-17 13:55:20 -08:00
Martijn Coenen
c5e5442acd Merge "Add nullable parameter to readEmbeddedBuffer." 2017-01-16 14:48:11 +00:00
Martijn Coenen
14fae06b60 Add nullable parameter to readEmbeddedBuffer.
To support reading embedded buffers that can be
nullptr (currently only in empty hidl_vec).

Bug: 34255213
Test: hidl_test_java
Change-Id: I72028f580b7863b6bfeb31a5c0f43deed36dfd64
2017-01-13 14:17:12 +01:00
Yifan Hong
b072d4d9d9 BBinder -> BHwBinder.
Test: mma
Test: croot && make

Bug: 33554989
Change-Id: I76ec5cd29fc510ba5b518f59dd83a38ad6675418
2017-01-12 14:43:41 -08:00
Mark Salyzyn
2225a0640b Merge "Replace cutils/log.h and log/logger.h with android/log.h or log/log.h (part deux)" 2017-01-12 15:18:26 +00:00
Treehugger Robot
34ed84d4eb Merge "Use new read(Embedded)Buffer APIs." 2017-01-12 10:17:40 +00:00
Treehugger Robot
d8384b5c15 Merge "BpBase -> BpHwBase" 2017-01-12 01:50:58 +00:00
Mark Salyzyn
96bf5985d5 Replace cutils/log.h and log/logger.h with android/log.h or log/log.h
(part deux)

Test: compile
Bug: 26552300
Bug: 31289077
Change-Id: I7417936c4d3666608fccfe51a312c90ecefba2fb
2017-01-11 15:30:30 -08:00
Mark Salyzyn
e7fcbcb991 Merge "Replace cutils/log.h and log/logger.h with log/log.h" 2017-01-11 15:24:11 +00:00
Martijn Coenen
24c82279fe Use new read(Embedded)Buffer APIs.
Bug: 34134129
Test: mma, hidl_test_java
Change-Id: I13b3841778d5df4e7c37760610712a26c68896d6
2017-01-11 13:33:19 +01:00
Andreas Gampe
8dfa178efb Zygote: Add fdsToIgnore
Add file descriptors that should be ignored in the file descriptor
table check.

Use this to ignore the pipe file descriptors when starting an app
with invoke-with (wrapper).

Bug: 32607405
Test: m
Test: Device boots
Test: Apps start
Test: adb root && adb shell setprop wrap.com.android.calculator2 logwrapper && adb shell am start -S -n com.android.calculator2/.Calculator
Change-Id: I4a30dfc9382d3172cc815bd41b17a123799354f6
2017-01-10 16:55:34 -08:00
Robert Sesek
54e387ddbe Dynamically add the webview_zygote's preloaded APK to the zygote FD whitelist.
This refactors the whitelist to be a class, rather than just a static C array.
The whitelist can then be augmented dynamically when the package path is known
in the webview_zygote.

Test: m
Test: sailfish boots
Test: Enable Multi-process WebView in developer options, perform a search in GSA.

Bug: 21643067
Change-Id: Ia1f2535c7275b42b309631b4fe7859c30cbf7309
(cherry picked from commit 061ee3088a79ab0e07d37d1c0897d51422f29c4e)
2017-01-10 11:44:56 -08:00
Robert Sesek
8225b7c951 Split core/jni/fd_utils-inl.h into a .h/.cpp pair.
(cherry picked from commit 44afe8be8f654192dc436a9c4238a925c22b14bf)

Test: m
Test: sailfish boots

Change-Id: I9ca93f31f6c20b702b2207333a9d56f6592630b0
2017-01-10 11:41:01 -08:00
Narayan Kamath
f701ba36b3 Zygote: Additional whitelisting for legacy devices.
On M and below, we provide a blanket whitelist for all files under
"/vendor/zygote_whitelist". This path is whitelisted purely to allow
this patch to be applied easily on legacy devices and configurations.

Note that this does not amount to a loosening of our security policy
because whitelisted files are reopened anyway.

(cherry picked from commit 5e2f7c6229d7191183888d685b57a7d0a2835fce)

Bug: 32691930
Test: manual
Change-Id: If5b53f6f0a707f8d36603c09bfd3f72dbfbbbb99
2017-01-10 11:27:52 -08:00
Narayan Kamath
0ff7ef60f5 Zygote: Additional whitelists for runtime overlay / other static resources.
Partially cherry picked from commit 1c15c635785c64a.

These files are safe to reopen for the same reason that files in
/system/framework are. They're regular files and will not change after
the first zygote fork.

(cherry picked from commit 25cd01cc69fcad34756b00e52a79c0c54178f2e6)

Bug: 32618130
Test: m
Change-Id: I119e0bfcbf397cb331064adf148d92a5cd3ea92f
2017-01-10 11:16:31 -08:00
Yifan Hong
90b6a37bd2 BpBase -> BpHwBase
Test: compiles

Bug: 33554989
Change-Id: I6ed40f4d0ac08876ab804720b193a17b49a93890
2017-01-09 17:58:33 -08:00
Mark Salyzyn
52eb4e01a4 Replace cutils/log.h and log/logger.h with log/log.h
Test: compile
Bug: 26552300
Bug: 31289077
Change-Id: I578b15b48f0fc2807a92abbc69a377c3d2191496
2017-01-09 14:31:34 -08:00
Treehugger Robot
9ec4fec5ca Merge "HwBinder: get/register checked exceptions." 2017-01-06 00:58:17 +00:00
Treehugger Robot
1d8995aa9c Merge "Fix stack-buffer-overflow detected by AddressSanitizer." 2017-01-06 00:17:00 +00:00
Evgenii Stepanov
ab622718f3 Fix stack-buffer-overflow detected by AddressSanitizer.
Bug: 31855186
Test: boot SANITIZE_TARGET=address build
Change-Id: I5c2c64564ccea28e416d66b27af9d86506d622ce
2017-01-05 13:03:07 -08:00
Steven Moreland
c0631d0bb7 HwBinder: get/register checked exceptions.
Bug: 33673120
Test: hidl_test_java
Change-Id: Id19b61b252e756a032ae11f7b59bd8eed82edbe9
2017-01-05 09:20:44 -08:00
Martijn Coenen
52280c38e2 Callback elision for HIDL interfaces.
Test: mma, hidl_test_java
Bug: 31380743
Change-Id: I9a5c8ef0cc6ac3150395a867690ca82ec2bc419f
2017-01-05 08:48:15 +01:00
Treehugger Robot
6c5cc261f8 Merge "Add checked exceptions to HwBinder transact." 2017-01-04 04:58:38 +00:00
Pavlin Radoslavov
44a4ef0aa9 Add a mechanism for configuring the A2DP Source codecs
* Added a new class BluetoothCodecConfig that contains codec-related
  configuration or capabilities: codec type, priority, sample rate,
  bits per sample, channel mode, and codec specific fields.

* Extended the Bluetooth A2DP AIDL interface to get/set the current
  codec configuration

* Added new call handleBluetoothA2dpDeviceConfigChange() to the Media
  Framework that is called when there are changes in the
  Bluetooth A2DP device configuration - e.g., the A2DP codec is changed.

Test: A2DP streaming to headsets, TestPlans/71390
Bug: 30958229
Change-Id: I9a82716cbc2a5efbe77352a031ac80c88f6a2459
2017-01-03 17:52:52 -08:00
Steven Moreland
e62b1f32f3 Add checked exceptions to HwBinder transact.
Bug: 33673120
Test: hidl_test_java
Merged-In: I7b62eb6b066fc24c44ef7e46aaa2a3208c053d11

Change-Id: I7b62eb6b066fc24c44ef7e46aaa2a3208c053d11
2017-01-04 01:13:16 +00:00
Treehugger Robot
9156ccdbb4 Merge "LocalSocketImpl.cpp: Set O_CLOEXEC on received FDs" 2017-01-01 22:28:37 +00:00
Martijn Coenen
727f7bf84f Add (un)linkToDeath support to HwBinder.
This is mostly copied over from binder's existing
death recipient support. The implementation keeps
a list of registered recipients, both for being
able to map a native recipient back to the corresponding
Java recipient, as well as being able to unregister
recipients correctly.

Test: mma, hidl_test_java
Bug: 31632518
Change-Id: Id313fd248be6925056c4ade8298fe5fb04e007cc
2016-12-29 04:22:30 +00:00
Steven Moreland
520d12c53c HwBinder: fail gracefully for device w/o hwbinder
Test: compiles
Change-Id: I03ffd0d7480c5771634977e30ccf02b39f69f8ba
2016-12-21 11:02:49 -08:00
Tim Murray
20375fe124 Fix incorrect FIFO cgroup assignment.
bug 33745094
Test: builds

Change-Id: I46eefc8ea6f17ca3795f4743692ddfea36d5db0f
2016-12-20 14:04:44 -08:00
Nick Kralevich
b0e5079b5d LocalSocketImpl.cpp: Set O_CLOEXEC on received FDs
Set O_CLOEXEC on received file descriptors. This prevents FD leakage
across an exec boundary. Please see the description of O_CLOEXEC in "man
2 open" for the reasons why this is useful.

Test: Device boots and no observed errors.
Change-Id: Id0d9c9d71efb25dacb26d5d98d93fc3b72c1b6ae
2016-12-20 07:14:49 -08:00
Treehugger Robot
d995c94426 Merge changes Ic85892b4,I627e47c6
* changes:
  Make sure Zygote is running at process priority 0 after VM has started.
  Revert "Add boost to increase the load on newly-forked zygote processes."
2016-12-16 22:20:25 +00:00
Torne (Richard Coles)
898fd69451 Add the webview zygote socket to the zygote whitelist.
Allow the webview zygote socket to be open at time of fork, so that
webview renderers can be forked successfully.

(cherry picked from commit a7fcb2bc2a65da3743914727adb0df89a4eb0b66)

Test: WebView functions correctly with multiprocess dev setting enabled
Bug: 21643067
Change-Id: I312846433a43a8e4548cb2f98b96b56acf9f5333
2016-12-16 10:53:35 -08:00
Vitalii Tomkiv
1e52ce48a6 Make sure Zygote is running at process priority 0 after VM has started.
Boosting up zygote priority before VM startup, saves ~450ms of boot time
for N9, 180ms for Nexus 5X.

(cherry picked from commit 5d551a5ac3d13706f62a86842ff6851e1d25213b)

Bug: 28866384
Test: m
Test: Device boots
Change-Id: Ic85892b408e15bbc1de7ce706f113f23974fe478
2016-12-16 09:06:28 -08:00
Todd Kjos
8175f0955a Revert "Add boost to increase the load on newly-forked zygote processes."
This reverts commit 6d43a861d01ef48f37c69f96346a13d23164a585.

(cherry picked from commit 0f2ded62ae3d88ddb732df182c3bfee3e2729018)

Test: m
Test: Device boots
Change-Id: I627e47c6ead4ce2d2bffa923a32a56d06c022df7
2016-12-16 09:05:50 -08:00
Andreas Gampe
c012ae3815 NativeLibraryHelper: Minor fixes
Skip over directories when iterating library files. Ensure correct
temp file naming.

Bug: 33668201
Test: m
Test: Device boots
Test: Manual: Install debuggable and non-debuggable apps
Change-Id: I2f0547e965d9a0c478e333a13b2db02f4eedac2c
2016-12-16 08:23:55 -08:00
Treehugger Robot
541845908c Merge "Move libandroid_runtime headers into frameworks/base/core/jni" 2016-12-16 08:46:59 +00:00
Treehugger Robot
c0cc7c646c Merge "Install all files from the lib directory for debuggable apps" 2016-12-16 00:35:55 +00:00
Martijn Coenen
11ec22ab2a Merge "HwBinder: Remove use of IHw class." 2016-12-15 20:28:49 +00:00
Erik Kline
ade3a8ccb0 Have IpManager track L2-L4 signaling traffic required for IP connectivity.
Test: as follows
    - built and flashed
    - observed logcat
    - observed "dumpsys wifi ipmanager"
    - runtest BlockingSocketReaderTest passes
    - runtest ConnectivityPacketSummaryTest passes
Bug: 21859053
Bug: 26101306
Bug: 31742572
Bug: 31707128
Bug: 33531488

Change-Id: Ibecaf809dcc1813924b25749e8ba8eb2d4bdf114
2016-12-15 19:09:49 +09:00
Colin Cross
71044fe7e5 Move libandroid_runtime headers into frameworks/base/core/jni
Move libandroid_runtime's headers into its source directory, and export
them to modules that link against libandroid_runtime.  Also fixes
one unused-paramter warning that was hidden by the use of -isystem to
include frameworks/base/include.

Bug: 33630870
Test: m -j native
Change-Id: Id6c2561d6c7d82a7ca2d183f11b1d3d3dcb42843
2016-12-14 13:35:40 -08:00
Martijn Coenen
1298711674 HwBinder: Remove use of IHw class.
Note that this is somewhat of a hack, until we properly
solve b/33440494.

Bug: 33440494
Bug: 33173166
Test: mma, hidl_test, hidl_test_java
Change-Id: I7db8eb11c8c9c624f2f5ed11bef6c32f155b5a76
2016-12-12 13:46:07 +01: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 25147878974f82f875062e99cdee85dd33f3f078)

Change-Id: I46da93ba4afa968facf98f7c3d844fd0c469095a
2016-12-09 13:59:33 +09:00
Yifan Hong
1abe6def68 Merge "Check for nullptr when casting IBinder to IBase."
am: 5014028691

Change-Id: I4a3c320351a9afa305a40e3912cc2e968494497c
2016-12-06 15:39:02 +00:00
Yifan Hong
b747440d2f Check for nullptr when casting IBinder to IBase.
Test: compiles

Bug: 33307202
Change-Id: I6ef880188e2f43766e52317244366b2fdd38c728
2016-12-05 13:10:13 -08:00