Commit graph

47898 commits

Author SHA1 Message Date
Treehugger Robot
c0349199db Merge "bootstat: add reboot,longkey sub-reason to known set" 2019-06-25 07:13:32 +00:00
Elliott Hughes
12794c039a Merge "Revert "Reland "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND.""" 2019-06-25 05:56:53 +00:00
Elliott Hughes
fab9f30f6f Revert "Reland "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND.""
This reverts commit b00e66f754.

Reason for revert: http://b/135753060

Change-Id: I30f472427f52076b64902420f9538b4a880a2cbe
2019-06-25 05:42:55 +00:00
Tom Cherry
84fc269b6e Merge "init: Handle properties in the background of calling fs_mgr" 2019-06-24 22:46:09 +00:00
Tom Cherry
20670249d0 Merge "Actually make fs_path_config / fs_path_config_from_file private" 2019-06-24 20:24:12 +00:00
Tom Cherry
71bdf2820e init: Handle properties in the background of calling fs_mgr
It's been a long standing problem that init calls fs_mgr functions
synchronously and therefore stops handling properties, which causes
deadlocks if either fs_mgr, or vdc, or vold attempt to set
properties.

Previous work, b/21904461, shows that there is a large performance
penalty for adding any amount of locking to properties, so moving
property service into its own thread generically is not a viable
option.  However, we can be sure that init is not setting properties
while the fs_mgr functions are running, so we can poll the property
socket in a thread while we call these functions.

The other alternative would have been to separate the fs_mgr functions
into smaller pieces and revisit the main init loop between each
piece.  Unfortunately, this would be difficult, since
fs_mgr_mount_all() calls out to different processes via logwrapper,
which synchronously polls on a logging FD from the child, among other
complexities that would make this strategy much more difficult than it
would be worth.

Bug: 21904461
Test: device boots, including when setting property in
      fs_mgr_mount_all()

Change-Id: Ib0b7123024035884f9d90f9b489c1e2f5a2e1707
2019-06-24 13:23:49 -07:00
Tom Cherry
3f6b16395d Merge "Avoid get same timestamps in log testcase" 2019-06-24 20:14:37 +00:00
Tom Cherry
af274fd086 Merge "init: use a property instead of file to communicate cold boot done" 2019-06-24 19:39:03 +00:00
Jone Chou
b9a8033037 bootstat: add reboot,longkey sub-reason to known set
regular expression:
- "reboot,longkey,.*" (184)

regex is dependent on:
- https://android-review.googlesource.com/947976

Test: none
Bug: 132955428
Bug: 133520088
Change-Id: I53d13d95ac11ac73273824156363378372a562ed
2019-06-24 06:29:49 +00:00
Mohammad Islam
99087decb9 Merge "Prevent definitions of expected.h from being included twice" 2019-06-21 09:27:49 +00:00
Christopher Ferris
4f2048d370 Merge "Switch case to suite to follow new gtest naming." 2019-06-21 05:57:45 +00:00
Treehugger Robot
1e13891988 Merge "Allow to drop existing fd cache of cgroup path" 2019-06-21 05:00:30 +00:00
Josh Gao
2a6ec6c332 Merge "Reland "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND."" 2019-06-21 02:36:56 +00:00
David Anderson
87db478ad6 Merge "libfiemap_writer: Improve device unwrapping to support simple linear devices." 2019-06-20 23:59:06 +00:00
Tom Cherry
68debff5ec Actually make fs_path_config / fs_path_config_from_file private
No one outside of libcutils is using these structs and we don't want
to leak them as they are private.

Test: build
Change-Id: I1c95564a9843c9155a333334008cbff7c7ff1f51
2019-06-20 23:34:30 +00:00
Christopher Ferris
7e21eba5b7 Switch case to suite to follow new gtest naming.
Bug: 135528735

Test: All unit tests pass.
Change-Id: I1f3dc6fe381ec557b6b7bc5cb1c58d210efa63da
2019-06-20 16:18:57 -07:00
Treehugger Robot
8c63ef828a Merge "usbd: Exit in case of charger mode." 2019-06-20 22:47:26 +00:00
David Anderson
1bfcd580c8 libfiemap_writer: Improve device unwrapping to support simple linear devices.
Normally we reject complex dm targets that would invalidate or shift the
block mappings returned via FIEMAP/FIBMAP. Currently the only targets
allowed are crypt, default-key, and bow. This patch adds support for
"linear" as long as there is only one linear target and it targets
sector 0 of the underlying block device.

This is useful for testing gsid, so we can simulate how a
metadata-encrypted device works without having to create a dm-crypt or
dm-default-key node.

Bug: 134536978
Test: manual test
Change-Id: I7c12bc20d95ff4c90402e66bafb4cf2fce7818e2
2019-06-20 13:39:11 -07:00
Elliott Hughes
2226fe6ddf Merge "Finally remove ZipString." 2019-06-20 19:20:39 +00:00
Badhri Jagan Sridharan
abc92991ea usbd: Exit in case of charger mode.
UsbGadget hal is not expected run in charger mode.
This should fix the following errors in charger mode:

[   86.609578] c4    612 init: Received control message 'interface_start' for 'android.hardware.usb.gadget@1.0::IUsbGadget/default' from pid: 565 (/system/bin/hwservicemanager)
[   86.618236] c7      1 init: Could not find 'android.hardware.usb.gadget@1.0::IUsbGadget/default' for ctl.interface_start

Bug: 135566354
Test: Manually verified that usbd exits early in charger mode.
Change-Id: I3ba5be883c49e5ca3e4dad4443528e4eee8b25b9
2019-06-20 12:13:31 -07:00
David Anderson
99f610da3d Merge "liblp: Handle invalid alignment offsets correctly." 2019-06-20 19:09:52 +00:00
David Anderson
0b5c3552cc Merge "Remove fs_mgr_wait_for_file." 2019-06-20 19:09:26 +00:00
David Anderson
71b3afe620 Merge changes Iae25434a,I13fd6699
* changes:
  libdm: Add LoopControl helpers for enabling direct IO.
  libdm: Add helpers for getting the device number of a dm device.
2019-06-20 19:06:32 +00:00
Mohammad Samiul Islam
9f24c38fe3 Prevent definitions of expected.h from being included twice
Bug: 135683564
Test: Included expected.h from two different files. Builds succesfully
    with the fix. Does not build without the fix.

Change-Id: If1962a3b70f7580fa652a043aaf29bf592d1926c
2019-06-20 19:03:32 +01:00
Tom Cherry
9b229069fb Merge "Remove fs_config endianness functions" 2019-06-20 16:41:27 +00:00
Tom Cherry
5550d4e90f Remove fs_config endianness functions
We don't support big endian on Android.

Test: build
Change-Id: I4278ecc139b0ffeba63cf7b3a43b1ce9e858e741
2019-06-20 16:35:50 +00:00
Tom Cherry
45f79b1c3b Merge "Remove fs_config_generate()" 2019-06-20 15:36:46 +00:00
Christopher Ferris
61fc364601 Merge "Fix potential race condition." 2019-06-20 15:01:14 +00:00
David Anderson
ea0dda1473 libdm: Add LoopControl helpers for enabling direct IO.
Bug: 134536978
Test: manual test
Change-Id: Iae25434ac54186fd6006b56eeb7a7f577a880053
2019-06-19 19:29:15 -07:00
David Anderson
d106f1e225 libdm: Add helpers for getting the device number of a dm device.
device-mapper will accept a "major:minor" string in place of a path for
any target parameter that specifies another block devie. This is useful
to have a helper for, since it lets us avoid a call to WaitForFile().

Bug: 134536978
Test: manual test
Change-Id: I13fd6699dd5d405bfa676830825b006b7810aa0f
2019-06-19 19:29:09 -07:00
David Anderson
2ca0700b45 liblp: Handle invalid alignment offsets correctly.
When stacking devices with dm-linear, it is possible to get a -1
alignment offset. In this case we should set alignment_offset to 0
rather than fail later trying to divide -1 by the sector size.

Bug: 134536978
Test: manual test
Change-Id: I3862fdda69531a3b230b7316707469a49ba871d6
2019-06-19 19:23:55 -07:00
Christopher Ferris
d1d973be12 Fix potential race condition.
Found when I noticed that the unit tests segfaulted every once in a while.

Test: Ran all unit tests 1000 times. The crash usually happens before 100 runs.
Change-Id: I1c8d2e3637400dc80f273f3677f4c94b0dbeac9d
2019-06-19 18:51:31 -07:00
Elliott Hughes
50ef29a170 Finally remove ZipString.
Bug: http://b/129068177
Test: treehugger
Change-Id: If8c009f96931c9c2672255d8d0fe01d7992282af
2019-06-19 15:26:38 -07:00
Treehugger Robot
3215fd93c7 Merge "[zip] Save 1 malloc and memset for each added file in ZipWriter" 2019-06-19 21:49:00 +00:00
David Anderson
02427f5f71 Merge "Introduce inotify-based replacements for fs_mgr_wait_for_file." 2019-06-19 19:39:34 +00:00
Treehugger Robot
a91e50bbf4 Merge "[zip] Change const char* to string_view in ZipWriter" 2019-06-19 19:35:38 +00:00
Xu YiPing
998fca5795 Avoid get same timestamps in log testcase
for arm64, userspace get time by vDSO, no syscall overhead.
multiple_test_2 sometimes get 2 same timestamps now, then testcase
fails.

Bug: b/135555666
Test: ./CtsLogdTestCases64 --gtest_filter=*multiple_test*
2019-06-19 16:38:33 +08:00
Yurii Zubrytskyi
a6633d7739 [zip] Save 1 malloc and memset for each added file in ZipWriter
+ add a benchmark for the function.

This change speeds up the function by about 3%: 910ns->880ns

Change-Id: I33c8c31de18d10eb38f109917ecbcbdda45b4034
2019-06-18 21:49:16 -07:00
Treehugger Robot
4a8d436ad1 Merge "init: Create /data/apex/hashtree folder at boot" 2019-06-19 04:37:56 +00:00
Yurii Zubrytskyi
2b283118a0 [zip] Change const char* to string_view in ZipWriter
This would allow adding entries from one zip archive into
a new one without copying, directly from a ZipString object

Change-Id: I52f91008f497e798e044c43f57a6481cf4bec36d
2019-06-18 21:00:43 -07:00
Treehugger Robot
411fb88506 Merge "Qualifies the mention of lazily starting services from 'interface'." 2019-06-19 03:03:00 +00:00
Treehugger Robot
52c856544d Merge "Start Vold on early-fs" 2019-06-19 02:35:18 +00:00
Treehugger Robot
90eb2ed62d Merge "create libmodprobe, integrate into first_stage_init" 2019-06-19 00:30:27 +00:00
Treehugger Robot
ad0f27fe72 Merge "adb: turn CHECKs into an error + transport restart." 2019-06-19 00:11:49 +00:00
Daniel Norman
d6d09c646a Qualifies the mention of lazily starting services from 'interface'.
The 'interface' option is not always used by services that support lazy
startup.

Test: None
Change-Id: I6bfb095d4ecb932933d56cd1859a5eff6df2edbd
2019-06-18 17:03:05 -07:00
David Anderson
5c475c70d0 Remove fs_mgr_wait_for_file.
This transitions all callers to WaitForFile/WaitForFileDeleted.

Bug: 134966533
Test: device boots
Change-Id: Ic2107c97271adbd82094eda4ea6df3ccd652fd51
2019-06-18 15:27:18 -07:00
David Anderson
c65121306a Introduce inotify-based replacements for fs_mgr_wait_for_file.
Bug: 134966533
Test: fs_mgr_unit_test gtest
Change-Id: I36802b87cec59b5277267eb919851ca390fea425
2019-06-18 15:27:09 -07:00
Josh Gao
b00e66f754 Reland "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND."
Read until we receive FUNCTIONFS_BIND after every USB descriptor setup,
instead of only after initial creation of the control fd, so we properly
handle a rebind caused by a change of the USB configuration.

This reverts commit 55b31933f41b1c550b788fa2054010c51f56111b.

Bug: http://b/133132986
Bug: http://b/135155652
Test: manually enabled/disabled MTP with nonblocking_ffs enabled and disabled
Change-Id: Ibb3f46b8f84854ede47a669a85e07e16a5dd6008
2019-06-18 15:00:15 -07:00
Steve Muckle
18b981ea7c create libmodprobe, integrate into first_stage_init
Modprobe functionality is required both within first stage init and also
as a standalone binary. Create a library for this using and extending
the logic in modalias_handler.cpp.

First stage init will attempt to load modules from /lib/modules.

Bug: 129780532
Change-Id: Ie3582358fd839c2f64e1b386b30ed551a86aef5d
2019-06-18 13:24:56 -07:00
Daniel Rosenberg
c6e8972588 Start Vold on early-fs
We need vold on early-fs so we can handle userdata checkpointing.
Without this, devices will take an extra minute or two as checkpointing
related vdc calls attempt to reach vold before it is available.

Bug: 134114000
Test: Boot, see vold has started before vdc checkpointing tries to call
      out to vold.
Merged-In: Idfdb304503a163fbb91f9317949eb98c06fecce1
Change-Id: Idfdb304503a163fbb91f9317949eb98c06fecce1
2019-06-18 19:25:56 +00:00