Commit Graph

47866 Commits

Author SHA1 Message Date
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
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
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
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
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 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
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
Treehugger Robot b89a4434ba Merge "Remove system/core/mkbootimg" 2019-06-18 16:10:40 +00:00
Treehugger Robot ad6f656be2 Merge "Remove ACgroupController_getFlags to fix API breakage" 2019-06-18 01:26:31 +00:00
Treehugger Robot 716ba5d91d Merge "libprocessgroup: move native_bridge_support" 2019-06-17 23:33:46 +00:00
David Anderson bc53c842e9 Merge "liblp: Remove the slot-suffix requirement in MetadataBuilder." 2019-06-17 22:58:20 +00:00
Tom Cherry 55fe01db69 Remove fs_config_generate()
We replaced creating the binary fs_config files with a python script
(/build/make/tools/fs_config/fs_config_generator.py), so there are no
more users of this function, nor do we plan for there to be.

Test: build
Change-Id: I49ec7e3d22c206bc250cbda6f66a4a59e47030e9
2019-06-17 13:40:31 -07:00
Steven Moreland b495b0d403 libprocessgroup: move native_bridge_support
To avoid merge conflict.

Bug: 135293492
Bug: 135298384
Test: N/A
Change-Id: I034b989c7e0f8a477b29ef7ca40bba8f2dc929e5
2019-06-17 12:48:06 -07:00
Suren Baghdasaryan 338260a467 Remove ACgroupController_getFlags to fix API breakage
Since ACgroupController_getFlags was introduced after LLNDK freeze it
causes media crashes due to missing symbol. Remove the new function and
re-implement cgroup controller detection to not require flags field but
instead check for its existence on the first access.

Bug: 135049992
Test: libcutils_test with and without CONFIG_CPUSETS enabled
Change-Id: I0220d6a926884dc22a7424d7d0a980c379c6f4eb
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-06-17 16:46:23 +00:00
Tom Cherry 7f34035f08 Merge "Create android-base/format.h that includes fmtlib headers" 2019-06-17 14:42:32 +00:00
Tom Cherry 30f6f42c04 Merge "init: use Errorf() now that we have it" 2019-06-17 14:42:20 +00:00
Josh Gao a6f90ce599 Merge "Revert "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND."" 2019-06-14 23:25:35 +00:00
Josh Gao 9dba0f5824 Revert "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND."
We're only reading FUNCTIONFS_BIND on creation upon the first creation
of the control fd, which results in an abort when rebind happens (e.g.
when MTP is enabled) and we unexpectedly read FUNCTIONFS_BIND in the
second instantiation of the connection.

This reverts commit 2b668d3906.

Bug: http://b/135155652
Test: manually enabled MTP
2019-06-14 16:21:21 -07:00
Treehugger Robot 6860f68475 Merge "VtsKernelLiblpTest: use static test" 2019-06-14 23:00:48 +00:00
Tom Cherry f4db2aad57 init: use Errorf() now that we have it
Init had some pretty horrid Error() << StringPrintf(...) calls that
are all much better replaced by Errorf(...) now.

Test: build, check that keyword_map errors look correct
Change-Id: I572588c7541b928c72ae1bf140b814acdef1cd60
2019-06-14 22:07:32 +00:00
Tom Cherry b90dcc07d3 Create android-base/format.h that includes fmtlib headers
We're already including fmtlib statically in libbase, so let's also
expose its functionality directly.

Also create a small benchmark of the most common operations for
format() and StringPrintf(): int, float, and string arguments.  Note
that fmt::format is faster than StringPrintf() in all of these cases.

Test: build, run benchmark
Change-Id: I1e18f13673dd89ea936ea5c51418fad723495b08
2019-06-14 14:55:27 -07:00
Jaegeuk Kim c47618662f Merge "fs_mgr_fstab: translate reserve_root to reserved_size in fsmgr" 2019-06-14 21:49:18 +00:00
Steve Muckle 83019575ac VtsKernelLiblpTest: use static test
To avoid introducing dependencies on target libraries, use a statically
compiled test instead.

Bug: 134912860
Test: run vts-kernel -m VtsKernelLiblpTest
Change-Id: Ie24cc8532c7821cb225c024c240c4d485557bfa7
2019-06-14 11:37:09 -07:00
Tom Cherry ebbe9e7391 Merge "Add Errorf and ErrnoErrorf" 2019-06-14 18:12:00 +00:00
Jaegeuk Kim f07d07bf47 fs_mgr_fstab: translate reserve_root to reserved_size in fsmgr
Without this patch, fstab should decribe reserve_root=[# of 4KB blocks] in
f2fs mount option as well as reserved_size=[KB] in fsmgr flag to notify it
to framework.
With this patch, it should be just fine to use reserve_root=[# of 4KB blocks]
in fstab.

Bug: 135003600
Test: checked vold.has_reserved
Change-Id: Iab75f7da9792ad205a6c4d2d0f1eba8c16a5266a
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2019-06-14 17:38:33 +00:00
Treehugger Robot 2d620c00f3 Merge "Link the sanitizer runtime libraries to the default unrestricted namespace." 2019-06-14 06:37:38 +00:00
Jooyung Han baa7c13c31 init: Create /data/apex/hashtree folder at boot
/data/apex/hashtree is internal to apexd, hence 0700

Bug: 120058143
Test: m && boot device
Change-Id: I3637a3cbedf871e982e02d50c21e0fe53e6b4824
2019-06-14 15:35:49 +09:00
Jiyong Park 20524ed6a2 Add Errorf and ErrnoErrorf
String formatting for error message can be done by using Errorf and
ErrnoErrorf. e.g. `return Errorf("{} failures", num_failure);`

The string format follows that of fmtlib, not printf.

Bug: 132145659
Test: libbase_test
Change-Id: I65f45d5f12ed23e2c14d6eb442278f467cc42e83
2019-06-14 14:29:36 +09:00
Peter Collingbourne 563ca38154 Link the sanitizer runtime libraries to the default unrestricted namespace.
Without this, binaries can't be run out of /data/local/tmp on a HWASANified
device.

Test: Chromium's /data/local/tmp/md5sum/md5sum_bin works on walleye_hwasan-userdebug
Change-Id: Ieceaab8aae0024864022ca42b38aa36e6212cf31
2019-06-13 18:50:46 -07:00
David Anderson 935420f968 liblp: Remove the slot-suffix requirement in MetadataBuilder.
Normally MetadataBuilder will refuse to create non-suffixed partitions
on A/B devices. There are some scenarios where this doesn't make sense,
like when gsid needs to build metadata files for
system_gsi/userdata_gsi. It also doesn't make sense for the "scratch"
partition, so we added exceptions.

It turns out that metadata created by gsid cannot be re-imported by
MetadataBuilder, because there's no opportunity to set the "ignore" flag
in MetadataBuilder's constructor. Rather than plumbing a flag through, I
think we should just remove this error. It has too many exceptions
already and it doesn't really protect against anything. The motivation was
to avoid confusion in fastbootd on retrofit devices (where there are two
super partitions), but it's a pretty minor concern.

Bug: 134536978
Test: liblp_test gtest
Change-Id: I4629a3c46070c35bcce1017096338e72aa234371
2019-06-13 16:43:26 -07:00
Treehugger Robot 69880e1a39 Merge "Support importing property file with expanded name" 2019-06-13 23:40:48 +00:00
Dongcheol Shin a87c0f99ad Support importing property file with expanded name
This change is to support importing property file with its path
variations.

By substitute its filename with another, it can be used to handle
runtime varying filename within single binary.

Here's an example of usage in property defined file.
    import /odm/build_${ro.boot.product.hardware.sku}.prop

Bug: 132592551
Test: boot a device and checks above example import statement in
    "/odm/build.prop" loading expanded filename correctly

Change-Id: If3fdcf620a5d717e0930b1e4e58261bc8f79ec24
2019-06-13 23:40:23 +00:00
Josh Gao fc0f80ae49 adb: turn CHECKs into an error + transport restart.
These CHECKs are expected to happen if the client does the wrong thing,
so we probably shouldn't be aborting in adbd.

Bug: http://b/133872605
Bug: http://b/134695864
Test: treehugger
Change-Id: I875b87a06ba9d399db26f8af1ad47ccf34e9445a
2019-06-13 13:16:57 -07:00
Elliott Hughes bc420c4748 Merge "ziparchive: add a std::string_view overload to Next." 2019-06-13 14:13:02 +00:00
David Anderson 5482189612 Merge "fastbootd: Don't include all of the fs_mgr namespace in commands.cpp." 2019-06-12 21:10:33 +00:00
David Anderson 43d9ced663 Merge "libfiemap_writer: Handle dm stacking more accurately." 2019-06-12 21:09:59 +00:00
Hridya Valsaraju 4952ef7494 Remove system/core/mkbootimg
Bug: 133171083
Test: make
Change-Id: Iaee7edbfe91c732806bac1a7998d3db1a2e3bff2
2019-06-12 19:54:01 +00:00