3696 Commits

Author SHA1 Message Date
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
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
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
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
TreeHugger Robot
39ba1b71fb Merge "Add new API for returning max custom fallback families" 2018-11-28 03:11:29 +00:00
Nader Jawad
23b82af43f Merge "Fix AdaptiveIconDrawable#getAlpha" 2018-11-27 01:04:45 +00:00
Hyunyoung Song
93a1b159bc Merge "Fix isProjected and setAlpha method inside AdaptiveIconDrawable" 2018-11-26 17:12:33 +00:00
Hyunyoung Song
911851b91f Fix isProjected and setAlpha method inside AdaptiveIconDrawable
Test: atest AdaptiveIconDrawableTest (in coretests and cts)
Bug: 119755247
Bug: 118503770

Some contexts regarding why setAlpha was misbehaving before and after
setBounds: mPaint object which is used to setAlpha was shared between
mLayerBitmpa and mMaskBitmap. When bounds changed, mMaskBitmap alpha was
never properly refreshed. To fix this issue AND to optimize memory
footprint, the drawable no longer make use of the mMaskBitmap object.

CtsGraphicsTestCases (21 Tests)
------------------------------
[1/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testInflateNull: PASSED (1ms)
[2/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testSetVisible: PASSED (1ms)
[3/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testDraw: PASSED (1ms)
[4/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testGetOpacity: PASSED (0ms)
[5/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testGetForegroundBackground: PASSED (25ms)
[6/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testGetConstantState: PASSED (0ms)
[7/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testIsStateful: PASSED (0ms)
[8/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testDrawNull: PASSED (1ms)
[9/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testDrawWithoutSetBounds: PASSED (0ms)
[10/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testGetIntrinsicHeight: PASSED (25ms)
[11/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testScheduleDrawable: PASSED (1ms)
[12/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testGetIntrinsicWidth: PASSED (1ms)
[13/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testSetColorFilter: PASSED (1ms)
[14/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testInflate: PASSED (1ms)
[15/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testMutate: PASSED (1ms)
[16/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testGetChangingConfigurations: PASSED (1ms)
[17/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testInvalidateDrawable: PASSED (0ms)
[18/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testUnscheduleDrawable: PASSED (25ms)
[19/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testConstructor: PASSED (0ms)
[20/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testSetAlpha: PASSED (0ms)
[21/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testDrawSetBounds: PASSED (478ms)

Summary
-------
CtsGraphicsTestCases: Passed: 21, Failed: 0

FrameworksCoreTests (6 Tests)
----------------------------
[1/6] android.graphics.drawable.AdaptiveIconDrawableTest#testDraw_withBounds: PASSED (454ms)
[2/6] android.graphics.drawable.AdaptiveIconDrawableTest#testDraw_withoutBounds: PASSED (0ms)
[3/6] android.graphics.drawable.AdaptiveIconDrawableTest#testGetIconMaskAfterSetBounds: PASSED (1ms)
[4/6] android.graphics.drawable.AdaptiveIconDrawableTest#testGetIconMask_withoutBounds: PASSED (1ms)
[5/6] android.graphics.drawable.AdaptiveIconDrawableTest#testGetOutline_withBounds: PASSED (0ms)
[6/6] android.graphics.drawable.AdaptiveIconDrawableTest#testSetAlpha: PASSED (0ms)

Summary
-------
FrameworksCoreTests: Passed: 6, Failed: 0

Change-Id: Ie52019f14159e06b957760cb33118cb74f58415e
2018-11-21 16:06:22 -08:00
Nader Jawad
c0a315a1a8 Fix AdaptiveIconDrawable#getAlpha
Reverted getAlpha implementation to return the
alpha value of the first non-null child drawable

Bug: 119668265
Test: Added test to AdaptiveIconDrawableTest
Change-Id: Ia3384755e8f9a83b88d586881eae80e4c201097f
2018-11-21 13:19:26 -08:00
Louis Chang
a358d7611c Set minimum scaled width/height to 1
Applications could be launched on a secondary display that
has lower density than default display. While some applications
may use 1x1 image resource as activity background, the scaled
width/height would be 0 if down scaling the 1x1 image with
scale ratio that is less than 1/2.

Making sure the scaled width/height won’t less than 1 to
prevent application crashed.

Bug: 117749148
Test: Launch app on secondary display

Change-Id: I73567dd237736466d0bc423485359d50073d86c1
2018-11-20 22:38:08 +08:00
Seigo Nonaka
e5f73f1c18 Add new API for returning max custom fallback families
Bug: 119620208
Test: TypefaceCustomFallbackBuilderTest
Change-Id: I7ef69bdebdce7d5dc4cbea2d30965c93197e965f
2018-11-19 10:11:02 -08:00
John Reck
5c6397e9bb Add compat workaround
Bug: 119066174
Test: repro from bug
Change-Id: Ifc50fc64422d571ee94ce8510825aed7f915adfd
2018-11-14 15:25:10 -08:00
TreeHugger Robot
958176c775 Merge "Update API doc of Typeaface.setSystemFallback" 2018-11-10 23:34:30 +00:00
TreeHugger Robot
a87656a7b5 Merge "Tweak RenderNode final/constructor API" 2018-11-10 06:31:40 +00:00
Seigo Nonaka
06dfab0136 Update API doc of Typeaface.setSystemFallback
Bug: 116116764
Test: N/A
Change-Id: I97ebdcfd8d4b4efb0a1d9e3729f74fe7fba96b12
2018-11-09 17:02:36 -08:00
John Reck
e5bc78ff9d Tweak RenderNode final/constructor API
Bug: 112709971
Test: builds
Change-Id: Idc558645015078b923bd94abc320b2a65d8d2c6b
2018-11-09 15:18:43 -08:00
John Reck
6ae76d0d8a Merge "Refactors and a potential public API for rendering" 2018-11-09 19:16:27 +00:00
TreeHugger Robot
c578d38eb7 Merge "Deprecate Drawable#getOpacity" 2018-11-09 03:55:04 +00:00
TreeHugger Robot
34f042d290 Merge "Updated ColorDrawable setAlpha/getAlpha documentation" 2018-11-09 01:46:33 +00:00
Nader Jawad
fc063e9c22 Updated ColorDrawable setAlpha/getAlpha documentation
Updated documentation on ColorDrawable to clarify that the alpha
value provided is combined with the color's already existing alpha
value instead of overwriting it.

Bug: 119004459
Test: Build and boots
Change-Id: Id62462c4ac7d2f46cdc3236876f7e0711fbc4c16
2018-11-08 15:53:47 -08:00
Nader Jawad
3d5c03df79 Deprecate Drawable#getOpacity
Deprecated getOpacity method on Drawable as the graphics optimization
is no longer utilized in the framework

Bug: 118841703
Test: Build and boots
Change-Id: Ie21c9379a5e9737ed68c09c2e518732c1578b3cb
2018-11-08 15:33:31 -08:00
John Reck
8785ceb3b9 Refactors and a potential public API for rendering
Split out the View/ViewRootImpl bits from the
hardware rendering bits.

Create a potential public API surface for
hardware rendering

Bug: 112709971
Test: builds & boots

Change-Id: I9e6f44b07a170574a905f42338282c4bb7e95f56
2018-11-08 15:32:35 -08:00
TreeHugger Robot
e6bded0d4a Merge "Pass custom fallback info to minikin" 2018-11-07 09:01:42 +00:00
Shuzhen Wang
68e8199c64 Merge "Camera: Unhide and update Y8 format spec" 2018-11-07 05:54:39 +00:00
Seigo Nonaka
f69e7037ba Pass custom fallback info to minikin
The custom fallback info is used for determine the priority between
custom fallback and locale fallback. The custom fallback should be
given priority over locale fallback.

Bug: 116512426
Test: minikin_tests
Test: atest TypefaceCustomFallbackBuilderTest
Change-Id: I79cc82fa990d7705ea5c40e9b0be40d062c218dc
2018-11-07 03:52:35 +00:00
Seigo Nonaka
c1b6ab69c6 Introduce new API for specifying user font fallback
Bug: 111133573
Test: atest TypefaceCustomFallbackBuilderTest
Change-Id: I0345824ecd475e43dbb5e5451f647020c4b53a83
2018-11-06 10:56:30 -08:00
Seigo Nonaka
0a2786cc5d Merge "Refactor Typeface construction logic" 2018-11-05 21:09:23 +00:00