Commit graph

769 commits

Author SHA1 Message Date
Xin Li
6042b45f56 Merge "Merge Android 12" 2021-10-07 23:50:14 +00:00
Wei Wang
1132977223 Merge changes from topic "sysbg_aosp"
* changes:
  task_profiles: add ServicePerformance to legacy device policy
  libutils: use system_background for low prio tasks in framework
2021-10-07 17:54:40 +00:00
Wei Wang
c39d60d114 libutils: use system_background for low prio tasks in framework
Bug: 201428466
Test: Build and boot check system_server's sched group
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: Iffc47fdaf3ef8fba6eb01a12cf534a0393e3e91c
2021-10-06 13:04:22 -07:00
Treehugger Robot
7dc38fe273 Merge "Looper: Use sequence numbers in epoll_event to track requests" am: 663c692a2d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1795650

Change-Id: Id4072ec03cbd6f0c5eb6a54d8c37d9dd453cf989
2021-09-13 12:11:00 +00:00
Treehugger Robot
663c692a2d Merge "Looper: Use sequence numbers in epoll_event to track requests" 2021-09-13 11:58:45 +00:00
Prabir Pradhan
729057ab8c Looper: Use sequence numbers in epoll_event to track requests
Previously, Looper internally kept track of the requests to add fds
using the fd value itself. It used an internal sequence number
associated with each request to add a callback to avoid a situation
where a callback is unexpectedly called. However, since it used the fd
value rather than the sequence number to register events into epoll,
there was still a way where unintended hangups could occur.

This exact sequence of events caused unintended behavior in Looper:
- An fd (FD) is added to the looper.
- Looper registers FD into epoll using its FD number.
- FD is closed.
- A hangup event arrives from epoll_wait while the Looper is polling.
Looper is waiting for the lock to process the callback for FD, because
it is blocked by:
- A new fd is created and added to the looper. Since the lowest number
fd is reused, this new fd has the same value as FD.
- The poll request for Looper is now unblocked, so it looks up the
callback associated with FD to process the hangup.
- Since FD is already associated with the new callback, the new callback
is called unintentionally.

This CL uses the sequence number to register fds into epoll. That way,
when we get a hangup from epoll that is associated with a sequence
number, there is no way an unexpected callback will called.

This CL also adds a test to verify this behavior. Due to the
nondeterministic nature of this multi-thread scenario, the test verifies
this scenario repeatedly. Without the fix in Looper, the test is flaky,
but should never fail after the fix.

Bug: 195020232
Bug: 189135695
Test: atest libutils_test --rerun-until-failure
Ignore-AOSP-First: Topic CL aosp/1799831 has a merge conflict with
internal master, resolved in ag/15613419.

Change-Id: Ib4edab7f2407adaef6a1708b29bc52634f25dbb6
2021-09-01 14:52:52 +00:00
Steven Moreland
e5eede1551 Merge "RefBase: Unknown mFlag meaning" am: 53e977339b
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1805816

Change-Id: I3594e5658cc4759c0552aedb394f397be94d81d5
2021-08-24 20:27:09 +00:00
陈冠有
0cbef728f9 RefBase: Unknown mFlag meaning
Change-Id: I3ddd1895c48c682bdb0868e890c62029710bf1c8
2021-08-22 16:36:36 +00:00
Elliott Hughes
5153cdee39 Merge "Split up the system/core/ TEST_MAPPING." am: 0589b7eb94
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1797132

Change-Id: I49316e97d5997bf5a0e5f7932aa3f1016b4566e6
2021-08-18 16:41:35 +00:00
Elliott Hughes
22e082e87a Split up the system/core/ TEST_MAPPING.
A lot of things had moved out of system/core/ without their TEST_MAPPING
entries having gone with them, reducing the amount of presubmit coverage
for those things.

In order to reduce the likelihood of that happening again, I've pushed
all that remained in the system/core/ TEST_MAPPING down into the
individual subdirectories.

Test: treehugger
Change-Id: Ib75d65f9200fa64ae1552471da6fbe5b7023cf94
2021-08-16 16:37:10 -07:00
Treehugger Robot
f34b2446bb Merge "Revert "Revert "Remove unused String8::setPathName.""" am: f9a9ee048c am: e9a9a4f071
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1771595

Change-Id: I815e30f78c4a129de8186bd1b08278024fdf01d6
2021-07-20 20:07:22 +00:00
Greg Kaiser
d03851e549 Revert "Revert "Remove unused String8::setPathName.""
This reverts commit 70d9fb63e6.

Reason for revert: Outstanding usage of this method removed internally

Change-Id: Idcc00ec261aa1d97f11e47abdb08b10a37b5d20f
Test: Local build; treehugger (which I'll manually confirm runs on the appropriate targets)
2021-07-19 20:19:44 +00:00
Greg Kaiser
2cca5cc992 Merge "Revert "Remove unused String8::setPathName."" am: 615bf4ef14 am: 01f3306b69
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1768145

Change-Id: I9856b917353e57b048eeec2d3ed6d157165e1148
2021-07-15 13:56:01 +00:00
Greg Kaiser
70d9fb63e6 Revert "Remove unused String8::setPathName."
This reverts commit c214426e0c.

Reason for revert: This is not unused; broke build internally

Change-Id: I18e8b7954256ae015ad32743fa6a75850b00913e
2021-07-15 13:33:10 +00:00
Elliott Hughes
941b1a61b0 Merge "Remove unused String8::setPathName." am: 40a0664b84 am: 5f7d548dc6
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1765465

Change-Id: If7b66e7de22107110fa595827611f1bb1a83a9dc
2021-07-14 21:48:06 +00:00
Elliott Hughes
c214426e0c Remove unused String8::setPathName.
Test: treehugger
Change-Id: Idc8d7e748b0df4ce8a26227dc73a5eef2b04244f
2021-07-13 17:20:53 -07: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
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
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
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
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
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
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
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
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
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
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
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
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