2 years agoMerge "Enable lmkd kill tracing everywhere" master
Suren Baghdasaryan [Fri, 3 Aug 2018 17:49:29 +0000 (17:49 +0000)]
Merge "Enable lmkd kill tracing everywhere"

2 years agoEnable lmkd kill tracing everywhere
Daniel Colascione [Mon, 12 Feb 2018 19:24:47 +0000 (11:24 -0800)]
Enable lmkd kill tracing everywhere

Test: asdf
Exempt-From-Owner-Approval: vacation
Merged-In: If6af7df74d303466aac4a69cdfe558e9748f72b9
Change-Id: If6af7df74d303466aac4a69cdfe558e9748f72b9

2 years agoMerge "lmkd: Disable memory.stat usage when per-application memcgs are not used"
Treehugger Robot [Fri, 3 Aug 2018 16:07:24 +0000 (16:07 +0000)]
Merge "lmkd: Disable memory.stat usage when per-application memcgs are not used"

2 years agolmkd: Disable memory.stat usage when per-application memcgs are not used
Suren Baghdasaryan [Wed, 20 Jun 2018 01:38:12 +0000 (18:38 -0700)]
lmkd: Disable memory.stat usage when per-application memcgs are not used

Per-application memory.stat files are not available when per-application
memcgs are not used (per_app_memcg=false). Disable its usage based on
ro.config.per_app_memcg property.

* correct indentation of memory_stat_parse
* move per_app_memcg check into memory_stat_parse inside
* change low_ram_device to per_app_memcg

Bug: 110384555
Test: manual test to see lkmd log message with memory hogger
Merged-In: Ib6dd7586d3ef1c64cb04d16e2d2b21fa9c8e6a3a
Change-Id: Ib6dd7586d3ef1c64cb04d16e2d2b21fa9c8e6a3a
Signed-off-by: Minchan Kim <>
Signed-off-by: Suren Baghdasaryan <>
2 years agoMerge "Remove dead gglFastDivx."
Elliott Hughes [Fri, 3 Aug 2018 14:24:22 +0000 (14:24 +0000)]
Merge "Remove dead gglFastDivx."

2 years agoMerge "Minor fixes to fastboot_driver"
Treehugger Robot [Fri, 3 Aug 2018 00:41:16 +0000 (00:41 +0000)]
Merge "Minor fixes to fastboot_driver"

2 years agoMerge "adb: delete hellish hodgepodge."
Treehugger Robot [Thu, 2 Aug 2018 23:46:50 +0000 (23:46 +0000)]
Merge "adb: delete hellish hodgepodge."

2 years agoRemove dead gglFastDivx.
Elliott Hughes [Thu, 2 Aug 2018 23:18:24 +0000 (16:18 -0700)]
Remove dead gglFastDivx.

Bug: http://b/112155920
Test: builds
Change-Id: Ia55245ce4484d5376abef16c9863015b0a0ca2b1

2 years agoMinor fixes to fastboot_driver
Aaron Wisner [Wed, 1 Aug 2018 17:57:20 +0000 (12:57 -0500)]
Minor fixes to fastboot_driver

- Make RCString() static
- Add clearer error message for 0 length upload error
- Fix regex hex matching for partition-size
- Move ZLP packet checking to SparseWriteCallback()

Test: build fastboot on glinux
Change-Id: I51a040e07b9698a41f64b35a9e2baa8d575527a9

2 years agoMerge "adbd: when rebooting, don't close socket before pausing."
Treehugger Robot [Thu, 2 Aug 2018 22:21:43 +0000 (22:21 +0000)]
Merge "adbd: when rebooting, don't close socket before pausing."

2 years agoadb: delete hellish hodgepodge.
Josh Gao [Thu, 2 Aug 2018 20:58:24 +0000 (13:58 -0700)]
adb: delete hellish hodgepodge.

This code was unreachable, since all of the callers were calling
register_socket_transport with foo.c_str() as the serial. Lift this
assumption into the type system by switching from char* to std::string
for the argument type.

Bug: http://b/112147760
Test: mma
Change-Id: I5a6ee265feee6b83bc933a64d895eed39fce68e7

2 years agoadbd: when rebooting, don't close socket before pausing.
Josh Gao [Wed, 1 Aug 2018 23:00:05 +0000 (16:00 -0700)]
adbd: when rebooting, don't close socket before pausing.

An accidental side-effect of the change to unique_fd was that we
started closing the reboot service socket before pausing and waiting
for our death. This results in the client immediately returning, which
means they might get a chance to run other commands before we actually
manage to reboot.

Bug: http://b/112104037
Test: adb reboot; adb devices
Change-Id: Id61321da0c08ebd1ab57f1ce926bafd9109dd9c2

2 years agoMerge "ueventd: require opt-in for modalias handling"
Tom Cherry [Thu, 2 Aug 2018 19:22:13 +0000 (19:22 +0000)]
Merge "ueventd: require opt-in for modalias handling"

2 years agoMerge changes from topic "liblp-blocksize"
Treehugger Robot [Thu, 2 Aug 2018 19:20:58 +0000 (19:20 +0000)]
Merge changes from topic "liblp-blocksize"

* changes:
  liblp: Require block-aligned partition sizes.
  liblp: Simplify GrowPartition().

2 years agoliblp: Require block-aligned partition sizes.
David Anderson [Wed, 1 Aug 2018 21:14:37 +0000 (14:14 -0700)]
liblp: Require block-aligned partition sizes.

DM_TABLE_LOAD will reject dm-linear entries if their size is not a
multiple of the backing device's logical block size. For example, a
partition of 10GiB+512 bytes will fail to map in device-mapper if the
logical block size is 4096 bytes. To address this, this patch adds a
few changes to liblp:

The block size given to lpmake is now recorded in LpGeometryMetadata.
The block size must be a multiple of the sector size. In addition,
partiton sizes are now aligned to the block size, and the super
partition must have enough free space to allocate at least one block (in
addition to storing metadata).

GrowPartition now has multiple checks that the block-size invariant is not
violated, to ensure that no invalid partition tables will be created.

Bug: 79173901
Test: liblp_test gtest
Change-Id: I484aac1f9b90ebd92dc1c89ce1e09cd89bbb441e

2 years agoliblp: Simplify GrowPartition().
David Anderson [Tue, 31 Jul 2018 23:43:26 +0000 (16:43 -0700)]
liblp: Simplify GrowPartition().

The partition resize algorithm duplicates a lot of logic because it
handles the final free interval separately from other free intervals.
This is unnecessary and makes it harder to change the actual algorithm.

This change makes GrowPartition() treat the final free space region the
same as free gaps in between partitions. It does this by converting the
extent list into a gap list, and then adds a final gap for the remainder
of the free space. The resize function no longer has to treat the end of
the disk separately.

This patch does not change the way partitions are allocated, it is
purely a refactoring.

Bug: 79173901
Test: liblp_test gtest
Change-Id: I4780f20b23fe021eac62de874b061857712c04fe

2 years agoMerge "liblp: Add a ResizePartition helper to MetadataBuilder."
Treehugger Robot [Thu, 2 Aug 2018 16:01:24 +0000 (16:01 +0000)]
Merge "liblp: Add a ResizePartition helper to MetadataBuilder."

2 years agoMerge "liblog: Add functions to reset log context"
Treehugger Robot [Thu, 2 Aug 2018 02:45:55 +0000 (02:45 +0000)]
Merge "liblog: Add functions to reset log context"

2 years agoliblog: Add functions to reset log context
Suren Baghdasaryan [Fri, 27 Jul 2018 19:47:26 +0000 (12:47 -0700)]
liblog: Add functions to reset log context

Add android_log_parser_reset and android_log_reset to reset reader/writer
log context. This allows to generate multiple log messages of the same
format without context reallocation.

Change-Id: Icb0f15855378aa4e66fc671ffefd15d9df6fee1e

2 years agoliblp: Add a ResizePartition helper to MetadataBuilder.
David Anderson [Tue, 31 Jul 2018 20:34:14 +0000 (13:34 -0700)]
liblp: Add a ResizePartition helper to MetadataBuilder.

This change is to assist with implementing the fastbootd "resize-partition"
command. The GrowPartition and ShrinkPartition functions are now

Bug: 78793464
Test: N/A
Change-Id: Ic66a3052359e2558663272ff6e014704206b197e

2 years agoMerge "fs_mgr: Always mount tmpfs with MS_NOEXEC"
Treehugger Robot [Wed, 1 Aug 2018 22:41:56 +0000 (22:41 +0000)]
Merge "fs_mgr: Always mount tmpfs with MS_NOEXEC"

2 years agoMerge "init: run fsck for early mount partitions"
Tom Cherry [Wed, 1 Aug 2018 21:02:35 +0000 (21:02 +0000)]
Merge "init: run fsck for early mount partitions"

2 years agoMerge "Flash super partition with fastboot flashall"
Treehugger Robot [Wed, 1 Aug 2018 20:47:53 +0000 (20:47 +0000)]
Merge "Flash super partition with fastboot flashall"

2 years agoueventd: require opt-in for modalias handling
Tom Cherry [Wed, 1 Aug 2018 20:12:20 +0000 (13:12 -0700)]
ueventd: require opt-in for modalias handling

Some devices have modules.alias and modules.dep for modprobe and other
purposes but do not want to opt into ueventd auto loading their
modules.  Therefore we add a flag that can be added to ueventd
configuration files to opt into this behavior.

Bug: 111916071
Bug: 112048758
Test: check that modules are loaded with this opt-in
Test: check that modules are not loaded without this opt-in
Change-Id: Ifb281b273059b4671eea1ca5bc726c9e79f3adfb

2 years agoMerge "Move back to BSD grep, and make it available for recovery too."
Elliott Hughes [Wed, 1 Aug 2018 20:28:27 +0000 (20:28 +0000)]
Merge "Move back to BSD grep, and make it available for recovery too."

2 years agoFlash super partition with fastboot flashall
Hridya Valsaraju [Wed, 1 Aug 2018 17:09:49 +0000 (10:09 -0700)]
Flash super partition with fastboot flashall

Bug: 111763923
Test: fastboot flashall
Change-Id: I9b89825bac00d1237972a61715da05f933ac35ce

2 years agoMove back to BSD grep, and make it available for recovery too.
Elliott Hughes [Wed, 1 Aug 2018 17:35:46 +0000 (10:35 -0700)]
Move back to BSD grep, and make it available for recovery too.

Bug: http://b/111849261
Test: manual
Change-Id: Ia4f67b9f803c4f039d170f6d015a1bd2bb0ef23d

2 years agoMerge "Remove unused logging symbols."
Tomasz Wasilczyk [Wed, 1 Aug 2018 16:37:38 +0000 (16:37 +0000)]
Merge "Remove unused logging symbols."

2 years agoMerge "adb: win32: fix Unicode console output"
Treehugger Robot [Wed, 1 Aug 2018 05:25:09 +0000 (05:25 +0000)]
Merge "adb: win32: fix Unicode console output"

2 years agoMerge changes Ib55d304d,I6fa078ea,I18e9213d,Ife58f0aa,Iccc55557
Treehugger Robot [Wed, 1 Aug 2018 04:19:16 +0000 (04:19 +0000)]
Merge changes Ib55d304d,I6fa078ea,I18e9213d,Ife58f0aa,Iccc55557

* changes:
  adb: disable ReconnectHandler in adbd.
  adb: fix error message for `adb {forward,reverse}`
  adb: more immediately try to reconnect connections.
  adb: don't pass time_point::max to condition_variable::wait_until.
  adb: move list-forward, kill-forward back into handle_forward_request.

2 years agoMerge "Add product-services.img for `fastboot flashall`."
Treehugger Robot [Wed, 1 Aug 2018 02:00:40 +0000 (02:00 +0000)]
Merge "Add product-services.img for `fastboot flashall`."

2 years agoadb: disable ReconnectHandler in adbd.
Josh Gao [Wed, 1 Aug 2018 01:28:32 +0000 (18:28 -0700)]
adb: disable ReconnectHandler in adbd.

Previously, when a TCP connection was disconnected from adbd, we were
registering it with ReconnectHandler, which led to the transport
sticking around after the socket was closed. Due to the naming of
TCP transports in adbd (host-<fd number>), this results in incoming
connections being immediately closed if their file descriptor number
ends up being the same as a TCP transport that had previously

Guard all of the reconnect logic with ADB_HOST, to fix this.

Bug: http://b/112054041
Test: while true; do adb connect <device>; adb connect <device>; adb shell true; done
Change-Id: Ib55d304d7e07d6d744e8321d34671bb6d4b91afe

2 years agoRemove unused logging symbols.
Tomasz Wasilczyk [Tue, 31 Jul 2018 18:16:55 +0000 (11:16 -0700)]
Remove unused logging symbols.

Bug: 35361699
Test: flash sailfish, it boots
Change-Id: Ie545145789faa299e1228b6c91566e0767f7ea79

2 years agoAdd product-services.img for `fastboot flashall`.
Dario Freni [Fri, 25 May 2018 15:07:19 +0000 (16:07 +0100)]
Add product-services.img for `fastboot flashall`.

This CL is largely and adaptation of

Bug: 80741439
Test: Successfully built product-services.img with one module in it, and
flashed on device. Also successfully built image with
/system/product-services and no dedicated /product-services partition.

Change-Id: I204a831e052d018018ab124d70ad1ff1610ee007

2 years agoadb: fix error message for `adb {forward,reverse}`
Josh Gao [Tue, 31 Jul 2018 22:36:03 +0000 (15:36 -0700)]
adb: fix error message for `adb {forward,reverse}`

Test: `adb reverse`
Change-Id: I6fa078ea7a0e019df5c6309df99ffdf2a3219194

2 years agoadb: more immediately try to reconnect connections.
Josh Gao [Tue, 31 Jul 2018 21:12:59 +0000 (14:12 -0700)]
adb: more immediately try to reconnect connections.

Most disconnects we're likely to encounter are cases where either we
notice immediately and can start reconnecting almost immediately (adbd
restarting because of `adb root`, etc.), or where we won't notice for a
while anyway, so a 10 second sleep is somewhat meaningless.

Test: adb root; time adb wait-for-device shell
Change-Id: I18e9213dc4e84d735e9240118a368dcb38f21c78

2 years agoadb: don't pass time_point::max to condition_variable::wait_until.
Josh Gao [Tue, 31 Jul 2018 01:51:55 +0000 (18:51 -0700)]
adb: don't pass time_point::max to condition_variable::wait_until.

libstdc++ implements wait_until by calculating the offset between its
default clock and the clock that it's given by calling now() on each
and subtracting, and then adds that offset to the time_point argument.
When time_point::max is used, this overflows, resulting in the
reconnection thread spinning.

Test: wine adb.exe server nodaemon
Change-Id: Ife58f0aad14bc44c0804483d3ff2351c28b3d576

2 years agoadb: move list-forward, kill-forward back into handle_forward_request.
Josh Gao [Tue, 31 Jul 2018 01:49:03 +0000 (18:49 -0700)]
adb: move list-forward, kill-forward back into handle_forward_request.

The daemon-side reverse functions depended on handle_forward_request:
move them back instead of duplicating the logic we had in
handle_host_request. Accomplish what we originally wanted to do in this
change by changing the transport argument of handle_forward_request to a
std::function that acquires a transport, either via
acquire_one_transport or immediately returning a value that we already

As a side effect, fix a bug where we would emit spurious errors for host
service requests.

Bug: http://b/112009742
Test: echo "001chost:connect:" | nc localhost 5037
Test: python
Test: python
Change-Id: Iccc555575df6dbd7de10382854c4ea2c6f4beeaa

2 years agoinit: run fsck for early mount partitions
Tom Cherry [Mon, 30 Jul 2018 23:23:49 +0000 (16:23 -0700)]
init: run fsck for early mount partitions

Bug: 111883560
Test: fsck runs successfully during early mount
Change-Id: I19bcd2610f87f5331f94c228fcbec8f9379fc5e8

2 years agoMerge "adb: Correctly detect deduplicated ext4 partitions."
Treehugger Robot [Tue, 31 Jul 2018 16:20:02 +0000 (16:20 +0000)]
Merge "adb: Correctly detect deduplicated ext4 partitions."

2 years agoadb: win32: fix Unicode console output
Spencer Low [Tue, 31 Jul 2018 02:53:23 +0000 (19:53 -0700)]
adb: win32: fix Unicode console output

commandline.cpp includes commandline.h which defines
StandardStreamsCallbackInterface which calls fwrite(). In the
compilation unit for commandline.cpp, fwrite is getting remapped to
adb_fwrite (good), but the compilation unit for bugreport.cpp includes
sysdeps.h pretty late, which prevents fwrite from getting remapped to

Apparently when linking, the version of StandardStreamsCallbackInterface
that gets used is the one from bugreport.cpp's compilation unit, which
doesn't call adb_fwrite().

And it's necessary to call adb_fwrite() to get Unicode console output on

The fix is to #include "sysdeps.h" earlier in bugreport.cpp. I searched
the other object files for other unremapped calls to printf/fwrite/etc.
and didn't find any.

Test: mma, manual test on Windows 10 x64

Change-Id: I322dff75a878397f5e10227e746e77b0024129d0
Signed-off-by: Spencer Low <>
2 years agoMerge "fastboot: Fix hang when sparse images end in small chunks." android-n-iot-release-smart-display-r2
Treehugger Robot [Mon, 30 Jul 2018 23:40:36 +0000 (23:40 +0000)]
Merge "fastboot: Fix hang when sparse images end in small chunks."

2 years agoMerge "Make /acct have 0555 permissions after mounting"
Treehugger Robot [Mon, 30 Jul 2018 23:37:59 +0000 (23:37 +0000)]
Merge "Make /acct have 0555 permissions after mounting"

2 years agoadb: Correctly detect deduplicated ext4 partitions.
David Anderson [Mon, 30 Jul 2018 23:06:01 +0000 (16:06 -0700)]
adb: Correctly detect deduplicated ext4 partitions.

The fs_has_shared_blocks function had two problems. One, it called
statfs() on the mount point, which will return information about the
file system the mount point is on, rather than the filesystem mounted at
that location. Second, the check for EXT4_SUPER_MAGIC was inverted.

Bug: N/A
Test: adb remount -R works on an ext4 deduplicated device
Change-Id: I2e5ef895ea274cb7cc3c35295120da90a026d0d2

2 years agofastboot: Fix hang when sparse images end in small chunks.
David Anderson [Mon, 30 Jul 2018 19:54:53 +0000 (12:54 -0700)]
fastboot: Fix hang when sparse images end in small chunks.

When host fastboot sends sparse blocks to the device, it tries to only
send blocks in multiples of 1024 bytes. If a block is not aligned to this
size, the excess bytes are prepended to the next write operation. This
is implemented by doing the write in two steps: first the previous
excess from the last write (plus new data up to alignment), then a
second write for the aligned remainder of the new data.

This logic has a bug if the final block plus the previous excess data
contains >= 1024 but < 2048 bytes. In this case the first write will
drain 1024 bytes from the data, and the second write will not have 1024
bytes to write. Instead of retaining this data for the next write, it
tries to write 0 chunks (and thus 0 bytes), which hangs the ioctl() call.

Bug: N/A
Test: "fastboot flash super super.img" where super.img is generated by
      lpmake, containing system and product_services partitions and

Change-Id: I9e8523c976ec84d5a57b36a28f4b1ca800edb7e7

2 years agoMake /acct have 0555 permissions after mounting
Luis Hector Chavez [Mon, 30 Jul 2018 20:06:46 +0000 (13:06 -0700)]
Make /acct have 0555 permissions after mounting

This change adds a `chmod 0555 /acct` just after mounting the cgroup fs
on it. This makes it such that even on systems where the rootdir+system
partitions are shared, the permissions allow for the system user to open
files within /acct, which in turn makes libprocessgroup not complain
that it can never do anything with those files.

Bug: 111996377
Test: adb shell 'ls -ldZ /acct'  # Before and after, on an aosp_sailfish
      dr-xr-xr-x 48 root root u:object_r:cgroup:s0 0 1971-12-29 17:41 /acct

Change-Id: Iee6531126c6e81aa7794e44500555bd3c1cdf7b8

2 years agoMerge "charger: minui error handling fixups"
Tao Bao [Mon, 30 Jul 2018 17:32:32 +0000 (17:32 +0000)]
Merge "charger: minui error handling fixups"

Treehugger Robot [Mon, 30 Jul 2018 16:20:08 +0000 (16:20 +0000)]

2 years agocharger: minui error handling fixups
Todd Poynor [Fri, 1 Jun 2018 18:09:58 +0000 (11:09 -0700)]
charger: minui error handling fixups

Log an error if minui init fails, and avoid subsequent calls to minui
in this case (which are likely to crash).

Warn if no system text font available.  This is now expected on most
devices, and the fallback text is not expected to be needed, but just
in case.

Avoid the attempt to print text if no system font available, log
warnings instead.

Bug: 80249440
Test: manual: charger mode with no system font
Change-Id: Ib0c761d37e41a893b2a192438eebcf48c4827049
Merged-In: Ib0c761d37e41a893b2a192438eebcf48c4827049
(cherry picked from commit 8211515fbe81c49d1e53a903ef890718ff01cadc)

2 years agoMerge "healthd_mode_charger: unblank the screen only on first frame"
Treehugger Robot [Mon, 30 Jul 2018 10:46:15 +0000 (10:46 +0000)]
Merge "healthd_mode_charger: unblank the screen only on first frame"

2 years agohealthd_mode_charger: unblank the screen only on first frame
Thierry Strudel [Wed, 23 May 2018 22:48:46 +0000 (15:48 -0700)]
healthd_mode_charger: unblank the screen only on first frame

Original code is unblank screen for all frames of the first
cycle, unblank is needed only before the first frame of the
first cycle.

Bug: 74771887
Change-Id: I51d8390e359335a0b1cb127b096db1a8b889b169
Signed-off-by: Thierry Strudel <>
2 years agoMerge "liblp: Allow building liblp as a shared library."
Treehugger Robot [Sat, 28 Jul 2018 22:52:23 +0000 (22:52 +0000)]
Merge "liblp: Allow building liblp as a shared library."

2 years agoliblp: Allow building liblp as a shared library.
David Anderson [Fri, 27 Jul 2018 23:05:31 +0000 (16:05 -0700)]
liblp: Allow building liblp as a shared library.

Bug: 79173901
Test: system image, partition_tools both build
Change-Id: I70f45d4cebfbddc39d03aa3fb3a56b6c48a20d7e

2 years agoMerge "init: Cleanly shut down subcontext processes"
Treehugger Robot [Sat, 28 Jul 2018 02:30:22 +0000 (02:30 +0000)]
Merge "init: Cleanly shut down subcontext processes"

2 years agoMerge "adbd: fix check of `remount -R`."
Treehugger Robot [Sat, 28 Jul 2018 01:00:36 +0000 (01:00 +0000)]
Merge "adbd: fix check of `remount -R`."

2 years agoMerge "NDK: add availability comments to <sync.h>."
Treehugger Robot [Sat, 28 Jul 2018 00:16:22 +0000 (00:16 +0000)]
Merge "NDK: add availability comments to <sync.h>."

2 years agoMerge "adb: split daemon services out of service_to_fd."
Josh Gao [Fri, 27 Jul 2018 23:17:18 +0000 (23:17 +0000)]
Merge "adb: split daemon services out of service_to_fd."

2 years agoadbd: fix check of `remount -R`.
Josh Gao [Fri, 27 Jul 2018 23:06:24 +0000 (16:06 -0700)]
adbd: fix check of `remount -R`.

The check was accidentally flipped when refactoring from strcmp to
std::string::operator==, inverting the behavior of `remount -R`.

Test: `adb remount` with verity enabled
Change-Id: Ib43889f1f4cc2f8fe1fd5d6e17e47d538dbe91bd

2 years agoNDK: add availability comments to <sync.h>.
Elliott Hughes [Fri, 27 Jul 2018 22:13:33 +0000 (15:13 -0700)]
NDK: add availability comments to <sync.h>.

Bug: N/A
Test: N/A
Change-Id: I0cc16cc9c32c6679098aa875d5f81829215868d4

2 years agoMerge "Move recovery to /system/bin"
Treehugger Robot [Fri, 27 Jul 2018 20:25:53 +0000 (20:25 +0000)]
Merge "Move recovery to /system/bin"

2 years agoMerge "adb: use WriteFdExactly when no format"
Treehugger Robot [Fri, 27 Jul 2018 20:06:32 +0000 (20:06 +0000)]
Merge "adb: use WriteFdExactly when no format"

2 years agoMerge "Restore tcpdump."
Treehugger Robot [Fri, 27 Jul 2018 18:54:35 +0000 (18:54 +0000)]
Merge "Restore tcpdump."

2 years agoinit: Cleanly shut down subcontext processes
Luis Hector Chavez [Fri, 27 Jul 2018 18:19:25 +0000 (11:19 -0700)]
init: Cleanly shut down subcontext processes

This change adds an explicit cleanup for the subcontext processes and
avoids them from respawning, which causes a bunch of LOG(FATAL)s when
the system is going down.

Bug: 80425914
Test: kill -TERM $INIT_PID, no crashes for subcontext inits

Change-Id: I135191d959c1dd921b102af316b24d2bc161d6c9

Yifan Hong [Fri, 27 Jul 2018 18:11:57 +0000 (11:11 -0700)]

This is the name used by

Test: `m init.environ.rc` and see directory
$OUT/root/product-services and see symlink $OUT/system/product-services

Change-Id: Ie615b6d76e2c60e6472900c33d9a87cfe99c4064

2 years agoadb: use WriteFdExactly when no format
Mark Salyzyn [Fri, 27 Jul 2018 14:31:30 +0000 (07:31 -0700)]
adb: use WriteFdExactly when no format

Minor cleanup

Test: compile
Bug: 109821005
Bug: 110985612
Change-Id: I15e33a9136675afe7a9498516301ad4960ad2a82

2 years agoMerge "Add support for /product-services partition."
Treehugger Robot [Fri, 27 Jul 2018 17:15:05 +0000 (17:15 +0000)]
Merge "Add support for /product-services partition."

2 years agoRestore tcpdump.
Elliott Hughes [Fri, 27 Jul 2018 16:31:01 +0000 (09:31 -0700)]
Restore tcpdump.

tcpdump accidentally fell off the device when its was converted
to Android.bp.

Bug: http://b/111654811
Test: builds
Change-Id: Ia49a6722b47c9017b6e573cb88f7a93f3d95db5d

2 years agoMerge "Revert "Switch to PCRE grep.""
Elliott Hughes [Fri, 27 Jul 2018 15:06:58 +0000 (15:06 +0000)]
Merge "Revert "Switch to PCRE grep.""

2 years agoMerge "Suppress gnu-zero-variadic-macro-arguments warning."
Treehugger Robot [Thu, 26 Jul 2018 23:22:44 +0000 (23:22 +0000)]
Merge "Suppress gnu-zero-variadic-macro-arguments warning."

2 years agoRevert "Switch to PCRE grep."
Elliott Hughes [Thu, 26 Jul 2018 21:43:31 +0000 (14:43 -0700)]
Revert "Switch to PCRE grep."

This reverts commit 90a018a87a605de6ad3550861143f1a5f7917570.

Not a clean revert because things have changed slightly, and I'm sticking
with the egrep/fgrep shell scripts for now.

Bug: http://b/111849261
Test: manual
Change-Id: I72ae637c84f0eb1c2b5291db73ebff1628d54110

2 years agoMerge "ueventd: Add dynamic kernel module loading"
Tom Cherry [Thu, 26 Jul 2018 21:40:36 +0000 (21:40 +0000)]
Merge "ueventd: Add dynamic kernel module loading"

2 years agoSuppress gnu-zero-variadic-macro-arguments warning.
Chih-Hung Hsieh [Thu, 26 Jul 2018 21:29:41 +0000 (14:29 -0700)]
Suppress gnu-zero-variadic-macro-arguments warning.

Bug: 111614304
Test: make with WITH_TIDY=1
Change-Id: I2a52073202f42d1912363ae864f2f7f892589cea

2 years agoMerge changes Ic90fac0b,Id9c12303,I2d9bdcb1,I9d699af1,Ia4d03f9e, ...
Treehugger Robot [Thu, 26 Jul 2018 20:10:04 +0000 (20:10 +0000)]
Merge changes Ic90fac0b,Id9c12303,I2d9bdcb1,I9d699af1,Ia4d03f9e, ...

* changes:
  adbd: turn on fdsan warnings.
  adb: add error-generating overload of adb_close(unique_fd).
  adb: fix register_socket_transport related double-closes.
  adb: fix double close in local_connect_arbitrary_ports.
  adb: use adb's unique_fd instead of android::base.
  adb: move remount_service.h into daemon.
  adb: split shell_service.h into client/daemon/protocol parts.
  adb: split file_sync_service.h into client and daemon parts.

2 years agoMerge "Create lookup table of DEX symbols."
Christopher Ferris [Thu, 26 Jul 2018 20:01:15 +0000 (20:01 +0000)]
Merge "Create lookup table of DEX symbols."

2 years agoMerge "Add support for fastboot transport timeouts and USB Reset() on linux"
Chris Fries [Thu, 26 Jul 2018 19:52:59 +0000 (19:52 +0000)]
Merge "Add support for fastboot transport timeouts and USB Reset() on linux"

2 years agoAdd support for /product-services partition.
Dario Freni [Fri, 25 May 2018 15:07:19 +0000 (16:07 +0100)]
Add support for /product-services partition.

This CL is largely and adaptation of

Bug: 80741439
Test: Successfully built product-services.img with one module in it, and
flashed on device. Also successfully built image with
/system/product-services and no dedicated /product-services partition.

Change-Id: I1046dfe19bf874da929c9131b76a1f85422fbb80
Merged-In: I1046dfe19bf874da929c9131b76a1f85422fbb80

2 years agoAdd support for fastboot transport timeouts and USB Reset() on linux
Aaron Wisner [Thu, 26 Jul 2018 15:56:09 +0000 (10:56 -0500)]
Add support for fastboot transport timeouts and USB Reset() on linux

USB Reset() allows simulating unplugging and replugging device.

Test: build and run fastboot on mac 10.13.3
Test: glinux build and run fastboot
Change-Id: Id924d063e549a4cca9dda03afd8f8fe266f6d2ab

2 years agoueventd: Add dynamic kernel module loading
Andrew F. Davis [Mon, 9 Jul 2018 18:12:00 +0000 (13:12 -0500)]
ueventd: Add dynamic kernel module loading

For some platforms it is not known at build time what devices
will be attached at runtime. Building into the kernel or pre-loading
at init all the modules that could be needed would unnecessary bloat
the kernel. The solution is dynamic kernel module loading.

The kernel will generate uevents when devices are added, userspace
should monitor for these events and load the compatible modules.

The init process already monitors for uevents, add here the ability
to respond to modalias events and preform the correct action.

Adding this to init is preferred over an external program as we
can read and process the module alias and dependency files once,
instead of for each module needing to be loaded.

Test: Run on Beagle-X15, check all needed modules are loaded (lsmod)
Change-Id: I1b57d9aeb0a9770f309207183dc4bc2b7b905f14
Signed-off-by: Andrew F. Davis <>
Reviewed-by: Sam Protsenko <>
2 years agoMerge "Revert "libsparse: Add sparse typed callback""
Tobias Thierer [Thu, 26 Jul 2018 10:36:07 +0000 (10:36 +0000)]
Merge "Revert "libsparse: Add sparse typed callback""

2 years agoRevert "libsparse: Add sparse typed callback"
Tobias Thierer [Thu, 26 Jul 2018 03:13:45 +0000 (03:13 +0000)]
Revert "libsparse: Add sparse typed callback"

This reverts commit db69f0d47f3ccb3ff656c56fe2b68aaf5ab853f6.

Reason for revert: Broke the build:

In file included from system/core/libsparse/sparse.cpp:26:
system/core/libsparse/output_file.h:34:72: error: unknown type name 'off64_t'; did you mean 'off_t'?
int (*skip_write)(void*, off64_t), void* priv,
/Applications/ note: 'off_t' declared here
typedef __darwin_off_t off_t;
1 error generated.

Bug: 78793464
Change-Id: I0f8bc4e9aa2f74612bfd8721d00d961e3f7e695f

2 years agoMerge "fs_mgr: Build and use shared libs."
Tao Bao [Thu, 26 Jul 2018 04:48:46 +0000 (04:48 +0000)]
Merge "fs_mgr: Build and use shared libs."

2 years agoMerge changes Ica6bf5c6,I3f626433
Treehugger Robot [Thu, 26 Jul 2018 02:29:12 +0000 (02:29 +0000)]
Merge changes Ica6bf5c6,I3f626433

* changes:
  fs_mgr: libdm: add support android-verity target.
  dmctl: Do not skip argument if not matched with '-ro'.

2 years agoadb: split daemon services out of service_to_fd.
Josh Gao [Thu, 26 Jul 2018 01:15:52 +0000 (18:15 -0700)]
adb: split daemon services out of service_to_fd.

Let minadbd override daemon services by pulling out the daemon services
into a separate translation unit, that isn't compiled into libadbd.

Bug: http://b/111831478
Test: mma
Change-Id: Iecfebea371e03864108eca9a4d2e9cfd5db34749

2 years agoadbd: turn on fdsan warnings.
Josh Gao [Thu, 26 Jul 2018 01:13:44 +0000 (18:13 -0700)]
adbd: turn on fdsan warnings.

Test: mma
Test: python
Change-Id: Ic90fac0b731b0aa9fa934f4472b0c40f1263c340

2 years agoadb: add error-generating overload of adb_close(unique_fd).
Josh Gao [Thu, 26 Jul 2018 01:03:08 +0000 (18:03 -0700)]
adb: add error-generating overload of adb_close(unique_fd).

Test: mma
Change-Id: Id9c1230394afe980ba90dbd5150b65e8bf997b6c

2 years agoadb: fix register_socket_transport related double-closes.
Josh Gao [Thu, 26 Jul 2018 00:21:49 +0000 (17:21 -0700)]
adb: fix register_socket_transport related double-closes.

Multiple codepaths were closing the fd they passed into
register_socket_transport on failure, which would close the fd itself.

Switch things over to unique_fd to make it clear that we don't actually
have to close on failure.

Test: mma
Change-Id: I2d9bdcb1142c24931d970f99ebdf9a8051daf05c

2 years agoadb: fix double close in local_connect_arbitrary_ports.
Josh Gao [Thu, 26 Jul 2018 00:27:34 +0000 (17:27 -0700)]
adb: fix double close in local_connect_arbitrary_ports.

register_socket_transport takes ownership of the fd, leading to a
double close if the registration fails.

Test: mma
Change-Id: I9d699af1a979bedc1dc466427436d47f09d0a88f

2 years agoadb: use adb's unique_fd instead of android::base.
Josh Gao [Wed, 25 Jul 2018 23:51:59 +0000 (16:51 -0700)]
adb: use adb's unique_fd instead of android::base.

Replace all usages of android::base::unique_fd with the unique_fd from
adb_unique_fd.h, which calls adb_close instead of close on Windows.

Most of these changes are no-ops, except for the ones to
create_service_thread, which was probably pretty broken on Windows.

Test: python
Test: adb_test
Test: wine adb_test.exe
Change-Id: Ia4d03f9e2e7ddc88c97dc64172d721f93f3bf853

2 years agoadb: move remount_service.h into daemon.
Josh Gao [Wed, 25 Jul 2018 23:07:51 +0000 (16:07 -0700)]
adb: move remount_service.h into daemon.

Test: treehugger
Change-Id: I1a895d52da2c2ef281d562be778cfe0a01854a4f

2 years agoadb: split shell_service.h into client/daemon/protocol parts.
Josh Gao [Wed, 25 Jul 2018 23:07:26 +0000 (16:07 -0700)]
adb: split shell_service.h into client/daemon/protocol parts.

Test: treehugger
Change-Id: I67042f6b29a8a07619b8d56e7376d49b956a840c

2 years agoadb: split file_sync_service.h into client and daemon parts.
Josh Gao [Wed, 25 Jul 2018 22:55:25 +0000 (15:55 -0700)]
adb: split file_sync_service.h into client and daemon parts.

Test: treehugger
Change-Id: I648c7001903a91448c69986e08a6cd2dd76ed793

2 years agoMerge "trusty: tipc_test: Read output and test result from ta2ta_ipc_test"
Arve Hjønnevåg [Thu, 26 Jul 2018 00:17:54 +0000 (00:17 +0000)]
Merge "trusty: tipc_test: Read output and test result from ta2ta_ipc_test"

2 years agoMerge "trusty: add the trusty folks to the system/core/trusty/ OWNERS."
Treehugger Robot [Wed, 25 Jul 2018 23:54:19 +0000 (23:54 +0000)]
Merge "trusty: add the trusty folks to the system/core/trusty/ OWNERS."

2 years agoMerge "Add OWNERS file to gatekeeperd"
Treehugger Robot [Wed, 25 Jul 2018 23:46:29 +0000 (23:46 +0000)]
Merge "Add OWNERS file to gatekeeperd"

2 years agoMerge "Declare __fake_use_va_args as a variadic function."
Treehugger Robot [Wed, 25 Jul 2018 23:34:18 +0000 (23:34 +0000)]
Merge "Declare __fake_use_va_args as a variadic function."

2 years agoAdd OWNERS file to gatekeeperd
Shawn Willden [Wed, 14 Feb 2018 23:01:58 +0000 (16:01 -0700)]
Add OWNERS file to gatekeeperd

Test: Yes, that would be nice, wouldn't it?
Change-Id: I4116c2546bbc15ef5edb90867ed156637bb125c6

2 years agotrusty: add the trusty folks to the system/core/trusty/ OWNERS.
Elliott Hughes [Wed, 25 Jul 2018 21:47:03 +0000 (14:47 -0700)]
trusty: add the trusty folks to the system/core/trusty/ OWNERS.

Bug: N/A
Test: N/A
Change-Id: Icd74a1fa322b4f7bd6a6a4d9e1b375b5598f84b6

2 years agoDeclare __fake_use_va_args as a variadic function.
Chih-Hung Hsieh [Wed, 25 Jul 2018 19:15:25 +0000 (12:15 -0700)]
Declare __fake_use_va_args as a variadic function.

* New clang compiler requires variadic function to have
  at least one named parameter type.
* Use ##__VA_ARGS__ to work with empty __VA_ARGS__.
* Fix one ALOG_ASSERT parameter bug in lmkd/lmkd.c.

Bug: 111614304
Test: make with WITH_TIDY=1
Change-Id: I90f35aa88527a6897954f69a35b256a157a725c5

2 years agofs_mgr: Build and use shared libs.
Tao Bao [Wed, 25 Jul 2018 20:07:31 +0000 (13:07 -0700)]
fs_mgr: Build and use shared libs.

Bug: 78793464
Test: `m dist`
Change-Id: I21ed5de72217c5cfa37e0217b0e79ed0a6f82031

2 years agoMerge "libsparse: Add sparse typed callback"
Treehugger Robot [Wed, 25 Jul 2018 20:03:44 +0000 (20:03 +0000)]
Merge "libsparse: Add sparse typed callback"