421 Commits

Author SHA1 Message Date
Daniel Zheng
b4f5c0fc8e health HAL: update description + naming
Update some undefined behavior + variable naming

Bug: 371322457
Test: th
Change-Id: Ic13b275d84b1fef52923afb906ecbff7eee39bfe
2024-12-05 05:06:24 +00:00
Daniel Zheng
b1553a0987 Health HAL: add hinge info
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
2024-11-20 10:46:34 -08:00
Treehugger Robot
d6dce1a891 Merge "Add proposed trendy teams for VTS modules" into main 2024-11-07 16:25:08 +00:00
Yihan Dong
c964c5bb7a Add proposed trendy teams for VTS modules
Change-Id: If887051367b0ec5033992cefae7b994b4e0a3ffc
Test: build locally
Bug: 368362374
2024-11-04 02:08:01 +00:00
Steven Moreland
e959f9678d Merge "Add proposed trendy teams for VTS modules" into main 2024-11-01 19:46:46 +00:00
Yihan Dong
c5e38cf394 Add proposed trendy teams for VTS modules
Change-Id: I4064140c7ea0cc5a27d29f3dc97c5c302b4470da
Test: build locally
Bug: 368362374
2024-11-01 00:11:34 +00:00
Cole Faust
be7e47f8ec Remove dependencies on the 1-variant fallback
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
2024-10-22 16:30:58 -07:00
Yifan Hong
2b10d4d109 Merge "health storage inherit root OWNERS." into main 2024-10-15 20:13:02 +00:00
HONG Yifan
6f5ba92e92 health storage inherit root OWNERS.
Test: TH
Fixes: 0fe0782761
    ("Split out health.storage OWNERS file")
Bug: 296950573
Change-Id: Ic975b0dc6efa4e9660e038695a47ffedd1c208bc
2024-10-14 22:06:56 -07:00
Devin Moore
33ae251c82 Add frozen: true|false to all AOSP HALs that don't have frozen
This is to prepare for enforcing a requirement of always having frozen
specified.

Test: m
Bug: 366292468

Change-Id: I2f26eb96a3a5a4ac279f665b9866bbfddbd8c496
2024-09-16 22:15:45 +00:00
Bart Van Assche
4187755208 libhealthloop: Reduce the size of the uevent receive buffer
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>
2024-09-04 09:34:01 -07:00
Bart Van Assche
32a9bfec7b libhealthloop: Modify receive buffer overflow handling
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>
2024-09-04 09:30:38 -07:00
Bart Van Assche
7b7948b1d5 libhealthloop: Use designated initializers
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>
2024-09-03 17:01:44 -07:00
Bart Van Assche
5264619177 libhealthloop: Reduce the number of ScheduleBatteryUpdate() calls
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>
2024-09-03 17:01:44 -07:00
Bart Van Assche
1f2a9d0b08 libhealthloop: Terminate KLOG messages with a newline
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>
2024-09-03 17:01:44 -07:00
Bart Van Assche
b8e15ebaa8 libhealthloop: Make the filterPowerSupplyEvents unit test easier to maintain
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>
2024-09-03 17:01:44 -07:00
Pawan Wagh
f25f4eac0c Merge "Fuzzer seed corpus for android.hardware.health.IHealth.default" into main 2024-08-29 22:01:28 +00:00
Pawan Wagh
7665b84c32 Fuzzer seed corpus for android.hardware.health.IHealth.default
Bug: 295220956
Test: TH
Flag: TEST_ONLY
Change-Id: Ia601f9c9aeb0e76824853241b6b52ee0cdff1fb5
2024-08-29 19:48:04 +00:00
Bart Van Assche
d9974eb049 Merge "Revert "libhealthloop: Handle netlink receive buffer overflows"" into main 2024-08-27 15:38:47 +00:00
Bart Van Assche
185589ba6c Revert "libhealthloop: Handle netlink receive buffer overflows"
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>
2024-08-27 14:22:14 +00:00
Bart Van Assche
5c604b9a73 libhealthloop: Only wake up for power supply events
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>
2024-08-05 15:56:25 -07:00
Bart Van Assche
0cfcfac12d libhealthloop: Handle netlink receive buffer overflows
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>
2024-08-05 15:56:16 -07:00
Bart Van Assche
6fe3618e7c libhealthloop: Micro-optimize HealthLoop::RegisterEvent()
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>
2024-08-05 15:55:24 -07:00
Bart Van Assche
7087858515 HealthLoop.cpp: Minimize #include directives
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>
2024-08-04 16:20:25 -07:00
Bart Van Assche
ce06c8ba6f health/2.1/default/Android.bp: Reformat with bpfmt -s -w
Change-Id: I04a94776bda9bbd08b2af2dceba177e90f60e27c
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2024-08-04 07:20:58 -07:00
Xin Li
64e598ce2b Merge Android 24Q2 Release (ab/11526283) to aosp-main-future
Bug: 337098550
Merged-In: I53a278f1317f5307441103dc42dc5be6f20d7075
Change-Id: I3a53ebf7339cdb886d3c1b733b8eee1847f8832a
2024-05-24 08:28:04 -07:00
David Anderson
b6e6f3bfec Annotate Health HAL test for VSR.
Bug: 310198142
Test: N/A
Change-Id: I4562c1f09cd5f32f528b74ed98e3a3a5cd733688
2024-03-29 11:45:31 -07:00
Devin Moore
a8efdb127e Vendor API level 202404 is now frozen
Ignore-AOSP-First: VINTF 202404 Finalization
Bug: 279809333
Test: build
Change-Id: Ie6d38d27a287e258c30516e0030ad8c931d06432
2024-02-20 21:05:23 +00:00
Xin Li
763c473c3d Merge Android 24Q1 Release (ab/11220357)
Bug: 319669529
Merged-In: I976f80006aeb88bde2ae34ca4f9be72cea727d9e
Change-Id: Id94b25af52bd2e2847b6858697ab21cc6ce27aa3
2024-01-30 10:36:50 -08:00
Devin Moore
92f705cee5 Use onUnlinked in health HAL
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
2024-01-25 00:17:47 +00:00
Treehugger Robot
2f66667556 Merge "Remove the active deletion action of callbacks" into main am: 2734d2f2bb am: 288f14e354
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2730951

Change-Id: I16dad9ef335ce966e9ddcd8c5e4f4bcfcd2c4ac2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-22 11:02:41 +00:00
Treehugger Robot
2734d2f2bb Merge "Remove the active deletion action of callbacks" into main 2024-01-22 10:03:12 +00:00
Yifan Hong
979995a0df Merge "health: OWNERS -elsk +dvander." into main am: 5ee7a66ee7 am: 54f12450e0
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2912229

Change-Id: I30f6009dfa75f669784eb64281c78638738fa807
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-17 21:21:48 +00:00
Yifan Hong
4cab108176 health: OWNERS -elsk +dvander.
Test: N/A
Change-Id: I8f5b3baf649c85a0af8c6c935ea1e847c08afea9
2024-01-17 10:49:07 -08:00
Treehugger Robot
16c0974ba5 Merge "health: Remove 2.0 HAL implementation." into main am: 7535e95430 am: f83c22ec72 am: dcf1d6889e
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2815768

Change-Id: I3c7a3539b4926976e3d689a5ae7a6accbc115d5d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-09 01:32:34 +00:00
Treehugger Robot
7535e95430 Merge "health: Remove 2.0 HAL implementation." into main 2024-01-09 00:28:28 +00:00
David Anderson
f213e177fd Merge "health: Query new properties from BatteryMonitor." into main am: c601ec2ff5 am: e62ba8d5ba am: 0748629366
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2865639

Change-Id: I6a021d6b7af3548859eac0ed4398ef823e0931b2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-12 21:47:44 +00:00
David Anderson
6e367dd86f Merge "Add android.hardware.health AIDL HAL V3." into main am: 9315c9f499 am: 346f8587c6 am: eb6c88c9d2
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2836453

Change-Id: I4a3578173a7d6a59d73f4acd6b84088358c1e0e2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-12 05:43:39 +00:00
David Anderson
8b413eb4ab health: Query new properties from BatteryMonitor.
Bug: 309792384
Test: VtsHealthTargetTest
Change-Id: I3e0117cf0e98b4861ede92623994877374cd2e23
2023-12-11 11:01:52 -08:00
David Anderson
85b3b0321a Add android.hardware.health AIDL HAL V3.
Bug: 309792384
Test: m
Change-Id: I5e9183b840f523f4d5b81dec813d35983882f71d
2023-12-11 11:01:52 -08:00
Yifan Hong
06343d55fe health: Remove 2.0 HAL implementation.
Remove HIDL 2.0 service implementation and unused
helper libraries.

Test: TH
Bug: 308450739
Change-Id: I8e1eb743d978315ae9b5b516d3e2e9dc6151d2c2
2023-11-02 13:42:21 -07:00
Treehugger Robot
2d67b6d140 Merge "Don't depend on String8 cast to C string [health]" into main am: d937584b22 am: 69f5242fba am: bd44ec07a2 am: 4d79351da6 am: e23e5c94bb
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2748301

Change-Id: Id918272405a3ceb1f10574c401cb1c60dbbe3a2c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-26 23:26:00 +00:00
Treehugger Robot
69f5242fba Merge "Don't depend on String8 cast to C string [health]" into main am: d937584b22
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2748301

Change-Id: I1c913e1f157c5270904b2d92d729b85977b5189d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-26 19:15:18 +00:00
Tomasz Wasilczyk
4f5fdf09a9 Don't depend on String8 cast to C string [health]
Bug: 295394788
Test: m checkbuild
Change-Id: I67f0468dc21dfb0baab58361078f4f7bc750bdbd
2023-09-13 04:25:40 +00:00
Treehugger Robot
2e0e3c182e Merge "Split out health.storage OWNERS file" into main am: 5a3ecbaaf6 am: 3d5c48819a am: 21b1364d18 am: 15bb1243d7 am: fed4223aec
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2747143

Change-Id: Ibc2a29b9f282f6e61e93ad7fe60becbd11bcd6d2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-11 21:26:07 +00:00
Treehugger Robot
1f6f9d56c7 Merge "Merge OWNERS files for health" into main am: a2a5939168 am: 6fca0ecdec am: ed2de1b455 am: d8b6194c9d am: 68f7d7b1a8
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2746942

Change-Id: Ib968ca3c73f17836bd1b50f033fd31f0ccc69e56
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-11 21:24:15 +00:00
Treehugger Robot
3d5c48819a Merge "Split out health.storage OWNERS file" into main am: 5a3ecbaaf6
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2747143

Change-Id: Icda20bc02328cb60e0356b59e1aba84273504d19
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-11 18:59:36 +00:00
Treehugger Robot
6fca0ecdec Merge "Merge OWNERS files for health" into main am: a2a5939168
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2746942

Change-Id: Ifc1af121db0c6e6fd15161f9745268a525dbe2cb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-11 18:56:21 +00:00
Devin Moore
0fe0782761 Split out health.storage OWNERS file
Test: none
Bug: 296950573
Change-Id: Ib91206406a35cc76d228d6351dcc785cb3d00002
2023-09-11 17:36:30 +00:00
Devin Moore
4d235eed2b Merge OWNERS files for health
Test: none
Bug: 296950573
Change-Id: I568017d621f9c539ab53c9fc48cf5f5844126f24
2023-09-08 21:22:23 +00:00