Commit graph

58677 commits

Author SHA1 Message Date
Jaegeuk Kim
63cdd7095b logcatd: unset pinning log files
commit 5327d931ac ("logcatd: fallocate and fadvise to logcat files")
introduced pinning log files in order to avoid f2fs fragmentation.

But, logcatd does not guarantee to write data within fallocated 2MB space.
So, we can see some bytes written beyond 2MB boundary which results in
pinning small chunks across the filesystem. This makes F2FS GC have to unset
the pinning blocks via GC loop. If this happens during checkpoint=disable
at booting time, we can see long delay to mount /data accordingly.

Bug: 136483670
Bug: 137180754
Bug: 149418646
Fixes: 5327d931ac ("logcatd: fallocate and fadvise to logcat files")
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: I986221d6d1da9b8e46e63d1be98ddf0ce4cb099f
2020-04-23 13:53:37 -07:00
Nikita Ioffe
1b8c391c29 Merge "Observe new apexd status value of "activated" as required." into rvc-dev 2020-04-22 18:43:01 +00:00
Oli Lan
7c59fc4fb4 Observe new apexd status value of "activated" as required.
- Cherry pick of aosp/1228482

As of aosp/1224611, there is a new step in the preparation of APEXes
where init calls back into apexd after DE user data is unencrypted to
allow DE apex data to be snapshotted or restored.

aosp/1228581 introduces a new apexd.status value of "activated" that
is set once APEXes are activated but before this snapshot has occurred.

init may execute "perform_apex_config" once this has occurred, so this
CL changes init to wait for "activated" rather than "ready" before
doing this.

Bug: 148672144
Test: build & flash, check boot completes and check in logs that init
waits on the correct status value.
Merged-In: I339580bf593d3b09a5dff749ac2a5d1952bcb210
Change-Id: I71b62c9dd2f7951811606002f38612784d3d9086
2020-04-22 12:37:27 +00:00
TreeHugger Robot
af9240abc9 Merge "Add /mnt/androidwritable for MOUNT_EXTERNAL_ANDROID_WRITABLE apps" into rvc-dev 2020-04-21 11:08:07 +00:00
Jiyong Park
132bb5f861 Merge changes from topic "apex_available" into rvc-dev
* changes:
  adbd: add apex_available and visibility for internal libs.
  Set apex_available property
  Set apex_available property
  Set apex_available property
  Set apex_available property
2020-04-21 03:15:39 +00:00
TreeHugger Robot
0970bcf9f7 Merge "adb: change mdns tls service names (RFC 6763)." into rvc-dev 2020-04-20 22:41:29 +00:00
Joshua Duong
aa0b72931d adb: change mdns tls service names (RFC 6763).
Even though mdnsresponder seems to allow us to use _adb_secure_connect
and _adb_secure_pairing as service names, these names violate the syntax
outlined in RFC6763, and may not be compatible with other dns-sd
implementations.

Also address some comments from a previous CL.

Bug: 154268895

Test: atest adbd_test
Change-Id: Ia872e976fc4276587b500a827a41d46d9dc755dd
Merged-In: Ia872e976fc4276587b500a827a41d46d9dc755dd
2020-04-20 21:03:15 +00:00
Nikita Ioffe
f42f972130 Merge "PrepareZramBackingDevice: use loop_control.h" into rvc-dev 2020-04-20 20:06:16 +00:00
Nikita Ioffe
c8313adf88 PrepareZramBackingDevice: use loop_control.h
loop_control.h already provides loop device management APIs that we need
here. In addition, this change fixes a subtle race condition between
uevented creating a loop device node in userspace and
PrepareZramBackingDevice accessing it without waiting for it to be
created.

Test: device boots
Test: adb reboot userspace
Bug: 154500256
Change-Id: If80f18c8c337210030a6caf2aec6f7a47472b6fb
2020-04-20 17:38:17 +01:00
Alessio Balsini
2f8bbb97c0 Merge "Fix liblp imported both as static and dynamic lib" into rvc-dev 2020-04-20 15:35:23 +00:00
Tom Cherry
2dd0ddff06 Merge "liblog: return -EPERM if a log_is_loggable() returns false" into rvc-dev 2020-04-20 15:05:26 +00:00
Alessio Balsini
75be098a45 Fix liblp imported both as static and dynamic lib
In vts_libsnapshot_test, liblp was explicitly imported as static
library, but due to the importing of libsnapshot_defaults, it also
inherited the shared importing.
The import in libsnapshot_default, is not required, drop it.

Test: manual inspection with ldd
Bug: 148889015
Signed-off-by: Alessio Balsini <balsini@google.com>
Change-Id: I12ba0516a482dc917848b5f34cccc659a60a4803
Merged-in: I12ba0516a482dc917848b5f34cccc659a60a4803
2020-04-20 14:54:23 +01:00
Josh Gao
d11e67d88d adbd: add apex_available and visibility for internal libs.
abb links against libadbd_core for the shell protocol, and must be
on the system image because it links against cmd, so let's just
expose it to abb for now.

Exempt-From-Owner-Approval: cherry-pick from AOSP

Bug: http://b/151398197
Test: treehugger
Merged-In: Id926bc4324d3259def21ea19d3bd72320311a6e3
(cherry picked from commit b567303330)
Change-Id: Id926bc4324d3259def21ea19d3bd72320311a6e3
2020-04-20 17:21:22 +09:00
Jiyong Park
a6bcd4817c Set apex_available property
The marked library(ies) were available to the APEXes via the
hand-written whitelist in build/soong/apex/apex.go. Trying to remove the
whitelist by adding apex_available property to the Android.bp of the
libraries.

Exempt-From-Owner-Approval: cherry-pick from AOSP

Bug: 150999716
Test: m
Merged-In: I8fd2a3c9b69454c6018c72f5198898bc90dc4d0d
(cherry picked from commit 937b4bf173)
Change-Id: I8fd2a3c9b69454c6018c72f5198898bc90dc4d0d
2020-04-20 16:35:05 +09:00
Jiyong Park
5390bee3f4 Set apex_available property
The marked library(ies) were available to the APEXes via the
hand-written whitelist in build/soong/apex/apex.go. Trying to remove the
whitelist by adding apex_available property to the Android.bp of the
libraries.

Exempt-From-Owner-Approval: cherry-pick from AOSP

Bug: 150999716
Test: m
Merged-In: Id08058f3105463558c6c82298344a33af0efb2d3
(cherry picked from commit e3d371e319)
Change-Id: Id08058f3105463558c6c82298344a33af0efb2d3
2020-04-20 16:34:28 +09:00
Jiyong Park
137fb1ff1e Set apex_available property
The marked library(ies) were available to the adbd APEX via the
hand-written whitelist in build/soong/apex/apex.go. Trying to remove the
whitelist by adding apex_available property to the Android.bp of the
libraries.

Exempt-From-Owner-Approval: already +2'ed by the owner (enh)

Bug: 150999716
Bug: 151398197
Test: m
Merged-In: I8b572e3c4e76bd10c0443a6c08b72e9519243ab5
(cherry picked from commit d25bb60e05)
Change-Id: I8b572e3c4e76bd10c0443a6c08b72e9519243ab5
2020-04-20 16:07:35 +09:00
Jiyong Park
a206b8cbf4 Set apex_available property
The marked library(ies) were available to the APEXes via the hand-written
whitelist in build/soong/apex/apex.go. Trying to remove the whitelist
by adding apex_available property to the Android.bp of the libraries.

In this change, following libs were made available to all apexes because
their usage is quite common and there is no reason to restrict them
to some APEXes.

* libbase_headers
* libcutils, libcutils_headers
* libutils_headers, libsystem_headers
* liblog_headers
* libbacktrace, libbacktrace_headers
* libcrypto_utils

Exempt-From-Owner-Approval: cherry-pick from aosp

Bug: 150999716
Test: m
Merged-In: If3d3652e6604ed4f6d7694fe7ac61ae496621026
(cherry picked from commit 8bf9b1632e)
Change-Id: If3d3652e6604ed4f6d7694fe7ac61ae496621026
2020-04-20 16:06:02 +09:00
TreeHugger Robot
8ee349bdbd Merge "start: Toggle iorapd on/off when using 'start' command (by itself)" into rvc-dev 2020-04-17 23:26:47 +00:00
Tom Cherry
ef855954de liblog: return -EPERM if a log_is_loggable() returns false
This was the previous behavior, so retain it.

Bug: 119867234
Test: logging unit tests
Merged-In: I088f760cc274a4a42d72477eb4e2e8d23c613a8a
Change-Id: I088f760cc274a4a42d72477eb4e2e8d23c613a8a
(cherry picked from commit 1ff17fcebb)
2020-04-17 15:51:55 -07:00
Nikita Ioffe
aa0ec1a902 Merge "Cleanup logic in KillZramBackingDevice" into rvc-dev 2020-04-17 10:23:44 +00:00
Jerome Gaillard
acc1a1b5de Merge "macOS build fix: no off64_t on darwin." into rvc-dev 2020-04-17 10:17:22 +00:00
Elliott Hughes
44daa2dde1 macOS build fix: no off64_t on darwin.
Darwin has always had a 64-bit off_t, and never added an off64_t.

Bug: 153328340
Test: builds on mac
Change-Id: I4b244dda94c67da76c9e0f47b333c2734f5a94af
2020-04-17 10:17:02 +00:00
Martijn Coenen
884c64a052 Merge "Rename external storage properties." into rvc-dev 2020-04-17 07:59:26 +00:00
Igor Murashkin
2680b3158e start: Toggle iorapd on/off when using 'start' command (by itself)
iorapd depends on pm in system_server, so turn it off too when we
turn off system_server with the 'stop' command.

Bug: 153964298
Test: adb shell stop
Test: adb shell start
Change-Id: I08390472b1e1b969d0380843efa1bbd35b194250
2020-04-16 14:24:45 -07:00
Nikita Ioffe
a840d405eb Cleanup logic in KillZramBackingDevice
Since this function is used in userspace reboot, we need to be more
diligent with error handling, e.g.:

* If init fails to read /sys/block/zram0/backing_dev, then fail and
fallback to hard reboot.
* Always call swapoff.
* Always reset zram.
* Tear down loop device only if zram is backed by a loop device.

Test: adb reboot userspace
Bug: 153917129
Change-Id: I4709da1d08cf427ad9c898cfb2506b6a29f1d680
2020-04-16 21:37:03 +01:00
Martijn Coenen
590969d140 Rename external storage properties.
According to property naming guidelines.

Bug: 152170470
Bug: 153525566
Test: N/A
Change-Id: Ia5ce2a95e43724f8d0a7abf6782bc177dedb18a8
Merged-In: Ia5ce2a95e43724f8d0a7abf6782bc177dedb18a8
2020-04-16 10:13:28 +02:00
Tianjie
abf60c8d2e Handle the invalid timestamp in zipfile
The month field is one based in the zipfile modification time. And
it causes an overflow converting it to struct tm. Switch to type to
signed integer to suppress the sub-overflow.

Bug: 153882979
Test: parse the problematic zipfile
Change-Id: Iaf47bcc7f83d61b18c9e7a98bb6ab3936c9257e3
Merged-In: Iaf47bcc7f83d61b18c9e7a98bb6ab3936c9257e3
(cherry picked from commit 426bf3a1f1)
2020-04-16 04:34:00 +00:00
Jaegeuk Kim
418f28dbe4 Merge "rootdir/init.rc: enable iostat by default" into rvc-dev 2020-04-16 00:48:11 +00:00
TreeHugger Robot
8c873fedcc Merge "Documented range of event logtags used by Android Automotive." into rvc-dev 2020-04-16 00:43:33 +00:00
David Anderson
cf024887ae Merge "fs_mgr: Fix executable path in clean_scratch_files." into rvc-dev 2020-04-15 23:25:31 +00:00
Felipe Leme
41bae8c1bf Documented range of event logtags used by Android Automotive.
Test: N/A
Bug: 153900032

Merged-In: I2e35d56f89becea33c4a4b7fb6af8de3ccbb087a
Change-Id: I2e35d56f89becea33c4a4b7fb6af8de3ccbb087a
(cherry picked from commit 76024d755a)
2020-04-15 14:43:36 -07:00
David Anderson
a632c0c470 fs_mgr: Fix executable path in clean_scratch_files.
Bug: 154071877
Test: no error log on startup
Change-Id: I84c627011992eed6952697e7260051006b1c10d0
Merged-In: I84c627011992eed6952697e7260051006b1c10d0
2020-04-15 21:27:56 +00:00
Steve Muckle
2980ba4b3d first_stage_init: add hook to exec a shell script
If the first stage console is being used, attempt to run /first_stage.sh
immediately before the console is created.

Bug: 154126020
Change-Id: I8b7431e7b8219afea295b120d7ea91751804bda6
Merged-In: I8b7431e7b8219afea295b120d7ea91751804bda6
2020-04-15 14:05:05 -07:00
Josh Gao
3b8745edac Merge "Add missing static for macOS inline." into rvc-dev 2020-04-14 19:39:20 +00:00
Ricky Wai
7f72524f9f Add /mnt/androidwritable for MOUNT_EXTERNAL_ANDROID_WRITABLE apps
Bug: 153540919
Test: Able to boot without errors
Change-Id: If206e5e3d76a7919b7468bc2d9666b3aff296b3b
2020-04-14 12:31:50 +01:00
Elliott Hughes
e2bd0f0f6d Add missing static for macOS inline.
Also switch to #pragma once and s/__inline__/inline/g for consistency.

There are a handful of inlines that are missing static, which seems like
a bug, but I've left those for now.

Bug: http://b/153328340
Test: treehugger
Change-Id: I2353215c0a8a6154ce8b39ecde022b282f5c0cb9
Merged-In: I2353215c0a8a6154ce8b39ecde022b282f5c0cb9
(cherry picked from commit 681338dfb6)
2020-04-13 17:17:31 -07:00
Nikita Ioffe
6236af3d0c Fallback to hard reboot if userspace reboot hasn't started in time
Similarly to other recovery mechanisms, timeout is controlled by a
read-only property that can be configured per-device.

Test: adb root
Test: adb shell setprop init.userspace_reboot.started.timeoutmillis 2
Test: adb reboot userspace
Bug: 152803929
Change-Id: Id70710b46da798945ac5422ef7d69265911ea5ef
Merged-In: Id70710b46da798945ac5422ef7d69265911ea5ef
(cherry picked from commit d05535485f)
2020-04-14 00:21:41 +01:00
Yifan Hong
d4cc15499b Merge "BatteryMonitor: report current_now in uA" into rvc-dev 2020-04-13 22:31:12 +00:00
Yurii Zubrytskyi
8ee7b1191a [zip] Stop calculating crc if it's not checked
Crc calculation shows up in the profiler in 2-5% range, and is
never currently validated. Let's disable it for good.
For a well-compressible test data the difference is even nicer:

Benchmark                       Time          CPU        Iteration
------------------------------------------------------------------
ziparchive-benchmarks:
before:
  #ExtractEntry/2            1943244 ns    1926758 ns          375
  #ExtractEntry/16           1877295 ns    1867049 ns          375
  #ExtractEntry/1024         1888772 ns    1879976 ns          373
after:
  #ExtractEntry/2             817003 ns     812870 ns          874
  #ExtractEntry/16            814029 ns     809813 ns          875
  #ExtractEntry/1024          804904 ns     800972 ns          879

Bug: 153392568
Test: atest, manual
Change-Id: I917abecab01301f1d09a5bf3b542d24b3875e359
Merged-In: I917abecab01301f1d09a5bf3b542d24b3875e359
2020-04-13 19:09:44 +00:00
Yurii Zubrytskyi
c13fd3149d Merge "[incfs] Stream the hash tree for incremental installation" into rvc-dev 2020-04-13 19:08:15 +00:00
Alex Buynytskyy
e2e850f325 [incfs] Stream the hash tree for incremental installation
Instead of sending the whole tree upfront use the same
streaming interface for it as for the data blocks

This improves installation speed by almost 200ms,
650-800ms -> 500-600ms

Bug: 153696423
Test: manual, adb install in various configurations

Change-Id: Ia83de2af54ca0b1969397514ea5d761719af9055
2020-04-10 14:45:51 -07:00
Tom Cherry
57c8eacee4 liblog: support extended logger_entry headers
logger_entry has a hdr_size field meant for backwards compatibility,
however there are a few checks that expect it to be a specific size.
More problematically, it has a variable length array element, msg[0]
at the end, that would be incorrect if the header size was not kept
static.

This change fixes up those issues to facilitate future additions.

Bug: 119867234
Test: logging works with extended size headers, logging unit tests
Test: newly added unit tests with extended size header
Merged-In: I14b2b0855d219d11f374b53a5aa8e05cd6a65eef
Change-Id: I14b2b0855d219d11f374b53a5aa8e05cd6a65eef
(cherry picked from commit d3ecc66b9c)
2020-04-10 11:48:06 -07:00
Yifan Hong
7cc7a54abc BatteryMonitor: report current_now in uA
/sys/class/power_supply/*/current_now should return uA and the HAL
expects uA too.

Test: VtsHalHealthV2_0TargetTest
Bug: 136717180
Change-Id: I675be1ae645413b9494af4a5d49955aad5bd4f2e
(cherry picked from commit e5bd5f914f)
Merged-In: I675be1ae645413b9494af4a5d49955aad5bd4f2e
2020-04-09 14:41:51 -07:00
Steve Muckle
ae317c716b first_stage_init: load modules in modules.load.recovery in recovery
In recovery mode, load modules from modules.load.recovery if it
exists. Otherwise load from modules.load as usual.

Bug: 150825361
Change-Id: I7636bb5958ed10ae9a66015f04f168129618272f
Merged-In: I7636bb5958ed10ae9a66015f04f168129618272f
2020-04-08 10:49:13 -07:00
Tej Singh
282afacd3a Merge "Link libc++ statically" into rvc-dev 2020-04-08 00:37:49 +00:00
TreeHugger Robot
1dc77eaa61 Merge "Abolish DmTargetDefaultKey::IsLegacy" into rvc-dev 2020-04-08 00:10:58 +00:00
Will Mcvicker
51ae53fa1c Merge "first_stage_init: increase serial console tries to 50" into rvc-dev 2020-04-07 20:24:02 +00:00
Nikita Ioffe
a680e261e6 Manually unmount /data_mirror mounts in the right order
Test: atest CtsUserspaceRebootHostSideTestCases
Bug: 152823078
Change-Id: I57ff9182807630d8cbcf3ca6374fdd6dc6379da5
Merged-In: I57ff9182807630d8cbcf3ca6374fdd6dc6379da5
(cherry picked from commit bf66f433d6)
2020-04-07 18:54:48 +01:00
Paul Crowley
c9c9d1288f Abolish DmTargetDefaultKey::IsLegacy
To make it easier to support disk formats created using old versions
of dm-default-key with new kernels, stop checking the kernel module
version; instead, the caller decides whether to use the old or new
options format.

Bug: 150761030
Test: crosshatch and cuttlefish boot normally; cuttlefish
    fails with "default-key: Not enough arguments" as expected when
    option is set to 1
Cherry-Picked-From: 539b98fb58
Merged-In: I810bb7e085b9b8648858de1a02165162d1fd163e
Change-Id: I810bb7e085b9b8648858de1a02165162d1fd163e
2020-04-07 07:33:05 -07:00
Nikita Ioffe
7facdac6af get_mounted_entry_for_userdata: Realpath block devices from fstabs
Use realpath as a canonical representation of block devices. This makes
it easier to reason about block devices. This also fixes a bug, in which
fs_mgr_get_mounted_entry_for_userdata didn't properly work on devices
that don't support metadata encryption.

Test: atest CtsFsMgrTestCases
Test: atest CtsUserspaceRebootHostSideTestCases
Bug: 153363818
Change-Id: I139c2be46336a632bbaee86667019c075d7de814
Merged-In: I139c2be46336a632bbaee86667019c075d7de814
(cherry picked from commit 7aa37f1f21)
2020-04-07 14:04:06 +01:00