Commit Graph

337 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
Steven Moreland
8e6aa6679e reflect libbinder/am split
(manual cherry-pick from AOSP to fix merge conflict)

Minimizing cost for using libbinder.

Bug: 183654927
Test: boot
Change-Id: I1a4785a58afcaf2d312ef52a07f41fe3dd3a8fa6
2021-04-08 23:56:27 +00:00
Steven Moreland
da164b6f83 Merge "reflect libbinder/am split" 2021-04-08 21:03:27 +00:00
Orion Hodson
98aa7d4c88 Revert "Remove setFrame from surface_control setGeometry"
Revert "Remove setFrame from BufferStateLayer"

Revert "Update tests to reflect the new behavior for setGeometry"

Revert submission 13843937-sc_remove_set_frame

Reason for revert: Candidate CL for b/184807094
Reverted Changes:
Iffbd955a3:Remove setFrame
I27f17bc61:Update tests to reflect the new behavior for setGe...
I5720276c1:Remove setFrame from surface_control setGeometry
I32ee0e3e4:Remove setFrame from BufferStateLayer

Bug: 184807094
Change-Id: I7f6f0d7799e6e2858af2ce2e8acb5c67db8714f8
2021-04-08 12:30:21 +00:00
Chavi Weingarten
56fa22a105 Merge "Remove setFrame from surface_control setGeometry" into sc-dev 2021-04-07 18:56:42 +00:00
Treehugger Robot
793941de0f Merge "Add more OWNERS to more places" am: 0901b326ad am: 5aa92f6e27 am: 95a41d1fbb
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1661241

Change-Id: I79bf2deddd07930f51cc2222c90826234b540979
2021-04-06 15:27:10 +00:00
Steven Moreland
2b5acf1040 reflect libbinder/am split
Minimizing cost for using libbinder.

Bug: 183654927
Test: boot
Change-Id: I1a4785a58afcaf2d312ef52a07f41fe3dd3a8fa6
2021-04-05 23:19:26 +00:00
Rob Carr
782102ccd5 Merge "ASurfaceTransaction: Add setEnableBackpressure" into sc-dev 2021-04-02 19:03:09 +00:00
John Reck
342e22dcfb Add more OWNERS to more places
Test: this
Change-Id: Icd6e7fcd723ef2fdf0139344f2499c4ef5942a3c
2021-04-02 14:43:36 -04:00
Treehugger Robot
84747c0e77 Merge "Add OWNERS for some native files" am: 20f4b99166 am: a1f2daa160 am: 6a1ac7167f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1653187

Change-Id: I15960b12c734488f071bf460ba8e0da12464c061
2021-04-02 00:11:03 +00:00
Robert Carr
f57c0163f9 ASurfaceTransaction: Add setEnableBackpressure
Expose the backpressure flag to NDK. See comment in
header file for extensive discussion.

Bug: 177458703
Test: Need new CTS
Change-Id: I97cdaef5d499f57a270972f001517b8a520aa2fe
2021-04-01 19:41:40 +00:00
Marin Shalamanov
d15b4b5473 Merge "setFrameRate: Make shouldBeSeamless an enum" into sc-dev 2021-03-31 14:30:23 +00:00
chaviw
5bdebd04de Remove setFrame from surface_control setGeometry
Use setMatrix and setPosition instead

Test: SurfaceFlinger_tests
Test: ASurfaceControlTest
Bug: 170765639
Change-Id: I5720276c12f085d564c19849c356ab304326979e
2021-03-30 16:51:17 -05:00
Marin Shalamanov
511f9145ba setFrameRate: Make shouldBeSeamless an enum
Change the shouldBeSeamless parameter to an enum
in order to make the API easier to understand.

This changes
 - SurfaceControl.setFrameRate
 - Surface.setFrameRate
 - ANativeWindow_setFrameRateWithChangeStrategy
 - ASurfaceTransaction_setFrameRateWithChangeStrategy

Bug: 179116474
Test: atest SetFrameRateTest
Change-Id: I55265399238e2c95fbb90fd33a4c2513d1fc5cec
2021-03-24 21:34:04 +01:00
chaviw
bde7f2bc0a Add OWNERS for some native files
Test: N/A
Change-Id: I1cf995813f9ea11b31d13ac52132315f62f086ec
2021-03-24 14:31:50 -05:00
Vasiliy Telezhnikov
647da08b1d Merge "Split ASurfaceTransaction_setGeometry api" into sc-dev 2021-03-24 13:26:03 +00:00
Remi NGUYEN VAN
86ae725fb9 Add NDK API for getprocdns,setprocdns
The API allows callers to control the default network that is used for
DNS hostname resolution.

Test: atest CtsNetTestCases
      Tests in change I00143cafcd3eb1d71e8d5c7ea9c839a99dc6f4ce
Bug: 171540887
Change-Id: I42f0d9b17b3058f6e10fd2e651278b290f26667f
2021-03-23 11:21:21 +00:00
Remi NGUYEN VAN
3d50059bbc Add NDK API for getprocnetwork
The API is the getter couterpart for setprocnetwork.
Use it in NetworkUtils so that the NDK API can be the source of truth
for the process network.

Bug: 171540887
Test: atest CtsNetTestCases
      Tests in change I311b58585033c2ca50ce5477ea9cd94b6f127507
Change-Id: Ie8f68cf1fa57deddb63324c1abf3d6fd5b0ef500
2021-03-23 01:01:06 +00:00