Commit Graph

3963 Commits

Author SHA1 Message Date
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
TreeHugger Robot
dd300fc347 Merge "Fixed issue where tint would be applied to solid region of GradientDrawable even if none was defined" 2019-10-31 22:39:44 +00:00
Nader Jawad
6b8e944486 Delegated implementation of Drawable#jumpToCurrentState
Updated DrawableWrapper to provide an implementation
of Drawable#jumpToCurrentState to call into the
internal Drawable's implementation

Test: Added CTS test to DrawableWrapper
Bug: 142867050
Change-Id: Ifd095c3174da2e240fdfe4a27cfe081db16a6db5
2019-10-31 13:38:38 -07:00
Nader Jawad
214e485373 Fixed issue where tint would be applied to solid
region of GradientDrawable even if none was defined

Fixed issue where solid black would be applied through
modulated default alpha value if both solid and gradient
colors were not applied to the gradient.

Test: Added CTS test
Bug: 142733137
Change-Id: Iecb7010f6d318cc962113528aac694b0de47d9dd
2019-10-31 11:09:18 -07:00
Wale Ogunwale
ed38d4f967 Merge "Revert "Remove native calls to HWUI from Surface and use the public API instead"" 2019-10-30 13:33:31 +00:00
Derek Sollenberger
a320e92c56 Revert "Remove native calls to HWUI from Surface and use the public API instead"
This reverts commit 79201b16f1.

Reason for revert: breaks wm-presubmit

Change-Id: I3245e202f88b16d30b924e229cbc05fca37a3759
2019-10-30 13:17:41 +00:00
Derek Sollenberger
2db814af51 Merge "Remove native calls to HWUI from Surface and use the public API instead" 2019-10-30 03:11:06 +00: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
Derek Sollenberger
79201b16f1 Remove native calls to HWUI from Surface and use the public API instead
Test: CtsGraphicsTestCases
Bug: 137655431
Change-Id: I1eda485282306d571ca973e179e7202958b59105
2019-10-25 16:25:39 -04:00
TreeHugger Robot
017cbabdce Merge "Add Bitmap.CompressFormat#WEBP_LOSSY/LOSSLESS" 2019-10-17 14:26:46 +00:00
TreeHugger Robot
459cb5cf2e Merge "Fix ColorSpace#get allocating" 2019-10-17 00:56:55 +00:00
John Reck
da94981b19 Fix ColorSpace#get allocating
Test: none
Change-Id: Ia4d380a74ac8f99ac408f52a602713823db43f50
2019-10-16 16:18:28 -07:00
Philip P. Moltmann
c137f1c679 Add TEST_MAPPING for print and pdf tests
Test: TH
Change-Id: I7157c630fccb8b4d50672ac014e5cd020f1ac71f
2019-10-11 14:53:15 -07:00
Nader Jawad
5830fc9836 Merge "Do not parse angle if it is negative" 2019-10-10 20:02:14 +00:00
Rob Carr
093f80de20 Merge "ViewRootImpl: Add USE_BLAST flag." 2019-10-10 19:43:49 +00:00
Leon Scroggins III
e8da8b12c3 Handle null assetFd like a FNF
Bug: 140961740
Test: TODO

We already catch an FNF and attempt to open the file as an InputStream.
Do the same if null is returned.

I haven't figured out a way to make assetFd set to null and yet opening
an InputStream succeeds, so this is untested.

Change-Id: Iabd05db714bc693ead2dc8cc4c0b46fef9f33d5a
2019-10-10 10:07:45 -04:00
Leon Scroggins
a3b702fa84 Merge "ImageDecoder: throw FileNotFoundException on null" 2019-10-10 13:28:09 +00:00
Nader Jawad
5baa087037 Do not parse angle if it is negative
If the Gradient angle is negative after
modding by 360, maintain the previous platform
behavior of TOP_BOTTOM oreintation instead of
attempting to wrap it

Test: Added CTS test to verify various negative
angle measurements
Bug: 142111195

Change-Id: Id9c050a9e15717bfaff331c6a37cb34cbce0f060
2019-10-09 17:03:17 -07:00
John Reck
183e1380ce Improve dumping of display list memory usage
The first step of improving is measuring. So measure better.

Bug: 138856108
Test: dump
Change-Id: I076b904a1f0dfb209622c76bcb8778a10cd2b7db
2019-10-09 13:42:43 -07:00
Robert Carr
48ec4e0b5c ViewRootImpl: Add USE_BLAST flag.
Add support for ViewRootImpl submitting buffers using
BLAST and put this support behind a disabled-by-default
FLAG.

Bug: 135786080
Change-Id: Ia3f205e34db9f9aa574c9c2e2c499dd3046af220
2019-10-08 14:36:38 -07:00
Leon Scroggins III
94d294bb52 Add Bitmap.CompressFormat#WEBP_LOSSY/LOSSLESS
Bug: 135133301
Test: Iadbd8cf3b69a150b9e38ad556392346e1bb27084

WEBP does not give clients explicit control of how to do their WEBP
encode. Add new formats that do. Update the docs for the existing
formats (and the new ones) to explain more precisely how quality is
interpreted.

Change-Id: I9583903c21ab2048fed8e7ed501ee8377ea5ba36
2019-09-23 14:35:54 -04:00
Nader Jawad
9f560fefbc Restored default behavior of GradientDrawable orientation
Fixed issue where GradientDrawable orientation had diverged
from the default behavior. Ensured that orientation by default
is configured to LEFT_RIGHT for xml defined GradientDrawables
and programmatically defined GradientDrawables have the
same default orientation of TOP_BOTTOM.

Refactored previous logic that would keep both the mAngle
parameter used in xml inflation and the mOrientation parameter
that is used to configure the angle of the gradient to no longer
keep these 2 values in sync.

Test: Added CTS test to verify orientation for xml and programmatically
defined GradientDrawables
Bug: 140835351
Bug: 139822941

Change-Id: I594496afe48d04d108053bf284e92bbfd3591fa3
2019-09-19 16:15:49 -07:00
Nader Jawad
87e5b74f8d Revert "Fixed default angle to be Orientation.LEFT_RIGHT"
This reverts commit d31d096720.

Reason for revert: Although this change fixed the behavior change for for creation of
GradientDrawables defined in xml, the default value for GradientDrawables defined
programmatically is different. The default orientation for GradientDrawables defined
in xml is LEFT_RIGHT, however, the default orientation for GradientDrawables defined
programmatically is TOP_BOTTOM. Since a fix for AAPT has been made to automatically
insert an angle measurement of 0 if one is not defined, we can revert this CL and target
a proper fix in master.

Change-Id: Ib8983386832fb25f53b5e68e76e9d41d9d26fec9
2019-09-19 16:15:12 -07:00
Leon Scroggins III
3d7ae4efff ImageDecoder: throw FileNotFoundException on null
Bug: 140961740
Test: I41a93b47acde6a7985c53107f448a8b647d245d7

If ImageDecoder has a null AssetFileDescriptor, either from a Callable
or from a ContentResolver directly, throw a FileNotFoundException.
Previously, a NullPointerException was thrown attempting to dereference
it.

Change-Id: Ie738b9edc062e520835010befc001578fce09832
2019-09-17 14:13:18 -04:00