Commit graph

836 commits

Author SHA1 Message Date
Florian Mayer
2b393f3664 Merge "Make callback outlive LruCache." am: 6948bbf62c am: 9e67f9302c am: 877cd36104
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2052189

Change-Id: Ibe676c9758cb914098ea775e05d8f468c0a564e2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-01 01:20:50 +00:00
Florian Mayer
e0240d3f61 Make callback outlive LruCache.
The callback can be called by the destructor of LruCache, so it needs to be destructed last.

Bug: 227635615
Change-Id: I7d965a2000c1ec32d9c9e88d25ab0c1ba3e9c739
2022-03-31 20:21:28 +00:00
Treehugger Robot
68876679ff Merge "Tweak linux_glibc properties for musl builds in system/core" am: ec8519e953 am: e06b7e163e am: cd92c351b5
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2044103

Change-Id: I2165ce47c46d4d32a34b9b56f01ff415b09fe08b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-03-30 00:52:07 +00:00
Treehugger Robot
ec8519e953 Merge "Tweak linux_glibc properties for musl builds in system/core" 2022-03-30 00:09:01 +00:00
Treehugger Robot
916624491d Merge "Fix build error from signed/unsigned comparison" am: 98c7076202 am: 9f63827322 am: dd79fa2c8d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2046028

Change-Id: Ia99c768ecfa04dffc1804f4eb37c5328980f5de7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-03-30 00:05:56 +00:00
Andrei Homescu
1a867dcb6e Fix build error from signed/unsigned comparison
Bug: 224644083
Test: m
Change-Id: I9adbe1ea53193d8c59f9022754cd3e23533e54ad
2022-03-29 00:30:34 +00:00
Colin Cross
10bbb01823 Tweak linux_glibc properties for musl builds in system/core
For convenience, builds against musl libc currently use the
linux_glibc properties because they are almost always linux-specific
and not glibc-specific.  In preparation for removing this hack,
tweak the linux_glibc properties by either moving them to host_linux,
which will apply to linux_glibc, linux_musl and linux_bionic, or
by setting appropriate musl or linux_musl properties.  Properties
that must not be repeated while musl uses linux_musl and also still
uses the linux_glibc properties are moved to glibc properties, which
don't apply to musl.  Whether these stay as glibc properties or get
moved back to linux_glibc later once the musl hack is removed is TBD.

Bug: 223257095
Test: m checkbuild
Test: m USE_HOST_MUSL=true host-native
Change-Id: I076fa026d7dddfccfa5cc395dd06bdc979eee1d8
2022-03-24 15:59:08 -07:00
Treehugger Robot
8da2dbe534 Merge "Fix TEMP_FAILURE_RETRY on non-GNU C++ dialects" am: addba34668 am: aae9c4ec53 am: 5c3f7bd328
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2025446

Change-Id: I73dae25afe75e8e26f365898685a6a17d6ff635d
2022-03-17 06:31:05 +00:00
Treehugger Robot
1727c0c622 Merge changes Iee0932b5,I0d77c490 am: f8cd69af8b am: e8c3bd931b am: 4db635bb0a
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2025448

Change-Id: Ic6452433dc944a8d53dc78c70815e18492f9f61b
2022-03-16 23:22:07 +00:00
Andrei Homescu
fcbc96191c Fix TEMP_FAILURE_RETRY on non-GNU C++ dialects
TEMP_FAILURE_RETRY uses typeof which is only allowed by gcc and clang
for GNU dialects. This switches to __typeof__ which is always supported.

Bug: 224644083
Test: m
Change-Id: I96d48d2f0dc5cd9ab903755d93c71c4eb80f7529
2022-03-16 20:54:31 +00:00
Andrei Homescu
aa4ebf2ce1 Fix Errors.h on systems that define NO_ERROR
Some systems (originally only Windows) define their own
NO_ERROR macro that overlaps with the enumerator from Errors.h.
The enumerator is only defined if the macro was not.

Bug: 224644083
Test: m
Change-Id: Iee0932b5259b3bfcf6494656b27e6e7488319f5c
2022-03-16 02:15:04 +00:00
Andrei Homescu
5c15de21da Disable call stacks on every OS except Linux/Android
To keep libutils (and consequently libbinder) as compact
and portable as possible, this disables call stacks on all
operating systems except Linux and Android.

Bug: 224644083
Test: m
Change-Id: I0d77c49022e852c2b8607f555174c4f9d54ed3df
2022-03-16 01:35:19 +00:00
Steven Moreland
91de6f1de6 Merge "libutils: ~RefBase more logs" am: 83785021f7 am: 976ee88aac am: 522182dff3
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2021996

Change-Id: Ia8aa98d8fa07b4994f767ce78e1d50e7f2130eba
2022-03-14 18:10:54 +00:00
Steven Moreland
f164de8935 libutils: ~RefBase more logs
This code was a bit confusing because Android runs with an old debug
mode on. The flag around this is removed to make it more clear what
is going on, and the log is promoted D -> W.

Bug: N/A
Test: boot, check logs
Change-Id: I4645b1a7b8e252336a6f9482ce6b57e1b907619d
2022-03-11 02:46:31 +00:00
Treehugger Robot
4c58cef88a Merge "Adding libutils owner smoreland@ as fuzz targets owner for alerts" am: 5520cb3309 am: bb9525cb67 am: 84fd9f8e99
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2016715

Change-Id: Ib21a3e63ac6bde2f2fd6a581050eedd0b0165c8b
2022-03-08 22:50:19 +00:00
Anis Assi
e75dd9a1c1 Adding libutils owner smoreland@ as fuzz targets owner for alerts
Bug: 221891733
Change-Id: I85ff5c754fb2eb85331e84b3dbacd24844d54efc
2022-03-08 19:48:21 +00:00
Treehugger Robot
e76d8254bf Merge "Fix OkOrFail<status_t> conversion ambiguities" am: 5a1f51b070 am: fb78f6f5e4 am: 7826f9a738
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2000911

Change-Id: Ia5c6fc34fe562a143d18acd89688b88e125442b2
2022-02-25 22:34:41 +00:00
Atneya Nair
dde6034eac Fix OkOrFail<status_t> conversion ambiguities
OkOrFail<status_t> has specialized conversions for Result<int, StatusT>
to avoid ambiguous implicit conversion sequences. Since user conversion
operators sequences can be followed by integral promotion, specializing
for integral types is necessary.

Specialize ResultError<StatusT> so calling code() returns a status_t
instead of a StatusT and message() is implemented even when not carrying
a string.
Eventually, these classes should be combined.

Add equality operators for ResultError<StatusT>.

Bug: 219580167
Test: atest Errors_test.cpp
Merged-In: I14acecfd2aef33c40e79ddb091e2f4af9291d837
Change-Id: Ifb5ed3c2d3452b10901e4aeb19368d873225d9ce
2022-02-25 14:27:41 -05:00
Treehugger Robot
81f6c2ec75 Merge "libutils: Remove a little dead code" am: 4a39ba316f am: 0a8e5126ef am: 9637277417 am: 74402be9d1
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1977026

Change-Id: I5fba0be1400bf89bd35692d68f2a518d486a20cb
2022-02-09 00:00:07 +00:00
Steven Moreland
7726d3dd4d Merge "libutils -= libprocessgroup dep" am: a0542fb15f am: 55975b7e0a am: 16149a30a3 am: caa74a6549
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1975707

Change-Id: I88506b52d099fdd120aec12dc517bd8e22b95f2e
2022-02-08 23:59:23 +00:00
Treehugger Robot
4a39ba316f Merge "libutils: Remove a little dead code" 2022-02-08 23:12:39 +00:00
Greg Kaiser
044be6bceb libutils: Remove a little dead code
With our recent change 0455a2c39c,
there's some logic that can be simplified to make this slightly
easier to read.

This CL does not change the behavior of this code.

Bug: 208895940
Test: TreeHugger
Change-Id: I4de2dbaf4406cbb7785df8839bb3ae453186ea69
2022-02-08 07:37:13 -08:00
Treehugger Robot
55eb96b366 Merge "libutils: don't call SetTaskProfiles around priority" am: 82b74d6f15 am: 5d078b5903 am: 15af4f4bf8 am: 14f3fb79e2
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1975808

Change-Id: Id430b68f2e21c9aa28f1e3cdc127ef61d53fae2f
2022-02-08 06:52:45 +00:00
Steven Moreland
39fc18b0cd libutils -= libprocessgroup dep
:)

This pulls in quite a few things into a lot of processes. Removing it
separately, in case the use of SetTaskProfiles needs to be reverted,
removing this as well might cause that revert to have linker errors
if new static users of libutils are introduced in the meantime.

Bug: 208895940
Test: build
Change-Id: Iaf5b5d41328c1b1f50bb32be8a6a1bd3a0c3f22f
2022-02-08 01:56:45 +00:00
Tim Murray
0455a2c39c libutils: don't call SetTaskProfiles around priority
Threads should always be in the same state as their parents. This also
implies that the additional SetTaskProfiles is unnecessary when
creating a new thread.

Test: boots, TH
Bug: 208895940
Change-Id: Id971c6e87d342a695bea106cdd258bc0ef6f7ecb
2022-02-08 01:54:09 +00:00
Colin Cross
bbca067d4b Merge "Use 0 instead of NULL for comparison to char16_t" am: 6a79e8113a am: dc4af935d5 am: 1901114704 am: 41ad47e55a
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1949458

Change-Id: If3a58bde6277971e7289eecef25b7f015d75b0bc
2022-01-14 00:26:18 +00:00
Colin Cross
02a3f958db Use 0 instead of NULL for comparison to char16_t
musl libc defines NULL as nullptr, which is explicitly allowed by
C++11.  nullptr_t cannot be implicitly cast to an integral type.
Use 0 instead.

Bug: 190084016
Test: m USE_HOST_MUSL=true host-native
Change-Id: I0c3b6c94cd69262f574414bf52494333f2f2645a
2022-01-13 13:41:59 -08:00
Jiyong Park
fea77d9a32 Merge changes from topic "or_return" am: e060580c31 am: d1e6b85f7b am: 8a038ec1b0 am: b22a816013
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1945135

Change-Id: Ifd5f0f6b37efad12731c0de0fdc5cb49ee3599d3
2022-01-12 08:37:14 +00:00
Jiyong Park
549a4a638b OR_RETURN supports status_t am: 705abe2d30 am: e1bd3f4b34 am: 29f45b2f1f am: 96413ff019
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1922318

Change-Id: I4c1dc92f6bcb231c6d3578454b1bb3959f8e2faf
2022-01-12 08:37:12 +00:00
Jiyong Park
e1bd3f4b34 OR_RETURN supports status_t am: 705abe2d30
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1922318

Change-Id: I2b4dc2d0a305e95b80fe06a22d2bd69a5d238053
2022-01-12 07:44:37 +00:00
Jiyong Park
e060580c31 Merge changes from topic "or_return"
* changes:
  Sort exported headers of libutils
  OR_RETURN supports status_t
2022-01-12 07:27:41 +00:00
Jiyong Park
8b196a7336 Sort exported headers of libutils
Bug: N/A
Test: build

Change-Id: I658155371ca32a7e9ba7e82f8e43780c515df77b
2022-01-12 09:23:46 +09:00
Jiyong Park
705abe2d30 OR_RETURN supports status_t
This change provide a specialization of android::base::OkOrFail for
status_t. As a result, a statement whose type is status_t can be used
with OR_RETURN.

The specialization also provides conversion operators to Result<T,
StatusT> where StatusT is a wrapper type for status_t. This allows
OR_RETURN macro to be used in newer functions that returns Result<T,
StatusT>.

Example usage:

\#include <utils/ErrorsMacros.h>

status_t legacy_inner();

status_t legacy_outer() {
  OR_RETURN(legacy_inner());
  return OK;
}

Result<T, StatusT> new_outer() {
  OR_RETURN(legacy_inner()); // the same macro
  return T{...};
}

Bug: 209929099
Test: atest libutils_test
Change-Id: I0def0e84ce3f0c4ff6d508c202bd51902dfc9618
2022-01-12 09:20:27 +09:00
Yi Kong
f435470449 Merge "Enable afdo for libutils" am: fe9b4ed7b8 am: 47707fb6fc am: 53b3b69bda am: f0b2856126
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1932625

Change-Id: Iee227087225bb778c67f9798293ee2d196e673b0
2022-01-05 19:48:50 +00:00
Yi Kong
6ee028f165 Enable afdo for libutils
Enable PGO (profile guided optimisation) for better performance.

Test: presubmit
Bug: 195134194
Change-Id: If9abecd830573946fc52b28afd7599800367aa09
2021-12-23 15:57:40 +08:00
Wei Wang
04090da4e5 Merge "libutils: do not follow process's group" into sc-v2-dev am: a2c0b86ad0 am: 0c54932e9e
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/16434460

Change-Id: I77333110d1a9ff52d7e3f812a1c57caec109ab86
2021-12-13 18:40:44 +00:00
Wei Wang
0c54932e9e Merge "libutils: do not follow process's group" into sc-v2-dev am: a2c0b86ad0
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/16434460

Change-Id: I06888702e43f9f6fe9e27c1e46cbd86a38db8d23
2021-12-13 18:23:56 +00:00
Wei Wang
e73180f8f5 libutils: do not follow process's group
1) App doesn't have cgroup access and there is no purpose of reading cgroup
for app. For system_server it should be known in foreground group. So
there is no benefit of reading group.

2) Reading cgroup in apps can also cause contention for other cgroup
operations.

3) vendor can change cgroup setting and get_sched_policy may return
incorrect information for get_sched_policy_profile_name.

Test: Boot
Bug: 210011562
Signed-off-by: Wei Wang <wvw@google.com>
Merged-In: I8e8c8b346984781c56ec93c0616121f7d5c99fe5
Change-Id: I8e8c8b346984781c56ec93c0616121f7d5c99fe5
(cherry picked from commit defb7773121545130fff80928ebcd7d6015be1d1)
2021-12-13 10:05:05 -08:00
Wei Wang
d2b270c063 libutils: do not follow process's group
1) App doesn't have cgroup access and there is no purpose of reading cgroup
for app. For system_server it should be known in foreground group. So
there is no benefit of reading group.

2) Reading cgroup in apps can also cause contention for other cgroup
operations.

3) vendor can change cgroup setting and get_sched_policy may return
incorrect information for get_sched_policy_profile_name.

Test: Boot
Bug: 210011562
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: I8e8c8b346984781c56ec93c0616121f7d5c99fe5
2021-12-10 02:53:08 +00:00
Christopher Parsons
416c0209f0 Merge "Remove libdl from shared_libs" am: aa6964861a am: 48c52fc8b8 am: 596ec7e22f am: 9beeb511f0
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1900970

Change-Id: I52f7223f049e9bb7cf156ff4345c21ddd023b3db
2021-11-30 00:05:07 +00:00
Chris Parsons
820da65897 Remove libdl from shared_libs
This entry is redundant, as system_shared_libs by default includes
libdl.

This should be a no-op change for the current build system, but avoids
an issue on the alternative (experimantal) build system, Bazel.

Test: md5sum libutils.so before/after on aosp_flame, verified no changes
Change-Id: I18f6e67c3e23299a0f1e0ef530a0a809b068dc03
2021-11-29 17:43:04 -05:00
Xin Li
6042b45f56 Merge "Merge Android 12" 2021-10-07 23:50:14 +00:00
Wei Wang
aa2599f0ed Merge changes from topic "sysbg_aosp" am: 1132977223 am: d7c942ad46 am: 808464a9d0 am: 04557e2fd7 am: 4497e13f02
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1847154

Change-Id: I3f936b58d68d0931ee403eca9174a601d192b0a0
2021-10-07 20:24:34 +00:00
Wei Wang
d7c942ad46 Merge changes from topic "sysbg_aosp" am: 1132977223
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1847154

Change-Id: Ida42e219f4782812392b213751560ab969b37b8f
2021-10-07 19:28:56 +00:00
Wei Wang
7ee4980dc2 libutils: use system_background for low prio tasks in framework
Bug: 201428466
Test: Build and boot check system_server's sched group
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: Iffc47fdaf3ef8fba6eb01a12cf534a0393e3e91c
Merged-In: Iffc47fdaf3ef8fba6eb01a12cf534a0393e3e91c
2021-10-07 17:58:44 +00:00
Wei Wang
1132977223 Merge changes from topic "sysbg_aosp"
* changes:
  task_profiles: add ServicePerformance to legacy device policy
  libutils: use system_background for low prio tasks in framework
2021-10-07 17:54:40 +00:00
Wei Wang
c39d60d114 libutils: use system_background for low prio tasks in framework
Bug: 201428466
Test: Build and boot check system_server's sched group
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: Iffc47fdaf3ef8fba6eb01a12cf534a0393e3e91c
2021-10-06 13:04:22 -07:00
Treehugger Robot
e93c1abe4b Merge "Looper: Use sequence numbers in epoll_event to track requests" am: 663c692a2d am: 7dc38fe273 am: cf90434fe6 am: 6bf0ea23fd am: 32df321051
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1795650

Change-Id: I1c830749b6c6999363c29c11f9cdb34749446b8d
2021-09-13 13:02:07 +00:00
Treehugger Robot
7dc38fe273 Merge "Looper: Use sequence numbers in epoll_event to track requests" am: 663c692a2d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1795650

Change-Id: Id4072ec03cbd6f0c5eb6a54d8c37d9dd453cf989
2021-09-13 12:11:00 +00:00
Treehugger Robot
663c692a2d Merge "Looper: Use sequence numbers in epoll_event to track requests" 2021-09-13 11:58:45 +00:00