620 Commits

Author SHA1 Message Date
John Reck
f91696e2c3 Adjust base/native/android OWNERs
Test: N/A
Change-Id: Ieb263e6b57b5e4495d45e6c22ac1f97cb1ca7913
2022-02-09 10:11:56 -05:00
Lorenzo Colitti
2b9e8860ec Really expose the new NDK socket tagging functions added in T.
These functions were already exposed as part of libandroid_net,
but that is not really part of the NDK.

Expose them in libandroid as well, so apps can actually use them.
This is consistent with all the other native networking APIs,
which are exposed in both libandroid_net and libandroid.

Test: atest CtsNativeNetPlatformTestCases
Test: strings out/target/product/bramble/system/lib64/libandroid.so | grep android_tag
Change-Id: I2273cdd48b30a88b82eb3af838031d9fe8897442
2022-02-02 11:59:41 +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
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
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"
98aa7d4c88834987d5102f0137d206e921583ace

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