Commit Graph

637 Commits

Author SHA1 Message Date
Rachel Lee
4832a69444 Merge changes from topic "achoreonanos"
* changes:
  Update hwui with renamed AChoreographer method.
  Update libandroid renamed AChoreographer methods.
2022-01-13 22:44:31 +00:00
Rachel Lee
545adcd1f7 Update libandroid renamed AChoreographer methods.
Test: atest ChoreographerNativeTest
Bug: 214303753
Change-Id: I32d9703c669b2408dddd199c678fca0564668142
2022-01-13 14:14:25 -08:00
Treehugger Robot
29795b0bf2 Merge "Add tagSocket/untagSocket NDK APIs" am: d992ee2925 am: 358573e8a3 am: cfdc49a491 am: 2a30ec9975
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1938795

Change-Id: If5f98e651be5b59753c15dd19fdedf2d67d034e5
2022-01-13 06:39:20 +00:00
Treehugger Robot
2a30ec9975 Merge "Add tagSocket/untagSocket NDK APIs" am: d992ee2925 am: 358573e8a3 am: cfdc49a491
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1938795

Change-Id: I1c005cbc1d888310e17c6105c0dd2457d4cc1c86
2022-01-13 06:24:56 +00:00
Treehugger Robot
cfdc49a491 Merge "Add tagSocket/untagSocket NDK APIs" am: d992ee2925 am: 358573e8a3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1938795

Change-Id: Id17914c8247e754e74c9434a6e6843b703ca2daf
2022-01-13 06:10:44 +00:00
Ken Chen
a4a35a92ea Add tagSocket/untagSocket NDK APIs
Provide native APIs to tag the various sockets used for network
transfer, which helps apps tracking down data usage inside their app.

We've had equivalent Java APIs since API level 14.
https://developer.android.com/reference/android/net/TrafficStats.html#tagSocket(java.net.Socket)
https://developer.android.com/reference/android/net/TrafficStats.html#untagSocket(java.net.Socket)

Given that these Java APIs are implemented in native side, providing
NDK APIs directly will be easier for native users to use it.

Bug: 29761778
Bug: 202086915
Test: Tests in change Ic6554d9b98cef9b41b7eae06315d284c574c0a45
Change-Id: I802ce62f82199ce087bf8feb03afb26de1ce526e
2022-01-12 23:21:17 +08:00
Robert Carr
df7c725586 DO NOT MERGE: Track SurfaceComposerClient changes
surfaceControlStats now includes the acquire count.

Bug: 197269223
Bug: 212846697
Test: Existing tests pass
Change-Id: I29f2e9ba1c100a831be5eddce2c2a442d136d98e
2022-01-02 21:55:41 +00:00
TreeHugger Robot
a1320c0a3a Merge "Pass JNIEnv explicitly into AInputQueue_fromJava" 2021-12-16 17:58:05 +00:00
Prabir Pradhan
d0c5dbabd5 Pass JNIEnv explicitly into AInputQueue_fromJava
Instead of assuming a JNIEnv*, the method should have the env passed
into it, which is the standard practice for native APIs.

Bug: 210727635
Test: atest InputQueueTest
Change-Id: Iae5fc5bd39c758c530185694751d6d79715ce31b
2021-12-16 03:37:20 -08:00
Rachel Lee
7834d38d95 Merge changes from topic "surfacectrl"
* changes:
  Pass start time from HWUI canvas context.
  Implement timeline in libandroid ASurfaceControl.
2021-12-15 20:02:30 +00:00
Rachel Lee
e1e77cca8a Implement timeline in libandroid ASurfaceControl.
As part of choreographer project.

Bug: 198192003
Test: atest ASurfaceControlTest
Change-Id: I36fdeae1d2bc07fdbd487fc0a40324fe48baca09
2021-12-09 16:04:06 -08:00
John Reck
7f55b13182 Reduce SurfaceControl feature gap to NDK API
Bug: 200697201
Test: atest android.view.cts.SurfaceControlTest

Change-Id: I1d0cff355714acb5668952b3d7f6fc0c15952523
2021-12-09 17:15:11 -05:00
Xin Li
10d9972786 Merge sc-qpr1-dev-plus-aosp-without-vendor@7810918
Bug: 205056467
Merged-In: I13199bc39e9445929195f3d15579cbffe94e92b0
Change-Id: I35fa3c6c2abf679c51033f1395a08d511ed8739f
2021-11-18 17:00:37 +00:00
Jim Blackler
86df7e4214 Give access to the native InputQueue to all native applications.
Bug: 116830907
Test: atest android.view.cts.InputQueueTest#testNativeInputQueue
Change-Id: Ia7741ac4922afeeca334266caef3331b521f87e4
2021-11-01 13:22:27 +00:00
Chavi Weingarten
e55fbe4ea9 Merge "Update setBuffer to use the new setBuffer API" 2021-10-01 17:43:00 +00:00
Rachel Lee
6350ff0b3b Choreographer: new libandroid for CTS.
Bug: 198191651
Test: make, atest ChoreographerNativeTest
Change-Id: I5fd1bbefc77b45ec953e06b0ed5da8521dc08732
2021-09-27 13:25:12 -07:00
chaviw
5513c615e7 Update setBuffer to use the new setBuffer API
Transaction.setAcquireFence is removed and instead the fence can be sent
directly in the setBuffer call.

Test: Chrome works
Fixes: 200065015
Change-Id: I248f07d7ce5a3faa0d7482fe4e0e7b33f3cfea55
2021-09-15 15:26:23 -05:00
Torne (Richard Coles)
ddd332f72b webview: make relro load failure a warning.
Failing to open the relro file when loading WebView isn't a major
problem (we can still load the library, it just loses a RAM
optimization), and can happen in some edge cases like when the current
address space reservation was not large enough to create the file.

The other messages logged from Java about this are at warning level;
make this native error also a warning. The other errors in this function
are entirely unexpected conditions, so leave them as errors.

Fixes: 197972345
Test: n/a
Change-Id: Iaf0d4a3b6e42ba93ef6782b5b9120cd69cae3002
2021-09-14 14:23:24 -04:00
Pablo Gamito
14b28ce9ce Get rid of unused ASurfaceControl in frame metrics listener callback
Test: Existing tests
Change-Id: Ia071814dabfc762d00d3324bfaa343ff94ab8338
2021-09-07 16:47:25 +00:00
Pablo Gamito
bc9e529031 Pass surface control id to callback to accurately identify surface metrics belongs to
Avoid getting the wrong frame info when duplicate frame numbers are found in the ring buffer. Will ensure there isn't a mismatch in the metrics data reported.

Test: Existing tests
Bug: 197515602
Change-Id: Iff9ba01f575f94e5a9872ee48c0dd1e5067880c3
2021-09-06 17:23:39 +00:00
Pablo Gamito
88660d77da Stop reporting frame stats from frames completed before observer was attached
Test: Run app from bug report
Fixes: 195699687
Change-Id: If80825dfb41467917b7b9b1e8c9ead1a0dcbffae
2021-08-31 10:33:28 +00:00
Bo Liu
d6a096006a ADPF: Handle preferred interval on unsupported device
The original java implementation just passed along whatever the server
returns which is -1 on unsupported devices. So do that here as well.

Test: PerformanceHintManagerTest passes on unsupported device
Bug: 194691581
Change-Id: I8ac07737e6ce52debf55478880d71f038f258056
2021-07-26 14:49:54 -04:00
Bo Liu
4426772eab Implement native PerformanceHint API
Test: atest PerformanceHintNativeTestCases
Bug: 194204196
Change-Id: Ie26e25e9ecf87046df92346dff54174934a8c73e
2021-07-22 11:31:49 -04:00
Bo Liu
fe71933655 Null check color_space_ptr in draw functor v2
Missed toXYZD50 usage last time. Still assume sRGB if null.

Bug: 187798471
Test: Manually tested setting color_space_ptr to null in
      GL/VKFunctorDrawable
Change-Id: Idee2660d368dd55e45f5d07d52839105ba951ff3
2021-07-19 10:16:05 -04:00
Bo Liu
f267de7625 Null check color_space_ptr in draw functor
Assume sRGB if null.

Bug: 187798471
Test: Checked webview still starts up and draws.
Change-Id: Idf8c8291bde0ce0624085afd143096c357246672
2021-07-15 20:46:26 -04:00
John Reck
2b2ba935f8 Remove isDataspaceValid
isDataspaceValid is problematic in that it prevents
applications from being able to pass-through dataspaces
they receive from other APIs, and it also assumes that
the display's capabilities are the only things that are supported.

Although it's recommended that applications stick to dataspaces
that the display can handle, it's not strictly required. RenderEngine
can handle more dataspaces than the display can, applying appropriate
color conversion. Similarly this could be going to a virtual display
instead, in which case the physical display's capabilities are not
necessarily relevant.

Bug: 149931223
Test: make
Change-Id: I475f4e4dcbcdb4765670f6a8eb4cc047a9babb43
2021-07-12 21:53:35 -04:00
John Reck
faa1b0ab2a Have HWUI validate the WebViewFunctors at registration
Also tweak how webview's plat_support creates the functor
sruct to be thread-safe, avoids any potential race conditions
even though WebView itself is stated to be thread-hostile in
general. It's too easy to have this just be defined-safe instead.

Bug: 186814981
Test: build & boot, no crashes in real-webview apps
Change-Id: I06f02a279e248fee375ce133c5ce9a2250665ad9
2021-05-13 17:17:21 -04:00
Vishnu Nair
6438998d64 Merge "Remove rotation based scaling" into sc-dev 2021-05-12 00:24:59 +00:00
Vishnu Nair
0d7aff7b35 Remove rotation based scaling
In order to simplify some of the geometry logic in BufferStateLayer,
and unify with the rest of the layer in SurfaceFlinger we translate the
concept of source and dest frame into crop, scale and position. This is
currently done on the client side.

But if there is buffer rotation transform, we will generate an
additional scale, to scale the buffer size to the new orientation. This
causes issues with rounded corners because the additional scale
stretches the rounded corner incorrectly. And translating the buffer
rotation into a rotation matrix affects child layers.

This solution only adjusts the buffer size based on the rotation
matrix and the scale is generated based on the rotated buffer.
This cannot be done in the client side because we do not have
the current display orientation to unflip the buffer if the client
sets the transformToDisplayInverse flag.

In the future the plan is to drive the transform hint and the
display orientation down from WM so this calculation can go
back to the client.

Also fixes incorrect additional scaling from source frame to dest frame
in ASurfaceTransaction_setGeometry.

Test: atest SurfaceControlTest ASurfaceControlTest libgui_test SurfaceFlinger_test
Test: go/wm-smoke
Bug: 185597146
Change-Id: I38adbc72c7567510c953cfd362a94b2b38d7fda7
2021-05-11 10:55:24 -07:00
Seigo Nonaka
de1e019d56 Update usage of FontCollection interfaces.
Bug: 187358499
Test: m
Change-Id: I2b1f001b3ebf7c297dae422c730d7052894e4394
2021-05-10 00:38:17 -07:00
Rob Carr
b71cd0f51e Merge "ANativeWindow_fromSurface: Use acquire not incStrong" into sc-dev 2021-05-06 18:44:36 +00:00
Leon Scroggins
ee8da6bdbf Merge "AImageDecoder: return BAD_PARAMETER on null info" into sc-dev 2021-05-06 15:51:52 +00:00
Robert Carr
86b378b810 ANativeWindow_fromSurface: Use acquire not incStrong
When we call incStrong like this, it won't work if the
caller of ANativeWindow_fromSurface later calls
ANativeWindow_release and so we leak the reference indefinitely.
We change to call acquire so that the caller can call release.

Bug: 186190571
Test: Existing tests pass
Change-Id: I647a856923c891da2d305471f5ff84103d1f9ed5
2021-05-05 15:51:35 -07:00
Leon Scroggins III
6116e5c0d8 AImageDecoder: return BAD_PARAMETER on null info
Bug: 186656488
Test: I4dc406e85709dda14af8b414e2da3d39bb07643b
Change-Id: Ibd7c1c3d1319818e86ac29bdc231e0e05cec2132
2021-05-03 11:34:34 -04:00
chaviw
87a07ea39d Restore old behavior in pulic API setGeometry
When setFrame was removed, it required some changes to setGeometry.
However, this created some behavior changes between R and S. Modified
setGeometry to restore old behavior.

1. Destination can't have negative left and top. If negative values are
set, it will revert to (0,0,w,h)
2. If invalid source is set, an invalid rect for crop will be sent to SF
which would normally mean crop is ignored.

Test: ASurfaceControlTest
Bug: 185533162
Change-Id: I5c86da7327f97e82c63ae1f1c985829b8a4dbaef
2021-04-29 10:41:01 -05:00
chaviw
9b2ac24f09 Added setBufferCrop to setGeometry
The crop being sent to SF is in layer space where the setGeometry API is
getting buffer space crop. This breaks the API behavior so call
setBufferCrop instead of setCrop

Test: ASurfaceControlTest
Fixes: 186266903

Change-Id: I8f2567aa41b9525c3c3dc08855d14d8a9b11c7e2
2021-04-27 16:47:45 -05:00
Leon Scroggins
bc4e5c6c66 Merge "AImageDecoder: only support animation for F16 and 8888 (impl)" into sc-dev 2021-04-27 19:22:23 +00:00
Colin Cross
875493dc1a Merge "Replace llndk_library with llndk clause in cc_library" am: 9e9d7bd0bc am: f9abc183b4 am: 5bc3c6ad47
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1684529

Change-Id: I78a0a42bdcec3338ec8f204c1a6a08158529995f
2021-04-27 02:25:02 +00:00
Leon Scroggins III
df33b95e68 AImageDecoder: only support animation for F16 and 8888 (impl)
Bug: 180594747
Test: I51dedd94aa8ff5d6846cada96861ffca30d509d7

See I03818703dc79942be4e574db31c6e2927ab571ed

Change-Id: Ibce55e4af38713d2e40fcb8846d9d7a939367fd6
2021-04-26 15:35:56 -04:00
Colin Cross
4ff7d4e678 Replace llndk_library with llndk clause in cc_library
Remove the vestigial llndk_library and replace it with properties
in the llndk clause of the implementation cc_library.

Bug: 170784825
Test: m checkbuild
Test: compare out/soong/build.ninja
Change-Id: I960d7592fc71482e547f3617d0e55503c36cb63a
2021-04-23 05:51:31 +00:00
Colin Cross
186a6edd47 bpfmt native/android/Android.bp
Fix formatting errors in with bpfmt -w native/android/Android.bp.

Test: builds
Change-Id: I444579e5672b3bc421f7e73f27bb0d12d92a9a03
Merged-In: I444579e5672b3bc421f7e73f27bb0d12d92a9a03
2021-04-23 05:50:40 +00:00
TreeHugger Robot
8af1716cc5 Merge "bpfmt native/android/Android.bp" into sc-dev 2021-04-23 04:51:12 +00:00
Colin Cross
b16eb69e6d bpfmt native/android/Android.bp
Fix formatting errors in with bpfmt -w native/android/Android.bp.

Bug: 170784825
Test: builds
Change-Id: I444579e5672b3bc421f7e73f27bb0d12d92a9a03
2021-04-23 01:26:14 +00:00
Vishnu Nair
beb3b482db Introduce ASurfaceTransaction_setOnCommit api
Introduce a new callback for SurfaceControl transactions that
fire after we commit a transaction in SurfaceFlinger. This
will help some clients pace when they should apply the next
transaction so it get applied on the next vsync. If they wait for
the existing transaction complete callback, there may not be
enough time between when the client applies the transaction
and surface flinger waking up and apply it on the new vsync.
This would mean the update would arrive a frame late.

Bug: 185843251
Test: atest ASurfaceControlTest
Change-Id: If0d5d01a1d5c2029eb81667356e666d7297376d4
2021-04-21 15:06:19 -07:00
Chavi Weingarten
0885db1f95 Merge "Updated native SurfaceControl APIs to reflect their behavior." into sc-dev 2021-04-20 16:38:11 +00:00
Seigo Nonaka
b950a1f746 Update native font API to read updated font files.
Bug: 184974821
Test: atest NativeSystemFontTest
Change-Id: Ia7fdf6155e07445d7f16edb88fd2a7293e63080c
2021-04-15 11:03:37 -07:00
chaviw
ccf3e8b9f9 Updated native SurfaceControl APIs to reflect their behavior.
Updated setPosition, setCrop, setBufferTransform, and added setScale
to native SurfaceControl API. The new functions should be pass through
calls to SurfaceComposerClient that sends it to SurfaceFlinger.

Test: ASurfaceControlTest
Bug: 170765639
Change-Id: I214c5ae998d8f896200f3010cf2de6754d1e8510
2021-04-14 16:40:33 -05:00
Chavi Weingarten
a6d011d092 Merge "Revert^2 "Remove setFrame from surface_control setGeometry"" into sc-dev 2021-04-12 13:51:01 +00:00
Chavi Weingarten
305ec1d5c8 Revert^2 "Remove setFrame from surface_control setGeometry"
98aa7d4c88

Change-Id: I9172fac77048f548e1adacdc0041dc52a25eac0d
2021-04-09 13:37:33 +00:00
Orion Hodson
397cb14bd3 Merge "Revert "Remove setFrame from surface_control setGeometry"" into sc-dev 2021-04-09 07:34:01 +00:00