Commit graph

835 commits

Author SHA1 Message Date
Elliott Hughes
73a6512bab Merge "Remove more documentation for obsolete board configuration." 2017-06-29 23:50:37 +00:00
Elliott Hughes
5dc7736f60 Remove more documentation for obsolete board configuration.
Bug: N/A
Test: builds
Change-Id: I0a4ea974a81aadba1a554072ceff9f243a70be0d
2017-06-29 08:52:49 -07:00
Treehugger Robot
6afbd476ab Merge "Allow SLOG* to vendors" 2017-06-29 03:53:38 +00:00
Jiyong Park
9ffeab85bf Allow SLOG* to vendors
Not only vendor libs, but also Android libs that are marked as
vendor_available are using SLOG*. Since both pure vendor libs and
Android libs available to vendors are using the same liblog headers for
VNDK, SLOG* needs to be visible via the headers.

Bug: 63088165
Test: BOARD_VNDK_VERSION=current m -j ATFWD-daemon
(or any other vendor modules using SLOG*)

Change-Id: Idfb74887a42d2418d3896bfdf5be3b4fc8e4c27f
2017-06-29 10:25:25 +09:00
Elliott Hughes
76a934a459 Remove documentation for obsolete board configuration.
Bug: N/A
Test: builds
Change-Id: I5afbf2da35a7defb12b98bb5387ab7d3eee6f15a
2017-06-28 07:50:00 -07:00
Ben Fennema
acd7b7b0c0 libcutils: fs_config: fix "system/<partition>/" aliasing
Pull prefix checking into fs_config_cmp and make prefix_cmp be a
glorified partial ? strncmp() : strcmp()

Results before:
[ RUN      ] fs_config.system_alias

[ ERROR ] system/core/libcutils/tests/fs_config.cpp:143:: vendor/lib/hw didn't match system/vendor/lib

[ ERROR ] system/core/libcutils/tests/fs_config.cpp:143:: system/vendor/bin/wifi didn't match vendor/bin/wifi

[ ERROR ] system/core/libcutils/tests/fs_config.cpp:143:: system/odm/bin/wifi didn't match odm/bin/wifi

[ ERROR ] system/core/libcutils/tests/fs_config.cpp:143:: system/oem/bin/wifi didn't match oem/bin/wifi
system/core/libcutils/tests/fs_config.cpp:247: Failure
Value of: check_fs_config_cmp(fs_config_cmp_tests)
  Actual: true
Expected: false
[  FAILED  ] fs_config.system_alias (6 ms)

Results after:
[ RUN      ] fs_config.system_alias
[       OK ] fs_config.system_alias (0 ms)

Bug: 62204623
Test: gTest libcutils-unit-test --gtest_filter=fs_config.*
Change-Id: I8282827002816e86ea3014fed29eabf43b837815
Signed-off-by: Ben Fennema <fennema@google.com>
2017-06-26 14:13:52 -07:00
Alex Naidis
2d998ea99b libcutils: Clarify schedboost_enabled()
Commit 795267d4c7 ("Removed cpusets/schedboost build time dependency.")
turned the cpusets and schedtune options into runtime
decisions.

However the kernel option which is mentioned in the
code comment (CONFIG_SCHEDTUNE) is very misleading
as it doesn't exist (CONFIG_SCHED_TUNE does exist)
and it doesn't describe the real functionality of
the method. schedboost_enabled() will still return
false if CONFIG_SCHED_TUNE is set in the kernel but
CONFIG_CGROUP_SCHEDTUNE is not.

So to clarify this, we need to change the comment
to reflect that CONFIG_CGROUP_SCHEDTUNE, which depends
on CONFIG_SCHED_TUNE, is required.

Signed-off-by: Alex Naidis <alex.naidis@linux.com>
2017-06-16 21:30:49 +00:00
Stephen Crane
f5b8e34660 Fix prctl argument type
Although prctl is declared as a varargs function, in actuality it takes
unsigned long arguments (after the first int argument). This patch
ensures that the slack value passed to prctl is correctly sized.

Without this change, the 32-bit ARM compiler places the 64-bit slack
value in registers r2 and r3, but prctl expects the first argument to be
in r1. For kernel versions < 4.6, set_sched_policy has not been
correctly setting the timer slack value in 32-bit ARM code.

Test: Run on bullhead device. Verified assembly of libcutils.so

Change-Id: Ie0e22cbf74a74ff168b257b2e58d0c252449d6c9
2017-06-07 17:25:00 -07:00
Hung-ying Tyan
3346338919 Revert "Load {default,build}.prop from /{system,vendor,odm}/etc/"
This reverts commit 723f1a2b31.

Bug: 62075509
2017-05-25 19:18:17 +08:00
Treehugger Robot
a9aa77d259 Merge "Load {default,build}.prop from /{system,vendor,odm}/etc/" 2017-05-25 02:32:37 +00:00
Hung-ying Tyan
723f1a2b31 Load {default,build}.prop from /{system,vendor,odm}/etc/
/default.prop may be moved to /system/etc/ and renamed as prop.default.
/{system,vendor,odm}/build.prop may be moved to /{system,vendor,odm}/etc/
and renamed as prop.build.
This patch makes property_service load prop.* from the new locations
first. Also replaces NULL with nullptr for C++ cleanup.

Bug: 37815285
Test: Booted pixel phones, checked the locations of prop.*, verified
      symlinks, checked a few properties (via adb shell getprop)
      and manually tested a few apps (Camera, Maps etc).
      ODM is not tested as it does not exist on the tested device.
Change-Id: Id8eeb3c1a5728dd04005dfad4733b8e6336f9093
2017-05-25 08:41:08 +08:00
Scott Randolph
d5d3276482 Add AID_EVS for use by the Automotive EVS system
The EVS HAL and related software stack will use this id when running
daemons that monitor car state, capture and display video, and interact
with users.
Test:  visual inspection

Change-Id: I53404c624933b7f55f1292c041c6c712522ab13b
2017-05-23 12:44:24 -07:00
Mark Salyzyn
2cf243528f libcutils: fs_config: remove aliases
Covered by the code automatically now.

Test: gTest libcutils_test --gtest_filter=fs_config.*
Bug: 37703469
Change-Id: Iad6ba65e023845aaea7a181b277a7383c44bd937
2017-05-18 15:56:54 -07:00
Mark Salyzyn
fa39110a8f libcutils: fs_config test report aliases
Instead of requiring aliases, let's report when we see
system/<partition>/ all by itself, or in the company of the alias
<partition>/.  Report if we see duplicate entries.  Add checking for
overrides as well.  Report any simple corruptions in internal table
or in the override files.

Test: gTest libcutils_test --gtest_filter=fs_config.*
Bug: 37703469
Change-Id: Ia6a7e8c9bc9f553d0c1c313937b511b2073318a9
2017-05-18 15:55:48 -07:00
Mark Salyzyn
2d37797b68 libcutils: fs_config: alias "system/<partition>/" to "<partition>/"
For the known partitions entrenched in the build system: vendor, oem
and odm only. We will alias entries that reference system/<partition>
and <partition>/ so that if either are specified, the rule will apply
to both possible paths.

Test: gTest libcutils-tests
Bug: 37703469
Change-Id: Ida9405cbed323489a3d0599c1645e9be2c7b9d08
2017-05-18 15:54:31 -07:00
Elliott Hughes
d77b537732 libcutils should #include <sys/sysmacros.h>
Bug: https://github.com/android-ndk/ndk/issues/398
Test: builds
Change-Id: I8ca21a74e2856fde09c284aee1343c627d8381e6
2017-05-17 11:36:51 -07:00
Siarhei Vishniakou
cecbc9993d Merge "Adding 'uhid' permission for access to /dev/uhid." 2017-05-11 19:02:32 +00:00
Siarhei Vishniakou
0729dd1edb Adding 'uhid' permission for access to /dev/uhid.
This CL is in support of another CL c/2048848, topic
'Refactor hid command in /frameworks/base/cmds' in
internal master. Adding the permissions for
shell here to access uhid_node as part of the
new 'uhid' group.

Bug: 34052337
Test: Tested on angler, bluetooth mouse works OK.

Change-Id: If9e100aa1262d689fb8adc5c0ce93f157c96399e
2017-05-11 01:28:53 +00:00
Dan Willemsen
0de03b53fc Assume bionic has up-to-date linux/capability.h
The fallback android_filesystem_capability.h doesn't play nicely with
other kernel headers, since it #undef's __user. If we're building with
bionic (either for device or host), we use the same kernel headers, so
just use those.

Bug: 38056396
Test: build with Host_bionic:true
Change-Id: Idc61b6d96d86891164abe71604924638d67aefe2
2017-05-07 12:06:55 -07:00
Greg Hackmann
4a9531d326 AshmemTest: expand ProtTest cases
ashmem buffers start with PROT_EXEC | PROT_READ | PROT_WRITE and can
have bits individually removed (but not added) through the
ASHMEM_SET_PROT_MASK ioctl.  Test that removing prot bits more than once
works, and that the kernel blocks adding prot bits.

Also test that the complementary ASHMEM_GET_PROT_MASK ioctl returns the
expected prot mask.

Test:  /data/nativetest64/libcutils_test/libcutils_test64 \
       --gtest_filter=AshmemTest.* (on hikey)
Test:  /data/nativetest/libcutils_test/libcutils_test32 \
       --gtest_filter=AshmemTest.* (on hikey)

Change-Id: If7b13672547ec4cf6dfd1886197f40f12b2f1c85
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2017-05-05 20:04:12 +00:00
Greg Hackmann
be11d570ec AshmemTest: test lseek() and read() on ashmem fds
ashmem has in-kernel handlers for lseek() and read(), but they aren't
currently being tested.

Add tests for various seeks on a buffer containing holes.  If we land
inside data, then check that we read() the expected data at that offset.

Test:  /data/nativetest64/libcutils_test/libcutils_test64 \
       --gtest_filter=AshmemTest.* (on hikey)
Test:  /data/nativetest/libcutils_test/libcutils_test32 \
       --gtest_filter=AshmemTest.* (on hikey)

Bug: 37254818
Change-Id: I96135a8cea2ce99932e3bc97b5254c95ef6b264a
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2017-05-05 19:58:09 +00:00
Mark Salyzyn
0f6a270d24 libcutils: fs_config internal table alias test
Private interface to permit testing only added to fs_config to
expose android_files and android_dirs.

Make sure that both paths to a partition are specified in fs_config
internal tables.

Test: gTest libcutils-unit-test --gtest_filter=fs_config.*
Bug: 37703469
Change-Id: Ida5fccdb786dc6d67325005d4fdd1fa1ffaef396
2017-05-04 11:41:17 -07:00
Mark Salyzyn
163ecc68c7 libcutils: convert fs_config.cpp
C++ify fs_config.c

Test: gTest libcutils-test
Bug: 37703469
Change-Id: Id48ae22f203ed923942257575296c69b32345ae6
2017-05-03 08:04:35 -07:00
Elliott Hughes
dd6e73f432 Merge "Preserve errno better in native_handle functions." 2017-05-03 01:02:21 +00:00
Elliott Hughes
bf0492a9a1 Preserve errno better in native_handle functions.
So a caller of native_handle_clone can trust errno to be relevant.

Bug: http://b/37215366
Test: builds
Change-Id: I0992f38ad559db4a02fce07123842dbad8e3f473
2017-05-01 21:34:15 -07:00
Treehugger Robot
43e9106410 Merge "libcutils: fs_config.c mark vendor, odm and oem partitions in duplicate" 2017-05-01 21:01:58 +00:00
Erik Staats
d6f8b5f2d4 Merge "Change set_sched_policy to set slack for current thread." 2017-05-01 18:35:30 +00:00
Mark Salyzyn
f0b53d0726 libcutils: fs_config.c mark vendor, odm and oem partitions in duplicate
Cover both direct and symlink indirect paths to the referenced
files in the vendor, odm and oem partitions.

Test: compile and hand-verify properties
Bug: 37703469
Change-Id: I5b3a887e904baee2ac193ac4a73aaaee0bbfdb9f
2017-05-01 16:17:31 +00:00
Elliott Hughes
4c8acafa25 Merge "Remove unused cruft from <cutils/bitops.h>." 2017-04-30 02:45:46 +00:00
Elliott Hughes
0e8810ccbe Remove unused cruft from <cutils/bitops.h>.
Bug: N/A
Test: builds
Change-Id: I5931f2b91b2d64d8e26f9ba092879c14d0ed3622
2017-04-29 10:22:40 -07:00
Erik Staats
d32331fb27 Change set_sched_policy to set slack for current thread.
Change set_sched_policy to use prctl PR_SET_TIMERSLACK if setting the policy
for the current thread and /proc/<tid>/timerslack_ns is not supported by the
kernel.

Bug: 32972117
Test: Verified that libcutils SchedPolicy tests pass.  See details in
testing done comment in
https://android-review.googlesource.com/381303 .
Change-Id: Id70940ed7f9ed94c3d105213f069bf3e5a8d8824
2017-04-26 15:39:26 -07:00
Philip Cuadra
1ac29896b0 Merge "Allow Bluetooth HAL CAP_SYS_NICE" 2017-04-26 16:56:00 +00:00
Erik Staats
b4c4654c7c Change get_sched_policy to check "schedtune" and "cpuset".
get_sched_policy will first attempt to get the policy from the "schedtune"
subsystem cgroup and, if not set, attempt to get the policy from the
"cpuset" subsystem cgroup.  If neither subsystem has a cgroup set,
SP_FOREGROUND is returned.

Bug: 32972117
Test: Verified that SchedPolicy libcutils test passes and that ps displays
the expected policies.  See details in testing done comment in
https://android-review.googlesource.com/379426 .

Change-Id: I586a921a38eea99d65590b07ece96c9808a2e56d
2017-04-25 15:26:53 +00:00
Philip Cuadra
e08303d8cf Allow Bluetooth HAL CAP_SYS_NICE
The Bluetooth HAL has threads that process Bluetooth audio.  They need
to be scheduled as RT priority, so allow the Bluetooth HAL to set its
threads to RT scheduling.

Bug 37518404
Test:  play Bluetooth audio, confirm priority via systrace
Change-Id: I4928cf182a0805c0714e4d073cba15c864fbe328
2017-04-24 17:59:20 -07:00
Lorenzo Colitti
b6e4b35fe4 Revert "Make the xtables lock readable only by AID_RADIO and root."
This reverts commit 5e801e7bd5.

The file permissions don't allow access to the lock on devices
where vendor code runs with UID root and GID radio. They are
no longer necessary because we have a more flexible selinux-based
solution in https://android-review.googlesource.com/#/c/354223/ .

Test: strace -f -e flock -p <netmgrd_pid> on angler shows flock succeeds
Test: strace -f -e flock -p <netmgrd_pid> on marlin shows flock succeeds
Test: netd_unit_test passes on marlin
Test: strace -f -e flock -p <netd_pid> on marlin shows flock succeeds
Bug: 36108349
Bug: 37483189
Change-Id: Ia1bbf8d93ec6777514be66cbd1a32dfc95df95c0
2017-04-21 16:41:35 +00:00
Steven Moreland
2bd4342234 Remove VNDK warning.
Added todo once usages are fixed.

Bug: 33241851
Test: things with -Werror now compile in VNDK
(cherry picked from commit 81626e48cb)
Merged-In: I6c4a148dca4d4710912fe62a8854cb8077651701
Change-Id: I6c4a148dca4d4710912fe62a8854cb8077651701
2017-04-19 10:32:49 -07:00
Steven Moreland
385fe692cc libcutils: vendor_available
By setting vendor_available, the following may become true:

* a prebuilt library from this release may be used at runtime by
  in a later releasse (by vendor code compiled against this release).
  so this library shouldn't depend on runtime state that may change
  in the future.
* this library may be loaded twice into a single process (potentially
  an old version and a newer version). The symbols will be isolated
  using linker namespaces, but this may break assumptions about 1
  library in 1 process (your singletons will run twice).

Background:

This means that these modules may be built and installed twice --
once for the system partition and once for the vendor partition. The
system version will build just like today, and will be used by the
framework components on /system. The vendor version will build
against a reduced set of exports and libraries -- similar to, but
separate from, the NDK. This means that all your dependencies must
also mark vendor_available.

At runtime, /system binaries will load libraries from /system/lib*,
while /vendor binaries will load libraries from /vendor/lib*. There
are some exceptions in both directions -- bionic(libc,etc) and liblog
are always loaded from /system. And SP-HALs (OpenGL, etc) may load
/vendor code into /system processes, but the dependencies of those
libraries will load from /vendor until it reaches a library that's
always on /system. In the SP-HAL case, if both framework and vendor
libraries depend on a library of the same name, both versions will be
loaded, but they will be isolated from each other.

It's possible to compile differently -- reducing your source files,
exporting different include directories, etc. For details see:

https://android-review.googlesource.com/368372

None of this is enabled unless the device opts into the system/vendor
split with BOARD_VNDK_VERSION := current.

Bug: 36426473
Bug: 36079834
Test: m -j libcutils
Test: attempt to compile with BOARD_VNDK_VERSION := current
Test: (sanity) boot internal marlin
(cherry picked from commit 9610c548a8)
Merged-In: I76f9b28ef08a26d84d1365881e00696cc1dcfe5d
Change-Id: I76f9b28ef08a26d84d1365881e00696cc1dcfe5d
2017-04-19 10:32:45 -07:00
Treehugger Robot
edaed3ed7a Merge "Allocate a GID range for external cache files." 2017-04-18 22:34:16 +00:00
Steven Moreland
d73be1b96b libcutils: compile with BOARD_VNDK_VERSION current
- moved __android_log_is_debuggable to a new public header
    (log_properties.h)
- vendor version of sched_policy uses ALOG* instead SLOG*

Test: (sanity) liblog-unit-tests
Test: (sanity) libcutils_test (noting b/b/32972117, two tests continue
  to fail)
Test: system/core as a whole makes with BOARD_VNDK_VERSION := current
  now with no problems.
Test: boots/works on internal marlin
Bug: 33241851

(cherry picked from commit 1f83aa424f)

Merged-In: I5bc1f348dc0f0c8814bec5b5c3d2c52c825ab640
Change-Id: I5bc1f348dc0f0c8814bec5b5c3d2c52c825ab640
2017-04-17 14:44:17 -07:00
Jeff Sharkey
fa16473921 Allocate a GID range for external cache files.
We can't reuse the GID range for internal cache files, otherwise
we don't have a way to tease apart the difference when deciding if
it's safe to move apps.

Test: builds, boots
Bug: 37193650
Change-Id: I22c4e575cd557636e74c5c73035adb1d4dcbb7f7
2017-04-17 14:50:27 -06:00
Josh Gao
0301b3217b Merge changes from topics 'adb_thread', 'adb_loopback'
* changes:
  adb: statically link libbase into the tests.
  adb: kill adb_thread_{create, join, detach, exit}.
  adb: don't try to resolve 'localhost'
2017-04-14 20:04:04 +00:00
Josh Gao
46de1d7f03 adb: don't try to resolve 'localhost'
Misconfigured systems can have localhost pointing to an address that
isn't 127.0.0.1 or ::1.

adb is the only caller of the libcutils socket_loopback functions, so
move them into adb and switch the implementations over to using
INADDR_LOOPBACK and in6addr_loopback, instead of resolving 'localhost'
when connecting.

Bug: http://b/37282612
Test: `killall adb; adb shell`
Test: `killall adb; ip addr del 127.0.0.1/8 dev lo; adb shell`
Change-Id: I01c1885f1d9757ad0f7b353dd04b4d1f057741c8
2017-04-12 16:07:49 -07:00
Ganesh Mahendran
6748f24d70 libcutils: fix system-background tasks shown in top command
tasks in system-background cgroup will be shown as below:
 580   580 system   12  -8   1% S 190656K  19408K unk surfaceflinger  /system/bin/surfaceflinger

This patch fix this issue.

Change-Id: Ib39ff892010498548d7fbfb4021df62498acd033
Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
2017-04-12 16:25:25 +08:00
Mark Salyzyn
6e9cb8fd79 libcutils: fs_config: target_out_path assumed /system breaking partitions
Strip off trailing / then /system and then add back the appropriate
config directory.  This fixes an issue with reading vendor, oem or odm
partitions.

Test: manual build successfully interprets all etc/fs_config_* files.
Test: manual incremental build successfully interprets all etc/fs_config_* files.
Bug: 36071012
Change-Id: Iba363f0731bb8d15e595bb45c56db97722edabc2
2017-04-07 10:29:51 -07:00
Thierry Strudel
29e0c8f1a9 Revert "libcutils: fs_config: target_out_path assumed /system"
This reverts commit 7130fb345d.

Bug: 36816191
Change-Id: I7d604d510865b1fa15781ffb4ad8b3e77ac44395
2017-04-07 00:34:03 +00:00
Mark Salyzyn
7130fb345d libcutils: fs_config: target_out_path assumed /system
Strip off /system/ and add appropriate config directory.

Test: manual build successfully interprets all etc/fs_config_* files.
Bug: 36071012
Change-Id: I2563248e91cea10fef3cc2f9e954e4782fdfce4f
2017-04-05 22:32:22 +00:00
Treehugger Robot
c1c0de3945 Merge "Add test config to libcutils_test" 2017-04-05 06:39:42 +00:00
Mark Salyzyn
a9403f0db8 libcutils: create private/fs_config.h
private/fs_config.h is required in order to build an independent
test that requires internal binary knowledge of the
etc/fs_config_(files|dirs) files.

Test: compile
Bug: 36071012
Change-Id: I268bcfdbb6d45b7bf6040cbf307a4e34812f5fef
2017-04-04 19:14:32 +00:00
Jeff Sharkey
d185445eee Revert "Allocate GID to use reserved disk space."
This reverts commit 82f8bb785e.

Sadly, we'd have to extend CAP_SYS_RESOURCE to a bunch of execution
domains to make this work, which isn't feasible.

Bug: 36450358
Change-Id: Iffe88e45d538c044382eb0d0ac24ff11a10d73c3
2017-04-03 04:00:36 +00:00
Dan Shi
2c67dfbc09 Add test config to libcutils_test
This change allows TradeFederation to run the test directly.
Refer to b/35882476 for design and discussion of this change.

Bug: 35882476
Test: local test
tradefed.sh run template/local --template:map test=libcutils_test

Change-Id: Ie083d1641e4ea226cbf7b82c6fd2c115e15b6bf6
2017-03-31 17:12:18 -07:00