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
Fixes build errors when using callstack library in gfxstream
project, where the definition is already made.
Test: build
Change-Id: I80d4038160725b5dc70f9af93d338aca66a2f0d5
To help cases where kernel drivers do not
implement poll events correctly.
Bug: 316829336
Test: boot
Change-Id: Ibad16a8e8e061a5be8cede7e8680c3095d6e6f32
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
When enabling DEBUG_CALLBACKS , compiler complains
for the undeclared identifier 'fd'.
Fix by removing undeclared objects.
Change-Id: I751a9ef9d8843350105acd6a30645f897050ffa4
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
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
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
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
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
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
This empty method is different from the old one - it aligns with
std::string definition.
Bug: 295394788
Test: make checkbuild
Change-Id: Id6baed8cde01a75a8839ad6b4475a31ba1f49c8a
This time following std::string::empty meaning.
String16::length is for parity with String8::length and to
follow std::string::length/size duo.
Bug: 295394788
Test: mma
Change-Id: I43df2cbb9ca6f980a4cf6d971064d594d661f884
This method causes confuction and bugs by having the same name, but
different meaning versus std::string::empty().
Bug: 295394788
Test: make checkbuild
Change-Id: I15aadc023b20559930e4ec79f43f7032e8cd90d0
This is for parity with String8::c_str and in general the first step
in transition from String8|16.string() - to make it more similar to
std::string.
Bug: 295394788
Test: mma -j
Change-Id: I6c1411bef07c761fb2fb3fb38c27801ac4cffc57
Bug: 290835996
Test: libutils_fuzz_string8 for several minutes
String8::removeAll() has 2 serious problems:
1. When `other` is an empty string, `removeAll()` will loop infinitely
due to below process:
a) with `other` being empty string `""`, find() will call strstr()
on an empty string, which always returns `mString`, and thus
find() always return 0 in this case
b) with find() returns 0 for empty string, the next while loop in
String8::removeAll() will keep loop infinitely as `index` will
always be 0
This CL fixes this problem by returning true if `other` is an empty
string (i.e. `strlen(other) == 0`), this follows the logic that an
empty string will always be found and no actual remove needs to be
done.
2. When `other` is a NULL string, strstr() has undefined behavior. See
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf.
This undefined behavior on Android unfortunately causes immediate
segmentation fault as the current `strstr` implementation in bionic
libc doesn't check `needle` being NULL, and an access to a NULL
location is performed to check if the `needle` string is an empty
string, and thus causes segmentation fault.
This CL gives an error message and aborts instead of having a
segfault, and to keep some backward compatibility.
This CL also adds test for String8::removeAll()
Change-Id: Ie2ccee6767efe0fed476db4ec6072717198279e9