Commit graph

58736 commits

Author SHA1 Message Date
Tom Cherry
c53c64c0ec Merge "Remove thread safety from libbase logging / liblog" into rvc-dev 2020-04-23 21:40:23 +00:00
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
David Anderson
d029ccd0d6 Merge "liblp: Fix tests for linear extent overlap." into rvc-dev 2020-04-23 20:51:15 +00:00
TreeHugger Robot
386e91d21c Merge "adb: Avoid extra string construction" into rvc-dev 2020-04-23 20:11:05 +00:00
Ytai Ben-Tsvi
6025b731e6 Control audio HAL services in start/stop
Some system services (e.g. SoundTriggerMiddleware) assume that
whenever they start, the audio HAL is in its default (reset) state.
init.rc scripts tie the lifetimes of the audio HAL and system
processes, but when using stop/start this is not the case, and this
may cause spurious crashes in this case.

stop/start is apparently being relied on in some test infrastructure,
so this change is needed to avoid causing problems for those systems
or false detection of problems, which are not actually present in
production.

Bug: 154029444
Test: Manually verify that the audio HAL is stopped on
      'adb shell stop', restarted on 'adb shell start' and that the
      system boots correctly after.
Change-Id: I39878b978b47a169c4fe446c43d7347809d15e06
2020-04-23 10:42:55 -07:00
Tom Cherry
2ae56067bf Remove thread safety from libbase logging / liblog
There are no libbase users that require thread safety for SetLogger,
SetAborter, or SetDefaultTag  and the equivalent liblog symbols are
unreleased, thus have effectively no users.

It is hard to imagine a scenario where a user would need to use these
functions in a multi-threaded program, and it is unreasonable for all
users to pay for thread safety for a vast minority of potential
scenarios. Thread safety implies less efficiency and necessarily means
that these functions are neither fork safe nor async-signal safe, and
we do have users who depend on those characteristics.

It is always possible for users of the non-thread safe versions of
these functions to build thread safe versions on top of them.  For
example, if a user needs a thread safe SetLogger(), they can use the
non-thread safe SetLogger at the start of their program to register a
logger that has its own lock and pointer to a logger function.

Bug: 119867234
Test: logging unit tests
Change-Id: I8afffec1a6957d3bda95502a4c59493e0c5049ce
(cherry picked from commit 53d301c29b)
2020-04-23 10:33:03 -07:00
Jeffrey Huang
2f51ad7b86 Tag libstatspull and libstatssocket tests as MTS
create both 32 and 64 bit variants
fixes libstatssocket_test for 32 bit devices

Bug: 154652564
Test: make mts, adb push, adb shell all 4 tests
Change-Id: Ia6b51686c06e786b38cb3713315977533f1bb819
2020-04-22 17:13:24 -07:00
David Anderson
f81ec0e43a liblp: Fix tests for linear extent overlap.
The "OwnsSector" tests did not work if one range fit completely inside
another range. The new OverlapsWith() methods address this case.

Bug: 154277287
Bug: 154646936
Test: liblp_test gtests
Change-Id: I1a59069db4ffe4f13c45963c4847cff7b3dd3dfc
2020-04-22 14:39:04 -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
Greg Kaiser
cb885c24fc adb: Avoid extra string construction
Bug: 150827486
Test: TreeHugger
Change-Id: Ie03062a17b98866f1bc419a7e509461cf4e6bb80
Merged-In: Ie03062a17b98866f1bc419a7e509461cf4e6bb80
2020-04-21 20:34:44 -07:00
Nikita Ioffe
71278019d1 Make /data/apex/active world readable
This will allow Phonesky to read APEXes under /data/apex/active.

Test: adb shell su 10114 dd if=/data/apex/active/com.android.tzdata@300000000.apex of=/dev/null
Bug: 154635217
Change-Id: I5278897413ca0e32aed9d1c7f82e48138bc51404
2020-04-21 21:14:59 +01: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