Commit graph

85207 commits

Author SHA1 Message Date
Yifan Hong
24d0304ee9 lshal: Do not use lastError API.
Use the new API with error message pointer instead.

Test: lshal_test
Bug: 179270601
Change-Id: I19d1307c7b72b90d205f307a81edfb1efabb874e
2021-04-05 18:35:13 -07:00
Calin Juravle
1fe4c9f19e Merge "Remove unused update_out_oat_access_times." 2021-02-02 01:35:22 +00:00
Ady Abraham
2ea3652017 Merge "Ensure that expected present time is in the future" 2021-02-02 01:14:12 +00:00
Snild Dolkow
1c1d4c71c2 Ensure that expected present time is in the future
onMessageInvalidate() sets mExpectedPresentTime to a value originating
from the vsync event that scheduled it. If handling of the invalidate
is delayed, this value will be in the past, which is clearly not a
plausible present time. Because of this, queued frames may incorrectly
be ignored as "too early".

This has caused problems in screen-on animations: even though the first
frame is drawn and ready, SurfaceFlinger shows an old frame. This looks
particularly bad with a fade-from-black animation: the old frame flashes
by before the first frame of the animation shows.

Here's an example timeline of how this problem could manifest:

 1000 ms    INVALIDATE queued with expectedVSyncTimestamp = 1010ms
 1013 ms    SF calls setPowerMode()
 1014 ms    SystemUI queues new NotificationShade frame
 1255 ms    setPowerMode() returns; invalidate can now be handled
 1256 ms    invalidate runs; mExpectedPresentTime set to 1010ms
 1257 ms    handlePageFlip() skips NotificationShade frame; "too early"
 1259 ms    refresh runs, composits prehistoric NotificationShade frame

It's a bit of a race: if SystemUI manages to queue its new frame before
the INVALIDATE message's timestamp, there won't be a problem.

To solve this, let's check that the expected present time is in the
future, and pick the nearest future vsync point if it's not. In order
to not break frame miss detection, mScheduledPresentTime is introduced
and used instead of mExpectedPresentTime for jank calculations.

Fixes: 178415552
Test: manual on Xperia device; flash of old frame is gone
Test: compiles on aosp/redfin
Change-Id: I095f1dd08374fd1d14552cd1af90d95e9718b4dd
Merged-In: I095f1dd08374fd1d14552cd1af90d95e9718b4dd
2021-02-02 00:50:00 +00:00
Steven Moreland
a9a7a83809 Merge changes I562f7fd1,I0ab1ed86
* changes:
  Remove in-process transaction log.
  Do not test panic capture in Rust.
2021-02-02 00:47:11 +00:00
Steven Moreland
f3d9aa5eaa Remove in-process transaction log.
This is used in production as a means to go between languages
(rust<->C++) in keystore.

Bug: N/A
Test: N/A
Change-Id: I562f7fd15d9b85e065074abf7b80e4d439432730
2021-02-01 22:35:24 +00:00
Matthew Maurer
6fc80d6348 Do not test panic capture in Rust.
We have switched panic strategy to abort rather than unwind. This
prevents the previously tested behavior from working correctly.

Bug: 178577888
Test: atest rustBinderSerializationTest
Change-Id: I0ab1ed86ed1264054f43a9655185496d9c8b6328
2021-02-01 14:02:10 -08:00
Mikhail Naganov
bcb89efed8 Merge "Remove audio HAL V2 from "interfaces to dump"" 2021-02-01 21:22:39 +00:00
Mikhail Naganov
a5d864b59e Remove audio HAL V2 from "interfaces to dump"
This version is deprecated, not supported in Android S.

Bug: 171260360
Test: m
Change-Id: Ida070506f296c676f663c89778b295691c562cac
2021-01-30 01:01:01 +00:00
Steven Moreland
2ac99ed553 Merge "ServiceManager: support debug dump w/ PIDs" 2021-01-29 21:24:26 +00:00
Rhed Jao
21474550bc Merge "Fixes presubmit test flaky in dumpstate" 2021-01-29 01:03:22 +00:00
Steven Moreland
3ea4327dc0 ServiceManager: support debug dump w/ PIDs
To enable binder service-name based dumps of services when the same
interface might be registered from multiple different processes.

The getDebugPid command can't be sent instead to specific instances,
since if they are hung, the PID couldn't be retrieved.

For partiy w/ HIDL, this uses the 'list' selinux permission to control
reading debug dumps.

Bug: 175322136
Test: using this info to dump AIDL HALs in ANR
Change-Id: I4bc7c2df5faa6be1cdcc69b2a7fc882293f1d249
2021-01-28 22:51:23 +00:00
Rhed Jao
1742c1bb8a Fixes presubmit test flaky in dumpstate
The test assert that file size of primary.prof in the
`FS/data/misc/profiles/cur/0/com.android.phone/` should
be greater than 0. This behavior depends on art module,
and it's not always true. Updates the test to assert
the file should exist.

Bug: 178561542
Test: atest dumpstate_smoke_test
Change-Id: I1038c6c10c320cd98fa97f0890fff7f64e29e731
2021-01-28 10:38:01 +08:00
Treehugger Robot
c282248fd7 Merge "Avoid integer underflow involving maxFreqCount." 2021-01-27 00:03:15 +00:00
Treehugger Robot
6e95c696ef Merge "SurfaceFlinger: VSyncPredictor should be robust with inconsistent vsyncs" 2021-01-26 23:05:59 +00:00
Peter Collingbourne
a5ca7665cd Avoid integer underflow involving maxFreqCount.
If a device does not have any policy directories under
/sys/devices/system/cpu/cpufreq this would previously lead to the
cputimeinstate subsystem being initialized with an empty set of policy
frequencies. This would lead to integer underflows in various loops
that enumerate the frequencies when subtracting 1 from a maxFreqCount
variable calculated as 0, resulting in us spending a significant amount
of time in these loops, likely leading to an ANR in system_server
since at least the loop in clearUidTimes is executed while holding the
BatteryStatsImpl lock. Fix the problem by skipping the initialization
of cputimeinstate if there are no policy directories.

Bug: 142352330
Bug: 178231152
Change-Id: I2ec1e8de0fe2a40ed100c8f14e6ca3f6d6285b82
2021-01-26 12:09:59 -08:00
Kalesh Singh
7dfe58cc10 Merge "Add mm_events trace instance" 2021-01-26 14:33:39 +00:00
Rock.Yeh
bf00bf32a7 Remove unused update_out_oat_access_times.
Bug: 178069299
Test: device boots
      adb shell cmd package compile -m speed|speed-profile packageName
      install new packages
Change-Id: I7fff5bc9e21bed51d34f5b630114ed480fb3feeb
2021-01-26 09:52:51 +08:00
Kalesh Singh
f21c54e464 Add mm_events trace instance
This instance is used as the signal for kmem_activity trigger
(See:go/mm-events-design)

Bug: 155928119
Test: adb shell ls /sys/kernel/tracing/instances/mm_events
Change-Id: I4d02fac3969ac837006eaa5396be5bc7797b6b81
2021-01-25 19:30:57 -05:00
Amos Bianchi
827e3d5b7d Merge "Change argument of active services callback to bool." 2021-01-23 02:43:23 +00:00
Ady Abraham
707840a56b SurfaceFlinger: VSyncPredictor should be robust with inconsistent vsyncs
If VSyncPredictor gets an invalid timestamp, it might be accepted as
a correct one, and then all the other correct timestamps will become
incorrect for VSyncPredictor leading to rejecting all the correct
timestamps followed by a one off inconsistent vsync.

Bug: 173235499
Bug: 177484301
Test: SF unit tests (+1 new)
Change-Id: I192b917196c727b9a97a0d18bae160467f75722d
Merged-In: I192b917196c727b9a97a0d18bae160467f75722d
2021-01-23 02:23:47 +00:00
Steven Moreland
f0b4ddc432 Merge "libbinder_rs: Use NDK parcelable array APIs" 2021-01-22 20:54:40 +00:00
Steven Moreland
253d914cc4 Merge "binderClearBufTest: remove unnecessary flush" 2021-01-22 18:40:38 +00:00
Steven Moreland
52e4110da1 Merge "Add Rust/C++ Parcel serialization tests" 2021-01-22 18:40:00 +00:00
Gavin Corkery
272d76d80d Merge "Make DumpstateListener onError method oneway" 2021-01-22 16:14:43 +00:00
Amos Bianchi
7a6cef975d Change argument of active services callback to bool.
Instead of passing the number of active services, pass a bool
that represents if there are clients.

Bug: 176239128
Test: test aidl_lazy_test

Change-Id: I8180547dfe4ebc11d5d7bb3a7306bc79f839d715
Merged-In: I8180547dfe4ebc11d5d7bb3a7306bc79f839d715
2021-01-21 18:35:50 -08:00
Stephen Crane
d58bce0d4a Add Rust/C++ Parcel serialization tests
This tests cross-language marshaling between C++ and Rust for all
available parcelable types.

Test: atest libbinder_rs-internal_test

Change-Id: I57fae844d58395ee85f0afa4604e1480262f1a4b
2021-01-21 15:01:13 -08:00
Stephen Crane
3ba4d8b97f libbinder_rs: Use NDK parcelable array APIs
Rather than embedding the wire format of parcelable arrays in rust, we
should rely on the NDK implementation to parcel and unparcel arrays of
generic parcelables. This allows the NDK to change the wire protocol
independently of the Rust library.

Test: atest -p frameworks/native/libs/binder/TEST_MAPPING
Bug: 174801709
Change-Id: I52dd35c506e96840f8e765ba53cb7c83f4921536
2021-01-21 14:39:32 -08:00
Steven Moreland
7677da691e Merge "Flush BC_FREE_BUFFER and ref ops from non-looper threads." 2021-01-21 17:15:14 +00:00
Steven Moreland
da4a5ca5b7 Merge "libbinder_ndk: ScopedAStatus description compat" 2021-01-20 21:36:51 +00:00
Adithya Srinivasan
aaf1ba472a Merge changes I10c3bf8a,Ifaafdbfb,I9f570567
* changes:
  remove SKIP_IF_BPF_NOT_SUPPORTED
  Remove gpumemtracer bloat
  Add unittests for GpuMemTracer
2021-01-20 18:34:10 +00:00
Maciej Żenczykowski
5b194e5396 remove SKIP_IF_BPF_NOT_SUPPORTED
Android S requires the device to support bpf.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I10c3bf8a3d0a42f9c90eaa578f9f94157cac2151
Merged-In: I10c3bf8a3d0a42f9c90eaa578f9f94157cac2151
2021-01-20 01:26:40 +00:00
Adithya Srinivasan
455834608f Remove gpumemtracer bloat
The size of gpuservice regressed while adding perfetto trace functions
inside GpuMemTracer for unittests. This change fixes the regression by
moving readPackets into the unittest, thereby removing the need to
include some libraries in gpumemtracer.so

Bug: 175904796
Test: atest gpuservice_unittest:GpuMemTracerTest
Change-Id: Ifaafdbfb24f8c51712276ef7efd645ce43c987f4
Merged-In: Ifaafdbfb24f8c51712276ef7efd645ce43c987f4
2021-01-20 01:25:52 +00:00
Adithya Srinivasan
134332b616 Add unittests for GpuMemTracer
This change adds some unittests for the GpuMemTracer module to verify
that the producer indeed works.

Bug: 164194338
Test: atest gpuservice_unittest:GpuMemTracerTest
Change-Id: I9f570567310f23261b43c85ab8cdc3ede8717f09
Merged-In: I9f570567310f23261b43c85ab8cdc3ede8717f09
2021-01-20 01:24:32 +00:00
Steven Moreland
0c75f9c8f3 libbinder_ndk: ScopedAStatus description compat
When the nice platform API description isn't available, we can still
build something here.

Bug: 134795810
Test: N/A
Change-Id: I2b5eb8365c3b6f56e2ba967a21cf304909d147ff
2021-01-20 01:20:52 +00:00
Steven Moreland
a0b95c803d Merge "libbinder_ndk: AIBinder_*_lt, clarify" 2021-01-20 00:16:45 +00:00
Steven Moreland
5ec74efd5e libbinder_ndk: AIBinder_*_lt, clarify
For clarity (a reference to RefBase is omitted here since many of the
details in the platform documentation are irrelevant here, since they
are not exposed).

Bug: 177020658
Test: N/A
Change-Id: I5b33124422243c2eb2517bd5e5325010126a45f3
2021-01-19 20:51:14 +00:00
Robin Lee
cb8eb2be57 Merge "SurfaceFlinger: fix no small window displayed in PIP mode of DTVKIT [1/1]" 2021-01-19 18:38:04 +00:00
Steven Moreland
ff30b34cd2 Merge "libbinder - avoid pthread_cond_broadcast per call" 2021-01-19 17:40:23 +00:00
Steven Moreland
b86f892039 Merge "libbinder: setupPolling flushes commands" 2021-01-19 16:43:16 +00:00
Tianhua Sun
dcff00c8a8 SurfaceFlinger: fix no small window displayed in PIP mode of DTVKIT [1/1]
Bug:146758432
PD#SWPL-39338

Problem:
Dtvkit, no small window displayed in pip mode

Solution:
porting from I82d81ded
For surfaceview of tv sideband, there is no activeBuffer in bufferqueue.
ClientCompostion layer if above it need plug holes for this case.

Verify:
ohm

Change-Id: Id92c3856eb8eb5a14813336f723d30b7a17514b1
Signed-off-by: Tianhua Sun <tianhua.sun@amlogic.com>
2021-01-19 17:12:24 +08:00
Gavin Corkery
bc2b607a9c Make DumpstateListener onError method oneway
The other change in this topic allows the onError
DumpstateListener call to be made asynchronous,
meaning that a blocking binder call will no longer be
made out of system_server.

Bug: 147703592
Test: Manual. Take bugreport, ensure that the death recipient
      logic never triggers before the onError/onFinished callback.
Change-Id: Ibb74bf068c4b186f07e19bb076b4ddea69eda768
2021-01-18 18:44:59 +00:00
Treehugger Robot
38bf134fc5 Merge "Libbinder APIs are guarded" 2021-01-18 12:14:27 +00:00
Treehugger Robot
28a811cb29 Merge "Pass caller information in cancelBugreport." 2021-01-18 09:41:21 +00:00
Steven Moreland
c648a765dc libbinder - avoid pthread_cond_broadcast per call
Because it uses:
- 0.4% of system_server CPU time
- 1% of com.android.bluetooth
- 0.8% of com.android.phone

This call is used to implement
IPCThreadState::blockUntilThreadAvailable, but this API is actually only
used by WatchDog.java, and due to the locking we have in place here, we
have more information than pthread does internally to tell it when a
broadcast would actually be useful.

Future considerations: this API is actually broken in the case of poll
calls or if too many userspace threads manually call joinRpcThreadpool.
We could move the binder part of WatchDog.java into a separate process
and completely remove all of the associated infrastructure. An external
process could call pingBinder (or similar) on different services. This
would have the same effect, but it would use the existing path of
processing a transaction in order to detect deadlocks.

Bug: 168806193
Test: boot, manually check how often this gets called now (only when
    the binder threadpool is saturated when this is called, so at most
    once/30 seconds given WatchDog's current implementation)
Change-Id: I44f8ff0d8ca2cdf236a9fa3ad1e3a0241663bfcd
2021-01-16 02:39:45 +00:00
Hunter Knepshield
e30d82197d Pass caller information in cancelBugreport.
In preparation for a broader set of apps using BugreportManager, we
enforce that only the app which started a bugreport is allowed to cancel
it.

Bug: 161393541
Test: atest BugreportManagerTestCases
Test: manual with two apps triggering/cancelling BRs
Change-Id: I10bdc9ff2a5746e2dc1e7d63876219bb34fad3b9
Merged-In: I10bdc9ff2a5746e2dc1e7d63876219bb34fad3b9
(cherry picked from commit 00c2a7563c)
2021-01-15 17:38:05 -08:00
Steven Moreland
2f4b651fcb binderClearBufTest: remove unnecessary flush
This flushCommands call is no longer required.

Bug: 139697085
Test: ran test repeatedly for 10 minutes
Change-Id: I58fb7e55e6e8b90962377ef165ef5ba5fdcba20a
2021-01-16 01:09:25 +00:00
Treehugger Robot
63e04c852d Merge "Remove VrFlinger usages from SF." 2021-01-16 00:25:24 +00:00
Martijn Coenen
0442a8694d Flush BC_FREE_BUFFER and ref ops from non-looper threads.
BC_FREE_BUFFER and ref commands are normally just queued, and not
automatically flushed out to the kernel driver. This usually works fine,
because BC_FREE_BUFFER is typically called from a binder thread (which
flushes when calling back into the kernel), or a thread making regular
binder transactions itself.

But it can happen that a Parcel is destructed from a thread that meets
neither of those requirements; especially Parcels created from Java are
sensitive to this, because if they aren't immediately recycled, they
will instead be garbage collected, and in that case the BC_FREE_BUFFER
will be queued to the FinalizerDaemon thread, which otherwise never
makes or receives any binder calls.

To prevent these commands from getting stuck, flush BC_FREE_BUFFER and
refcount operations automatically from such threads.

Bug: 68604253
Bug: 139697085
Test: boots, binderLibTest
Change-Id: I98109a7046c122db22af0b15a268629284f06663
2021-01-15 23:48:51 +00:00
Steven Moreland
f210b50c00 libbinder: setupPolling flushes commands
Calling setupPolling and then handling polled commands has the effect
of never telling the kernel anything, and then then waiting for it to
get back to you. While this type of (non)communication may be common
among some humans, it should not be common among our processes.

So - the general requirement for a flushCommands call by every client of
this call is lifted.

Critically, also, this means that LL-NDK users of the setupPolling
command don't also need a flushCommand. This avoids an extra API. Sure,
it may be useful to have such a command, but whenever it is used in our
tree, it is mostly used as a hack. So, hopefully this delay in adding it
will instead encourage fixes in libbinder which help avoid people
needing to understand binder internals.

Bug: 139697085
Test: use with servicemanager and boot
Change-Id: I45d19bf6b58950f9d91dd6f7dcaa94b8061d3666
2021-01-15 23:46:41 +00:00