Commit Graph

3687 Commits

Author SHA1 Message Date
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
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
John Reck
ddeaa487da Make RenderNode public API
Bug: 112709971
Test: CtsUiRenderingTestCases:.testclasses.RenderNodeTests
Change-Id: I57d64165b842d03565eda5f4d37343c4f9c45d42
2018-11-02 14:24:32 -07:00
Siyamed Sinir
3bef4908b2 Move MeasuredText.sRegistry to Builder
Test: atest android.graphics.text.cts.MeasuredTextTest
Test: atest android.graphics.text.cts.LineBreakerTest
Test: atest android.text.cts.StaticLayoutTest

Bug: 117888473
Bug: 112327179
Change-Id: I0c1b86928429dce02867ac0cba674e0f69fc5fdf
2018-10-30 16:53:59 -07:00
Seigo Nonaka
ee4b6d85dc Refactor Typeface construction logic
API refactoring:
- Replace Font.getWeight()/getSlant() with Font.getStyle().
- Change Typeface.CustomFallbackBuilder.setItalic() to setSlant()

Implementation refactoring:
- Add hidden builder API for asset manager with cookie. The cookie is
internal, so hide the API as well.
- Replace createFromResources with Typeface.Builder
- Reimplement Typeface.Builder with Typeface.CustomFallbackBuilder

Ground work for b/114479228
- Keep list of FontFamily in the Typeface.

Bug: 114479228
Test: atest CtsTestCases
Test: atest CtsGraphicsTestCases
Test: atest CtsWidgetTestCases
Change-Id: Ifaaa58ddea147644a93158aa075394c2f645617c
2018-10-30 12:18:12 -07:00
TreeHugger Robot
a5ce2c7c7c Merge "Register generic font families in Zygote" 2018-10-29 20:06:34 +00:00
Shuzhen Wang
ec5e8d25f0 Camera: Unhide and update Y8 format spec
- Unhide Y8 format as part of MONOCHROME camera support.
- Specify required stream combination for Y8 format.

Test: Camera CTS test
Bug: 70216652
Change-Id: Iab28b7ee3f2d5ec534a517079f14e0ed648ae556
2018-10-29 07:44:13 -07:00
TreeHugger Robot
815aa66d3c Merge "Update some docs & tweak some method names" 2018-10-27 00:24:59 +00:00
Seigo Nonaka
d06aa0ab1f Register generic font families in Zygote
Bug: 114479228
Test: TreeHugger and verified this is booted manually
Change-Id: I5e2c25ad01d5686e6116f343c7345d43f8160c62
2018-10-26 17:17:48 -07:00
John Reck
c7ddcf390f Update some docs & tweak some method names
Test: builds
Change-Id: Id0e5cf6fdb3a391136a1d314498f75e0b954ceeb
2018-10-26 13:57:12 -07:00
TreeHugger Robot
3fb3ac1ab2 Merge "Keep file path used to create SkTypeface in MinikinFontSkia" 2018-10-26 04:12:51 +00:00
John Reck
c59e7dd6ad Merge "Clarify createScaledBitmap's 'filter' docs" am: e0f6d84ba1 am: 324cb8c075
am: c2eaf48e42

Change-Id: Id0a228f273f83b238ba1df92a78b7a0da66c4209
2018-10-25 18:17:28 -07:00
Seigo Nonaka
54c6a2722b Keep file path used to create SkTypeface in MinikinFontSkia
This is a ground work for the itemize API. The file path will be the
output of the itemize API.

Bug: 114479228
Test: minikin_tests
Test: hwui_unit_tests (only tested on 32bit. couldn't test 64bit)
Change-Id: I70252594889175bf5fa0013bbaa95c6c87ca5680
2018-10-25 22:49:04 +00:00