Commit graph

58678 commits

Author SHA1 Message Date
Elliott Hughes
0fe3b67024 Fix logd's implicit dependency on libsysutils.
We're trying to remove the implicit dependency on libsysutils that *all*
code has via the symlink in system/core/include/, but netd and logd have
code that #includes the headers without declaring the dependency (which
works out in the end because their executables declare the dependency).

Bug: http://b/165825252
Test: treehugger
Change-Id: I8c582e427d9dbe7d9f8172c445f38ae2737a9049
2020-08-20 15:40:57 -07:00
Elliott Hughes
5d0eb66590 Merge "Deprecate <utils/Debug.h>." 2020-08-17 20:36:10 +00:00
Elliott Hughes
af99e1e88a Merge "Don't #include <utils/Debug.h> from <utils/Flattenable.h>." 2020-08-17 20:35:59 +00:00
Paul Crowley
5350746a2b Merge "Set ro.crypto.type even on failure" 2020-08-17 20:14:25 +00:00
Tom Cherry
5b02193f5c Merge "Remove android_lookupEventTagNum() and related code" 2020-08-17 19:58:22 +00:00
Tom Cherry
d11f2371e1 Remove android_lookupEventTagNum() and related code
This was introduced years ago but never gained any users.

Test: build
Merged-In: Id2deb6de1839f995970c6350a1970a872f0b51cf
Change-Id: Id2deb6de1839f995970c6350a1970a872f0b51cf
2020-08-17 18:04:00 +00:00
Elliott Hughes
884cedc770 Don't #include <utils/Debug.h> from <utils/Flattenable.h>.
It's not used, and shouldn't be used.

Also switch to `#pragma once`.

Test: treehugger
Change-Id: I464d3de1b0e1d536cea06362e6c73fddaad967d1
2020-08-17 10:14:16 -07:00
Elliott Hughes
832815151f Deprecate <utils/Debug.h>.
I stumbled across this because of the `#ifdef __cplusplus` inside an
unguarded `namespace`, but this whole file should be deprecated and
removed in favor of static_assert.

Test: treehugger
Change-Id: I2b65db67e694115e915f0cc9d762b0fd41a7d2af
2020-08-17 10:07:29 -07:00
Treehugger Robot
920393ddb7 Merge "Revert "[adb] fix signature check"" 2020-08-15 10:59:15 +00:00
Jaegeuk Kim
8a6e8be2b8 Merge "fs_mgr: try tune2fs for casefolding on /data only" 2020-08-15 03:42:05 +00:00
Alex Buynytskyy
2698b8ddeb Revert "[adb] fix signature check"
This reverts commit c935d0c450.

Reason for revert: invalid test, let's change it instead of breaking incremental installations

Change-Id: Ie5fb318c26d3a74cd2dbb16e09bda018efece211
2020-08-14 23:45:00 +00:00
Songchun Fan
d500072443 Merge "[adb] fix signature check" 2020-08-14 21:32:39 +00:00
Jaegeuk Kim
5ba5b90cd6 fs_mgr: try tune2fs for casefolding on /data only
Bug: 163420666
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: Id646bd25d6fed0f547fb0647150acdc4845a5eec
2020-08-14 12:57:25 -07:00
Songchun Fan
c935d0c450 [adb] fix signature check
BUG: 163543633
Test: atest CtsIncrementalInstallHostTestCases
Change-Id: Ie65d4639d5fb5b2dc100f1d17e3dd1c843510325
2020-08-14 11:49:58 -07:00
Paul Crowley
9acab5a4d6 Set ro.crypto.type even on failure
Move responsibility for setting ro.crypto.type into fs_mgr_mount_all,
so that even if setting up the filesystem fails, the type is set
correctly and so errors are appropriately handled.

Bug: 162289984
Test: simulate a failure and check that it's set.
Change-Id: Ib061a454e7e21d7206c3c1fa8e88e16618099581
2020-08-14 11:36:39 -07:00
Treehugger Robot
e473c89c52 Merge "libcutils: use 0 for netlink socket port id" 2020-08-14 17:52:37 +00:00
Gyeongtaek Lee
2f11cb4c4c libcutils: use 0 for netlink socket port id
AudioHAL and SoundtriggerHAL is separeted HAL but running in thread with
same process id.
So, if both HAL try to open netlink socket using uevent_open_socket(),
secondly opening socket receives already-in-use error.
To prevent situation, set 0 to socket port id.
By the LINUX man page, "The kernel assigns the process ID to the first
netlink socket the process opens and assigns a unique nl_pid to every
netlink socket that the process subsequently creates."

Bug:163008274
Test: tested by opening netlink socket in AudioHAL and
SoundtriggerHAL both.

Signed-off-by: Gyeongtaek Lee <gt82.lee@samsung.com>
Change-Id: I5f9859e8dac749bf5d0998e825043c9988c202ba
2020-08-14 21:29:17 +09:00
Christopher Ferris
278f11b574 Merge "Set warning for dex pc not in map." 2020-08-13 23:25:26 +00:00
Florian Mayer
96e966eb3d Set warning for dex pc not in map.
This way, the profilers will know they have to reparse maps.

Bug: 163130539

Test: Verified updated unit tests pass.
Change-Id: I88a801ffdda12811eab5e4833dcf472f2d75c09a
2020-08-13 13:07:21 -07:00
Tom Cherry
0398117a9a Merge "Reland: "liblog: use a blocking socket for sending messages to logd""" 2020-08-13 15:15:57 +00:00
Tom Cherry
7ef8bca1f9 Merge changes I40fe9b79,I4b6f8331
* changes:
  logd: SerializedLogBuffer: never wait for a reader during prune/clear
  logd: always wake 'wrapped' readers on prune
2020-08-12 22:44:42 +00:00
Tom Cherry
3932a9c074 logd: SerializedLogBuffer: never wait for a reader during prune/clear
Previously, chatty had logic that would skip a certain number of log
entries to satify pruning, but otherwise keep the reader connected.
This was a best-effort attempt at helping pruning and had additional
logic that handled further disruptions, if logd's memory was 2x the
allotted memory.

The new logic has two components:
1) memcpy() each individual log message in FlushTo() such that there
are no references to the underlying log data without a lock held.
Note, that this memcpy is completely negligible for performance.
2) In Prune(), immediately delete all log chunks required to reduce
memory to the allotted amount, which is now safe given 1).  If readers
will lose logs, continue to print a warning.

This additionally makes the Clear() logic deterministic.  It was
previously best effort in chatty, but will immediately and always
clear all logs for SerializedLogBuffer.

Bug: 163617910
Test: logging unit tests
Test: Prune() immediately frees buffers during high log pressure
Test: Clear() immediately frees buffers during high log pressure
Change-Id: I40fe9b791312af3dc256b166e5c34425f4ca51ac
2020-08-12 12:49:56 -07:00
Treehugger Robot
1173476551 Merge "Fix non-existent module error" 2020-08-12 19:49:18 +00:00
Treehugger Robot
b9edfee8a2 Merge "charger: Avoid a couple string constructions" 2020-08-12 19:29:49 +00:00
Tom Cherry
c5282c2121 Reland: "liblog: use a blocking socket for sending messages to logd""
This reverts commit b1eb731197.

Test: post-submit failure now passes
Change-Id: Iabbd18ad8403dd30aa07dd73e42fcc5b233b0222
2020-08-12 10:51:27 -07:00
Tom Cherry
d0e8451d59 logd: always wake 'wrapped' readers on prune
See the comment in the code for more details.  'wrapped' readers are
uncommon and error prone, and this change makes them more reliable.
Its side effect is that wrapped readers will wake more often, but
they'll still be batched to a large degree.

Bug: 163617910
Test: logging unit tests
Test: logcat --wrap does the right thing
Change-Id: I4b6f8331ff7854787c97f821b2a5bf8d7da321c6
2020-08-12 10:42:44 -07:00
Tom Cherry
0df0fcbb9d Merge "logd: add a test that logd ignores SIGPIPE" 2020-08-12 17:18:57 +00:00
Yo Chiang
78ee4c1005 Fix non-existent module error
TARGET module init_vendor requires non-existent TARGET module: init_first_stage

Module `init_first_stage` is skipped (not defined) on ASAN builds.

Bug: 163802658
Test: TH
Change-Id: I5aa030dfaa59a21511a7112ff89f8a5d8b8dc735
2020-08-12 16:27:08 +00:00
Greg Kaiser
8763fd26fb charger: Avoid a couple string constructions
With a couple recent changes to APIs taking a const std::string&,
instead of a const char *, we switch to directly passing in a
reference to our string.

Test: TreeHugger
Change-Id: Id9f832dd5e3def28cfeaa0d3cda7da323332b16c
2020-08-12 07:03:50 -07:00
Treehugger Robot
546cf270ab Merge "Add failure logs in __ashmem_open_locked()" 2020-08-11 23:04:28 +00:00
Tom Cherry
cadeec102c Merge "Revert "liblog: use a blocking socket for sending messages to logd"" 2020-08-11 22:17:41 +00:00
Tom Cherry
b1eb731197 Revert "liblog: use a blocking socket for sending messages to logd"
This reverts commit 4af349b072.

Reason for revert: post submit test logs too much fails after this
Bug: 163611679

Change-Id: If9939f3c9864dad67536d0c5481f662b9d07c58e
2020-08-11 22:15:09 +00:00
Treehugger Robot
d81e1d3483 Merge "liblog: remove android_lookupEventTag" 2020-08-11 19:05:35 +00:00
Yifan Hong
333149339b Merge changes from topic "charger_soong"
* changes:
  charger: Add tests for loading animation resources
  charger: Move built-in resources to /system
  charger: Load default resources from /system
2020-08-11 18:51:31 +00:00
Tom Cherry
175366df44 liblog: remove android_lookupEventTag
This function has been marked deprecated for quite some time, has no
users, and isn't in liblog.map.txt.

Test: build
Change-Id: Ic3bf47c780b18a5d4f1e997b9265be76049fb824
2020-08-11 09:20:18 -07:00
Elliott Hughes
7298ba0992 Merge "libsparse: Fix overflow of merged sparse chunk length" 2020-08-11 15:19:01 +00:00
Tom Cherry
d731184c38 Merge "liblog: use a blocking socket for sending messages to logd" 2020-08-11 15:13:02 +00:00
Hyeongseok Kim
e8d02c50d7 libsparse: Fix overflow of merged sparse chunk length
Merging sparse chunk can make sparse map block bigger than 4GiB,
that can't be covered by unsigned integer type. Fix this by
changing unsigned int to uint64_t type.

Test: sparse build
Bug: 162808120
Change-Id: Id4d3f88f9d531c25c3937c99b2c81efb915605ee
Signed-off-by: Hyeongseok Kim <hyeongseok@gmail.com>
Cc: hyeongseok.kim <hyeongseok.kim@lge.com>
2020-08-11 08:34:28 +09:00
Tom Cherry
4af349b072 liblog: use a blocking socket for sending messages to logd
liblog uses a non-blocking socket for sending messages to logd as a
performance/reliability trade-off, favoring not blocking processes
when they log over reliably tracking all logs.

This change asserts that the above is the wrong trade-off: that log
relability is more important than slight delays when logging. Further
points to consider:

1) The new logd implementation without chatty has lower latency and
less variance in its ::Log() function.
2) liblog also writes to /dev/pmsg0 and this call is already blocking.
3) Logging is already expensive and excess spam must be eliminated
regardless.

Bug: 151654749
Bug: 155922578
Bug: 160314220
Test: No messages are dropped by this socket
Change-Id: I163b7d51aa73a10978850f1868cb9fc4bf9ead1b
2020-08-10 15:56:15 -07:00
Eric Biggers
9b6922b5df Merge "fs_mgr: use __ANDROID_API_Q__ instead of pre_gki_level" 2020-08-10 22:35:21 +00:00
Tom Cherry
c486371741 Merge "logd: document the decision to use compression instead of chatty" 2020-08-10 21:47:39 +00:00
Hridya Valsaraju
9a147033f8 Add failure logs in __ashmem_open_locked()
Bug: 160984921
Test: build, boot
Change-Id: I754c961289828463af6de905d8b057b4350f5f07
2020-08-10 14:14:13 -07:00
Tom Cherry
edc1ba6a1d logd: document the decision to use compression instead of chatty
Open README.compression.md in a markdown viewer for details.

Test: vscode and gitiles render this correctly
Change-Id: Iaa0093dc565b5c6bb016c9e97248375f0906d0c8
2020-08-10 11:53:51 -07:00
Eric Biggers
75ebdd9c7c fs_mgr: use __ANDROID_API_Q__ instead of pre_gki_level
The name "pre_gki_level" is causing some confusion because not all
devices launching with Android R are subject to the GKI requirement.
(See b/161563110#comment11.)  E.g., devices that use a 4.14-based kernel
are exempt from GKI.  However, the encryption requirements still apply.

Just use __ANDROID_API_Q__ directly instead.

No change in behavior.

Change-Id: I4242745ccc9f88e084a1adfab5796daa9bc59b6e
2020-08-10 11:43:52 -07:00
Elliott Hughes
2cfea97ba3 Merge "Add second batch of fuzzers for libutils" 2020-08-10 15:40:44 +00:00
Treehugger Robot
52c8422ea1 Merge "Add uptimeNanos to SystemClock" 2020-08-08 01:04:09 +00:00
Yifan Hong
c2bed97e10 charger: Add tests for loading animation resources
Bug: 143907179
Test: run it

Change-Id: I1b1dfe4947210932c674657689e396ae909013c2
2020-08-07 17:07:09 -07:00
Yifan Hong
5109c8ce04 charger: Move built-in resources to /system
Convert rules to build charger resources to Soong
assuming BOARD_CHARGER_NO_UI is not set. As of now,
no devices in the source tree sets this variable. Also,
these images should be installed to the system image
regardless of this variable.

This change moves battery_fail and battery_scale to
/system/etc/res/images/charger.

Test: build and inspect system/etc/res/images/charger
Fixes: 143907179
Change-Id: Idccf5631371c7520cbfcfa6e92d1e88d0f3f95e7
2020-08-07 17:07:09 -07:00
Yifan Hong
abda7153fe charger: Load default resources from /system
When charger resources are missing from /product, before this change,
images are loaded from /res/images/charger. After this change, charger
first checks if the resource exists at that location, and if not, use
resource under /system/etc/res/images/charger.

On devices that uses resources from /product, this change has no effect.
On devices that uses resources from /res,
- if an old image is mounted at /, charger continues to load resources
  from /res.
- if a new image is mounted at /, that is, battery_fail and
  battery_scale may not exist under /res, charger loads them from /system.
  There are no font files installed by modules defined here, so any
  device-specific font files stay at /res.

Also create virtual function wrappers over minui APIs to be mocked
later.

See next change on moving battery_scale and battery_fail images to
/system.

Test: build and inspect system/etc/res/images/charger
Bug: 143907179
Change-Id: I4895b9602274fa4a1ebb4d7d3b842622b81b7b51
2020-08-07 17:07:09 -07:00
Jooyung Han
ccab04e5b5 Merge "Fix the order for boot scripts scanning" 2020-08-07 23:21:55 +00:00