Commit graph

943 commits

Author SHA1 Message Date
Spandan Das
8bc0ee30bf Merge "Add libz to static libs of libutils_test" into main 2024-06-11 23:08:56 +00:00
Tomasz Wasilczyk
50095020db Merge "Fix libutils_binder_sdk build warnings" into main 2024-05-28 20:13:03 +00:00
Tomasz Wasilczyk
e028a195d0 Merge "Mark libutils_binder_sdk as snapshot supported" into main 2024-05-28 20:11:34 +00:00
Tomasz Wasilczyk
0a2a015e39 Fix libutils_binder_sdk build warnings
-Wclass-memaccess
-Winvalid-offsetof
-Wsequence-point
-Wzero-as-null-pointer-constant (turned on in ag/4503295)

Bug: 285204695
Test: m libutils_binder_sdk
Change-Id: I5b988f498cb8e0cf04617a4f7fd41ba9970d321d
2024-05-28 09:51:20 -07:00
Tomasz Wasilczyk
7badb51d22 Mark libutils_binder_sdk as snapshot supported
Bug: 302718225
Test: https://r.android.com/2803466
Change-Id: I3a26e1c4c63e0ed6de896ef31eb56f3a3a6bba01
2024-05-28 09:49:49 -07:00
Kiyoung Kim
110308e5ab Merge "Remove VNDK definition(s)" into main 2024-05-23 00:38:19 +00:00
Ryan Prichard
f01048743a Define String8 and String16 operator<=>
Previously, in C++20 mode, using <=> on String8 or String16 would
compare the pointer values from the implicit conversion operators
returning const char* and const char16_t*. Instead, compare the string
content. This is especially a problem with STL containers that prefer
<=> when it is available.

See https://godbolt.org/z/cc1hW17h3 for a demo of the problem.

Bug: 339775405
Test: treehugger
Change-Id: I5ee6af96dee0c9968a1bab1ad96729e45bb1ac50
2024-05-15 17:34:57 -07:00
Steven Moreland
cd3ffd1f2c Merge "libutils: T* is a trivial type" into main 2024-04-26 23:06:22 +00:00
Steven Moreland
38d36e4492 libutils: T* is a trivial type
Avoid calling constructors/destructors for
each element, when we have Vector<T*>. These
are used in libbinder and elsewhere.

std::vector is still faster but uses more mem.

Bugs: me
Test: boot && binderLibTest
Change-Id: Id1239daddd018f8eee5480d1cb6dd25d6f4df808
2024-04-26 21:08:48 +00:00
Akshata Kadam
541f850372 Updated fuzz_config in Android.bp file
Added new fields in fuzz_config like - componentid,
description, vector, service_privilege, users, fuzzed_code_usage, etc.

Bug: 306435930
Test: Build libutils_fuzz_callstack

Change-Id: I826d75ab01eb0a4d2b363681d4f5a3a4578bbc99
2024-04-11 14:31:25 +05:30
Christopher Ferris
bcaeacc686 Enable weak functions properly.
There is a check for WEAKS_AVAILABLE that is never set. Change this so
so it is available everywhere except apple/windows.

Add new test to verify that on Android the logStackInternal function is
defined.

Bug: 331489939

Test: All unit tests pass.
Change-Id: Ie982eba30ae421931a62718d39ff1f0c282453db
2024-03-27 17:49:51 -07:00
Kiyoung Kim
ad8cf52c4c Remove VNDK definition(s)
As of VNDK deprecation, any libraries that defines vndk is no longer
valid anymore. This change removes all VNDK definition(s) from modules
which was VNDK. Any former VNDK-SP libraries will be marked as double-loadable,
so it can keep be able to be referenced by LLNDK libraries.

Bug: 328994089
Test: AOSP CF build succeeded
Change-Id: I1662f16e5e446bb28167b0bb278cd63997267d2a
2024-03-15 08:19:44 +00:00
Elliott Hughes
fdc642643d Reduce <CallStack.h> namespace pollution.
Use the CALLSTACK_ prefix uniformly, and undefine all the macros
at the end of the file.

Change-Id: Ie5f92bb8cb8b3753082b1c1145696a1e0409e04d
2024-02-23 00:46:16 +00:00
Andy Hung
071880f5cb RefBase: update sp and wp to allow constinit
A constexpr ctor is useful for static initialization.
We also modernize the unit test for static variable best practices.

Test: atest libutils_binder_test
Change-Id: If42c0939fb1a2dcb8eb101ed0e10051f67e2150d
2024-02-21 21:34:22 -08:00
Serdar Kocdemir
593b19b5ce Check if ALWAYS_INLINE is already defined
Fixes build errors when using callstack library in gfxstream
project, where the definition is already made.

Test: build
Change-Id: I80d4038160725b5dc70f9af93d338aca66a2f0d5
2024-02-14 17:52:19 +00:00
Elliott Hughes
29cd07132d Remove obsolete __STDC_LIMIT_MACROS references.
None of our libcs need this any more.

Test: treehugger
Change-Id: I8a942ad6b3860633a6d722bd237a7c75482499eb
2024-02-09 16:40:02 +00:00
Elliott Hughes
6225d6f3eb We don't need __STDC_FORMAT_MACROS any more.
Test: treehugger
Change-Id: Iada8b959f61bfa55b61d2ed4b345801ed9cea0c6
2024-02-07 18:27:47 +00:00
Steven Moreland
34a09861af libutils: Looper add 'repoll'
To help cases where kernel drivers do not
implement poll events correctly.

Bug: 316829336
Test: boot

Change-Id: Ibad16a8e8e061a5be8cede7e8680c3095d6e6f32
2024-01-23 21:51:13 +00:00
Spandan Das
c4db546a21 Add libz to static libs of libutils_test
libz is no longer statically linked into libunwindstatck, so needs to be
added explicitly to the static libs of this test

Bug: 281077552
Test: presubmits
Change-Id: Ia04b63cb8dfd5e80536a188a35d036dd3e4fd775
2024-01-20 20:12:03 +00:00
Hsin-Yi Chen
e5b667bd38 Enable header_abi_checker for libutils explicitly
The ABI checking rules for VNDK will be deleted from the main branch.
To keep monitoring the ABI, the check must be enabled explicitly.

Test: m libutils.vendor
Bug: 314010764
Change-Id: I762dec1ed7de014db653663d2917a19df5076fc8
2024-01-08 18:52:13 +08:00
Tomasz Wasilczyk
1578cb3c14 Introduce libutils_binder_sdk
Bug: 285204695
Test: mma in Binder directory
Change-Id: I430b81594167940cb47897e4261ad87c75ac3783
2023-12-07 14:04:16 -08:00
Kai Sky
862f049d17 Looper: Fixed compile error when enabling DEBUG_CALLBACKS
When enabling DEBUG_CALLBACKS , compiler complains
for the undeclared identifier 'fd'.
Fix by removing undeclared objects.

Change-Id: I751a9ef9d8843350105acd6a30645f897050ffa4
2023-11-29 05:41:01 +00:00
John Reck
e01550bbb6 Add StrongPointer::release()
Useful when dealing with raw pointers in unavoidable places. Avoids
an awkward (and "slow") dance of mySp->incStrong(0); mySp->get(); ~mySp;

Test: make && atest --host libutils_binder_test
Change-Id: Ib8d46150592725cc256779bccfed19a16dce78b2
2023-11-20 11:55:02 -05:00
Tomasz Wasilczyk
b6f459abbc Allow disabling callstack
Bug: 302723053
Test: mma
Change-Id: Idea326cc9914d4c81d75dad287e169c09a736486
2023-10-27 10:48:43 -07:00
Steven Moreland
c738370273 libutils_binder: isolate headers
This isolated all libutils_binder headers from libutils
except for RefBase use of CallStack.h. This header can
be disabled with a macro option easily.

Bug: N/A
Test: N/A
Change-Id: I83af091fc17b5418ab9e4d7fc41fb43792ec547d
2023-10-24 23:45:01 +00:00
Steven Moreland
7a1ca59839 libutils: split out libutils_binder
Dependencies of libbinder, so we can build
a core libbinder library, libbinder_sdk.

This is preparing the way to move this part of libbinder
together with binder code into a single project.

Bug: 302720583
Change-Id: Icff078ac6e36c7f2b91cf815d5b9ed19b2e706e1
2023-10-09 21:56:15 +00:00
Steven Moreland
0666c3a632 libutils: remove unused 'CALLSTACKS'
This macro is set, but it doesn't exist.

Bug: 302720583
Test: build
Change-Id: I88032c24b8bc8dc52d521e769149cbd8f619dde8
2023-10-07 00:35:38 +00:00
Steven Moreland
066e625b6b libutils: use log/log.h internally
utils/Log.h is one less file we need if we're
splitting up this library for binder.

Bug: 302720583
Test: build
Change-Id: Ibc7ec5402df342627f465354d7cf59e98f450a31
2023-10-07 00:29:44 +00:00
Tomasz Wasilczyk
8c9c7d076f Merge "Revert "Revert "Lock down String8|16.string() usage""" into main 2023-09-27 15:06:23 +00:00
Ryan Prichard
532a608f58 Merge changes I7790dde8,I065907a5,Id2e82024 into main
* changes:
  Add missing <assert.h> include
  Add missing <functional> and <vector> includes
  snapuserd_test: don't discard result of std::async
2023-09-22 19:42:45 +00:00
Ryan Prichard
999efbef09 Add missing <functional> and <vector> includes
Bug: 175635923
Test: m MODULES-IN-system-core-libutils
Change-Id: I065907a58a88723ae512f155dfde2d2fcb3fc322
2023-09-21 17:52:29 -07:00
Tomasz Wasilczyk
2b1a0599c4 Don't depend on String8 cast to C string
Bug: 295394788
Test: m checkbuild
Change-Id: I5b86ae56250d409a23ab3f2bc72b725bcf6ab23e
2023-09-20 15:11:54 +00:00
Tomasz Wasilczyk
010c37b615 Revert "Revert "Lock down String8|16.string() usage""
This reverts commit 7210b285c2.

Reason for revert: attempt re-submit

Change-Id: Ia95d11628c512163ae3d13cbdd5ebbe60f435937
2023-09-15 22:22:14 +00:00
Devika Krishnadas
7210b285c2 Revert "Lock down String8|16.string() usage"
This reverts commit 8b95a12489.

Reason for revert: DroidMonitor: Test failure

Change-Id: I09230ea7c3b80e1b4d277d3c6c6355a38f7bbc92
2023-09-15 18:46:03 +00:00
Tomasz Wasilczyk
8b95a12489 Lock down String8|16.string() usage
All users should migrate to .c_str()

Bug: 295394788
Test: make checkbuild
Change-Id: Ic6295848cf3377e0bf5334448d5ed7ea53fae7ae
2023-09-14 18:37:52 +00:00
Tomasz Wasilczyk
358a982b71 Merge "Lock down String8.isEmpty() usage" into main 2023-09-14 16:18:49 +00:00
Tomasz Wasilczyk
8b5c8477f9 Lock down String8.isEmpty() usage
All users should migrate to .empty()

Bug: 295394788
Test: make checkbuild
Change-Id: I5ec7921b9cf70e6b0857e1087f141dce958d2587
2023-09-14 15:04:00 +00:00
Tomasz Wasilczyk
771bda6c0b Merge "Implement android::String access methods that avoid C string cast" into main 2023-09-12 20:43:20 +00:00
Tomasz Wasilczyk
86c9ea8f86 Implement android::String access methods that avoid C string cast
Bug: 295394788
Test: m checkbuild
Change-Id: If25fd69319171e8c549fc8fcfd95a0819291d8e6
2023-09-12 17:25:29 +00:00
Tomasz Wasilczyk
8245afd47d Merge "Revert "Revert "Revert "Revert "Drop all path-related methods from android::String8""""" into main 2023-09-12 14:02:13 +00:00
Tomasz Wasilczyk
a1853516ff Revert "Revert "Revert "Revert "Drop all path-related methods from android::String8""""
This reverts commit 141255f30c.

Reason for revert: Attempt re-submit again

Change-Id: I0e568fdf8f7a141ee3c5d54f68530ff478a47439
2023-09-11 17:45:16 +00:00
Rhed Jao
d395f638fa Merge "Revert "Revert "Revert "Drop all path-related methods from android::String8"""" into main 2023-09-11 03:43:31 +00:00
Rhed Jao
141255f30c Revert "Revert "Revert "Drop all path-related methods from android::String8"""
This reverts commit 4b6a7c3940.

Reason for revert: b/299695302, b/299694769

Change-Id: I89c6719d23446f2f9ce24e5b75d321538b580431
2023-09-11 02:05:58 +00:00
Tomasz Wasilczyk
b2b037d9f0 Merge "Revert "Revert "Drop all path-related methods from android::String8""" into main 2023-09-08 19:59:48 +00:00
Tomasz Wasilczyk
9cbae9d75b Merge "Drop String8::std_string" into main 2023-09-08 18:17:25 +00:00
Tomasz Wasilczyk
4b6a7c3940 Revert "Revert "Drop all path-related methods from android::String8""
This reverts commit cff2e40d19.

Reason for revert: Attempt re-submit

Change-Id: I8802b519e4ae3046858b854815ba580c7a6b965d
2023-09-08 11:03:59 -07:00
Tomasz Wasilczyk
cff2e40d19 Revert "Drop all path-related methods from android::String8"
This reverts commit b9dc1c2991.

Reason for revert: http://b/299624573

Change-Id: I0d5993295df65ec31c180b6b5a76fbe939891f45
2023-09-08 17:08:39 +00:00
Tomasz Wasilczyk
adaf33026a Drop String8::std_string
This method was preserved under assumption it would be baked into many
prebuilts, but since it's inline, there should be no linkage to libutils
- thus, should be safe to remove anyway.

Bug: 35363681
Bug: 295394788
Test: treehugger
Change-Id: I59964935600e9e786424136177bfc8a70bebec67
2023-09-08 09:51:24 -07:00
Tomasz Wasilczyk
b9dc1c2991 Drop all path-related methods from android::String8
Move them to androidfw and aapt, the last users.

Bug: 295394788
Test: m checkbuild
Change-Id: I7268b88d11bf221f93efed06cfd1ee65449a2421
2023-09-08 03:07:52 +00:00
Hsin-Yi Chen
e474f21a45 Check the ABI of libutils for vendor and product only
It is not necessary to compare the dumps with the library installed in
system partition.

Test: m out/target/product/generic_x86_64/lsdump_paths.txt
Bug: 280008249
Change-Id: I8fc39ad17d37cd43bf1d77ba23dde55d05dadce1
2023-09-04 03:38:15 +00:00