Commit Graph

3721 Commits

Author SHA1 Message Date
Leon Scroggins III
8bbcd3477c Add Paint#setShadowLayer(..., @ColorLong)
Bug: 120904891
Test: I38537394bf314668cc38349c34b9492164cb0c92

Change-Id: Id1c294a2a79087cfaaf4a25fa4888f706fdb8124
2019-01-15 15:37:36 -05:00
Leon Scroggins III
aefa03dd9e Add Paint#setColor(@ColorLong)
Bug: 120904891
Test: Iba796744a9cc3652a6bc1881a9b229403ffaed31
Change-Id: Ib03212b27bc330e61b876a4be3d45c34ed551540
2019-01-15 15:37:36 -05:00
Daniel Solomon
edb5e1a1b8 Merge "Add Display Auto White Balance to ColorDisplayService" 2019-01-15 19:29:16 +00:00
TreeHugger Robot
77571c7f31 Merge "Add Bitmap#eraseColor(@ColorLong) + helpers" 2019-01-15 18:50:21 +00:00
Leon Scroggins III
4c4259b339 Add Bitmap#eraseColor(@ColorLong) + helpers
Bug: 120904891
Test: I162451ebf807f3a8a44679e5c10406468c922500

- Add Bitmap#eraseColor(@ColorLong). This allows erasing in ColorSpaces
  besides SRGB. New API is hidden pending API-council approval. It is
  @TestApi so it can be used by the new tests.
- Rewrite Bitmap#erase(@ColorInt)'s internals. The ColorInt should be
  treated as an SRGB color. The old code (deep in SkPixmap::erase)
  treated the color as being in the SkColorSpace of the SkBitmap.
- Update getNativeColorSpace to return immediately when it throws.
  Existing callers should never throw anyway, since they do their own
  checks (and throws) in Java before reaching this method. But relying
  on this method to properly return simplifies the new callers.

Change-Id: I1b736934ce1b8294c827bb61c2a363207569da4f
2019-01-15 12:16:19 -05:00
Seigo Nonaka
74cababfd5 Merge "Add Canvas.drawTextRun(MeasuredText)" 2019-01-15 08:55:13 +00:00
Daniel Solomon
8b72c5b1d3 Add Display Auto White Balance to ColorDisplayService
This change adds Display Auto White Balance to ColorDisplayService.
Given panel chromaticity data, a nominal white point, and a desired
correlated color temperature (CCT), this logic generates and applies a
matrix transform to shift the nominal white point to match the desired
CCT.

Bug 116516917

Change-Id: I07e341881a020a130944217fff372003edac0a8c
2019-01-14 17:37:15 -08:00
Leon Scroggins
151b6729ab Merge "Make ColorSpace#isSrgb more restrictive" 2019-01-14 17:23:36 +00:00
Leon Scroggins III
203034fe2c Make ColorSpace#isSrgb more restrictive
Test: Ide74c2e98d4aadba8bb0a24d132f161dbe64f4db

Previously, BT709 was believed to be SRGB, resulting in errors when we
tried to convert between them. Make isSrgb test several values passed to
OETF and EOTF to verify that it is very close to SRGB. This results in
BT709 no longer being considered SRGB, fixing the conversion.

Update the documentation to reflect the new behavior.

Now that isSrgb is more restrictive, a gamma of 2.2 is no longer
considered to be SRGB, which requires a change to a CTS test.

Change-Id: I7bf8d5e3af2f91e38ca0b0d5d906713a125dd484
2019-01-11 14:31:52 -05:00
Seigo Nonaka
3fea923b47 Ignore missing target font family during alias registration
Bug: 122665938
Test: TreeHugger
Change-Id: Ic9f72bf5e6891f4d30d54b3f1a3b6a6fc8424788
2019-01-10 13:24:22 -08:00
Hans Boehm
13f86506cc Merge "Fix spelling of "HARDWARE"" am: 9fbe481727 am: 281664abf5
am: 5ff66466e5

Change-Id: I54f91677a909281b402f2be8658813d3a91e3ae0
2019-01-09 11:55:01 -08:00
TreeHugger Robot
d3a110b811 Merge "Fix a typo in ColorSpace.get" 2019-01-08 20:38:47 +00:00
Leon Scroggins III
f50e8d4bc0 Fix a typo in ColorSpace.get
Test: I1759437bf620868706be0aadce2250ac9194ca7d

The intent is that an index that does not match a Named ColorSpace will
throw an IllegalArgumentException, so make that true for
Named.values().length, which does not correspond to one.

Also, update the Exception message to make it clear that the last index
is exclusive.

Change-Id: I015b7ee6274873cc329653473ead04b08f1cd55f
2019-01-08 09:20:07 -05:00
Hans Boehm
e5b337dd88 Fix spelling of "HARDWARE"
Happened to notice this while reading the code for other purposes.

Test: Treehugger
Change-Id: I2d1b1e239bfd8d2506a62173fe854f608a45f5b0
2019-01-07 17:42:05 -08:00
Mathew Inwood
55418eada5 Limit access to suspected false positives.
Members modified herein are suspected to be false positives: i.e. things
that were added to the greylist in P, but subsequent data analysis
suggests that they are not, in fact, used after all.

Add a maxTargetSdk=P to these APIs. This is lower-risk that simply
removing these things from the greylist, as none of out data sources are
perfect nor complete.

For APIs that are not supported yet by annotations, move them to
hiddenapi-greylist-max-p.txt instead which has the same effect.

Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.

Bug: 115609023
Test: m
Change-Id: Ia937d8c41512e7f1b6e7f67b9104c1878b5cc3a0
Merged-In: I020a9c09672ebcae64c5357abc4993e07e744687
2018-12-28 14:26:35 +00:00
Mathew Inwood
31755f94e1 Limit access to suspected false positives.
Members modified herein are suspected to be false positives: i.e. things
that were added to the greylist in P, but subsequent data analysis
suggests that they are not, in fact, used after all.

Add a maxTargetSdk=P to these APIs. This is lower-risk that simply
removing these things from the greylist, as none of out data sources are
perfect nor complete.

For APIs that are not supported yet by annotations, move them to
hiddenapi-greylist-max-p.txt instead which has the same effect.

Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.

Bug: 115609023
Test: m
Change-Id: I020a9c09672ebcae64c5357abc4993e07e744687
2018-12-28 11:50:04 +00:00
Jorim Jaggi
99dc47483c Merge "A brave new world for window insets (5/n)" 2018-12-21 14:00:45 +00:00
Jorim Jaggi
5bb571dc40 A brave new world for window insets (5/n)
Implement controlWindowInsetsAnimation

Based on the leashes we have on the client, and the insets the
client has requested, we are able to move the surfaces around
such that the resulting insets will match what the client
requested.

Bug: 118118435
Change-Id: I0616e53455a6544aaf374c1b0eb10e258aced21d
2018-12-21 13:05:30 +01:00
Derek Sollenberger
24fc901e5f Improve performance of unclipped save layers.
Instead of allocating a separate renderTarget and switching
between them on each draw the new implementation follows the same
pattern that the old HWUI renderer used. The area of the layer is
now copied to a buffer on the GPU, the area is then cleared, rendered
as normal, and finally the texture is redrawn using dst_over blending.

This results in no render target switches and is considerably faster
on some hardware.

Test: CtsGraphicsTestCases, CtsUiRenderingTestCases
Bug: 119222339
Change-Id: I716aac1fc31e4c7a171373d37dee82034c01cf18
2018-12-20 10:04:46 -05:00
John Reck
c0cd1d7f33 Merge "New WebViewFunctor API" 2018-12-18 17:50:37 +00:00
John Reck
3a0041cf1d Merge "Add missing getter & improve docs" 2018-12-17 23:52:21 +00:00
John Reck
470a919135 Add missing getter & improve docs
Also fix SkiaDisplayList::getUsedSize()

Bug: 120865963
Test: atest android.uirendering.cts.testclasses.RenderNodeTests
Change-Id: I3cdbd8d330da9a00367199087c9ae1e0a2cacf46
2018-12-17 11:25:34 -08:00
John Reck
283bb46846 New WebViewFunctor API
Should function alongside existing functor API.

Bug: 120997728
Test: hwuiunit passes
Change-Id: I8f6143d0be1111431b55016f34de319f6b8c8910
2018-12-14 14:07:18 -08:00
Nader Jawad
8168f6fa28 Merge "Added support for additional Blend Modes" 2018-12-13 21:02:37 +00:00
Fabian Kozynski
863c52e80a Merge "Sets Drawable in DrawableWrapper properly" 2018-12-12 13:58:48 +00:00
Fabian Kozynski
de9f10d9d9 Sets Drawable in DrawableWrapper properly
Before this change, creating a DrawableWrapper (through a custom class
that extends it) using the public constructor will not set the drawable
callback properly and DrawableWrapper will not update when the
underlying Drawable is invalidated.

Test: CTS test added
Bug: 120835632
Change-Id: I3545db76e032c0bd074846e0fa64c5cf01e2941c
2018-12-11 22:15:12 +00:00
Xin Li
15b123ef45 DO NOT MERGE - Merge pie-platform-release (PPRL.181205.001) into master
Bug: 120502534
Change-Id: Idc8bfb6d97a869b76cfb87ca1a494201baf9e8bd
2018-12-11 14:13:44 -08:00
Seigo Nonaka
291ef0536d Recompute PcT with existing PcT for different direction
The text direction can not be fully determined in detached state.
To improve even in that case, compute PrecomputedText from existing
PrecomputedText with new direction.

Here is the performance difference. According to the perf test result,
up to 80% of computation can be recycled from existing PrecomputedText.

android.text.StaticLayoutPerfTest (u sec):
    PrecomputedText Greedy NoHyphenation             :    371 ->    371: (   +0,  +0.0%)
    PrecomputedText Greedy NoHyphenation DirDifferent:  6,923 ->  1,437: (-5486, -79.2%)
    RandomText Greedy NoHyphenation                  :  6,633 ->  6,627: (   -6,  -0.1%)

On the other hand, this CL increase the memory usage of the
PrecomputedText up to 10%. Here is an reference memory usage.

android.text.PrecomputedTextMemoryUsageTest (bytes):
  MemoryUsage
    Arabic Hyphenation                               : 17,135 -> 18,116: ( +981, +5.7%)
    Arabic NoHyphenation                             : 17,135 -> 18,116: ( +981, +5.7%)
    CJK Hyphenation                                  : 29,000 -> 31,584: (+2584, +8.9%)
    CJK NoHyphenation                                : 29,000 -> 31,584: (+2584, +8.9%)
    Latin Hyphenation                                : 16,526 -> 17,185: ( +659, +4.0%)
    Latin NoHyphenation                              : 14,200 -> 14,784: ( +584, +4.1%)

Bug: 119312268
Test: atest CtsWidgetTestCases
Test: atest CtsTextTestCases
Test: atest CtsGraphicsTestCases
Test: minikin_tests

Change-Id: Ia02c201afac5d7d1c086a45f15696f39a6b2a76c
2018-12-10 16:18:02 -08:00
Nader Jawad
55e49d8816 Added support for additional Blend Modes
Created new BlendMode enum that maps to XferModes with additional
supported native values that map to SkBlendMode constants
Created new BlendModeColorFilter
Deprecated PorterDuffColorMode and PorterDuffColorFilter in
favor of BlendMode and BlendModeColorFilter.
Updated Paint API to use setBlendMode and deprecated setXfermode

Bug: 119671925
Bug: 112166079
Bug: 73224934
Test: Added CTS tests for BlendMode and BlendModeColorFilter
Change-Id: Idd50e2f0b81975c5ecf6f1c0edd4eb68198d9131
2018-12-10 15:38:59 -08:00
Hyunyoung Song
9fed6daf9c Merge "Make AdaptiveIconDrawable to read in config_icon_mask at non boot time" 2018-12-05 06:02:31 +00:00
Hyunyoung Song
a6ceda2e9b Make AdaptiveIconDrawable to read in config_icon_mask at non boot time
Bug: 120286620
Bug: 120286623

Test: adb shell cmd overlay enable --user 0 com.android.theme.icon.square

Change-Id: Ifcb8f39308ba3b1702df983c87be3872abdbf68d
2018-12-04 16:11:52 -08:00
Daniel Solomon
37fc6eaaf4 Merge "Add API to ColorSpace to compute chromaticity coordinates from CCT" 2018-12-04 20:12:46 +00:00
TreeHugger Robot
d380bd78bb Merge "Select closest font's style for backward compatibility" 2018-12-04 10:10:11 +00:00
Seigo Nonaka
68d1d5ae7e Select closest font's style for backward compatibility
Bug: 119425212
Test: atest CtsGraphicsTestCases
Test: atest CtsContentTestCases:android.content.res.cts.ResourcesTest
Change-Id: I796baf342f752366040b657954b0f82d358a7790
2018-12-03 20:16:26 -08:00
TreeHugger Robot
b0160bb541 Merge "Fix issue with xml GradientDrawables consuming both resources and parameters provided by the Theme leading to array size mismatch exceptions being thrown." 2018-12-03 22:32:37 +00:00
Daniel Solomon
1ca52e44cc Add API to ColorSpace to compute chromaticity coordinates from CCT
Add a ColorSpace API that computes the chromaticity coordinates of a CIE
series D illuminant from the specified correlated color temperature.

Test: cts-tradefed run singleCommand cts-dev --module CtsGraphicsTestCases --test android.graphics.cts.ColorSpaceTest
Bug 116516917

Change-Id: I6c9f2a23ed548556d5fbdcc22ed5a094a76bb8e4
2018-12-02 12:01:11 -08:00
TreeHugger Robot
7b705a37cc Merge "Remove mFamilies from Typeface" 2018-12-01 00:04:51 +00:00
Nader Jawad
65add40281 Fix issue with xml GradientDrawables consuming both resources
and parameters provided by the Theme leading to array size
mismatch exceptions being thrown.

GradientDrawable#updateGradientDrawableGradient is invoked multiple
times during xml inflation, once with the attributes provided in the xml
and another with attributes provided in the Theme. However, if
parameters come from both the xml resources and the theme, when
theme attributes are applied it can partially squash previously applied
values.

In the case of gradients this can lead to a previously initialized
positions array with floating point offsets for color positions
being applied but not overriden with theme attributes that only include
a portion of the attribute values leading to exceptions being thrown
as the colors and positions arrays are not of the same size

Bug: 112122447
Test: Created test of xml inflation of GradientDrawables both with and
without theme attributes

Change-Id: Ie4183e2304677d30b6faef1cdc5c1be27ef9edd4
2018-11-30 13:13:26 -08:00
Daniel Solomon
94da729e42 Merge "Add a public chromatic adaptation API to ColorSpace" 2018-11-30 18:38:15 +00:00
Seigo Nonaka
6b160006e9 Enforce at least 64 fallback capacity for custom font fallback.
Bug: 119620208
Test: atest TypefaceCustomFallbackBuilderTest
Change-Id: Ibf1eaac97a4f940f00ef117f7fb386f72b67b6c5
2018-11-29 21:52:00 -08:00
Nader Jawad
cce6c22e76 Merge "Hidden API usage Landroid/graphics/Canvas;->mBitmap:Landroid/graphics/Bitmap;" 2018-11-29 21:25:40 +00:00
John Reck
fd45bee176 Merge "Add a unique ID to rendernode" 2018-11-29 20:39:08 +00:00
TreeHugger Robot
362a3caaf1 Merge "Make Drawable#isProjected public" 2018-11-29 20:21:27 +00:00
John Reck
f96b284dec Add a unique ID to rendernode
Bug: 120089776
Test: dump'd skp, verified ID present
Change-Id: I97a03804ebc53925e1b79db3dd616a728eff0bfa
2018-11-29 10:34:32 -08:00
Jorim Jaggi
f96c90ac6c A brave new world for window insets (1/n)
This CL starts a journey to discover a brave new inset world. The
path to get us there may be rocky, but it's going to be rocky.

One of the main pledges of the new API is that an app can retrieve
what is causing a certain inset easily. For that, we need to
dispatch metadata who is causing what inset, such that we can query
it from the client side.

Furthermore, the client will be able to manipulate insets directly,
but also listen to animation changes. We don't want to go through
window manager for that, thus, there needs to be a local codepath
from (global window state -> WindowInsets).

Because we have these two requirements, we dispatch the relevant
global window state for insets, represented by InsetsState, and
dispatch it to the client. On the client side we take the frame
and the InsetsState and generate WindowInsets out of it.

Bug: 118118435
Test: InsetsSourceTest, InsetsStateTest, InsetsSourceProviderTest,
InsetsStateControllerTest
Change-Id: I2bfe9dda376512916261823fc2ee35cbedeb6731
2018-11-29 13:37:43 +01:00
Seigo Nonaka
9d04f3ee11 Remove mFamilies from Typeface
mFamilies was added for itemize API but it won't happen in this
release, so removing unused member from Typeface.

Bug: 120177351
Test: TreeHugger
Change-Id: Iee0e381b28aa42daba1621084ce5a9d1a8753cd5
2018-11-28 22:50:09 -08:00
Seigo Nonaka
18c9aa3e66 Add Canvas.drawTextRun(MeasuredText)
This API is needed to port PrecomputedText in support library.

Bug: 112327179
Test: atest CtsWidgetTestCases
Test: atest CtsGraphicsTestCases
Test: atest CtsTextTestCases
Change-Id: Ib3aa4cc9e486bdcf6e4cbbfa75c0d2cf6960e982
2018-11-28 17:17:31 -08:00
Nader Jawad
29cad18bd3 Hidden API usage Landroid/graphics/Canvas;->mBitmap:Landroid/graphics/Bitmap;
Added maxTargetSdk version for Android P for access of mBitmap field
through reflection. The bitmap field is configured by application usages
only already so there is no need for apps to query the Bitmap from the
Canvas and should do so directly. Getters on Canvas is generally seen
as an anti-pattern.

Bug: 117521088
Test: none
Change-Id: Ie2318248f7682fd4e0a46121bc6e9f5c1546dcfb
2018-11-28 17:10:08 -08:00
Nader Jawad
3af32bd94f Make Drawable#isProjected public
Modify Drawable public API to no longer mark isProjected
as hidden. This makes the Drawable API consistent with the public
RenderNode API and enables androidx to move away from accessing
this method through reflection

Bug: 120159096 117521142
Test: none
Change-Id: Icdd778bf3d8842eb2d69e5872f704c7e96f915fa
2018-11-28 16:08:10 -08:00
Daniel Solomon
6310160c4e Add a public chromatic adaptation API to ColorSpace
This change adds a public version of ColorSpace.chromaticAdaptation(),
so that chromatic adaptation can be done on independent CIE xyY or XYZ
coordinates without the involvement of ColorSpace.Rgb.

Test: cts-tradefed run singleCommand cts-dev --module CtsGraphicsTestCases --test android.graphics.cts.ColorSpaceTest
Bug 116516917

Change-Id: I73c33750c343301bed4bb018c351d87c5043b59b
2018-11-28 03:34:20 +00:00