Add a hingeinfo field to the Health HAL that returns information related to a
foldable's hinge health + rated life expectancy.
Ignore-AOSP-First: deprecated_ota_test compilation
Bug: 371322457
Test: th
Change-Id: I23688be268afcc542fa4bc90af37933e9c1c36e7
When adding a dependencies, if the variants don't match, but the
dependency only has 1 variant anyways, soong will always use that
variant. This makes it hard to add new variants to soong, because the
1-variant fallback stops being used and you start getting missing
variant errors. Make changes to bp files such that all dependencies
correctly specify the variant to use.
Bug: 372091092
Flag: EXEMPT refactor
Test: m nothing
Change-Id: Ia820b73e20525ff35c9a8bf8179eb63869857988
This is to prepare for enforcing a requirement of always having frozen
specified.
Test: m
Bug: 366292468
Change-Id: I2f26eb96a3a5a4ac279f665b9866bbfddbd8c496
The HealthLoop code only checks the name of the subsystem in the uevents
that it receives. Since the recently added BPF filter only passes power
supply uevents, all we need to know is whether or not any such uevents
have been received. We do not need to know how many of these events have
been received. Hence, reduce the size of the uevent receive buffer.
This CL reduces the number of ScheduleBatteryUpdate() calls if uevents
are received faster than these can be processed.
Bug: 362986353
Change-Id: If286ae5d05a95d59bc637a869c94d5c5472b5be2
Signed-off-by: Bart Van Assche <bvanassche@google.com>
Let epoll_wait() wake up healthd if a receive buffer overflow has
happened. If a receive buffer overflow happened, this indicates that one
or more power supply uevent messages have been discarded. Handle this by
updating the battery statistics. This is the approach recommended in the
netlink(7) man page. From that manual page: "However, reliable
transmissions from kernel to user are impossible in any case. The kernel
can't send a netlink message if the socket buffer is full: the message
will be dropped and the kernel and the user-space process will no longer
have the same view of kernel state. It is up to the application to
detect when this happens (via the ENOBUFS error returned by recvmsg(2))
and resynchronize."
Bug: 362986353
Change-Id: I0c89907eaa014f9e2859a73b29239e82f066f03f
Signed-off-by: Bart Van Assche <bvanassche@google.com>
Make the code somewhat easier to read by using designated initializers.
No functionality has been changed.
Bug: 362986353
Change-Id: I707ea158c9c45eeb2662d7b5c1efc9b63f0375cb
Signed-off-by: Bart Van Assche <bvanassche@google.com>
Instead of calling ScheduleBatteryUpdate() every time a uevent has been
received, only call it after the netlink socket receive buffer has been
drained. This change is safe because the contents of the power supply
uevent messages is ignored.
A subtle change in this CL is that an additional call to
uevent_kernel_multicast_recv() is introduced after all the receive
buffer has been drained. In case of a receive buffer overflow, this
extra call will receive and clear the socket error (sk_err).
Bug: 362986353
Change-Id: Ic1c489dde3338f0142def743b4cd654363517486
Signed-off-by: Bart Van Assche <bvanassche@google.com>
KLOG messages are sent to /dev/kmsg and hence must be terminated with a
newline character.
Bug: 362986353
Change-Id: I7484b7722f05d8defb9529788324ac51228b7ea6
Signed-off-by: Bart Van Assche <bvanassche@google.com>
Instead of hard-coding input lengths, let the compiler calculate the
input length.
Change-Id: I47d849b85dd983706bfada0293ccbdd04c8a597a
Signed-off-by: Bart Van Assche <bvanassche@google.com>
Revert this CL because there are several signs that too much time
is spent in healthd and because CL "libhealthloop: Handle netlink
receive buffer overflows" is suspected of causing an infinite loop.
Bug: 359559224
Change-Id: Iaec132da47284d662b357b901b81b21fb6d7cd9e
Signed-off-by: Bart Van Assche <bvanassche@google.com>
healthd receives power supply information as uevents and holds a
wakelock while receiving these uevents. Without uevent filter, suspend
is postponed indefinitely if a uevent is generated during suspend. Fix
this by attaching a BPF program to the uevent socket that filters out
all events that are not power supply events.
This CL replaces the following CLs:
* Lianwei Wang, healthd: Don't set all eventpoll wakeup-able,
2015-07-09
(https://android-review.googlesource.com/c/platform/system/core/+/158851).
* Stephane Lee, Add BPF filter to filter uevents for
SUBSYSTEM=powersupply, 2022-05-06.
Multiple ideas and some code in this CL have been borrowed from
Stephane Lee's CL.
Bug: 139203596
Bug: 140330870
Bug: 203131934
Bug: 203229817
Bug: 203462310
Bug: 221725014
Test: Verified that a Pixel 2024 still wakes up if a USB cable is connected or disconnected.
Test: Verified that suspend and resume still works for a Pixel 2024 device.
Test: Verified that the following text appears in the Cuttlefish logcat output: "HealthLoop: Successfully attached BPF program to uevent socket"
Test: Verified as follows that recovery mode works fine with Cuttlefish: adb reboot recovery && adb root && adb shell dmesg | grep -E 'F DEBUG|HealthLoop'
Change-Id: I64446b103d660d220880461bdef7ef0f531e1734
Signed-off-by: Bart Van Assche <bvanassche@google.com>
The Linux kernel netlink implementation sets EPOLLERR if delivery of a
netlink message fails because of a buffer overrun (see also the Linux
kernel netlink_overrun() and sock_def_error_report() functions). Handle
buffer overruns by calling ScheduleBatteryUpdate() unconditionally.
Bug: 203462310
Change-Id: I54f7d239e6b4caad0db4d1b15de7c0385f796ebd
Signed-off-by: Bart Van Assche <bvanassche@google.com>
BoundFunction is an alias for std::function<>. Copying a function object
may be expensive. Use std::move() to avoid copying std::function<>. From
https://engdoc.corp.google.com/eng/doc/devguide/cpp/std_function.md:
"Generally prefer both accepting and passing by value if ownership is
transferred. Recall that when using value semantics, it's important to
also use std::move() when appropriate."
Bug: 203462310
Change-Id: I9fb87737dd5ce0fbb84bfbbdb0f8bb952dea1fbc
Signed-off-by: Bart Van Assche <bvanassche@google.com>
Remove the #include directives for header files of which no symbols are
used.
Bug: 203462310
Change-Id: I0d1678d9d01f05d7dc83e70b5f4df0f1129b1968
Signed-off-by: Bart Van Assche <bvanassche@google.com>
It's possible to get an onBinderDied callback after a call to
AIBinder_unlinkToDeath() so we can't delete the objects in callbacks_
until we are done using the void* cookie.
Handling the cleanup in onBinderUnlinked will handle the case where we
manually unlink it as well as the case where it's unlinked due to death.
Test: atest VtsHalHealthTargetTest
Bug: 319210610
Change-Id: Iee4783217cc88134af6de0fe66128684ca984dba