Commit Graph

3988 Commits

Author SHA1 Message Date
Derek Sollenberger
f8d4a6684c Fix mmap errors when reading font files via the AssetManager.
Previous attempts to do this ignored the offset that the
AssetFileDescriptor may have.

Bug: 149927583
Test: CtsTextTestCases and androidx.appcompat.widget.AppCompatTextViewTest
Change-Id: Idcc8cb83a7f265cfa12707b7ce643b35f7f72352
2020-02-27 15:12:43 -05:00
TreeHugger Robot
781185099b Merge "Do not attempt to special case uncompressed font assets." 2020-02-21 22:35:55 +00:00
Derek Sollenberger
dd03a8ef81 Do not attempt to special case uncompressed font assets.
The logic to attempt to directly mmap uncompressed font assets
has resulted in breakages for some applications and utilities.
This CL disables this speculative optimzation until we can determine
the problem with this approach and if such an optimization is required.

Bug: 149780695
Test: CtsTextTestCases and androidx.appcompat.widget.AppCompatTextViewTest
Change-Id: I3b10a801a5600aefe8573fab1b28cd79c848c892
2020-02-21 15:28:52 -05:00
Derek Sollenberger
76e7430bae Merge changes from topic "HWUI_JNI"
* changes:
  Export symbols for the newly exposed APEX/internal headers
  Remove dependence on libandroid_runtime from Bitmap.cpp
  Update Region.cpp to use AParcel NDK APIs
  Cleanup header and build targets for libhwui clients.
  Remove dependencies on headers outside UI module
  Cleanup LOG_TAG when bundled in HWUI
  Move android.graphics JNI & APEX files into HWUI
2020-02-21 11:43:02 +00:00
Derek Sollenberger
42c50042d1 Remove dependence on libandroid_runtime from Bitmap.cpp
The end goal is to have Bitmap.cpp use AParcel, but until that
API is extended to support this use case this is an alternative
way to isolate the graphics files from the libandroid_runtime.

Test: CtsGraphicsTestCases
Bug: 145227478
Change-Id: Ie3854fe03dec4f7b1b485295bb9a5ebba52ddb7c
2020-02-20 21:50:06 -05:00
Leon Scroggins
251888e9eb Merge "Add details regarding setConvexPath deprecation" 2020-02-20 20:00:38 +00:00
Leon Scroggins III
076bbe1ceb Add details regarding setConvexPath deprecation
Bug: 149857968
Test: make docs
Change-Id: I995e035fc7d73d196a50b4e515db38110baa0fe5
2020-02-20 11:16:11 -05:00
Leon Scroggins III
5a190b19bb Add Bitmap#getHardwareBuffer
Bug: 148155907
Bug: 135299581
Test: TODO

Hidden for now. We'd like to make it an SDK API eventually
(b/148155907).

Internal code is currently calling createGraphicBufferHandle. This is
not something we plan to expose from the UI rendering module, so add a
method to get a HardwareBuffer instead. This is something we were
already planning to add. It seems that clients of
createGraphicBufferHandle really wanted a Parcelable to pass the
HARDWARE Bitmap to another thread. This should satisfy that use case.

Change-Id: Id701f7c7eab37830cd7d2cdb929cbe6ba4eca119
2020-02-18 16:35:56 -05:00
Derek Sollenberger
db8164c0ac Merge "Move RenderNodeAnimator to android.graphics.animation package" 2020-02-14 16:32:50 +00:00
TreeHugger Robot
8780aae16c Merge "Create a ParcelableColorSpace" 2020-02-14 00:58:30 +00:00
Derek Sollenberger
8c2f6b6e15 Move RenderNodeAnimator to android.graphics.animation package
A wrapper still exists at android.view.RenderNode animator
as it needs access to internals of the view that would violate
the package layering if moved into android.graphics.animation.

This CL also moves the Java and cpp files associated with creating
a native interpolator that can be run directly on the RenderThread.

Bug: 149293249
Test: CtsViewTestCases
Change-Id: I5260331fedbd634cf2f6d6d392941e7284527420
2020-02-13 16:14:06 -05:00
John Reck
aa5f38577a Create a ParcelableColorSpace
Bug: 148412652
Test: ParcelableColorSpaceTest CTS
Change-Id: If0901367e501e2ecfc71b9ed29ec7d8dd4d0550f
2020-02-12 14:28:10 -08:00
Derek Sollenberger
e2edcebb2b Merge "Consolidate AssetManager calls in Font/FontFamily" 2020-02-11 13:11:42 +00:00
Derek Sollenberger
4db7bd28e7 Consolidate AssetManager calls in Font/FontFamily
The Font/FontFamily classes use private API calls in native
code to get the contents of an Asset.  These calls need to
be made on public APIs in order to isolate the graphics module
from the rest of the system.  Public Java APIs already exist so
this CL refactors the code to use those methods.

Test: CtsTextTestCases
Bug: 147136234
Change-Id: I35a6558b597684e59279d7a841669c5f909d5152
2020-02-10 20:05:31 +00:00
Stan Iliev
c90438175f Refactor GraphicsStatsService for updateability
Move GraphicsStatsService to android.graphics package.
Move GraphicsStatsService JNI from libservices.core to
libandroid_runtime.
Declare GraphicsStatsService ctor as the only @SystemApi.
Remove MemoryFile usage from GraphicsStatsService, but use
SharedMemory and other SDK APIs instead. This is done to
avoid using unstable API MemoryFile.getFileDescriptor.
Propose new SharedMemory.getFdDup API for next release, which
is hidden for now.
Refactor statsd puller to avoid proto serialization by moving
data directly into AStatsEventList.
"libprotoutil" is added as a static dependancy to libhwui, which
should be fine because its implementation does not link anything.

Bug: 146353313
Test: Ran "adb shell cmd stats pull-source 10068"
Test: Passed unit tests and GraphicsStatsValidationTest CTS
Change-Id: If16c5addbd519cba33e03bd84ac312595032e0e1
2020-02-07 12:27:07 -05:00
Derek Sollenberger
1863d94e9a Ensure SkiaPipeline always has a valid colorspace.
Previously we didn't assign a colorspace to the pipeline until it
was provided a surface to render into.  This resulted in undefined
behavior if the application attempted to render an offscreen layer
before the OS provided the main window with its surface. Now instead
of deferring setting whether or not the application is wide gamut we
do initialize it to a default setting when the pipeline is created.

Bug: 148042673
Test: apct/device_boot_health_check_extra_postsubmit
Change-Id: I84d743511e949ac977486470bb14eec936de7f88
2020-02-06 07:41:50 -05:00
Leon Scroggins III
a49beaaa69 Replace Outline#setConvexPath with Outline#setPath
Bug: 148544953
Test: No change in behavior, no new tests

setConvexPath no longer requires that the Path be Convex, so deprecate
the method and replace it with a name that does not imply it must be
Convex.

Update internal references to the Path being Convex as well.

Change-Id: I8935dc8ac7f7fb7db0d667e35fda67afdf2e6ac8
2020-01-31 14:21:46 -05:00
Leon Scroggins
e98ae477cc Merge "Deprecate Path#isConvex" 2020-01-29 18:10:14 +00:00
TreeHugger Robot
e428a2cc04 Merge "Deprecate Canvas.EdgeType" 2020-01-28 18:13:01 +00:00
John Reck
efac0521d6 Improve bitmap IPC
Make all received bitmaps immutable as this
improves re-use for subsequent transfers.

Remove minimum size to stay on ashmem, as
Parcel's writeBlob already has similar logic.
This effectively reduces the minimum size to 16kB.

Bug: 148301859
Test: device booted, a notification showed up
Change-Id: I2fafb0989944c0ef82de6edcb4924056a592cf66
2020-01-24 16:06:14 -08:00
Leon Scroggins III
2410b90e06 Deprecate Canvas.EdgeType
Bug: 129694386
Test: No change in behavior, no new tests

EdgeType is only used as a parameter to quickReject, but it is always
ignored. Deprecate it and the existing quickReject methods. Add new
versions of quickReject without EdgeType parameters. Switch clients to
the new versions.

Change-Id: Id932f10915a8c4959fe0e85f507ce7fd2da8a576
2020-01-23 20:43:34 +00:00
Leon Scroggins III
6a0cdd24df Deprecate Path#isConvex
Bug: 133807397
Test: No change in behavior, no new tests

isConvex is unreliable. We may change how we compute it from release to
release, and it could change based on various factors like a rotation.

Change-Id: Ib76246fc24f09bd13cf63b4b96b56afa613d0bc9
2020-01-23 12:41:08 -05:00
Sunny Goyal
77a2416924 Adding API to check if an icon returned by PackageManager
is a fallback icon

Bug: 141588119
Test: atest PackageManagerTest
Change-Id: I9ae5a74dd0b0c0c49a078d46914986ecb0d27a94
2020-01-21 16:17:49 -08:00
Haoyu Zhang
9f9301ccc2 Restrict UnsupportedAppUsage after Q
Bug: 145986883
Test: atest FontFamilyTest
Test: adb shell am instrument -w -r -e class 'androidx.core.graphics.TypefaceCompatTest' androidx.core.test/androidx.test.runner.AndroidJUnitRunner
Change-Id: I1cf0444b93df00532536531903e889ade9612597
2020-01-14 15:28:09 -08:00
TreeHugger Robot
c18efd1f4d Merge "Use new UnsupportedAppUsage annotation." 2020-01-08 07:55:21 +00:00
Leon Scroggins
d534534a72 Merge "Handle null assetFd like a FNF" 2020-01-07 17:34:59 +00:00
Artur Satayev
00f8b53650 Use new UnsupportedAppUsage annotation.
Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library.

Bug: 145132366
Test: m && diff unsupportedappusage_index.csv
Change-Id: I8ffa1da1bcd43c25f4ff817575db77a33c0f3d31
2020-01-07 14:40:02 +00:00
Brian Osman
bc44fa0fa8 Use SkRuntimeEffect rather than SkRuntimeShaderFactory
The old API was a shim over the new API, and will be deleted soon.
The new API is actually public, simpler, and more powerful.

Test: Everything still builds.
Change-Id: I11af8da9132e23a070e87dd5a7401c4854dd102a
2020-01-03 20:31:50 +00:00
Artur Satayev
53fe96661b Use new UnsupportedAppUsage annotation.
Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library.

Bug: 145132366
Test: m && diff unsupportedappusage_index.csv
Change-Id: I4bc8c9482e4bb1af21363f951affff7ee3fefeab
2019-12-18 15:42:06 +00:00
Derek Sollenberger
7da86dd922 Merge "Move FrameMetricsObserver logic into UI Module." 2019-12-18 12:14:26 +00:00
TreeHugger Robot
3d37450027 Merge "ImageDecoder: compare Strings with .equals()" 2019-12-17 23:37:52 +00:00
Derek Sollenberger
c4ef2c702a Move FrameMetricsObserver logic into UI Module.
Introduce HardwareRendererObserver to isolate the android.graphics
package from the android.view package.  The native code that
interacts with the observer was also moved from libandroid_runtime to
libandroid_graphics to keep it within the confines of the UI Rendering
module.

Bug: 137655431
Test: CtsUiRenderingTestCases
Change-Id: Ibccecbeda0c4d9501d86514a53eb98548233ba6a
2019-12-17 10:15:27 -05:00
TreeHugger Robot
ff4627bf4c Merge "Revert submission" 2019-12-17 03:06:55 +00:00
Nader Jawad
913dd6b9a9 Revert submission
Reason for revert: Causes regressions tracked in:

b/145900622
b/145864909
b/145948923

Change-Id: Ia24ece94d5281cd25d990d8cae923cf50497e1f1
2019-12-17 01:08:20 +00:00
Haoyu Zhang
fe7b206c8d Revert "Rmove @UnsupportedAppUsage"
This reverts commit 351df0901d.

Bug: 146181012
Bug: 145986883
Bug: 146318594
Bug: 146316215
Bug: 146315595

Reason for revert: This changed caused APP crash.
Change-Id: I0a1863176bf80ba5ad044621b5a2ff72e0d57fa4
2019-12-16 22:25:02 +00:00
Haoyu Zhang
351df0901d Rmove @UnsupportedAppUsage
Bug: 145986883
Test: atest FontFamilyTest
Test: adb shell am instrument -w -r -e class 'androidx.core.graphics.TypefaceCompatTest' androidx.core.test/androidx.test.runner.AndroidJUnitRunner
Change-Id: Iac6b9cb0dde2289604e5ec4b9bff8930fd9a4229
2019-12-12 14:40:52 -08:00
Leon Scroggins
773ae61247 Merge "ImageDecoder: Disallow empty/unsorted crop rects" 2019-12-11 14:44:28 +00:00
Leon Scroggins III
beebd3ca9b ImageDecoder: Disallow empty/unsorted crop rects
Bug: 135133301
Test: Idf64474f28c0bf3f77616a31d843d84fbfd570ab

If the specified crop Rect is empty or unsorted, throw an
IllegalStateException, like we do if the Rect does not fit in the target
size.

This is a change in behavior to make it more consistent. Here are the
specific behavior changes:
- an empty crop rect was previously supported in all cases, but would
  result in a zero width and/or height Bitmap/Drawable. If one
  dimension is non-zero, it still affects layout, though nothing is
  drawn. This is not useful, so the new Exception is more helpful. (It
  is also more consistent with setTargetSize, which throws an
  IllegalArgumentException for non-positive dimensions.)
- a negative width or height in decodeBitmap, or on a static image in
  decodeDrawable, previously threw an IOException when trying to call
  SkBitmap::setInfo with a negative width or height. Throwing an
  IllegalStateException is more consistent with other invalid crop rects
- a negative width or height in decodeDrawable on an animated image
  previously resulted in an AnimatedImageDrawable with a negative
  intrinsic width and/or height. When passed to an ImageView, this
  dimension ends up being 1. Again, this does not seem useful.

Change-Id: I15d2f77125799413eaf55d417e98ff34599e2eb4
2019-12-06 12:45:11 -05:00
Jeffrey Huang
cb78285b81 Rename writeToProto to be dumpDebug
We want to eventually migrate some of these APIs to be @SystemApi for mainline modules.
The #dumpDebug name is more appropriate than #writeToProto.

Bug: 142279786
Test: Manual
Change-Id: I60793e91cedf6b720d4ecef6a8484f4fed4ff30f
2019-12-05 11:28:11 -08:00
Stan Iliev
6867fc8778 Implement a new Shader API, which can run custom code on GPU
Add RuntimeShader hidden API, which calculates pixel output with
a fragment shader running on GPU.
Extend ColorFiltersMutateActivity HWUI test to use new API and
show how to animate uniforms on UI thread.

Test: Updated HwAccelerationTest
Change-Id: Ia26e44259b12099924facba250880cbbd9be21c7
2019-12-03 11:38:29 -05:00
Leon Scroggins III
637efbaa0a ImageDecoder: compare Strings with .equals()
Bug: 143231863
Test: Infeasible?

Previously we compared with "==", which requires that the two String
objects be the same to return true. We want to return true if the two
Strings are logically equal, even if they are different objects.

Prior to this commit, we may have accidentally called
openAssetFileDescriptor when we should have called
openTypedAssetFileDescriptor.

Change-Id: I9229039b752bafa9a9b85b914a62093dff1eec34
2019-11-19 13:53:29 -05:00
Mehdi Alizadeh
f86ed37ce0 Adds adaptive bitmap support to URI based icons
Adds a new creator method to accept a Uri and set an internal flag for
Adaptive bitmap, and return adaptive bitmap drawable on loadDrawable().

Bug: 142831407
Test: atest IconTest
Change-Id: Iefee1aaa154a47fc9e5ed1e1c03587a3c8fb6da9
2019-11-14 22:08:49 +00:00
Joshua Baxter
eff6269b3f Merge "docs: Fix docs for Canvas#drawTextOnPath add parameter descriptions for index and count in drawTextOnPath fix a couple of typos" into qt-dev am: 228d235d5b am: 5f4d7e4ac5 am: d59ed2f2a7
am: 3f7792b9bc

Change-Id: I099ad12cdb39780acc8a4a17418bebb812b4f477
2019-11-11 14:38:27 -08:00
Joshua Baxter
228d235d5b Merge "docs: Fix docs for Canvas#drawTextOnPath add parameter descriptions for index and count in drawTextOnPath fix a couple of typos" into qt-dev 2019-11-11 21:52:31 +00:00
Derek Sollenberger
36cf8b2c12 Merge "Remove native calls to HWUI from Surface and use the public API instead" 2019-11-08 13:40:22 +00:00
Joshua Baxter
151f0e3ea3 Merge "docs: fix typos" into qt-dev am: f6c85f3c0d am: 256363052e am: bd87d666eb
am: 28a023d243

Change-Id: I24cecf7107959da96b5969d7f901dfc40b308932
2019-11-06 14:31:27 -08:00
Joshua Baxter
811e7aa557 docs: fix typos
Change-Id: Ica9765713212955caf3c7fb246ef4ad8ca0e1c35
test: make ds-docs
bug: 113636515
2019-11-06 21:16:00 +00:00
Joshua Baxter
d20c23b15f docs: Fix docs for Canvas#drawTextOnPath
add parameter descriptions for index and count in drawTextOnPath
fix a couple of typos

test: make ds-docs
Bug: 36969777
Change-Id: I7c451fac4468fb2066b9b29a321fad57785a8a36
2019-11-06 20:58:32 +00:00
Derek Sollenberger
4aa30d07c5 Remove native calls to HWUI from Surface and use the public API instead
Test: CtsGraphicsTestCases and CtsWindowManagerDeviceTestCases
Bug: 137655431
Change-Id: I8427f96e4f33905e8cabb6d48a0cc29443b9ed63
2019-11-06 14:31:44 -05:00
TreeHugger Robot
4da463026c Merge "Delegated implementation of Drawable#jumpToCurrentState" 2019-11-01 22:15:38 +00:00