Commit graph

770 commits

Author SHA1 Message Date
Dylan Katz
50ed92a7e0 Adds license header
Missed a review point made, added the license header to FuzzFormatTypes
Test: Compiled code

Signed-off-by: Dylan Katz <dylan.katz@leviathansecurity.com>
Change-Id: Ib8f32b802ec207d0483772c38a0a741e0dd1f151
2020-10-02 11:08:15 -07:00
Steven Moreland
087e53f295 Merge "Fixes to String8 fuzzer" am: 3e3e44c740 am: ee59f6b3b3 am: d2060583cd am: d9188a4eed am: 7e8affb180
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1439322

Change-Id: I5754d7ae0902ac4bed61b85cb5c06ee100e03d77
2020-09-29 01:03:57 +00:00
Steven Moreland
d2060583cd Merge "Fixes to String8 fuzzer" am: 3e3e44c740 am: ee59f6b3b3
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1439322

Change-Id: I996789a1a891fc111b6340d40aa0e8beca8b1bf0
2020-09-28 23:40:52 +00:00
Steven Moreland
3e3e44c740 Merge "Fixes to String8 fuzzer" 2020-09-28 22:35:38 +00:00
Rick Yiu
64ffe82e7b Merge changes from topic "revert_androidSetThreadPriority_api" am: 2b1c37a3e4 am: 75595e006e am: 9bb11eb78e am: ae8504a46f am: 40a80c8bef
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1440132

Change-Id: Ie437b5fcb686d5e4d9effe4765a0fd13d138c747
2020-09-28 04:06:29 +00:00
Rick Yiu
9bb11eb78e Merge changes from topic "revert_androidSetThreadPriority_api" am: 2b1c37a3e4 am: 75595e006e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1440132

Change-Id: I1595b5fbebfa9dfb775b79ffa980b9e5a60bd03a
2020-09-28 02:52:44 +00:00
Rick Yiu
fa02bb9952 Revert "Add choice for changing sched policy when setting thread priority"
This reverts commit 57affbf91d.

Reason for revert: new API is no longer used

Change-Id: I97128c1d367e161aa50deaefa8b73a0f25e29af4
2020-09-27 11:21:11 +08:00
Rick Yiu
290efe38b6 Revert "Fix API for C compatibility"
This reverts commit b473061c5a.

Reason for revert: new API is no longer used

Change-Id: I2c4f9f37736faeb5d0403c2ba531c792d2531505
2020-09-27 11:20:03 +08:00
Dylan Katz
98e14de057 Fixes to String8 fuzzer
Adds support for format fuzzing, fixes several bugs.
Fix: 163680603
Fix: 162926178
Fix: 157469647
Test: libutils_fuzz_string8 clusterfuzz-testcase-minimized-libutils_fuzz_string8-6188353572306944
Test: libutils_fuzz_string8 clusterfuzz-testcase-minimized-libutils_fuzz_string8-6413754773012480
Test: libutils_fuzz_string8 clusterfuzz-testcase-minimized-libutils_fuzz_string8-5691524777246720

Signed-off-by: Dylan Katz <dylan.katz@leviathansecurity.com>
Change-Id: I7107c3637a4befccab345e17171a1119f8677557
2020-09-25 16:28:49 -07:00
Treehugger Robot
ec484d34fd Merge "Removed RWLock fuzzer" am: 928910999f am: 48507b1c27 am: 01cf1878c9 am: 6579e89b78 am: 7d50d0c41b
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1434261

Change-Id: I77045246577762c6d475244a11aa8e3ddd1628fb
2020-09-22 20:06:53 +00:00
Treehugger Robot
01cf1878c9 Merge "Removed RWLock fuzzer" am: 928910999f am: 48507b1c27
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1434261

Change-Id: I5f8a6f78dcfff5118ded304cae1e6e9bcf7c8e89
2020-09-22 19:17:04 +00:00
Dylan Katz
806b3d8619 Removed RWLock fuzzer
The class being fuzzed here was too simple for a fuzzer to be effective at finding crashes that were not working as intended.
To resolve the issue noted in 163775285 would require the fuzzer to simply use RWLock exactly as intended, defeating the point of fuzzing it.
Because of this, we have made the decision to remove this class. It should have a fairly small impact on coverage. In the future,
perhaps a better approach would be fuzzing pthread's rwlock methods directly.
Test: Made sure the project still builds without RWLock_fuzz.

Signed-off-by: Dylan Katz <dylan.katz@leviathansecurity.com>
Change-Id: Id5e77d053dc800a982176802dc506d26b54d810f
2020-09-11 11:03:02 -07:00
Treehugger Robot
e54b85b9ad Merge "Move PropertyMap from libutils to libinput" am: 01a30c0d2b am: 91f3227436 am: f535386aa7 am: 05a8129c88 am: 50fc3dc833
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1396177

Change-Id: Iab2a30fce6d5e0569b01b894babe33ef416dd53b
2020-09-08 17:13:30 +00:00
Treehugger Robot
f535386aa7 Merge "Move PropertyMap from libutils to libinput" am: 01a30c0d2b am: 91f3227436
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1396177

Change-Id: I04748c0a73394f593c70b8f6863e40dce0eb3616
2020-09-08 16:22:37 +00:00
Treehugger Robot
91f3227436 Merge "Move PropertyMap from libutils to libinput" am: 01a30c0d2b
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1396177

Change-Id: I02919926ccbc4127f9c9c2a2b66eb2a7334c7270
2020-09-08 16:17:05 +00:00
Siarhei Vishniakou
1329696700 Move PropertyMap from libutils to libinput
The input code is the only customer of PropertyMap. For easier
maintenance and eventual removal of it, move it to libinput.

Currently, the caller is responsible for managing the lifecycle of the
returned outMap when calling PropertyMap::load. However, the fact that
the function call allocates new memory is not obvious from the function
signature.

In a separate commit, I will refactor the function to return
Result<unique_ptr<>> to make it less errorprone.
In this commit, only move the files around to make code reviews easier.

Bug: 163171599
Test: atest inputflinger_tests
Change-Id: I316084886c3f09a1776fdb449d2f03d0563b66c1
2020-09-02 20:54:38 -07:00
Xin Li
0a112d52f8 Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709)
Bug: 166295507
Merged-In: Id18cb0e2d2f3e776a42b566c4a1af2e250890896
Change-Id: Iba7cab32ab3aa6f47952c840ff6dc8492e8d0704
2020-08-29 01:42:13 -07:00
Treehugger Robot
aa86d0ae3c Merge "Fix API for C compatibility" am: 6f3e974ab5 am: 909219ccc2
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1408797

Change-Id: I5c4a960756ba710fd1e70294f0f10414f87113bf
2020-08-26 01:28:41 +00:00
Greg Kaiser
b473061c5a Fix API for C compatibility
In https://android-review.googlesource.com/c/platform/system/core/+/1224544
when we introduced a default argument to androidSetThreadPriority(),
we broke C compatibility with this API, and with the header file
in general.

We fix this up by instead introducing a new method that takes
three arguments.  This gets this header file compiling for C again,
and keeps this particular API C compatible.

Any C++ callers of the three argument version of
androidSetThreadPriority() will need to switch to using
androidSetThreadPriorityAndPolicy().  Although since this was
a recent change, we believe there is only one such user, which
we are fixing at the same time.

Test: TreeHugger
Bug: 165009705
Merged-In: Iab0b7e6c91a8e32a17ba1b186fd0c2fe96b601e4
Change-Id: Iab0b7e6c91a8e32a17ba1b186fd0c2fe96b601e4
2020-08-24 17:29:25 +00:00
Greg Kaiser
39c7fa9ffe Fix API for C compatibility
In https://android-review.googlesource.com/c/platform/system/core/+/1224544
when we introduced a default argument to androidSetThreadPriority(),
we broke C compatibility with this API, and with the header file
in general.

We fix this up by instead introducing a new method that takes
three arguments.  This gets this header file compiling for C again,
and keeps this particular API C compatible.

Any C++ callers of the three argument version of
androidSetThreadPriority() will need to switch to using
androidSetThreadPriorityAndPolicy().  Although since this was
a recent change, we believe there is only one such user, which
we are fixing at the same time.

Test: TreeHugger
Bug: 165009705
Change-Id: Iab0b7e6c91a8e32a17ba1b186fd0c2fe96b601e4
2020-08-24 10:25:03 -07:00
Elliott Hughes
bb791bc97e Merge "Deprecate <utils/Debug.h>." am: 5d0eb66590 am: f2587f3698 am: d6e98167a5 am: a83f7cb606 am: ee858fe0b8
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1402847

Change-Id: Iea7d4bc16f35d998baa17da206badc9f8236e0a8
2020-08-17 21:40:04 +00:00
Elliott Hughes
79ce0a5ca6 Merge "Don't #include <utils/Debug.h> from <utils/Flattenable.h>." am: af99e1e88a am: 80a8682fff am: ca308a093f am: a304bb12d2 am: 97dd36c274
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1402848

Change-Id: Iceae4c8fb882517685439d34737df8990e7d5e08
2020-08-17 21:39:36 +00:00
Elliott Hughes
d6e98167a5 Merge "Deprecate <utils/Debug.h>." am: 5d0eb66590 am: f2587f3698
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1402847

Change-Id: I570616eaa8976ee45ed78425f6b1ba7b78650dc3
2020-08-17 20:59:50 +00:00
Elliott Hughes
ca308a093f Merge "Don't #include <utils/Debug.h> from <utils/Flattenable.h>." am: af99e1e88a am: 80a8682fff
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1402848

Change-Id: I9afda802fb1bde38c086ba9e7b8ba995e6e4db4c
2020-08-17 20:59:22 +00:00
Elliott Hughes
5d0eb66590 Merge "Deprecate <utils/Debug.h>." 2020-08-17 20:36:10 +00:00
Elliott Hughes
884cedc770 Don't #include <utils/Debug.h> from <utils/Flattenable.h>.
It's not used, and shouldn't be used.

Also switch to `#pragma once`.

Test: treehugger
Change-Id: I464d3de1b0e1d536cea06362e6c73fddaad967d1
2020-08-17 10:14:16 -07:00
Elliott Hughes
832815151f Deprecate <utils/Debug.h>.
I stumbled across this because of the `#ifdef __cplusplus` inside an
unguarded `namespace`, but this whole file should be deprecated and
removed in favor of static_assert.

Test: treehugger
Change-Id: I2b65db67e694115e915f0cc9d762b0fd41a7d2af
2020-08-17 10:07:29 -07:00
Steven Moreland
bad50ed24f libutils: check vsnprintf error
For encoding errors, this function will return a negative value which
causes problems down the line. Check for an error and return. Also,
integer overflows are guarded.

Bug: 161894517
Test: fuzzer test case
Change-Id: Ia85067d4258bde4b875c832d6223db5dd26b8838
Merged-In: Ia85067d4258bde4b875c832d6223db5dd26b8838
(cherry picked from commit ee22384c54)
2020-08-12 21:45:05 +00:00
Elliott Hughes
c11ce1d769 Merge "Add second batch of fuzzers for libutils" am: 2cfea97ba3 am: 354d814409 am: 20fc570cd2 am: f5d5edbb8d am: ec11814f57
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1356122

Change-Id: I3f66b6200d83defd2e2cfaa2517b8b43f02bbe47
2020-08-10 17:06:45 +00:00
Elliott Hughes
20fc570cd2 Merge "Add second batch of fuzzers for libutils" am: 2cfea97ba3 am: 354d814409
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1356122

Change-Id: Ia72091a216e548beb007c4f30ba3412fe54fa1b8
2020-08-10 16:10:54 +00:00
Elliott Hughes
2cfea97ba3 Merge "Add second batch of fuzzers for libutils" 2020-08-10 15:40:44 +00:00
Treehugger Robot
388a02c78a Merge "Add uptimeNanos to SystemClock" am: 52c8422ea1 am: c7a2225665 am: ba7efc63cc am: 11a0227d2a am: e2269017ad
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1394287

Change-Id: I4594a62d40bee62362f72d0aed1f01e40d337256
2020-08-08 02:33:21 +00:00
Treehugger Robot
ba7efc63cc Merge "Add uptimeNanos to SystemClock" am: 52c8422ea1 am: c7a2225665
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1394287

Change-Id: I8dd8c3e148a011b250260a2ebc329fdeb06433a6
2020-08-08 01:37:29 +00:00
Treehugger Robot
52c8422ea1 Merge "Add uptimeNanos to SystemClock" 2020-08-08 01:04:09 +00:00
Dylan Katz
7168f2726e Add second batch of fuzzers for libutils
This adds fuzzers for:
- CallStack
- Looper
- LruCache
- Printer
- ProcessCallStack
- PropertyMap
- RWLock
- RefBase
- StopWatch.
Test: Ran each fuzzer for 10 minutes. Rough coverage est. (likely far below actual value): 10.97%

Signed-off-by: Dylan Katz <dylan.katz@leviathansecurity.com>
Change-Id: I2f9f35c18b13338c282fb7f9c3ea4099ecb2c56f
2020-08-07 15:36:39 -07:00
Suprabh Shukla
a55ef96ea7 Add uptimeNanos to SystemClock
Test: system/core/libutils/SystemClock_test.cpp

Bug: 162791194
Change-Id: I0e3ea2004146eb7442c89bb35a9f3a2171d9c4b8
2020-08-07 14:36:07 -07:00
Steven Moreland
f1c0be76ab Merge "libutils: check vsnprintf error" into oc-dev am: a03d37d542 am: d8801aaad8 am: d05ecb8d9d am: dc99a094dd am: 64b312bbd8 am: 0cb14f1fe7 am: ce44c8ac3c
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/12254459

Change-Id: I6fb2a6370b202cbe476aee558e09c702605d8328
2020-08-04 23:38:00 +00:00
Steven Moreland
ce44c8ac3c Merge "libutils: check vsnprintf error" into oc-dev am: a03d37d542 am: d8801aaad8 am: d05ecb8d9d am: dc99a094dd am: 64b312bbd8 am: 0cb14f1fe7
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/12254459

Change-Id: I1cb83a4a22e205dddd10536f61392215d5cb33dc
2020-08-04 23:19:46 +00:00
Steven Moreland
64b312bbd8 Merge "libutils: check vsnprintf error" into oc-dev am: a03d37d542 am: d8801aaad8 am: d05ecb8d9d am: dc99a094dd
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/12254459

Change-Id: I79dcbb310a2515e7f17ad2ebbb0367070084dab2
2020-08-04 22:46:49 +00:00
Steven Moreland
dc99a094dd Merge "libutils: check vsnprintf error" into oc-dev am: a03d37d542 am: d8801aaad8 am: d05ecb8d9d
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/12254459

Change-Id: I816b8858c69e6481299f942401a16b5b39cd8b69
2020-08-04 22:21:36 +00:00
Steven Moreland
d05ecb8d9d Merge "libutils: check vsnprintf error" into oc-dev am: a03d37d542 am: d8801aaad8
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/12254459

Change-Id: Ifa0692e4966e78f4e180a2efc53db991177b6006
2020-08-04 22:03:55 +00:00
Steven Moreland
d8801aaad8 Merge "libutils: check vsnprintf error" into oc-dev am: a03d37d542
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/12254459

Change-Id: Id247c7079c146da8eaf52f098027d5daa25ce8d8
2020-08-04 21:37:54 +00:00
Steven Moreland
a03d37d542 Merge "libutils: check vsnprintf error" into oc-dev 2020-08-04 21:20:36 +00:00
TreeHugger Robot
cf6c14c850 Merge "Fail explicitly on length overflow." into oc-dev am: ea8d38e77f am: cf91151364 am: 84dcff4c6b
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619803

Change-Id: Ie7b7a57f55ead23f8d382ac98eb5087a2c614b1b
2020-07-31 20:24:42 +00:00
TreeHugger Robot
84dcff4c6b Merge "Fail explicitly on length overflow." into oc-dev am: ea8d38e77f am: cf91151364
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619803

Change-Id: Idb480f2a4dc1aa0d929e17e7e568a9c1b05c8489
2020-07-31 20:03:44 +00:00
TreeHugger Robot
cf91151364 Merge "Fail explicitly on length overflow." into oc-dev am: ea8d38e77f
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619803

Change-Id: I9a6def9ff590fdadb457e9a011df3532829d23f4
2020-07-31 19:45:35 +00:00
TreeHugger Robot
ea8d38e77f Merge "Fail explicitly on length overflow." into oc-dev 2020-07-31 19:24:50 +00:00
TreeHugger Robot
30a74852b0 Merge "Fail explicitly on length overflow." into qt-dev 2020-07-30 21:21:49 +00:00
Steven Moreland
ee22384c54 libutils: check vsnprintf error
For encoding errors, this function will return a negative value which
causes problems down the line. Check for an error and return. Also,
integer overflows are guarded.

Bug: 161894517
Test: fuzzer test case
Change-Id: Ia85067d4258bde4b875c832d6223db5dd26b8838
Merged-In: Ia85067d4258bde4b875c832d6223db5dd26b8838
2020-07-30 17:29:34 +00:00
Treehugger Robot
d882aa06c6 Merge "Update language to comply with Android's inclusive language guidance" am: 98ea1340fb am: b939c5602c am: 3105cca029 am: 9e95eeafbd am: 99813b33da
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1373460

Change-Id: I16b163dba73ed43ab95b89930c2046f9fb07bf93
2020-07-29 21:57:38 +00:00
Treehugger Robot
3105cca029 Merge "Update language to comply with Android's inclusive language guidance" am: 98ea1340fb am: b939c5602c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1373460

Change-Id: Id3fd33f2d61182ab18e87d80f0adabca855ffb80
2020-07-29 20:55:31 +00:00
Dan Albert
ac4500e67d Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference

Bug: http://b/161896447
Test: None
Change-Id: I9e5a37a20012b2f7a8eac55701df03f7b7a9ab6c
2020-07-28 15:58:25 -07:00
Steven Moreland
0f0cb957b2 libutils: check vsnprintf error
For encoding errors, this function will return a negative value which
causes problems down the line. Check for an error and return. Also,
integer overflows are guarded.

Bug: 161894517
Test: fuzzer test case
Change-Id: Ia85067d4258bde4b875c832d6223db5dd26b8838
2020-07-28 21:43:13 +00:00
Michael Wright
c3af6fcaa6 Merge "Soften BitSet class comment." am: 2ea91cfe76 am: 009d58d8da am: ec8ff6eed3 am: 80783c1327 am: 413dd3fd72
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1360510

Change-Id: I367fcce825cf0568b25678e5f769ac2525575dad
2020-07-16 13:35:01 +00:00
Michael Wright
ec8ff6eed3 Merge "Soften BitSet class comment." am: 2ea91cfe76 am: 009d58d8da
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1360510

Change-Id: I3f6493c151e4b75be52cf3e2dbda1db94c9642b6
2020-07-16 13:00:28 +00:00
Michael Wright
f32317c869 Soften BitSet class comment.
std::bitset<> doesn't have exact replacements for all of the
functionality of BitSet32/64, so there are still places we want to use
these classes.

Bug: 160010896
Test: test BitSet_test.cpp
Change-Id: Ica59a138e014d82139fb6dcea0597a207faecc2a
2020-07-16 00:04:20 +00:00
Steven Moreland
1275da032f Merge "String8: explicit int -> char cast." am: 3619489de6 am: 84cdbe20a4 am: 41eaad8e35 am: 607cd4b8c8 am: 8497ea1487
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1362304

Change-Id: I4424d63aa9060b2f00ac276a8097823c3be55c00
2020-07-14 18:07:49 +00:00
Steven Moreland
80c46b0541 String16::remove - avoid overflow am: 4048e49956 am: 107f18cb61 am: 9be245c3f0 am: 64fb5012b8 am: 4e27b6992b am: 26b81f59d2 am: 8367a666b5
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619802

Change-Id: Ic25dca55b553b062edc4ced44ddef68b96428906
2020-07-14 17:24:42 +00:00
Victor Khimenko
add3b3a137 Merge "Make libbacktrace buildable for native_bridge" into rvc-dev 2020-07-14 17:18:34 +00:00
Steven Moreland
8367a666b5 String16::remove - avoid overflow am: 4048e49956 am: 107f18cb61 am: 9be245c3f0 am: 64fb5012b8 am: 4e27b6992b am: 26b81f59d2
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619802

Change-Id: Ib4704bc8a733ace56e7998b7bad5a6c5638900ad
2020-07-14 17:03:30 +00:00
Steven Moreland
3619489de6 Merge "String8: explicit int -> char cast." 2020-07-14 16:30:42 +00:00
Steven Moreland
4e27b6992b String16::remove - avoid overflow am: 4048e49956 am: 107f18cb61 am: 9be245c3f0 am: 64fb5012b8
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619802

Change-Id: I03057c052a24f205c78ee600178d45e0cd51a3c1
2020-07-14 16:29:09 +00:00
Steven Moreland
64fb5012b8 String16::remove - avoid overflow am: 4048e49956 am: 107f18cb61 am: 9be245c3f0
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619802

Change-Id: I3ab9771d898eea0158acfd07fbe5a2f4b7dad883
2020-07-14 16:12:53 +00:00
Steven Moreland
9be245c3f0 String16::remove - avoid overflow am: 4048e49956 am: 107f18cb61
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619802

Change-Id: I22f6b8299b4b77be31859a10b14efe01b297d531
2020-07-14 15:51:29 +00:00
Steven Moreland
107f18cb61 String16::remove - avoid overflow am: 4048e49956
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619802

Change-Id: I4dedf81e3471473e589a858e14d7a9ae5f91b3d9
2020-07-14 15:37:25 +00:00
Steven Moreland
fdbc565dd5 String8: explicit int -> char cast.
Since tolower/toupper take and return integer arguments, ascii chars in
the extended range will be converted from positive int values to
negative char values. In order to silence an error here, which was added
recently with integer sanitization here, casting explicitly.

Fixes: 160831549
Test: w/ libutils_fuzz_string8
Change-Id: Iedcd6643f95f84ce662a80e38931d918a200f508
2020-07-13 23:33:25 +00:00
Michael Wright
9d5fcc66ab Merge "Cast away signedness of built-ins in BitSet." am: 71f4494bd1 am: 1baa61b095 am: 5a5f41e12d am: 82c9d4c52b am: 4c0e768880
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1360509

Change-Id: I6d8ff4b06b62786343611dbce0b8231e99eaae81
2020-07-13 16:50:22 +00:00
Michael Wright
71f4494bd1 Merge "Cast away signedness of built-ins in BitSet." 2020-07-13 15:45:40 +00:00
Yo Chiang
8ac8c4cc47 Merge "Move SingletonTest back to libutils_test" am: 9a57044ab3 am: 8cf6a0b69e am: b9930bb2d1 am: 55e3aec8fe am: dda41f845b
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1360220

Change-Id: I49a7c0598c7e48032fc6467692431b1a84b83164
2020-07-13 04:58:17 +00:00
Michael Wright
23e1363d55 Cast away signedness of built-ins in BitSet.
Most of the built-in functions return signed values but BitSet deals
only in unsigned values. We can safely cast these away though as they're
always indices, which can't be negative.

Bug: 160010896
Test: atest inputflinger_tests, atest libinput_tests
Change-Id: I6e0b33972fabcd41ad1c269ea0e2a07b13b33c12
2020-07-12 01:56:58 +01:00
Victor Khimenko
fb60e6c9ae Make libbacktrace buildable for native_bridge
Bug: http://b/153609531

Test: m -j64 libbacktrace.native_bridge

Change-Id: I2b8a881b4e952f3b68dbcaeb14f147a6d955b406
Merged-In: I2b8a881b4e952f3b68dbcaeb14f147a6d955b406
2020-07-10 20:13:23 +02:00
Yo Chiang
5b028bab2a Move SingletonTest back to libutils_test
Use the new "data_libs:" to specify test library dependency. This is
like "data:" and it treats compiled libraries as test data files.
The result is libutils_test_singleton{1,2} is picked up by libutils_test
and installed next to the test binary.

Mark the test libs libutils_test_singleton{1,2} as uninstallable. This
prevents installing libutils_test_singleton{1,2} directly and only
permits installing via "data_libs:".

```
$ m libutils_test
testcases
└── libutils_test
    ├── arm
    │   ├── libutils_test
    │   ├── libutils_test_singleton1.so
    │   └── libutils_test_singleton2.so
    ├── arm64
    │   ├── libutils_test
    │   ├── libutils_test_singleton1.so
    │   └── libutils_test_singleton2.so
    └── libutils_test.config
```

Bug: 124838889
Test: atest libutils_test
Change-Id: I432135e128fc9eedb1b8c18a331957e271d8b0f0
2020-07-10 19:34:53 +08:00
Steven Moreland
ce3884af70 Merge "libutils: integer sanitization" am: 1652ac276a am: 313e7de136 am: edf2ad1d1c am: 92cdaf3ce7 am: 57c9b00093
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1356015

Change-Id: Ibda4048b917670f25904799917d3db9d60d97d06
2020-07-08 17:49:13 +00:00
Steven Moreland
9c832028c1 libutils: integer sanitization
For sanity.

Fixes: 160342252
Test: manually introduce overflow for "ubsan: mul-overflow"
Change-Id: I292039eaef24582f05dd9f0fef011f0ece8364ed
2020-07-07 22:37:07 +00:00
Victor Khimenko
827b861f38 Merge "Make libbacktrace buildable for native_bridge" am: a2f97dbb0f am: f3f15d2867 am: 1c1c0d7fa9 am: b116386279 am: b1c5595e7e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1343519

Change-Id: If2404847d59bb37ca2d0a80a82a2a6bec6e12283
2020-06-19 22:22:26 +00:00
Victor Khimenko
7428c52ef2 Make libbacktrace buildable for native_bridge
Bug: http://b/153609531

Test: m -j64 libbacktrace.native_bridge

Change-Id: I2b8a881b4e952f3b68dbcaeb14f147a6d955b406
2020-06-18 22:02:46 +02:00
Christopher Ferris
4d14303653 Fail explicitly on length overflow.
Instead of aborting when FileMap::create detects an overflow, detect the
overflow directly and fail the call.

Bug: 156997193

Test: Ran unit tests, including new unit test that aborted before.
Change-Id: Ie49975b8949fd12bbde14346ec9bbb774ef88a51
Merged-In: Ie49975b8949fd12bbde14346ec9bbb774ef88a51
(cherry picked from commit 68604b9c29)
2020-06-04 11:05:18 -07:00
Christopher Ferris
f846413e62 Fail explicitly on length overflow.
Instead of aborting when FileMap::create detects an overflow, detect the
overflow directly and fail the call.

Bug: 156997193

Test: Ran unit tests, including new unit test that aborted before.
Change-Id: Ie49975b8949fd12bbde14346ec9bbb774ef88a51
Merged-In: Ie49975b8949fd12bbde14346ec9bbb774ef88a51
(cherry picked from commit 68604b9c29)
2020-05-28 18:38:18 -07:00
Christopher Ferris
bff51b88aa Fail explicitly on length overflow.
Instead of aborting when FileMap::create detects an overflow, detect the
overflow directly and fail the call.

Bug: 156997193

Test: Ran unit tests, including new unit test that aborted before.
Merged-In: Ie49975b8949fd12bbde14346ec9bbb774ef88a51
Change-Id: Ie49975b8949fd12bbde14346ec9bbb774ef88a51
(cherry picked from commit 68604b9c29)
2020-05-28 15:46:51 -07:00
Steven Moreland
4048e49956 String16::remove - avoid overflow
Bug: 156999009
Test: libutils_test (cases added)
Change-Id: Iad46d95d9848928ba81000090b2fe9aec1e5eaac
Merged-In: Iad46d95d9848928ba81000090b2fe9aec1e5eaac
(cherry picked from commit f251c1c581)
(cherry picked from commit 9a9c8910e9296c9dc8d79c37f589895f5a2a836c)
2020-05-28 20:45:55 +00:00
Steven Moreland
fcd8ed55cb Merge "String16::remove - avoid overflow" 2020-05-28 20:06:34 +00:00
Steven Moreland
f251c1c581 String16::remove - avoid overflow
Bug: 156999009
Test: libutils_test (cases added)
Change-Id: Iad46d95d9848928ba81000090b2fe9aec1e5eaac
2020-05-28 00:31:01 +00:00
Elliott Hughes
842e1cc17e Make systemTime() abort on bad input.
There's no CHECK in libutils, sadly.

Bug: http://b/157167405
Test: treehugger
Change-Id: I1532bf80ba7fdafad016610be3c782b547417126
2020-05-27 15:31:55 -07:00
Christopher Ferris
68604b9c29 Fail explicitly on length overflow.
Instead of aborting when FileMap::create detects an overflow, detect the
overflow directly and fail the call.

Bug: 156997193

Test: Ran unit tests, including new unit test that aborted before.
Change-Id: Ie49975b8949fd12bbde14346ec9bbb774ef88a51
2020-05-26 12:00:07 -07:00
Rick Yiu
9ada65c0c6 Merge "Add choice for changing sched policy when setting thread priority" 2020-05-20 03:03:18 +00:00
Dylan Katz
9d5845bb5e Add fuzzers for libutils classes
Adds fuzzers for BitSet, FileMap, String8, String16, and Vector.
Test: Ran fuzzers on Android Pixel 3a. Aggregate coverage was 1.2% (this is far lower than true coverage due to shared libraries being counted)

Change-Id: I739216fe88afa51dc2f73b857da91116853382f0

Removed unneeded cflags, moved libbase to defaults

Test: Built Android.bp successfully

Signed-off-by: Dylan Katz <dylan.katz@leviathansecurity.com>
Change-Id: I739216fe88afa51dc2f73b857da91116853382f0
2020-05-15 10:30:16 -07:00
Rick Yiu
57affbf91d Add choice for changing sched policy when setting thread priority
If the policy has been changed already, we do not need to change
it again.

Bug: 139521784
Test: functionality verified
Change-Id: I251db1d3f874896ba9be68df87209e7e514b80f9
2020-05-15 15:28:23 +00:00
Jooyung Han
7937f29be8 Set min_sdk_version to be part of mainline modules
Modules contributing mainline modules (APK/APEX) should set
min_sdk_version as well as apex_available.

For now setting min_sdk_version doesn't change build outputs.
But build-time checks will be added soon.

Bug: 152655956
Test: m
Merged-In: Ida890adfe6dfac79267fc0e18b63d2330266438c
Change-Id: Ida890adfe6dfac79267fc0e18b63d2330266438c
(cherry picked from commit 7ea0d74bc8)
2020-05-13 12:10:36 +09:00
Jooyung Han
7ea0d74bc8 Set min_sdk_version to be part of mainline modules
Modules contributing mainline modules (APK/APEX) should set
min_sdk_version as well as apex_available.

For now setting min_sdk_version doesn't change build outputs.
But build-time checks will be added soon.

Bug: 152655956
Test: m
Change-Id: Ida890adfe6dfac79267fc0e18b63d2330266438c
2020-05-13 08:18:06 +09:00
Christopher Ferris
310b46c1ca Merge "Fix mac build." into rvc-dev 2020-05-12 17:17:25 +00:00
Christopher Ferris
1500d0e7a9 Fix mac build.
Add an inline for mmap64 to use on mac.

Bug: 155662887
Bug: 156053599

Test: Builds.
Change-Id: Id02e2c2f40acea2bdef604e9b80b70a85a941927
(cherry picked from commit 8a6dff22dc)
2020-05-11 23:07:53 +00:00
Christopher Ferris
8a6dff22dc Fix mac build.
Add an inline for mmap64 to use on mac.

Bug: 156053599

Test: Builds.
Change-Id: Id02e2c2f40acea2bdef604e9b80b70a85a941927
2020-05-08 15:30:21 -07:00
Christopher Ferris
de38b1a356 Change call to mmap64.
The code was using an off64_t but calling mmap. This caused the code
to abort on 32 bit.

Add a unit test that would abort on the previous version.

Bug: 155662887

Test: New unit test passes.
Change-Id: I7a6efbc0d4227403c3d08a08deea56f239382157
Merged-In: I7a6efbc0d4227403c3d08a08deea56f239382157
(cherry picked from commit 7b9f35c9de)
2020-05-07 17:45:30 -07:00
Christopher Ferris
7b9f35c9de Change call to mmap64.
The code was using an off64_t but calling mmap. This caused the code
to abort on 32 bit.

Add a unit test that would abort on the previous version.

Bug: 155662887

Test: New unit test passes.
Change-Id: I7a6efbc0d4227403c3d08a08deea56f239382157
2020-05-06 22:32:18 +00:00
Yurii Zubrytskyi
f8987c393d [cleanup] Fix a clang-tidy warning
const parameters can't be moved but only get copied -
removed const

Bug: 153704006
Test: builds & boots
Change-Id: If7e2250325bf1bc498afd3539f60bcb075a1d43b
2020-04-22 16:20:29 -07:00
Jiyong Park
a206b8cbf4 Set apex_available property
The marked library(ies) were available to the APEXes via the hand-written
whitelist in build/soong/apex/apex.go. Trying to remove the whitelist
by adding apex_available property to the Android.bp of the libraries.

In this change, following libs were made available to all apexes because
their usage is quite common and there is no reason to restrict them
to some APEXes.

* libbase_headers
* libcutils, libcutils_headers
* libutils_headers, libsystem_headers
* liblog_headers
* libbacktrace, libbacktrace_headers
* libcrypto_utils

Exempt-From-Owner-Approval: cherry-pick from aosp

Bug: 150999716
Test: m
Merged-In: If3d3652e6604ed4f6d7694fe7ac61ae496621026
(cherry picked from commit 8bf9b1632e)
Change-Id: If3d3652e6604ed4f6d7694fe7ac61ae496621026
2020-04-20 16:06:02 +09:00
Jiyong Park
8bf9b1632e Set apex_available property
The marked library(ies) were available to the APEXes via the hand-written
whitelist in build/soong/apex/apex.go. Trying to remove the whitelist
by adding apex_available property to the Android.bp of the libraries.

In this change, following libs were made available to all apexes because
their usage is quite common and there is no reason to restrict them
to some APEXes.

* libbase_headers
* libcutils, libcutils_headers
* libutils_headers, libsystem_headers
* liblog_headers
* libbacktrace, libbacktrace_headers
* libcrypto_utils

Bug: 150999716
Test: m
Change-Id: If3d3652e6604ed4f6d7694fe7ac61ae496621026
2020-03-09 16:38:02 +09:00
Steven Moreland
3c22033c72 Merge "String8: operator<<" 2020-02-27 23:18:49 +00:00
Steven Moreland
8ef1e1b535 Merge "String*: remove 'StaticLinkage' constructor" 2020-02-26 17:57:07 +00:00
Steven Moreland
b1d3161b7b String8: operator<<
For parity with String16.

Bug: N/A
Test: N/A
Change-Id: I2d7d207138c96146814da31cf27a49cc310e5362
2020-02-25 17:59:54 -08:00
Steven Moreland
bdbd0dde26 Merge "libutils: introduce sp<T>::make" 2020-02-24 17:03:19 +00:00
Elliott Hughes
f77f6f003c Remove various bits of dead code and unused workarounds.
Test: treehugger
Change-Id: I68fcd5da304d04ff4da3c3f3712fb79ce6b5791e
Merged-In: I68fcd5da304d04ff4da3c3f3712fb79ce6b5791e
2020-02-22 16:53:24 +00:00
Steven Moreland
401d69aa94 libutils: introduce sp<T>::make
This is in preparation of doing what we did for SharedRefBase (hiding
operator new) so that clients can't accidentally construct
shared_ptr/unique_ptr or any other alternative memory management scheme
which would conflict with RefBase. You can see what ultimately happened
to SharedRefBase in frameworks/native CL
10d9ddf2e3da3ba3a425fb8396aaaec728e5fbdb.

The goal for this:
- promote use of 'sp<T>::make' over 'sp<T> .. = new T'
- make 'operator new' a private member of RefBase

Bug: 138956784
Test: libutils_test
Change-Id: I47f4d28edbf7534730c7b6fb1de748dd60f34e11
2020-02-20 17:21:27 -08:00
Jeffrey Huang
ab19b995be Merge "Add apex available to libutils" 2020-02-13 06:06:02 +00:00
Jeffrey Huang
18986cb220 Add apex available to libutils
Bug: 145922701
Test: m -j
Change-Id: I32a15359bc2f97675f8b5e7e112978667f43bf4f
2020-02-12 17:57:04 -08:00
Steven Moreland
824418c370 Merge "String16: operator<<" 2020-02-11 22:43:26 +00:00
Treehugger Robot
6075b1fa9a Merge "Refine set_sched_policy behavior" 2020-02-11 03:25:33 +00:00
Steven Moreland
7a57b8a3cf String16: operator<<
Before, this was printing the pointer to the char16_t* because of an
automatic conversion. However, this is almost never intended.

Bug: N/A
Test: dumpsys_test
Change-Id: Iaafcb2145cf93028cf3271813c56b8b74948f943
2020-02-10 14:18:45 -08:00
Steven Moreland
727a6dd5f5 String*: remove 'StaticLinkage' constructor
Unneeded.

Bug: N/A
Test: N/A
Change-Id: I3ff473d1e2fec98e47abd8abb45dd36e0a808170
2020-02-10 13:56:44 -08:00
Steven Moreland
e90f7f0fb3 Remove String16 header cruft.
-= forward declaration of imported class
-= empty extern decl

Bug: N/A
Test: N/A
Change-Id: I4eba90870f6d2e8d06fb49872cad51ca95da5ad9
2020-02-10 13:26:18 -08:00
Rick Yiu
f7f4442176 Refine set_sched_policy behavior
If a thread priority is greater than or equal to
ANDROID_PRIORITY_BACKGROUND, and the new priority is less than
ANDROID_PRIORITY_BACKGROUND, set the sched policy to its parent process.

Bug: 139521784
Test: functionality verified
Change-Id: Ie6fe33e08e4fda0a119b9869e8dd1733c164d79e
2020-02-07 02:54:57 +00:00
Steven Moreland
306f8b5713 libutils: sp lh comparison w/ pointer
Perhaps the better question is, why have I 100s of times, typed
"ASSERT_NE(nullptr, foo)" for sp<> foo, and got a compiler error and
then change it to "foo.get()". This CL so we can stop wasting cycles
with that error.

Fixes: 147842528
Test: libutils_test
Change-Id: Id63b29d2a1ff3077201a62b69d864c5a826c47e0
2020-01-17 22:50:30 +00:00
Xin Li
b091f4d40b DO NOT MERGE - Merge QQ1A.200105.003 into stage-aosp-master
Change-Id: I307003cb8d6311ed3662535a54ac8586b8a25bd0
2020-01-02 13:29:54 -08:00
Steven Moreland
243f57bb82 libutils: sp/wp: undef #defines
Seems these undefs are slightly out of sync/out of date.

Bug: N/A
Test: libutils_test
Change-Id: I884ae1ca97754a6459a2c7844264f513eecddaba
2019-12-19 16:17:33 -08:00
Steven Moreland
1e8e49cc2c statusToString: parenthesize strerror
For clarity, when printint w/o delination, noticed in b/145776393.

Test: view output of statusToString from a dumpsys change
Change-Id: I5ea9f052c223f167dd58923e2470c852907c97b8
2019-12-10 18:43:53 +00:00
Hans Boehm
5341172587 Add check to sp<> raw pointer constructor
For the raw pointer constructor, check that the argument is not on the
stack. Passing a stack pointer as an sp<> parameter is dangerous,
since we will attempt to deallocate the object once the sp<> is no
longer needed. We approximate ste stack ccheck by testing whether it
is on the same page as the frame pointer.

Do the same for raw pointer assignment.

Bug: 138956784
Test: Boot AOSP
Change-Id: I2c2405be443389af7e6a713aadcb3ee1f372a85e
2019-11-26 15:32:40 -08:00
Steven Moreland
591cab8cee Add statusToString function.
For libbinder, not having these statuses printed out causes never ending
problems for developers.

Bug: 144534032
Test: libhidl_test tests this, which is on TH here
Change-Id: I02f37fb1e5b743131598ddc95ef89ebdfbdff615
2019-11-18 17:38:22 +00:00
Steven Moreland
b5d3e902ff FlattenableUtils::align memsets
Bug: 141890807
Test: boot, check data is zero'd
Change-Id: I45aaeac369f4c5cf3eb44f61c233e00f870a5c79
(cherry picked from commit bf824f8fa5)
(cherry picked from commit e62a9d7669)
2019-11-15 06:15:49 +00:00
Steven Moreland
4392bca7f7 FlattenableUtils::align memsets am: e62a9d7669 am: 59e7d4e8ea am: 3f273f49f1
am: f7724dfcfb

Change-Id: I0ecdb9a58418d0c65629c70fc6df2a4aad7a1784
2019-11-06 16:19:08 -08:00
Steven Moreland
f7724dfcfb FlattenableUtils::align memsets am: e62a9d7669 am: 59e7d4e8ea
am: 3f273f49f1

Change-Id: I91a8ef78619709fcdcb48cdad8e0e7a6b699b631
2019-11-06 16:13:06 -08:00
Steven Moreland
3f273f49f1 FlattenableUtils::align memsets am: e62a9d7669
am: 59e7d4e8ea

Change-Id: I1105027b52c3621e2031bdb747de61ce54d3ec74
2019-11-06 16:06:57 -08:00
Steven Moreland
59e7d4e8ea FlattenableUtils::align memsets
am: e62a9d7669

Change-Id: I51a5528d8544f374ff3ceb632e75a1d3ae97d963
2019-11-06 15:55:08 -08:00
Steven Moreland
5f46923634 Trace.h: explicitly use global namespace
Imagine an AIDL file:
  package android.foo;
  interface IFoo {}

The AIDL C++ backend will generate classes like "::android::foo::IFoo".
In order to avoid ODR conflict, the NDK (Stable C) backend linking
against libbinder_ndk puts everything under the "::aidl" namespace. So,
we have "::aidl::android::foo::IFoo". When using ScopedTrace in a class
implementing a class from this backend, there is this problem.

Bug: 141828236
Test: works
Change-Id: Iafadea11788d4c011229657b4f53063bcf65f8d8
2019-11-05 17:59:46 -08:00
Steven Moreland
e62a9d7669 FlattenableUtils::align memsets
Bug: 141890807
Test: boot, check data is zero'd
Change-Id: I45aaeac369f4c5cf3eb44f61c233e00f870a5c79
(cherry picked from commit bf824f8fa5)
2019-10-15 19:26:22 +00:00
Steven Moreland
ae9749a29a libutils: flattenable deprecation comment
This class isn't used very much and it isn't supported by AIDL. In order
to recommend new users against this and recommend an alternative, added
a comment here.

Bug: 142282873
Test: N/A

Change-Id: If7c6c9fac6c868ed6a515e658de752092d25d5f9
2019-10-07 18:14:14 -07:00
Vic Yang
5a141424e6 Fix memory leak in String16
Newly allocated SharedBuffer already has reference count 1, so we
should not call acquire().

Bug: 141764153
Test: Run String16Test.* with ASan that was able to detect the leak
      without this change.
Change-Id: Ib8b1b707b028386d717414d8c5ec5ea7b4b59464
2019-09-27 21:07:00 -07:00
Steven Moreland
1cb99ea59b libutils: Trace.h for everything but windows
libcutils has trace implemented for host. In order to increase code
portability, opening that up for libutils Trace.h usage as well.

Bug: 124524556
Test: use Trace.h on host glinux
Change-Id: Ia873f88e7436a18f6c0f761000bf697c68ffea17
2019-09-20 11:28:00 -07:00
Brett Chabot
1af6acc4d3 Use Android systemTime implementation for host linux.
The Android framework, notably android.view.Choreographer, assumes
that System.nanoTime and SystemClock.uptimeMills return consistent
values. This was true on device, but not on host.

This commit makes those values consistent on host linux. The necessary
support should be in place in kernels 2.6.39 and newer, which have been
available since 2012.

Test: m -j libutils
Change-Id: I833a89a810ae9fb3e8c01f6095ee2aca893c284f
2019-09-19 15:32:33 -07:00
Elliott Hughes
c21c0ac740 Merge "Remove unused big-endian cruft." 2019-09-19 21:26:11 +00:00
Steven Moreland
c1e04d8ac5 libutils: increase test TIMING_TOLERANCE_MS
25 -> 100, because we are seeing larger values sometimes on cuttlefish.

Fixes: 141212746
Test: libutils_test
Change-Id: I371416473b97f46891104ff9d893ec38c25728aa
2019-09-18 20:35:49 +00:00
Elliott Hughes
b6e7de2221 Remove unused big-endian cruft.
Test: builds
Change-Id: I19fef65d311923e4e6dac7307914f5fbb92b7bde
2019-09-18 08:02:10 -07:00
Treehugger Robot
f613b4a9a6 Merge "Reland "libutils: Introduce StaticString16""" 2019-09-06 02:29:23 +00:00
Vic Yang
9fb93edd5b Reland "libutils: Introduce StaticString16""
This reverts commit 1270e4fbf1.

Bug: 138856262
Test: Run unit tests.
Change-Id: I37be01d7d4f98a83078870cb0917275336fa2bbd
Merged-In: I8da93f2c9b95183e32d4a2ea895f90c449abbe4d
2019-09-05 13:19:14 -07:00
Steven Moreland
c732c03482 compare android::Vector and std::vector
Have been wondering for a while.

Test: libutils_benchmark
--------------------------------------------------------------------
Benchmark                          Time             CPU   Iterations
--------------------------------------------------------------------
BM_fill_android_vector          24.6 ns         24.5 ns     28207074
BM_fill_std_vector              5.24 ns         5.21 ns    130675479
BM_prepend_android_vector       5783 ns         5770 ns       100000
BM_prepend_std_vector           5731 ns         5717 ns       100000

Change-Id: Ie296ce2c4395121b6a456d57421f820909418afe
2019-09-03 18:11:43 -07:00
Kevin Han
1270e4fbf1 Revert "Reland "libutils: Introduce StaticString16"""
This reverts commit c55ac92bd6.

Reason for revert: Breaks down-stream branches. See b/140315617

Change-Id: I4937fdf4bdcc7a44d5f10700ecf2d5e96aef7d27
Merged-In: I8da93f2c9b95183e32d4a2ea895f90c449abbe4d
2019-08-30 23:50:38 +00:00
Vic Yang
c55ac92bd6 Reland "libutils: Introduce StaticString16""
This time with old branches excluded.

Bug: 138856262
Test: Run unit tests.
Change-Id: Id0bb1d54b71e38244d64f1b684db1fda81de854c
Merged-In: I8da93f2c9b95183e32d4a2ea895f90c449abbe4d
2019-08-30 11:01:27 -07:00
Vic Yang
86eaa8de78 Revert "libutils: Introduce StaticString16"
This reverts commit d4cb489434.

Reason for revert: Breaking aosp_bonito-userdebug

Change-Id: Iea72f39d40f476002ce0ad6b5ce3b4e1ca570de7
2019-08-29 22:47:07 +00:00
Vic Yang
d4cb489434 libutils: Introduce StaticString16
This is a backward compatible implementation of compile time
constructed String16 support.

As much as we'd like a regular constexpr constructor for String16, we
want to make sure the regular non-static String16 does not regress.
We also need to make sure prebuilts built with previous version of
String16 still works with new libutils.  This means we cannot change
the size of String16 objects and we cannot make anything virtual.

To add a flag to indicate whether a String16 is static without
increasing the size of non-static String16 objects, we repurpose a
reserved field in SharedBuffer as "for client use".  With this, we can
tag every String16 and perform memory operation differently based on
how the underlying buffers are allocated.

By using StaticString16, we are able to eliminate the runtime
construction of a String16 and move it out of .bss section.

Bug: 138856262
Test: Run newly added unit tests.
Change-Id: I72bb8dc27a59b9ef34e0d934bc1e00b0f675855a
2019-08-09 11:01:37 -07:00
Treehugger Robot
d7546f1d57 Merge "Remove two more unused utf32 functions." 2019-08-02 19:29:45 +00:00
Steven Moreland
18daa7b5f0 libutils: RefBase remove 'basetype' typedefs
useless/unused

Bug: N/A
Test: N/A
Change-Id: I72462a64411a58d22e071f20e2c950bd99fdffb1
2019-07-16 21:06:28 +00:00
Elliott Hughes
9658fc0823 Remove two more unused utf32 functions.
Test: builds
Change-Id: I6ab2104fc6836e9edb772e8368199e6171e9d87a
2019-07-16 07:56:23 -07:00
Steven Moreland
c0927e64b1 libutils: remove references to unimplemented func
printWeakPointer isn't implemented anywhere. This also allows us to
remove a forward declaration of TextOutput.

Bug: N/A
Test: N/A
Change-Id: Ie2debdfda17b7cc1d599c431eaf4c362a591e482
2019-07-11 17:50:52 -07:00
Steven Moreland
0e19f3b4cc Remove utf32 functions.
These don't appear to be used by anything.

Bug: N/A
Test: binary inspection + code inspection
Change-Id: I6c12db26c320a66bcf6e28618c6e9f61b40d985e
2019-07-02 18:15:03 -07:00
dimitry
454ba7ec88 Enable native_bridge_support for libutils
Android build system added support for building translated binaries
used on natively bridged targets (arm on x86 for example).

However in order to avoid building unnecessary binaries and libraries
for such architectures most modules do not support native bridge by default.

All needed modules have to explicitly indicate if they may be used as part
of translated binary build.

This change enabled native bridge support for libutils which is a
greylisted library (available for apps targeting Android version < N).

Bug: http://b/77159578
Test: make
Change-Id: I58667558d2a673fc0d882cf623b7a1b6f6f305ec
2019-05-16 13:48:17 +02:00
Alessio Balsini
1406207e67 Looper: missing cinttypes when debugging poll/callbacks
When enabling DEBUG_POLL_AND_WAKE or DEBUG_CALLBACKS, compiler complains
for the undefined PRI* fprintf format constants.
Fix by including the missing cinttypes.

Test: m
Bug: none
Change-Id: I0a7b5b45bd274eefa9644cba491a8dc28f1992ff
2019-05-11 20:53:47 +01:00
Treehugger Robot
ee4cc04429 Merge "libutils: more detailed logging." 2019-04-02 02:45:41 +00:00
Steven Moreland
d33a2ee172 libutilscallstack: removed from darwin
libbacktrace only includes its Backtrace.cpp on the linux targets
but not windows or darwin targets. So, both should be disabled.

Previously, libutilscallstack was only ever a static library on
these platforms. Since nothing provided the symbols, these targets
couldn't have been used.

Fixes: 129636352
Test: m

Change-Id: I3f0b09e1d67c485b3ea57f58d1220d9516b326f2
2019-04-01 15:16:13 -07:00
Elliott Hughes
fd12160087 libutils: more detailed logging.
The question arose on the bug of whether this is a legit errno or just
a stale value.

Bug: http://b/129139241
Test: ran tests
Change-Id: I486176496028f04d4fcccdd0b29a3df6b13849c9
2019-04-01 12:24:19 -07:00
Steven Moreland
43f29072a9 Merge "libutils/libcutils: make host more like device" 2019-03-29 23:05:20 +00:00
Mikhail Naganov
e1a285ddc1 libutils: Fix thread safety annotations in Mutex
The annotations for Mutex::tryLock and timedLock were
incorrectly specifying the return value for the successful
acquisition.

Test: make libutils_test
Change-Id: I9729b6555ede5cb1d6db046e33c35bf5926c7755
2019-03-29 12:21:57 -07:00