Commit Graph

470 Commits

Author SHA1 Message Date
TreeHugger Robot
a4a8be3748 Merge "AImageDecoder: ensure that stride is pixel aligned" 2020-01-27 16:06:27 +00:00
Steven Thomas
8c9f31b8b0 Merge "Add setFrameRate() api" 2020-01-23 19:40:20 +00:00
TreeHugger Robot
795168a1b8 Merge "Update imagedecoder for header updates" 2020-01-23 18:58:16 +00:00
Leon Scroggins III
64301cbed1 Update imagedecoder for header updates
Bug: 135133301
Test: Ibf7c0e563feeb08ce6dbabb5e86ddb385c9dff54

Remove isAnimated and update parameters/returns to match
I93df851dd9fee2eb8d097e2158fb95003a0474db.

Change-Id: Ida2af1682b5f9b91e37079005391b1594239d345
2020-01-23 09:47:47 -05:00
Leon Scroggins
e609b0c82a Merge "Make getDataSpace fail instead of crash on recycled" 2020-01-22 23:04:23 +00:00
Steven Thomas
6cf051ef89 Add setFrameRate() api
setFrameRate() is a new api in Android 11 that will enable apps to
specify their intended frame rate.

Bug: 143912624
Bug: 137287430

Test: Added a new CTS test - android.graphics.cts.SetFrameRateTest.

Change-Id: I922573c0d704e2e0ce4cfc2a462f14dce8cb7a79
2020-01-22 13:20:42 -08:00
Leon Scroggins III
7871f4953a Rename AndroidBitmap_compress callback
Bug: 135133301
Test: No change in behavior, no new tests

Along with Id5d039761054cf8e7fb906624a277714c21156de, which does the
rename in the header, this does the rename in the impl.

Change-Id: I27244df241a8141b0fd39e02e778eef2975f4dc0
2020-01-22 15:18:36 -05:00
Leon Scroggins
569229f0bb Merge "Implement AImageDecoder dataspace methods" 2020-01-22 19:39:06 +00:00
Leon Scroggins
69bfed8d60 Merge "Update NDK methods for HARDWARE Bitmaps" 2020-01-22 19:37:36 +00:00
Leon Scroggins
d50c7697a6 Merge "Implement AImageDecoder_computeSampledSize" 2020-01-22 19:33:01 +00:00
Leon Scroggins III
d894c59881 AImageDecoder: ensure that stride is pixel aligned
Bug: 147749998
Test: I902de3410c45a21cf27b48a02cdc5d514b7ada60

If the client uses a stride that is not pixel aligned, AImageDecoder
will crash internally trying to access the memory. Return a failure
instead of crashing. Rely on SkImageInfo to compute the minimum size
required, too.

Change-Id: Ia4d14d6209e6f4af74906ff43208fa83ac82cbcd
2020-01-22 14:18:12 -05:00
Leon Scroggins III
e5ace3f9cb Implement AImageDecoder dataspace methods
Bug: 135133301
Test: Iffe659e50078139188c3325545624640ae177cc2

Implement AImageDecoderHeaderInfo_getDataSpace, which reports the
default ADataSpace to decode to. It may report ADATASPACE_UNKNOWN, which
means that we've mostly left the colors in their original color profile.
This matches android.graphics.ImageDecoder/BitmapFactory, which would
use a ColorSpace named "Unknown". (It will standardize on DISPLAY_P3 for
some profiles, which again matches the Java classes.)

Implement AImageDecoder_setDataSpace, which allows specifying the
ADataSpace to decode to. It only supports explicit ADataSpaces.

Change-Id: Iba2f9e09531c23fae83ebe13cb9d18394ee3cd59
2020-01-21 13:27:58 -05:00
TreeHugger Robot
712d610d05 Merge "Refactor TextureLayer JNI to use only APEX APIs" 2020-01-21 18:18:21 +00:00
Leon Scroggins III
f8e41c5fc2 Make getDataSpace fail instead of crash on recycled
Bug: 135133301
Test: I32e9a257a63382629b25f64d1d0abe9682ddec70

Make sure the Bitmap is valid before trying to read its data space.

Change-Id: I0d075197ddc548143a4e4845cc5cc5d3b10d87c7
2020-01-21 11:51:09 -05:00
Leon Scroggins III
84a2afcbfb Update NDK methods for HARDWARE Bitmaps
Bug: 135133301
Test: I2c1e58c41e49c72fb4bdbc64989da103885d34bf

_getInfo now sets a bit in AndroidBitmapInfo.flags to indicate whether
the Bitmap has Config.HARDWARE.

For a HARDWARE Bitmap, its AHardwareBuffer can now be retrieved with
AndroidBitmap_getHardwareBuffer. Call AHardwareBuffer_acquire on the
buffer so it will not be deleted while the client is using it.

Change-Id: I9240c1928c1478053ecf7c252443a33dbd6fd6db
2020-01-21 11:51:03 -05:00
Leon Scroggins III
f89de63304 Implement AImageDecoder_computeSampledSize
Bug: 135133301
Test: If9ed79d8dcf1169369ba454723f4ac8d26427b7b
Change-Id: I4926188cf66e2693c09dd7f1197173441936080c
2020-01-19 21:22:18 -05:00
Leon Scroggins
83d7f05c66 Merge "Update AImageDecoder_getAlphaFlags return value" 2020-01-18 14:07:55 +00:00
Stan Iliev
5af5d3077f Refactor TextureLayer JNI to use only APEX APIs
Move ASurfaceTexture JNI implementation from libandroid to
libnativedisplay.
TextureLayer uses ASurfaceTexture_fromSurfaceTexture from
libnativedisplay instead of libandroid_runtime code.
libgui is no longer leaked through surface_texture_platform.h.
DeferredLayerUpdater uses ASurfaceTexture_release instead of
private ASurfaceTexture dtor.

Test: pass CtsUiRenderingTestCases and CtsViewTestCases
Bug: 147060713
Exempt-From-Owner-Approval: Changed only a header path in android_hardware_camera2_legacy_LegacyCameraDevice.cpp
Change-Id: I9720d9c383f8120f9db116fd2b74fc241af84396
2020-01-17 20:09:19 +00:00
TreeHugger Robot
c3d20c1935 Merge "Implement native compress API" 2020-01-17 19:23:46 +00:00
Leon Scroggins III
9010e8ba91 Implement native compress API
Bug: 135133301
Test: Ifbcb41388a48afc64bb22623bb7e981b288b2457

Refactor the bulk of Bitmap_compress into hwui/Bitmap::compress, so that
it can be shared by the new API. Update its enum to match the proper
style. Also make the enum a class so it does not need to have a special
return value for a bad parameter, which is now handled by the caller.

Add ABitmap_compress, which implements the new API by calling
hwui/Bitmap::compress.

Change-Id: Ia8ba4c17b517a05b664c6e317e235836473fd7f6
2020-01-16 22:21:10 +00:00
Leon Scroggins III
1ade46d272 Replace setAlphaFlags with setUnpremultipliedRequired
Bug: 135133301
Test: I48e49ee08ab1954eddf62ecae87942aeb128c10d

As described in I3381582e27894e1072db9b8635f3762b801f5d69, this is a
more sensible API.

In addition, remove unused methods on ImageDecoder.

Lastly, update AImageDecoder methods in the map to document which API
level they were introduced in.

Change-Id: I1aff544e8d6932b9ed0931a00da66a0aba6cd536
2020-01-16 12:17:56 -05:00
Leon Scroggins III
d8840bd9f0 Update AImageDecoder_getAlphaFlags return value
Bug: 135133301
Test: I2ea58bede5cf49a7947c96e7e6e37f967632ad6b

BAD_PARAMETER is a more sensible value than -1. The other return will
not be reached, but the code is clearer.

Change-Id: I4bee8f238f61a6c6cd13b5458f201f34d34315d9
2020-01-15 04:09:48 -05:00
TreeHugger Robot
1202d7ca24 Merge "Reland "Implement AndroidBitmap_getDataSpace"" 2020-01-14 22:30:17 +00:00
Leon Scroggins III
1994fcb2a0 Reland "Implement AndroidBitmap_getDataSpace"
Originally reviewed in Ie05a45da32b2fd670abdae35626cd6548cfb102c
(and reverted in I0b06312f6583f766512cc771a35d3d735debcce1)

Bug: 135133301
Test: I7a5fcb726fba0c832bbb86a424d7534a7cfa35b6

This supplements AndroidBitmap_getInfo, allowing NDK clients to know how
to interpret the colors in an android.graphics.Bitmap.

Only build android_bitmap.cpp on Android so that it can rely on
libnativewindow (which is Android-only) for data_space.h

Change-Id: I4b23c68c7e62ed733e95af6f76c47fecbc2c5747
2020-01-13 08:44:00 -05:00
Leon Scroggins
5c127940b5 Merge changes from topic "ndk_imagedecoder"
* changes:
  Implement new NDK image decoding apis
  Create AAssetStreamAdaptor, for reading from AAssets
2020-01-12 21:26:22 +00:00
Kweku Adams
d3ce139cb3 Merge "Revert "Implement AndroidBitmap_getDataSpace"" 2020-01-10 17:43:13 +00:00
Kweku Adams
10b2ddc1d2 Revert "Implement AndroidBitmap_getDataSpace"
Revert "Add AndroidBitmap_getDataSpace"

Revert "Test AndroidBitmap_getDataSpace"

Revert submission 9940762-_getDataSpace

Reason for revert: Breaks build: http://screen/kBMYHusKiOV.png
Reverted Changes:
Ie05a45da3: Implement AndroidBitmap_getDataSpace
I7a5fcb726: Test AndroidBitmap_getDataSpace
Ia46dfb39d: Add AndroidBitmap_getDataSpace

Change-Id: I0b06312f6583f766512cc771a35d3d735debcce1
2020-01-10 17:25:33 +00:00
Leon Scroggins
392b4e0f0b Merge "Implement AndroidBitmap_getDataSpace" 2020-01-10 16:02:37 +00:00
Leon Scroggins III
407b544925 Implement new NDK image decoding apis
Bug: 135133301
Test: Ib84462ea5fa8a7779eaa44494775e182e52ecaca

Separate out the code for encodedFormatToString into a piece which
returns a const char* that can be used by AImageDecoder (with its own
header) and the part that the JNI code uses to convert that into a Java
String.

Change-Id: I4cf8bfb0aacfb8e22c3f9b1689bd614ed1253673
2020-01-10 09:27:38 -05:00
Automerger Merge Worker
b0ec4f6bde Merge "Add AConfiguration_getScreenRound." am: c44bffa46a am: 7a93b588c0 am: 42c621eea9
Change-Id: Id7632e38f4d49cdfd50d8c745dd232ba486d74fd
2019-12-20 02:33:05 +00:00
Elliott Hughes
241393a30b Add AConfiguration_getScreenRound.
This was actually added in M, but because it wasn't in the version map
(and there's no CTS test) it's not actually reliably available until
next year...

Bug: https://issuetracker.google.com/146458518
Change-Id: I5eed970118b627c7e74800f04751a07ce64d86da
2019-12-18 14:30:46 -08:00
Leon Scroggins III
9732e29bce Create AAssetStreamAdaptor, for reading from AAssets
Bug: 135133301
Test: Ib84462ea5fa8a7779eaa44494775e182e52ecaca, once
      I4cf8bfb0aacfb8e22c3f9b1689bd614ed1253673 lands

AAssetStreamAdaptor lives in libjnigraphics, for use by AImageDecoder.

Change-Id: I4e2559c3c21c866d61fb431a0a1368150c7d39cb
2019-12-18 12:05:19 -05:00
Leon Scroggins III
9065a5fc42 Implement AndroidBitmap_getDataSpace
Bug: 135133301
Test: I7a5fcb726fba0c832bbb86a424d7534a7cfa35b6

This supplements AndroidBitmap_getInfo, allowing NDK clients to know how
to interpret the colors in an android.graphics.Bitmap.

Depends on I8e06071060ab19b103900ff04d60f1c3d3fccda9

Change-Id: Ie05a45da32b2fd670abdae35626cd6548cfb102c
2019-12-18 10:57:14 -05:00
Derek Sollenberger
6c41ab13d0 Consolidate NDK and APEX implementations
the NDK APIs are implemented in terms of the APEX APIs to
reduce the number of different implementations serving the
same fundamental purpose.

Bug: 137655431
Test: CtsGraphicsTestCases
Change-Id: Idc7b85403a7e546843b9c1d822acc0a1e740059a
2019-11-21 12:49:20 -05:00
Alec Mouri
2ae4572e6a Merge "[AChoreographer] Consolidate AChoreographer source files" 2019-11-14 19:00:45 +00:00
Jiyong Park
d0c8d9bd22 Rename # vndk tag to # llndk
The APIs that are tagged with # vndk are actually for LLNDK libraries.
Although LLNDK is part of VNDK, calling those APIs 'vndk' has given
users a wrong perception that the APIs don't need to be kept stable
because that's the norm for most of the VNDK libraries that are not
LLNDK.

In order to eliminate the misunderstanding, rename the tag to 'llndk' so
that people introducing new such API will realize what they are signing
themselves up for.

Exempt-From-Owner-Approval: cherry-pick from internal gerrit

Bug: 143765505
Test: m
Merged-In: I7ae77e232ec25cbe7afd98d1b68fc7a7fcf9bdfd
(cherry picked from commit a9258ab2e1)
Change-Id: I7ae77e232ec25cbe7afd98d1b68fc7a7fcf9bdfd
2019-11-13 05:51:59 +00:00
TreeHugger Robot
224bccea58 Merge "Rename # vndk tag to # llndk" 2019-11-13 00:31:32 +00:00
Alec Mouri
440c5ac251 [AChoreographer] Consolidate AChoreographer source files
Now that AChroeographer is defined in libnativedisplay, libandroid
should not need its own copy. Instead what we do is:
* Statically link libnativedisplay into libandroid
* Delete choreographer.cpp

This structure is the same as that of ANativeWindow.

Bug: 136262896
Test: builds
Change-Id: I159d69398bb33ccd7b01aae798d14c04438355c1
2019-11-11 15:38:02 -08:00
Stan Iliev
aaa9e834d4 Decouple SurfaceTexture from HWUI
Remove all Skia and HWUI types from SurfaceTexture
implementation.
Move SurfaceTexture to libgui (ag/9578265).
Define private C++ API for SurfaceTexture, which is consumed
by DeferredLayerUpdater.
Move AutoBackendTextureRelease/Skia code from SurfaceTexture
to HWUI.

Test: pass CtsUiRenderingTestCases and CtsViewTestCases
Bug: 136263580
Change-Id: I3f971bb490f64a3ac0b2a66a89ba935bf7f08213
2019-11-08 15:37:17 +00:00
Jiyong Park
a9258ab2e1 Rename # vndk tag to # llndk
The APIs that are tagged with # vndk are actually for LLNDK libraries.
Although LLNDK is part of VNDK, calling those APIs 'vndk' has given
users a wrong perception that the APIs don't need to be kept stable
because that's the norm for most of the VNDK libraries that are not
LLNDK.

In order to eliminate the misunderstanding, rename the tag to 'llndk' so
that people introducing new such API will realize what they are signing
themselves up for.

Bug: 143765505
Test: m
Change-Id: I7ae77e232ec25cbe7afd98d1b68fc7a7fcf9bdfd
2019-11-08 11:23:19 +09:00
Seigo Nonaka
01709c7469 Make AFont_getLocale work
There are multiple problems here:
- Java Font.equals and hashCode doesn't look at locale list. Due to this
issue, the CTS tests have been passing unexpectedly.
- The null pointer check in the AFont_getLoacle was inversed. Should
return only when it is non-null.
- Looks like we cannot get the parent's attribute which always returns
null. Instead, read the "lang" attribute when we read the family tag.

Bug: 139201432
Test: atest NativeSystemFontTest
Test: atest TypefaceEqualsTest
Change-Id: I0514847bbf46a73358afab374ccfce2db09b2ec0
2019-10-29 19:53:35 +00:00
atrost
5076854633 Add userId to the package name API.
The service would query package manager with the provided userId, and
will return true if the package is not visible.

Test: locally, b/143129258
Change-Id: Iab8ddaa76358d5fad63e10d7c4c3f92e2a0f51a2
Merged-In: I92ea650b49743c388bff9943a7ec620e3d61a5d6
2019-10-22 21:10:53 +01:00
TreeHugger Robot
69a5323a46 Merge "Add userId to the package name API." 2019-10-22 19:57:55 +00:00
atrost
ff948d8a2f Add a native aidl API.
Introduce a platform_compat_native service that just calls the
platform_compat service.
The new service is needed as it needs a slightly different (more
limited, no ApplicationInfo in cpp) aidl API, and a class can only
extend one stub.

Test: Call the service from dumpsys.cpp (http://aosp/1142055)
Bug: 138275545
Change-Id: Ic46cc34b4c1dd4ebc6bcc996fb3f8503607214ac
Merged-In: Ic46cc34b4c1dd4ebc6bcc996fb3f8503607214ac
2019-10-22 18:54:13 +00:00
atrost
53bca9377d Add userId to the package name API.
The service would query package manager with the provided userId, and
will return true if the package is not visible.

Bug: 142942524
Bug: 143129258
Test: m, treehugger
Change-Id: I92ea650b49743c388bff9943a7ec620e3d61a5d6
2019-10-22 18:57:08 +01:00
Valerie Hau
d4dac416ae Merge "Adding transformHint to callbacks" 2019-10-22 16:13:59 +00:00
Valerie Hau
ec453e1423 Adding transformHint to callbacks
Bug: 141939598, 133512804
Test: build, boot, manual
Change-Id: I58411368e5187b3a23eb9e8ac9abbf1cb1a5d97e
2019-10-21 14:43:28 -07:00
atrost
874883536a Add a native aidl API.
Introduce a platform_compat_native service that just calls the
platform_compat service.
The new service is needed as it needs a slightly different (more
limited, no ApplicationInfo in cpp) aidl API, and a class can only
extend one stub.

Test: Call the service from dumpsys.cpp (http://aosp/1142055)
Bug: 138275545
Change-Id: Ic46cc34b4c1dd4ebc6bcc996fb3f8503607214ac
2019-10-17 11:53:47 +01:00
Valerie Hau
5e18c43fa7 Do not crash on invalid dataspace
Prior logic caused device to crash when setting the dataspace for a
layer to hdr on a non-hdr device.  Update to log the failure and perform
a no-op to match framework APIs.

Bug: 140029823
Test: build, boot, CtsViewTestCases:android.view.cts.ASurfaceControlTest
Change-Id: I9baf88a6d787e043b440ad4c2ebeb4c7a1fd90a2
2019-08-26 14:23:52 -07:00
Vishnu Nair
1ad69541a4 Handle NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY flag in ASurfaceTransaction
BufferStateLayer ignores NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY flag if its set as part of
the transform.

Fix this by calling Transaction::setTransformToDisplayInverse when calling
ASurfaceTransaction_setGeometry.

Bug: 133330435
Test: Test landscape orientation in test app
Test: go/wm-smoke
Change-Id: Id499448d822425e5b7be4efed7f448c4e4378b87
2019-05-23 09:09:09 +00:00