Commit graph

920 commits

Author SHA1 Message Date
Treehugger Robot
cbd5c0d396 Merge "libutil: no special copy from StaticString16" am: 7d067aee62 am: ece939ecc9 am: b8e683537f am: 73fcfd0c52
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1751786

Change-Id: I5cc9831a8a940cdead57b4a0811e55eec34092ef
2021-06-30 03:17:45 +00:00
Treehugger Robot
b8e683537f Merge "libutil: no special copy from StaticString16" am: 7d067aee62 am: ece939ecc9
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1751786

Change-Id: Ic13c3a84471160c534b0e84ac5d0987f457eef75
2021-06-30 02:51:49 +00:00
Treehugger Robot
1bdcd5fbbf Merge "String16 is moveable (noexcept)" am: 3551e457ca am: 32ceaa1299 am: dcd1cacbbb am: 131315c51c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1749261

Change-Id: I2ded754cebb3d529f1adc2413cfa8f11f108a556
2021-06-30 02:18:50 +00:00
Treehugger Robot
dcd1cacbbb Merge "String16 is moveable (noexcept)" am: 3551e457ca am: 32ceaa1299
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1749261

Change-Id: Ia658a7b6ad2c21c83ef109230a4c5f0a7d02068a
2021-06-30 01:48:14 +00:00
Jooyung Han
6f92640d45 libutil: no special copy from StaticString16
String16's ctors already handle static strings, so we don't need a
specialized constructor which accepts StaticString16.

Bug: n/a
Test: libutils_test
Change-Id: I93a1ba70d743ff9c73f113d53ffba73cef6adade
2021-06-30 09:04:29 +09:00
Jooyung Han
98b396e785 String16 is moveable (noexcept)
String16 is still in use by AIDL compiler. Because String16 is not
noexcept-move-constructible, the C++ compiler will complain when it is
used with non-copyable types (such as ParcelFileDescriptor).

For example, when vector<Foo> is resized, copy-ctor of Foo is called,
which is not available.

  parcelable Foo {
    String s;
    ParcelFileDescriptor[] pfds;
  }

By providing noexcept move-ctor for String16, vector<Foo> can be resized
with no problem.

Btw, copy from StaticString16 is specialized for efficiency and move
from StaticString16 don't need to be different from copy.

Bug: 192136980
Test: libutils_test
Change-Id: I13744a2ceebf5781c3ef7f3a04237a6750b0db0a
2021-06-29 10:18:23 +09:00
Elliott Hughes
c341dc774f Merge "Check for overflow in String16::append and String16::insert." into sc-dev am: eec890e173 am: 117b7cd3e9
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/14940186

Change-Id: I6572e3288efc7e3ac203c8688ea2fc08c8260bfc
2021-06-15 22:50:02 +00:00
Elliott Hughes
e227beedde Merge "Check for overflow in String16::append and String16::insert." into sc-dev am: eec890e173
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/14940186

Change-Id: I2f6c9abc6b2baf587980224698cdeba4d55ed2a8
2021-06-15 22:34:06 +00:00
Elliott Hughes
eec890e173 Merge "Check for overflow in String16::append and String16::insert." into sc-dev 2021-06-15 22:19:15 +00:00
Elliott Hughes
ddc464cd56 Merge "Check for overflow in String8::real_append." into sc-dev am: 20462789dc am: 78c0d1d623
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/14941314

Change-Id: Iffb6b98e2db53ba153af2e376b2c4bce31e7a69b
2021-06-15 21:29:52 +00:00
Elliott Hughes
1ce243f7a6 Merge "Check for overflow in String8::real_append." into sc-dev am: 20462789dc
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/14941314

Change-Id: Ib18670bec989f9ec4ec628647718ed97e81468b3
2021-06-15 21:16:47 +00:00
Elliott Hughes
a6be6f0acb Check for overflow in String16::append and String16::insert.
Bug: http://b/178802681
Bug: http://b/178821065
Test: new tests
Change-Id: I2352ea4c65e3f29e44e2ad6cad20ad610ceace1f
2021-06-10 17:06:26 -07:00
Elliott Hughes
59682761fb Check for overflow in String8::real_append.
Bug: http://b/178822418
Test: new tests
Change-Id: I73631a070ade0689441abe5645ba5a5f64a58675
2021-06-10 16:42:20 -07:00
Treehugger Robot
eb245bc746 Merge "Fix implicit cast from ssize_t to size_t in KeyedVector.h" am: a14beb2dbc am: f4d3b9e85f am: 272d5034c2 am: 88f61126e5
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1715473

Change-Id: I4165604813f52d37862f618fae684fed78e9f495
2021-05-22 05:40:49 +00:00
Treehugger Robot
272d5034c2 Merge "Fix implicit cast from ssize_t to size_t in KeyedVector.h" am: a14beb2dbc am: f4d3b9e85f
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1715473

Change-Id: I938079b95fa8cd7a9978a3713564bf34a7dd9536
2021-05-22 05:01:02 +00:00
Treehugger Robot
a14beb2dbc Merge "Fix implicit cast from ssize_t to size_t in KeyedVector.h" 2021-05-22 03:46:09 +00:00
Vishnu Nair
51b958d57c Fix implicit cast from ssize_t to size_t in KeyedVector.h
Fixes a compiler warning for implicit conversion changes from signed
to unsigned which surfaced when refactoring native input libraries.
Add an explicit cast to avoid adding -Wno-sign-conversion compile
flags.

Test: b libsurfaceflinger_unittest
Bug: b/188792659

Change-Id: I1b9309c3530d6063d5cefcaa31af84d9cebc3f5d
Merged-In: I8866aef7f09ca5173604abe18c586b68bbf12ed6
2021-05-21 16:49:07 +00:00
Vishnu Nair
0878f71613 Fix implicit cast from ssize_t to size_t in KeyedVector.h
Fixes a compiler warning for implicit conversion changes from signed
to unsigned which surfaced when refactoring native input libraries.
Add an explicit cast to avoid adding -Wno-sign-conversion compile
flags.

Test: b libsurfaceflinger_unittest
Change-Id: I8866aef7f09ca5173604abe18c586b68bbf12ed6
2021-05-21 16:45:46 +00:00
Elliott Hughes
3b9238cf0f Merge "Increase coverage of Timers to 100%." am: 2dc28bcfc4 am: 1db66002c1 am: b9a7a9886f am: 72e2e0c164
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1710936

Change-Id: Ib4120727615f6b8e9d4ea963cd6e3d71e81d47be
2021-05-20 21:07:05 +00:00
Elliott Hughes
b9a7a9886f Merge "Increase coverage of Timers to 100%." am: 2dc28bcfc4 am: 1db66002c1
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1710936

Change-Id: Iffe5a4df00e9d4daaf0cbde46e1fb9969fbbc9da
2021-05-20 20:22:27 +00:00
Elliott Hughes
4139da606d Increase coverage of Timers to 100%.
Test: treehugger
Change-Id: I3dda9a1a60c88886e5ef42de72bf341ba6cd0361
2021-05-18 13:10:50 -07:00
Elliott Hughes
d64b91a43b Merge "Remove String16::remove." am: e9c7c5c80c am: 50d6fc417e am: 203cdf89fc am: 1056bd564e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1704013

Change-Id: I0e980e54b13f53f0dfdd58cad21de886bfda3870
2021-05-13 19:53:26 +00:00
Elliott Hughes
1056bd564e Merge "Remove String16::remove." am: e9c7c5c80c am: 50d6fc417e am: 203cdf89fc
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1704013

Change-Id: I5e718c0920791a41ee4a5638b81465a406d783e1
2021-05-13 19:44:55 +00:00
Elliott Hughes
e9c7c5c80c Merge "Remove String16::remove." 2021-05-13 19:04:33 +00:00
Treehugger Robot
db0a816120 Merge "libutils: remove the unused StopWatch lap functionality." am: 0839837fa4 am: 5c28af9897 am: 038077c1c5 am: 70673be9dd
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1703652

Change-Id: I6e5461a9f1f3d3f7aa4ba8af8e65195896cfe671
2021-05-13 04:53:12 +00:00
Elliott Hughes
2cf0411910 Remove String16::remove.
This function, ironically, is being removed.

Even more amusing, it was never "remove" anyway --- it literally did
the opposite, and removed everything *except* the range you passed to
it, and should probably have been called "keep"!

I'm looking at reimplementing much of libutils, but first I'm improving
test coverage, and literally every test I wrote for this failed. And
then when I fixed the "obvious bugs" in the implementation, I found
there actually were a couple of existing unit tests --- that mostly
served to demonstrate just how counter-intuitive this function was.

Bug: http://b/156999009
Test: treehugger
Change-Id: I41fd85f7c0988070f4039f607d2e57523d862ed9
2021-05-12 20:24:26 +00:00
Treehugger Robot
70673be9dd Merge "libutils: remove the unused StopWatch lap functionality." am: 0839837fa4 am: 5c28af9897 am: 038077c1c5
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1703652

Change-Id: If73e10e9321af420ff32b992a6df4f8dd9e5a911
2021-05-12 19:00:08 +00:00
Elliott Hughes
418e0e0c06 Remove String16::remove tests. am: dc334a7c8f
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/14508384

Change-Id: Ia7b6aa12097e0ce5151f849c7d395bb7f4d12482
2021-05-12 04:27:02 +00:00
Elliott Hughes
dc334a7c8f Remove String16::remove tests.
These tests are only in internal right now, preventing me from removing
this function entirely. So let's get them out of the way...

Test: treehugger
Ignore-AOSP-First: workaround for presubmit merge conflict
Bug: http://b/35267372
Change-Id: Ib5de178ffad833c87e8e93bfd33e85a0ff504ac0
2021-05-12 03:57:26 +00:00
Treehugger Robot
0839837fa4 Merge "libutils: remove the unused StopWatch lap functionality." 2021-05-12 01:38:10 +00:00
Elliott Hughes
afa6e9fc04 libutils: remove the unused StopWatch lap functionality.
It's not tested, and it's not used. Also remove the fuzzer which is just
wasting CPU cycles.

This gets us to 100% function coverage, 100% line coverage, and N/A
branch coverage for StopWatch.

Test: treehugger
Change-Id: Ib5e08510ef1046a6f2af3f0b8a1c317a8bb39fd4
2021-05-11 16:33:47 -07:00
Treehugger Robot
81fe365db8 Merge "libutils: remove obsolete README." am: c85c9ee4e6 am: 542b434331 am: 47f22f9ba7 am: 6801ff60bb
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1703649

Change-Id: I4cea6f36b9f049f68c9c6f44e7721f51a0decc04
2021-05-11 22:05:17 +00:00
Treehugger Robot
6801ff60bb Merge "libutils: remove obsolete README." am: c85c9ee4e6 am: 542b434331 am: 47f22f9ba7
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1703649

Change-Id: I1c3156ddd57102f5ba29c34b2b3b8474ca1aff7f
2021-05-11 21:46:30 +00:00
Elliott Hughes
af021e87a6 libutils: remove obsolete README.
This dates from when libutils was still part of frameworks, and talks
about stuff that *didn't* move out of frameworks.

Test: treehugger
Change-Id: Icf22eebc417bcb37abdbfdc89e9a3f14894e18c2
2021-05-11 12:01:26 -07:00
Steven Moreland
f59fb81121 Merge "libutils: LightRefBase: incStrongRequireStrong" am: 1c65d40154 am: b31a05bb47 am: 77b47c4185 am: 55862852fe
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1696268

Change-Id: Ied8436e131d709a8f5e5b0c9bb34abffdb4cd7c3
2021-05-05 01:08:44 +00:00
Steven Moreland
55862852fe Merge "libutils: LightRefBase: incStrongRequireStrong" am: 1c65d40154 am: b31a05bb47 am: 77b47c4185
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1696268

Change-Id: Ia753aaf062e8d58c60ca1113922165a2946a9a07
2021-05-05 00:44:45 +00:00
Steven Moreland
c2dc7cd31c libutils: LightRefBase: incStrongRequireStrong
Allow LightRefBase to be used with
ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION, mainly for
libhwui.

Bug: N/A
Test: libutils_test
Change-Id: I251c874a80f0a069572bc51da45f8f8e74ba6f5b
2021-05-04 21:42:26 +00:00
Steven Moreland
8eafcc0c7d Merge "libutils: sharedbuffer test - expect greatness!" am: 9dd80b6b04 am: 246739cc61 am: 161d760f31 am: 02ede6f998
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1688812

Change-Id: I1923123c1c81d0cfe533df0102da2e1a63d10814
2021-04-28 22:33:26 +00:00
Steven Moreland
02ede6f998 Merge "libutils: sharedbuffer test - expect greatness!" am: 9dd80b6b04 am: 246739cc61 am: 161d760f31
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1688812

Change-Id: Id6ec8ae3f744c1936faebdd66bb2f32b2e6cf814
2021-04-28 22:12:28 +00:00
Steven Moreland
128826ca07 libutils: sharedbuffer test - expect greatness!
This test previously expected failure - a machine which does not have
2GiB of memory. However, while today is becoming the past,
2GiB allocations working is no longer a dream of the future!

Fixes: 186569165
Test: libutils_test
Change-Id: I6a9ed608c0989d415b4e7735b8a451b8928b4083
2021-04-28 17:15:58 +00:00
Steven Moreland
a06e68cb7a Reland^2 "libutils: disable implicit ref base construction"
This reverts commit 2cb7593792.

Reason for revert: reland after fixing b/186468053
Bug: 184190315

Change-Id: I2a46b7a8148db444f9bd4b24746f64217cbba947
2021-04-27 00:09:23 +00:00
Steven Moreland
2cb7593792 Revert "Reland "libutils: disable implicit ref base construction""
This reverts commit 02c47655e7.

Reason for revert: broke another test b/186468053

Change-Id: I0ec82455ad203071e523092ae3cb5f0f1df6aac7
2021-04-27 00:07:55 +00:00
Steven Moreland
02c47655e7 Reland "libutils: disable implicit ref base construction"
This reverts commit 8e11f9e3f3.

Reason for revert: reland after fixing b/186028624
Bug: 184190315

Change-Id: Ia7339a46c3af7dd1a95bc82327cae5304f9f2e16
2021-04-26 17:19:17 +00:00
Steven Moreland
8e11f9e3f3 Revert "libutils: disable implicit ref base construction"
This reverts commit 9a1bf53c4b.

Reason for revert: b/186028624

Change-Id: Icb8b1623df2794222ce3fe34ed5f43506ccf2f68
2021-04-21 23:24:53 +00:00
Steven Moreland
9a1bf53c4b libutils: disable implicit ref base construction
Ignore-AOSP-First: b/184196278

Bug: 184190315
Test: libutils_test
Change-Id: If47f79a8b96ee75706817081950f9ca5c0d12731
2021-04-19 22:01:35 +00:00
Elliott Hughes
6182b330f2 Merge "Remove move dead code." am: acec0918e5 am: 1fc404900c am: 906a03fc49
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1677028

Change-Id: I7fb50216bcf983584f664a691321683dd79ae38d
2021-04-16 17:53:46 +00:00
Elliott Hughes
4b7b4d6d7b Remove move dead code.
Test: treehugger
Change-Id: I6a23b19d078400dfe90329a49ae1abbcb24ef2bf
2021-04-15 15:18:54 -07:00
Elliott Hughes
b996f3f512 Merge "Remove String8::toUpper()." am: 450f66bd8f am: ca3794ea68 am: 334a0b1c10
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1673886

Change-Id: Ica526ca8cb76065e4008a8dbd494beb795ea1390
2021-04-14 19:58:02 +00:00
Elliott Hughes
450f66bd8f Merge "Remove String8::toUpper()." 2021-04-14 17:36:36 +00:00
Steven Moreland
2efd418005 Merge "libutils: group deprecated RefBase functions" am: 4efe03b492 am: 7e2a6bf3b0 am: 20606f64bd
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1673555

Change-Id: I88aad9df554c90358b019200a26c5adfa0b440a3
2021-04-13 18:50:50 +00:00
Steven Moreland
4efe03b492 Merge "libutils: group deprecated RefBase functions" 2021-04-13 16:47:28 +00:00
Steven Moreland
8c8d361981 libutils: group deprecated RefBase functions
Make it easier to see reference to usage documentation, as requested in
review.

Bug: 184190315
Test: libutils_test
Change-Id: If9056e35b1c7a779dd78f2b986ad10d02f25eaf3
2021-04-12 23:56:07 +00:00
Elliott Hughes
9434f59c17 Remove String8::toUpper().
Actually, it looks like it's only toLower() that's used, so let's remove
toUpper() separately, since it's so easy.

Test: treehugger
Change-Id: I8fae9fa513b2a34d5bd6b3f64e9305a1ee3c1ec4
2021-04-12 13:38:31 -07:00
Elliott Hughes
b546cf8c5c Merge "Remove the weird range variants of String8::toLower() and String8::toUpper()." am: 561209ee66 am: 7e7ff3635d am: 685c0c9a7f
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1670567

Change-Id: Iedb8ab438496e0fa3f6697fb18b060e3a1acbc89
2021-04-12 20:35:29 +00:00
Elliott Hughes
561209ee66 Merge "Remove the weird range variants of String8::toLower() and String8::toUpper()." 2021-04-12 18:51:22 +00:00
Elliott Hughes
a858395f91 Remove the weird range variants of String8::toLower() and String8::toUpper().
I want to remove these bad ASCII-only APIs completely, but it might be
easier to remove the range variants first.

Test: treehugger
Change-Id: I4c11f959a7bd8e670708cc03281ea72e9c461ff7
2021-04-09 13:06:20 -07:00
Treehugger Robot
c33f57b7f9 Merge "Remove String16::makeLower()." 2021-04-09 00:35:09 +00:00
TreeHugger Robot
7c4fc3cbdc Merge "Remove String16::makeLower()." into sc-dev 2021-04-08 23:38:34 +00:00
Treehugger Robot
b0d5c56336 Merge changes I66c97386,Id205c88d am: 05a7dfa104 am: 25d87e4419 am: debdf364bd
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1668805

Change-Id: I15f849b229b1e505111d39983ec0a43ba2bf9841
2021-04-08 19:46:01 +00:00
Elliott Hughes
49cb03211f Remove String16::makeLower().
If you need to do a case transformation for a Unicode string, you need
to use icu4c. This only worked for ASCII, which is just silly. Luckily
it doesn't seem to be used anywhere.

Test: treehugger
Change-Id: I4a864823ec35a0b57b50909587cc3efac3f531a7
Merged-In: I4a864823ec35a0b57b50909587cc3efac3f531a7
(cherry picked from commit c74d97c854)
2021-04-08 17:00:39 +00:00
Steven Moreland
dc43fb279f libutils: wp::fromExisting bugfix
This API was tested before, but it wasn't used until it is needed in
libbinder. Previously it passed the tests because wp::operator==
compares weak_ptrs which are never deleted, but it doesn't check the
value of m_ptr as well. This assumes that the RefBase implementation is
self-consistent.

Future considerations:
- add additional CHECK (perf?)
- add an additional optional CHECK?
- update all refbase tests to use an embellished form of this operator

Bug: 184190315
Test: libutils_test, boot and kill process when libbinder is using this
API

Change-Id: I66c97386d769529d5efae48e06775d4b4a344025
2021-04-07 23:06:09 +00:00
Elliott Hughes
016beb8559 Remove String16::makeLower().
If you need to do a case transformation for a Unicode string, you need
to use icu4c. This only worked for ASCII, which is just silly. Luckily
it doesn't seem to be used anywhere.

Test: treehugger
Change-Id: I4a864823ec35a0b57b50909587cc3efac3f531a7
Merged-In: I4a864823ec35a0b57b50909587cc3efac3f531a7
2021-04-07 22:38:20 +00:00
Steven Moreland
1d68548823 libutils: add sp::cast method
Previously, sp::sp(T*) internally had a static cast, and people
frequently wrote code like this:

    sp<A> a = ...;
    sp<B> b(a.get()); // implicit static cast

Luckily, none of the other sp constructors have this implicit cast. So,
for explicit code, rather than making those use static_cast internally,
adding an sp::cast function.

Bug: 184190315
Test: use in libbinder
Change-Id: Id205c88d03e16cf85ccb8f493ce88b4bbc65a688
2021-04-07 20:30:21 +00:00
Steven Moreland
746757a02f Merge "ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION" am: 99037347d6 am: d8c4c860ef am: e1a51daf9b
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1660499

Change-Id: I72e661607a70876fa8f63f95318c3805cb26fb4b
2021-04-05 20:53:01 +00:00
Steven Moreland
da75cef983 ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION
In form, inspired by ANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION.

We get occasional bugs about sp double-ownership. When this flag is
enabled, we have:
- you must construct RefBase objects using sp<>::make
- you must construct wp<> objects by converting them to sp<>
- if you want to convert a raw pointer to an sp<> object (this is
  possible since the refcount is used internally, and is used commonly
  on this*), then you must use 'assertStrongRefExists' semantics which
  aborts if there is no strong ref held. That is, if a client uses
  std::make_shared and then calls a function which internally used to
  call `sp<T>(this)`, you would now call
  `sp<T>::assertStrongRefExists(this)`, and the double ownership
  problem would become a runtime error.

Bug: 184190315
Test: libutils_test
Change-Id: Ie18d3146420df1808e3733027070ec234dda4e9d
2021-04-05 17:45:18 +00:00
Steven Moreland
d9a8a7c340 Merge "libutils: better docs for sp<>::make" am: 767f264fa4 am: fb91070a83 am: 2eb2b5edbf
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1663182

Change-Id: I8c21003dbac86e0d57a4cf634f0c9b719f703e0a
2021-04-02 23:14:46 +00:00
Steven Moreland
09b0495b47 libutils: better docs for sp<>::make
Bug: 184190315
Test: N/A
Change-Id: I56621058b9d85122b7dca3727e40c8c85595031f
2021-04-02 17:26:16 +00:00
Treehugger Robot
387c02293b Merge "Disallow exit-time destructors in libutils." am: 1c9f84edeb am: c83480e3f9 am: 3fb1a85148
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1619600

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib6c5f0d5ca8a144e97e6965556378d626b8a8f6c
2021-03-05 22:55:00 +00:00
Elliott Hughes
48a9eb49ee Disallow exit-time destructors in libutils.
There weren't any, but let's keep it that way.

Test: treehugger
Change-Id: I2a64eed47f41413a43c524af23b3070e5c2083a6
2021-03-04 09:46:23 -08:00
Treehugger Robot
cc3a9ee812 Merge "Add docs to SystemClock.h" am: 0d4089cb1c am: 27e2d3d4fd am: ac92eef968
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1603259

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I913b74e6af9332ca30d4f94684439a01c4bf5206
2021-02-24 02:49:43 +00:00
Treehugger Robot
0d4089cb1c Merge "Add docs to SystemClock.h" 2021-02-24 00:03:15 +00:00
Zhomart Mukhamejanov
45e0dc1dae Add docs to SystemClock.h
Test: n/a
Change-Id: I16a41e9b98c88270857fe2a1d6b382bfe469bca6
2021-02-23 12:14:57 -08:00
Bob Badour
994fe355d9 Merge "[LSC] Add LOCAL_LICENSE_KINDS to system/core" am: d0bfde2f78 am: b2145c414a am: 4cf31dacb3
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1591651

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3ea2cdf9470b391f3a1067a9f6eb666fd461d92b
2021-02-21 17:31:20 +00:00
Bob Badour
d69ad69a93 [LSC] Add LOCAL_LICENSE_KINDS to system/core
Added SPDX-license-identifier-Apache-2.0 to:
  bootstat/Android.bp
  cli-test/Android.bp
  code_coverage/Android.bp
  cpio/Android.bp
  debuggerd/crasher/Android.bp
  debuggerd/proto/Android.bp
  diagnose_usb/Android.bp
  fs_mgr/libdm/Android.bp
  fs_mgr/libfiemap/Android.bp
  fs_mgr/liblp/Android.bp
  fs_mgr/libsnapshot/Android.bp
  fs_mgr/libstorage_literals/Android.bp
  fs_mgr/libvbmeta/Android.bp
  fs_mgr/tests/Android.bp
  fs_mgr/tools/Android.bp
  gatekeeperd/Android.bp
  healthd/Android.bp
  healthd/testdata/Android.bp
  init/Android.bp
  init/Android.mk
  init/sysprop/Android.bp
  init/test_kill_services/Android.bp
  init/test_service/Android.bp
  libappfuse/Android.bp
  libasyncio/Android.bp
  libbinderwrapper/Android.bp
  libcrypto_utils/Android.bp
  libcrypto_utils/tests/Android.bp
  libdiskconfig/Android.bp
  libgrallocusage/Android.bp
  libkeyutils/mini_keyctl/Android.bp
  libmodprobe/Android.bp
  libnetutils/Android.bp
  libpackagelistparser/Android.bp
  libprocessgroup/Android.bp
  libprocessgroup/cgrouprc/Android.bp
  libprocessgroup/cgrouprc_format/Android.bp
  libprocessgroup/profiles/Android.bp
  libprocessgroup/setup/Android.bp
  libqtaguid/Android.bp
  libsparse/Android.bp
  libstats/push_compat/Android.bp
  libsuspend/Android.bp
  libsync/Android.bp
  libsystem/Android.bp
  libsysutils/Android.bp
  libusbhost/Android.bp
  libutils/Android.bp
  libvndksupport/Android.bp
  libvndksupport/tests/Android.bp
  llkd/Android.bp
  llkd/tests/Android.bp
  property_service/libpropertyinfoparser/Android.bp
  property_service/libpropertyinfoserializer/Android.bp
  property_service/property_info_checker/Android.bp
  qemu_pipe/Android.bp
  reboot/Android.bp
  rootdir/Android.bp
  rootdir/Android.mk
  rootdir/avb/Android.bp
  rootdir/avb/Android.mk
  run-as/Android.bp
  sdcard/Android.bp
  set-verity-state/Android.bp
  shell_and_utilities/Android.bp
  storaged/Android.bp
  toolbox/Android.bp
  trusty/apploader/Android.bp
  trusty/confirmationui/Android.bp
  trusty/confirmationui/fuzz/Android.bp
  trusty/coverage/Android.bp
  trusty/fuzz/Android.bp
  trusty/fuzz/test/Android.bp
  trusty/gatekeeper/Android.bp
  trusty/gatekeeper/fuzz/Android.bp
  trusty/keymaster/Android.bp
  trusty/keymaster/fuzz/Android.bp
  trusty/libtrusty/Android.bp
  trusty/libtrusty/tipc-test/Android.bp
  trusty/secure_dpu/Android.bp
  trusty/storage/interface/Android.bp
  trusty/storage/lib/Android.bp
  trusty/storage/proxy/Android.bp
  trusty/storage/tests/Android.bp
  trusty/utils/spiproxyd/Android.bp
  trusty/utils/trusty-ut-ctrl/Android.bp
  usbd/Android.bp
  watchdogd/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  debuggerd/Android.bp
  fastboot/Android.bp
  libkeyutils/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-MIT
to:
  libcutils/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-MIT
to:
  fs_mgr/Android.bp
  fs_mgr/libfs_avb/Android.bp
  trusty/Android.bp
  trusty/utils/rpmb_dev/Android.bp

Added SPDX-license-identifier-BSD
to:
  fastboot/fuzzy_fastboot/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: Id740a7d2884556081fdb68876584b25eb95e1bef
2021-02-19 12:59:05 -08:00
Treehugger Robot
f5186a5128 Merge "Revert "[LSC] Add LOCAL_LICENSE_KINDS to system/core"" am: ca474f994d am: aea25045ba am: fa48b67e98
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1590280

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ifdbd05d3e1c993bf1b6c92161669555fba108abd
2021-02-17 00:46:03 +00:00
Elliott Hughes
c3a206ccda Revert "[LSC] Add LOCAL_LICENSE_KINDS to system/core"
This reverts commit 187b7d1950.

Reason for revert: system/core is multiple projects, not one.

Change-Id: I790ea41741f8cd9b8b6db2f59a49e71fb0958fd6
2021-02-16 20:01:20 +00:00
Treehugger Robot
34add4fe2c Merge "[LSC] Add LOCAL_LICENSE_KINDS to system/core" am: d0aa350c02 am: 504895aacb am: d856628451
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1589006

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I85c87dc31f7599b64202578ed33587eeadb1650f
2021-02-16 19:41:17 +00:00
Bob Badour
187b7d1950 [LSC] Add LOCAL_LICENSE_KINDS to system/core
Added SPDX-license-identifier-Apache-2.0 to:
  bootstat/Android.bp
  cli-test/Android.bp
  code_coverage/Android.bp
  cpio/Android.bp
  debuggerd/crasher/Android.bp
  debuggerd/proto/Android.bp
  diagnose_usb/Android.bp
  fs_mgr/libdm/Android.bp
  fs_mgr/libfiemap/Android.bp
  fs_mgr/liblp/Android.bp
  fs_mgr/libsnapshot/Android.bp
  fs_mgr/libstorage_literals/Android.bp
  fs_mgr/libvbmeta/Android.bp
  fs_mgr/tests/Android.bp
  fs_mgr/tools/Android.bp
  gatekeeperd/Android.bp
  healthd/Android.bp
  healthd/testdata/Android.bp
  init/Android.bp
  init/Android.mk
  init/sysprop/Android.bp
  init/test_kill_services/Android.bp
  init/test_service/Android.bp
  libappfuse/Android.bp
  libasyncio/Android.bp
  libbinderwrapper/Android.bp
  libcrypto_utils/Android.bp
  libcrypto_utils/tests/Android.bp
  libdiskconfig/Android.bp
  libgrallocusage/Android.bp
  libkeyutils/mini_keyctl/Android.bp
  libmodprobe/Android.bp
  libnetutils/Android.bp
  libpackagelistparser/Android.bp
  libprocessgroup/Android.bp
  libprocessgroup/cgrouprc/Android.bp
  libprocessgroup/cgrouprc_format/Android.bp
  libprocessgroup/profiles/Android.bp
  libprocessgroup/setup/Android.bp
  libqtaguid/Android.bp
  libsparse/Android.bp
  libstats/push_compat/Android.bp
  libsuspend/Android.bp
  libsync/Android.bp
  libsystem/Android.bp
  libsysutils/Android.bp
  libusbhost/Android.bp
  libutils/Android.bp
  libvndksupport/Android.bp
  libvndksupport/tests/Android.bp
  llkd/Android.bp
  llkd/tests/Android.bp
  property_service/libpropertyinfoparser/Android.bp
  property_service/libpropertyinfoserializer/Android.bp
  property_service/property_info_checker/Android.bp
  qemu_pipe/Android.bp
  reboot/Android.bp
  rootdir/Android.bp
  rootdir/Android.mk
  rootdir/avb/Android.bp
  rootdir/avb/Android.mk
  run-as/Android.bp
  sdcard/Android.bp
  set-verity-state/Android.bp
  shell_and_utilities/Android.bp
  storaged/Android.bp
  toolbox/Android.bp
  trusty/apploader/Android.bp
  trusty/confirmationui/Android.bp
  trusty/confirmationui/fuzz/Android.bp
  trusty/coverage/Android.bp
  trusty/fuzz/Android.bp
  trusty/fuzz/test/Android.bp
  trusty/gatekeeper/Android.bp
  trusty/gatekeeper/fuzz/Android.bp
  trusty/keymaster/Android.bp
  trusty/keymaster/fuzz/Android.bp
  trusty/libtrusty/Android.bp
  trusty/libtrusty/tipc-test/Android.bp
  trusty/secure_dpu/Android.bp
  trusty/storage/interface/Android.bp
  trusty/storage/lib/Android.bp
  trusty/storage/proxy/Android.bp
  trusty/storage/tests/Android.bp
  trusty/utils/spiproxyd/Android.bp
  trusty/utils/trusty-ut-ctrl/Android.bp
  usbd/Android.bp
  watchdogd/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  debuggerd/Android.bp
  fastboot/Android.bp
  libkeyutils/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-MIT
to:
  Android.bp
  libcutils/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-MIT
to:
  fs_mgr/Android.bp
  fs_mgr/libfs_avb/Android.bp
  trusty/utils/rpmb_dev/Android.bp

Added SPDX-license-identifier-BSD
to:
  fastboot/fuzzy_fastboot/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I5bd81adb5cdcf2b4dd4141b204eb430ff526af8f
2021-02-16 04:10:03 -08:00
Treehugger Robot
f0e5355a6a Merge "Add product_available to product available modules" am: a9e6057dad am: 9d879b847f am: 721f41f062
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1496003

Change-Id: Ic52a2b2e31685a5af4a09dc0377e0e6f7c033f44
2020-12-04 04:11:30 +00:00
Justin Yun
feef4d390f Add product_available to product available modules
vendor_available modules were available to product modules.
However, not all vendor_available modules are required to be
available to product modules. Some modules want to be available only
to product modules but not vendor modules.

To cover the requirement, we separate product_available from
vendor_available.
vendor_available will not provide product available module.

Rename libcutils/include_vndk to libcutils/include_outside_system as
it provides the headers to the modules outside the system partition
including /product.

Bug: 150902910
Test: build
Change-Id: I791b5a6a1dc99442065debfce6fa0f54a335fcea
2020-12-04 09:59:20 +09:00
Hamzeh Zawawy
b425404633 Merge "Resolved UAF issue in RefBase fuzzer" am: 9a79c84499 am: da2960df35 am: 5a8869456e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1424812

Change-Id: Iac76b32d88a3618434669f6b1e00c3591340c849
2020-12-01 19:30:18 +00:00
Dylan Katz
55107c195d Resolved UAF issue in RefBase fuzzer
Restrucures this fuzzer to be far more robust and less brittle.
Fix: 163727995
Fix: 163449137
Test: libutils_fuzz_refbase clusterfuzz-testcase-minimized-libutils_fuzz_refbase-5674315436261376
Test: libutils_fuzz_refbase clusterfuzz-testcase-minimized-libutils_fuzz_refbase-5731662044069888
Test: libutils_fuzz_refbase clusterfuzz-testcase-minimized-libutils_fuzz_refbase-5081777218256896

Signed-off-by: Dylan Katz <dylan.katz@leviathansecurity.com>
Change-Id: I239298dc2895a06af5a126e9ca2ae452579e5cc0
2020-11-30 16:18:27 -08:00
Devin Moore
5f9490712b Merge "libutils: add unit tests for invalid utf-8 and utf-16 strings" am: eb85221dcf am: c21e63ea26 am: ddc33e4f85 am: cc2f1917ac
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1470423

Change-Id: Ie9f981fb869868a3acc2ca60e1a1a727b0905ad5
2020-11-12 17:47:51 +00:00
Devin Moore
eb85221dcf Merge "libutils: add unit tests for invalid utf-8 and utf-16 strings" 2020-11-12 16:05:38 +00:00
Devin Moore
6bcbeeafba libutils: add unit tests for invalid utf-8 and utf-16 strings
Characters get dropped during the conversionis between 8 and 16.

Test: atest libutils_test
Change-Id: Ie76dd38e97968137555ba2ab7ce188c9122ed06e
2020-11-10 02:54:39 +00:00
Yifan Hong
65e2660523 libcutils: make vendor_ramdisk_available. am: 55015ffb82 am: 861fd6376b am: 9485558332 am: 304ae82046
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1477501

Change-Id: I3c7e80aa56ee9d406e7650ea809a97cad97b3f09
2020-10-29 19:15:59 +00:00
Yifan Hong
861fd6376b libcutils: make vendor_ramdisk_available. am: 55015ffb82
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1477501

Change-Id: I68d5532918c31209c61733fb546b1fd4ee836eb7
2020-10-29 17:49:19 +00:00
Yifan Hong
0248561ae6 Merge changes from topic "vendor_ramdisk"
* changes:
  libprocessgroup_headers: make vendor_ramdisk_available.
  libdebuggerd_handler_fallback: make vendor_ramdisk_available.
  libcutils: make vendor_ramdisk_available.
  libpropertyinfoparser: make vendor_ramdisk_available.
2020-10-29 17:17:27 +00:00
Yifan Hong
55015ffb82 libcutils: make vendor_ramdisk_available.
Test: builds
Bug: 156098440
Change-Id: I663a3839e402a83ebf31b8a680c61f1e269548f6
2020-10-28 10:57:51 -07:00
Elliott Hughes
a330a676e3 Merge "Remove unused utf8_length()." am: 52dac2f8b7 am: 0ee0648569 am: a7f8cdbfff am: 6add13eba2
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1474916

Change-Id: Ie0948010f2e0f246c89a58ac055e75e9829f3905
2020-10-27 16:15:02 +00:00
Elliott Hughes
939e43e66e Remove unused utf8_length().
Test: treehugger
Change-Id: Idcebc4ae1dcad102873d50f199f5e8745e589da4
2020-10-26 13:14:47 -07:00
Jason Chiu
311735f981 Merge "Disable callstack for mac too." am: 7e93bd24b2 am: e9e08faf3a am: b5cc09e765 am: 99c8599198
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1468408

Change-Id: Icecd6f66d345196b44aa42c7760446cef9f5adee
2020-10-21 09:30:04 +00:00
Christopher Ferris
8377b10f29 Disable callstack for mac too.
Bug: 171353386

Test: Builds.
Change-Id: Id8a5cce170682ea43aa641c187c22cb31b6fd017
2020-10-21 06:04:00 +00:00
Christopher Ferris
08491d6c1c Merge "Remove include/backtrace symlink." am: 5c573b45ec am: f75f38308b am: 0c53abc313 am: bbf44c1494
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1467958

Change-Id: I2f9f8df7c8ee4d9b41b2f881546e6cd6afb5dfc7
2020-10-21 00:24:29 +00:00
Elliott Hughes
5dba989281 Merge "Fix SharedBuffer tests to pass under hwasan." am: 2d697d330f am: 7266e44305 am: 1c8f0bad6b am: f9ff52ef3f
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1466463

Change-Id: Ic03befb80608e15b21ac703810bb0a45308dcad3
2020-10-20 20:40:37 +00:00
Christopher Ferris
0e69160ebc Remove include/backtrace symlink.
This requires a few other changes to support building libutils
properly. It does appear the windows versions of libutils is
referencing CallStack code, but it doesn't seem to cause any problems.
However, I removed those references completely for the windows build.

Also removed a few extra spaces that seem to have accumulated in the
RefBase.cpp.

Bug: 170465278

Test: Builds and libutils unit tests pass.
Change-Id: Ibeee7791b13636b34bdd592c5420fd91620f752a
2020-10-20 12:46:14 -07:00
Elliott Hughes
f2f016e741 Fix SharedBuffer tests to pass under hwasan.
Allocating the entire address space is sufficiently unreasonable that
hwasan blows you out of the water if you try to do that. Half the
address space feels like it's large enough to be guaranteed to fail
(which is all I think this intended to test) without being quite so
obviously incorrect that tools like hwasan are going to object...

...except hwasan actually has a 2GiB limit. So let's keep the cleanup,
but also just disable these tests if they're running under hwasan for
now.

Bug: https://issuetracker.google.com/171054277
Test: treehugger
Change-Id: I41f3def5c3a43aa7f9ca3a130b4306ebed659d6a
2020-10-19 16:51:58 -07:00
The Android Open Source Project
7fd5f8d2bc DO NOT MERGE - Merge RP1A.201005.006
Bug: 168212094
Change-Id: I79a7517bce1c012eac2a2a7c1c2cffc5a3516eaa
Merged-In: Ia85067d4258bde4b875c832d6223db5dd26b8838
2020-10-06 04:30:21 +00:00
Steven Moreland
4749998c88 Merge "Adds license header" am: 754c6b2924 am: 967bacd0dd am: 9b445e0cb8 am: e4c07f8eaf am: 2f766bbb7d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1446918

Change-Id: I600e7d1b4de4ba8ad0279235013c9ad5ee003df5
2020-10-02 22:31:42 +00:00
Steven Moreland
9b445e0cb8 Merge "Adds license header" am: 754c6b2924 am: 967bacd0dd
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1446918

Change-Id: If3d1f1676f6d1d1d085c1b1ce706c0925fa628de
2020-10-02 21:16:38 +00:00
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