Commit graph

29427 commits

Author SHA1 Message Date
Tom Cherry
26ed9cb706 init: rename 'Trigger' to 'Event' and convert to std::variant
The term 'trigger' should be used in 'Action' to indicate what causes
the 'Action' to be executed.

The term 'event' should be used in ActionManager's queue to indicate
a state change that is checked against the 'triggers' of an 'Action' to
see if it should execute.

Convert the previous Trigger class to std::variant, as the latter is
better suited for this use.

Change-Id: I2558367c8318b536aa69fcec93793f1c12857ef5
2017-04-25 17:14:23 +00:00
Treehugger Robot
d0013343e9 Merge "libsysutils: Android.mk -> Android.bp" 2017-04-25 16:32:49 +00:00
Treehugger Robot
41346e553b Merge "Update persist.sys.usb.config on runtime" 2017-04-25 03:51:17 +00:00
Jaekyun Seok
0cf3a07e14 Update persist.sys.usb.config on runtime
persist.sys.usb.config values can't be combined on build-time when
property files are split into each partition.
So we need to apply the same rule of
build/make/tools/post_process_props.py on runtime.

Test: building succeeded and tested on sailfish.
Bug: 37617113
Bug: 37648659

Change-Id: I78cdffee446d3ae6a89f138faed5f3149e4b507d
2017-04-25 01:31:19 +00:00
Treehugger Robot
f1bd536efd Merge "init: set ro.boot.avb_version in recovery mode" 2017-04-25 00:31:41 +00:00
Treehugger Robot
bcd36a20d4 Merge "init: moving early mount logic into init_first_stage.cpp" 2017-04-25 00:31:27 +00:00
Steven Moreland
d0d759dc09 libsysutils: Android.mk -> Android.bp
Test: links
Change-Id: If1d034ecb880e8c41d58b14ebebcda5b72e88424
2017-04-24 17:15:31 -07:00
Mark Salyzyn
5002a48cee Merge "Revert "logd: add Chattiest LOG_TAG statistics"" 2017-04-24 19:54:25 +00:00
Mark Salyzyn
afd7e70553 Revert "logd: add Chattiest LOG_TAG statistics"
This reverts commit 903156ddaa.

Test: compile
Bug: 37254265
Change-Id: If9af79684119861ceecf4f88a4a4c84f991b188a
2017-04-24 19:52:33 +00:00
Tom Cherry
51b7cb006f Merge changes Ic446c026,I86568a5b
* changes:
  init: create init_tests.cpp
  init: clean up the SectionParser interface and Parser class
2017-04-24 18:02:05 +00:00
Bowgo Tsai
fd18a452be init: set ro.boot.avb_version in recovery mode
Previously we set ro.boot.avb_version during the first stage mount in normal mode:
  - https://android-review.googlesource.com/#/c/371774/

As the first stage mount is not performed in recovery mode, we need to set the
property separately in recovery mode.

Bug: 37414003

Test: first stage mount /vendor with vboot 2.0 (avb) on bullhead in normal mode
Test: first stage mount /system with without verity on bullhead in normal mode
Test: checks ro.boot.avb_version is 1.0 on bullhead in recovery mode

Test: first mount /vendor with with vboot 1.0 on sailfish in normal mode
Test: checks ro.boot.avb_version doesn't exist on sailfish in recovery mode

Change-Id: I262e75b8b557c4de7609b4049ccb01793644245e
2017-04-24 23:10:59 +08:00
Bowgo Tsai
d262017fef init: moving early mount logic into init_first_stage.cpp
Also renames "early mount" to "first stage mount" to prevent confusion
with "mount_all --early", which is run in the init second stage.

Also creates a base class: FirstStageMount and two derived classes:
FirstStageMountVBootV1 and FirstStageMountVBootV2 to replace/refactor
existing functions:

   - early_mount() -> DoFirstStageMount() and FirstStageMount::DoFirstStageMount()

   - vboot_1_0_early_partitions -> FirstStageMountVBootV1::GetRequiredDevices()
   - vboot_2_0_early_partitions -> FirstStageMountVBootV2::GetRequiredDevices()

   - vboot_1_0_mount_partitions ->
       FirstStageMount::MountPartitions() and
       FirstStageMountVBootV1::SetUpDmVerity()

   - vboot_2_0_mount_partitions ->
       FirstStageMount::MountPartitions() and
       FirstStageMountVBootV2::SetUpDmVerity()

Bug: 37413399
Test: first stage mount /vendor with vboot 2.0 (avb) on bullhead
Test: first stage mount /system with without verity on bullhead
Test: first stage mount /vendor with with vboot 1.0 on sailfish
Change-Id: I6584bdf7d832c9fbc8740f97c9b8b94e68a90783
2017-04-24 23:10:10 +08:00
Treehugger Robot
39aee46352 Merge "logd: add Chattiest LOG_TAG statistics" 2017-04-24 14:35:36 +00:00
Lorenzo Colitti
d272ca38f6 Merge "Revert "Make the xtables lock readable only by AID_RADIO and root."" 2017-04-22 04:21:18 +00:00
Tom Cherry
ad54d094cd init: create init_tests.cpp
Start a init_tests.cpp file for end-to-end tests that parse small init script
segments and verify that they act as expected.

The first tests ensure that the execution order of event triggers
happens appropriately.

Test: Boot bullhead, run unit tests

Change-Id: Ic446c02605ab796fd41e0596ce1fd381aee80ce0
2017-04-21 18:27:42 -07:00
Tom Cherry
30a6f276fd init: clean up the SectionParser interface and Parser class
Remove the dependency on Action and Service from what should be a
generic Parser class.

Make ActionParser, ImportParser, and ServiceParser take a pointer to
their associated classes instead of accessing them through a
singleton.

Misc fixes to SectionParser Interface:
1) Make SectionParser::ParseLineSection() non-const as it always should
have been.
2) Use Rvalue references where appropriate
3) Remove extra std::string& filename in SectionParser::EndFile()
4) Only have SectionParser::ParseSection() as pure virtual

Document SectionParser.

Make ImportParser report the filename and line number of failed imports.

Make ServiceParser report the filename and line number of duplicated services.

Test: Boot bullhead

Change-Id: I86568a5b375fb4f27f4cb235ed1e37635f01d630
2017-04-21 18:26:40 -07:00
Keun-young Park
a037bddd8a Merge "Revert "Ensure update_verifier run before zygote"" 2017-04-22 00:56:48 +00:00
Keun-young Park
2de3344180 Revert "Ensure update_verifier run before zygote"
This reverts commit 5dc05effec.

Change-Id: Ic041860dee8a2993c6b4890beca4da745cfbfb60
2017-04-22 00:43:55 +00:00
Mark Salyzyn
903156ddaa logd: add Chattiest LOG_TAG statistics
Report global LOG_TAG usage.

Test: gTest liblog-unit-tests, logd-unit-tests & logcat-unit-tests
Test: manual: inspect logcat -S results around 'Chattiest TAGs'
Bug: 37254265
Change-Id: I32473a1d9131c87e4fb7841d5cc0ea9cc14c63cd
2017-04-21 15:55:10 -07:00
Treehugger Robot
a42ec8a9e3 Merge "Ensure update_verifier run before zygote" 2017-04-21 22:16:52 +00:00
Wei Wang
5dc05effec Ensure update_verifier run before zygote
Currently zygote is started early for FBE device but update_verifier is run later
which creates a potential risk. This CL ensures update_verifier run before
zygote touches anything within data/ partition. With this change, we also start zygote
early for unencrypted/unsupported encryption state device.

Bug: 37543411
Test: marlin boots
Change-Id: I95daa73bc1a503eecb70d7be78251b74b773abf8
2017-04-21 11:54:55 -07:00
Keun-young Park
a0bf415cad Merge "early start zygote_secondary as well" 2017-04-21 16:49:11 +00: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
Treehugger Robot
515e7a4fc4 Merge "fs_mgr: remove the repetitive and annoying bootconfig error print" 2017-04-21 16:29:37 +00:00
Treehugger Robot
3ed85748e1 Merge "liblog: test: liblog.__security miscalculation" 2017-04-21 15:17:03 +00:00
Keun-young Park
f8532445b4 early start zygote_secondary as well
- late start of zygote_secondary leads into occasional
  1 second wait for starting system service.
- Early start secondary zygote so that there is no additional
  wait.

bug: 37508384
Test: python packages/services/Car/tools/bootanalyze/bootanalyze.py -r -c packages/services/Car/tools/bootanalyze/config.yaml -n 100 -f -e 16 -w 30
Change-Id: I2e4eb0b59a9a8417b56a72fe2de6fa2a6e1ab0a2
2017-04-20 18:31:48 -07:00
Sandeep Patil
73fbf0ee16 fs_mgr: remove the repetitive and annoying bootconfig error print
The new changes to slotselect() call makes it try to find the
"slot" config before trying "slot_suffix" and that causes fs_mgr to
print the needless error and spam the kernel logs for no reason.
Remove the print.

Test: Builds for sailfish

Change-Id: I020575d70f4cd6e137e82c127b5d5234d709d0e3
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-04-20 14:41:23 -07:00
Treehugger Robot
bd53ea4063 Merge changes Ia11dffde,I76f24890
* changes:
  Convert libnetutils to Android.bp
  Don't export libutils_headers from libbase
2017-04-20 21:19:17 +00:00
Tom Cherry
f890ca9a1f Merge "init: fix errno handling on KillProcessGroup" 2017-04-20 20:48:49 +00:00
Mark Salyzyn
b867beac56 liblog: test: liblog.__security miscalculation
The gTest should not be able to set ro.device_owner, either as a unit
test or a CTS test.  The CTS test should not be able to set
persist.logd.security, the gTest may as it is run on userdebug with
root, so check if we are root to discern expectations.

Test: gTest liblog-unit-tests --gtest_filter=liblog.__security
Test: cts-tradefed run cts-dev -a armeabi-v7a -m CtsLiblogTestCases -t liblog#__security
Bug: 36480230
Change-Id: I1da88aae34da4e2fca8dd88d740eeb879d9c65bb
2017-04-20 13:26:12 -07:00
Treehugger Robot
2e821078e4 Merge "adb: fix two device offline problems." 2017-04-20 19:45:18 +00:00
Colin Cross
cafe889aa8 Convert libnetutils to Android.bp
See build/soong/README.md for more information.

Test: m -j checkbuild
Change-Id: Ia11dffde6fc4d89be6ee651be06b48131c877dc0
2017-04-20 10:36:43 -07:00
Colin Cross
4eda982a77 Don't export libutils_headers from libbase
libutils headers are only used by the implementation of libbase,
and should not be exported to everything that uses libbase headers.

Test: m -j
Change-Id: I76f248908f649e3a3c91cd3e84d629a0049939ef
2017-04-20 10:36:32 -07:00
Treehugger Robot
d9982803ed Merge changes I6555c135,If5723ff4
* changes:
  logcat: test: also check "failed to clear" in blocking_clear
  logd: reader/writer element locks
2017-04-20 17:33:50 +00:00
Yabin Cui
b5e11415d9 adb: fix two device offline problems.
When device goes offline, user usually has to manually replug the
usb device. This patch tries to solve two offline situations, all
because when adb on host is killed, the adbd on device is not notified.

1. When adb server is killed while pushing a large file to device,
the device is still reading the unfinished large message. So the
device thinks of the CNXN message as part of the previous unfinished
message, so it doesn't reply and the device is in offline state.

The solution is to add a write_msg_lock in atransport struct. And it
kicks the transport only after sending a whole message. By kicking
all transports before exit, we ensure that we don't write part of
a message to any device. So next time we start adb server, the device
should be waiting for a new message.

2. When adb server is killed while pulling a large file from device,
the device is still trying to send the unfinished large message. So
adb on host usually reads data with EOVERFLOW error. This is because
adb on host is reading less than one packet sent from device.

The solution is to use buffered read on host. The max packet size
of bulk transactions in USB 3.0 is 1024 bytes. By preparing an at least
1024 bytes buffer when reading, EOVERFLOW no longer occurs. And teach
adb host to ignore wrong messages.

To be safe, this patch doesn't change any logic on device.

Bug: http://b/32952319
Test: run python -m unittest -q test_device.DeviceOfflineTest
Test: on linux/mac/windows with bullhead, ryu.
Change-Id: Ib149d30028a62a6f03857b8a95ab5a1d6e9b9c4e
2017-04-20 10:14:59 -07:00
Treehugger Robot
a58c4b5bcd Merge "Convert libusbhost to Android.bp" 2017-04-20 17:07:43 +00:00
Dan Willemsen
a5c6017d8f Convert libusbhost to Android.bp
See build/soong/README.md for more information.

Test: mmma -j system/core/libusbhost
Change-Id: I57109380678bd452af545d4c5b1b9d2356b356b8
2017-04-20 08:37:12 -07:00
Mark Salyzyn
0a1424e196 logcat: test: also check "failed to clear" in blocking_clear
Add more detail about logcat.blocking_clear test failure

Test: gTest logcat-unit-test --gtest_filter=logcat.blocking_clear
Bug: 37483775
Change-Id: I6555c13593781a1278d9106e66c2dec6009a2215
2017-04-20 08:24:38 -07:00
Mark Salyzyn
3c501b50b4 logd: reader/writer element locks
Switch to a reader writer lock for the Element List lock.  Also setup
for a reader writer lock for the Times list, but continue to use a
mutex where rdlock() and wrlock() are the same implementation for now.

This should improve general reader performance and prevent blocking of
other reader operations or exit by a single hung logd.reader.per
thread.  For example, a full length logcat of an empty buffer (eg:
crash log buffer) will hold a lock while the iterator scans the entire
list.

Test: gTest liblog-unit-tests, logd-unit-tests, logcat-unit-tests
Bug: 37378309
Bug: 37483775
Change-Id: If5723ff4a978e17d828a75321e8f0ba91d4a09e0
2017-04-20 08:24:38 -07:00
Mark Salyzyn
e32517d773 Merge "logd: statistics add logspan" 2017-04-20 15:19:05 +00:00
Christopher Ferris
4c1560ce5c Merge "Add function definitions for MapInfo." 2017-04-20 02:08:33 +00:00
Treehugger Robot
3dfaa44491 Merge changes from topic 'system-vendor-internal-pick'
* changes:
  libbase: fix build breakage
  libsync: vendor_available
  Remove VNDK warning.
  libbase: make vendor_available
  libcutils: vendor_available
  libbacktrace: make vendor_available
  libbase: add libbase_headers
2017-04-20 01:39:23 +00:00
Treehugger Robot
8dead17a58 Merge "Fix various adb error reporting bugs." 2017-04-20 00:37:38 +00:00
William Roberts
e6ec2661b7 init: fix errno handling on KillProcessGroup
KillProcessGroup can return -1 without errno set, which produces error
messages like this:

init: Sending signal 15 to service 'vold' (pid 1806) process group...
init: failed to kill 2 processes for processgroup 1806
init: killProcessGroup(0, 1806, 15) failed: Success

Test: boot and reboot hikey.

Change-Id: I51f242da234daee84795a3fbdffe9ad1f4567140
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2017-04-19 17:21:44 -07:00
Treehugger Robot
9401a0b9d1 Merge "libprocessgroup: Android.mk -> Android.bp" 2017-04-19 23:29:23 +00:00
Mark Salyzyn
3a052c42be Merge changes Ie7a5303e,I2b3c2ac4
* changes:
  liblog: log_time add usec() and msec()
  logd: replace stats.add+stats.subtract with stats.addTotal
2017-04-19 23:18:14 +00:00
Christopher Ferris
0d7cf3e8dd Add function definitions for MapInfo.
Bug: 23762183

Test: All new unit tests pass.
Change-Id: I26a1f6e84bf1a02447eff48ff6e35068554330fe
2017-04-19 15:48:02 -07:00
Steven Moreland
419ce36c7d libprocessgroup: Android.mk -> Android.bp
Test: links
Test: (sanity) boot marlin in recovery + to system UI
Bug: 37512442
Change-Id: Ie19c02bda9df7c0cfdeeaf34c48f251b2b93961d
2017-04-19 14:29:08 -07:00
Treehugger Robot
8d644d2c96 Merge "init: Stop combining actions" 2017-04-19 20:00:50 +00:00
Treehugger Robot
652ce94f40 Merge "libsparse: Fix odd-sized input files total_blks" 2017-04-19 19:14:47 +00:00