3101 Commits

Author SHA1 Message Date
TreeHugger Robot
e6746726bc Merge "Revise method comment on setFontVariationSettings" into oc-dev 2017-04-27 17:34:48 +00:00
Seigo Nonaka
080b054bdd Font API clean up
- Move FontRequest from android.graphics.fonts to android.provider since
  this is only used by android.provider.FontsContract and never draw
  anything.
- FontRequest is no longer being Parcelable.
- Remove FontSpec.aidl which is not necessary.

Bug: 37326126
Test: am instrument -w -e class android.provider.FontsContractTest
      com.android.frameworks.coretests/\
      android.support.test.runner.AndroidJUnitRunner
Test: am instrument -w -e class android.provider.cts.FontProviderTest
      android.provider.cts/android.support.test.runner.AndroidJUnitRunner
Test: am instrument -w -e class android.provider.cts.FontRequestTest
      android.provider.cts/android.support.test.runner.AndroidJUnitRunner

Change-Id: I0eb501844247c2f07eaa1fc7a71f72e404888b5b
2017-04-26 18:00:17 +00:00
Seigo Nonaka
d9de8be233 Load font file from remote provider synchronously.
Since CancellationSignal is not guaranteed to be handled by remote
process, introduce threaded font loading mechanism.
At the same time, this fixes possible NPE issue in openFont.

Bug: 37552479
Test: am instrument -w -e class android.provider.FontsContractE2ETest
      com.android.frameworks.coretests/\
      android.support.test.runner.AndroidJUnitRunner

Change-Id: Ie235c5a57bd172b0882da5aa27a990d7c6686ff2
2017-04-25 21:19:22 -07:00
Seigo Nonaka
54084b64b1 Font provider cleaning ups.
- Remove Columns.STYLE
- Decouple Context from Typeface.
- Make FontsContract constructor private since it is essentially static.
- Removed unused constants.

Bug: 37281200
Bug: 37268410
Test: am instrument -w -e class android.provider.FontsContractE2ETest
      com.android.frameworks.coretests/\
      android.support.test.runner.AndroidJUnitRunner
Test: am instrument -w -e class android.provider.FontsContractTest
      com.android.frameworks.coretests/\
      android.support.test.runner.AndroidJUnitRunner
Test: am instrument -w -e class android.graphics.cts.TypefaceTest
      android.graphics.cts/android.support.test.runner.AndroidJUnitRunner
Change-Id: Ic46c256141d27ca28f30023bcc40f4e1161d5338
2017-04-25 19:40:58 +00:00
Seigo Nonaka
5a09c64345 Remove Typeface.create
Test: Manually done
Bug: 37514611
Bug: 37463988
Bug: 37281200
Change-Id: Ida704af910e0ae195b96803de506fa1e1d66c9f5
2017-04-25 09:38:39 -07:00
Jeff Sharkey
6bc03748a7 Merge "More auto-doc work." into oc-dev 2017-04-22 19:11:34 +00:00
TreeHugger Robot
aec1fbeaa3 Merge "Fix @throws javadoc on SurfaceTexture ctors" into oc-dev 2017-04-21 23:25:54 +00:00
TreeHugger Robot
5be3647a9e Merge "Propagate density through AdaptiveIconDrawable and BitmapDrawable" into oc-dev 2017-04-21 22:35:57 +00:00
Jeff Sharkey
910e081216 More auto-doc work.
Add support for AnyThread, CallSuper, and UiThread.

Another related CL started documenting @RequiresPermission, so remove
duplicated information in existing APIs.

Suppress auto-doc on a handful of classes that are already
well-documented.

Test: make -j32 offline-sdk-docs
Bug: 37526420
Change-Id: I791437dccec0f11d5349a23b982ba098cb551af8
2017-04-21 16:35:08 -06:00
John Reck
b8d152f5cd Fix @throws javadoc on SurfaceTexture ctors
Change-Id: I63bd76ec4e44251b7e06ad6fc8aa5a3372104656
Fixes: 37323694
Test: Looked at generated docs, verified correct
2017-04-21 13:49:36 -07:00
Adam Lesinski
50954d2b4e Propagate density through AdaptiveIconDrawable and BitmapDrawable
Resources#getDrawableForDensity now propagates the overridden
density through to AdaptiveIconDrawable so that the density can be
propagated to leaf BitmapDrawables correctly.

This enables AdaptiveIconDrawable to support higher resolution
foreground/background bitmaps for use in Launcher.

Bug: 36039665
Test: bit CtsContentTestCases:android.content.res.cts.ResourcesTest
Change-Id: Iaa9a5592626e38e1ff839a76f7c6cfb9e16e5dc1
2017-04-21 13:25:44 -07:00
TreeHugger Robot
eedceb5721 Merge "Add transfer mode support to ColorDrawable" into oc-dev 2017-04-21 19:29:07 +00:00
Seigo Nonaka
daa8dfc690 Cache the Typeface based on the FontRequest.
Bug: 37471729
Test: FontsContractE2ETest
Change-Id: Ifb1bd2b50077471404f5f1dffc01e7697d7042e6
2017-04-21 09:11:10 -07:00
TreeHugger Robot
ab7a2879eb Merge "Support fraction type for inset* for InsetDrawable. b/36024318" into oc-dev 2017-04-21 15:14:27 +00:00
TreeHugger Robot
337be5a12f Merge "Update Typeface callback docs about error codes" into oc-dev 2017-04-21 09:44:53 +00:00
Hyunyoung Song
d0dfe3008d Support fraction type for inset* for InsetDrawable.
b/36024318

Test: manually tested on default icons.
Test: $ runtest --path=cts/tests/tests/graphics/src/android/graphics/drawable/cts/InsetDrawableTest.java

adb  shell am instrument -e class 'android.graphics.drawable.cts.InsetDrawableTest' -w 'android.graphics.cts/android.support.test.runner.AndroidJUnitRunner'

android.graphics.drawable.cts.InsetDrawableTest:........................

Time: 0.132

OK (26 tests)

Change-Id: Ie8d24680b6884e65017f07723a371120f5ae610c
2017-04-20 16:23:40 -07:00
Lucas Dupin
b27b47df6b Add transfer mode support to ColorDrawable
Test: runtest --path cts/tests/tests/graphics/src/android/graphics/drawable/cts/ColorDrawableTest.java
Change-Id: Ice87f248e307710315304fc191cb58ee7142e525
2017-04-20 13:57:01 -07:00
Clara Bayarri
5706a1b12d Update Typeface callback docs about error codes
As requested by API council, mention that the provider may
return its own error codes within the positive int range.

Bug: 37084803
Test: none
Change-Id: Ia8ee99432cc5025a12d43049e327605095dd2b57
2017-04-20 12:02:57 +01:00
TreeHugger Robot
e53b00c6d1 Merge "Set the color space as nullptr on native bitmaps when sRGB is requested" into oc-dev 2017-04-19 21:09:46 +00:00
TreeHugger Robot
611fae13df Merge "Fix compose shader child local matrix mutation" into oc-dev 2017-04-19 20:41:06 +00:00
TreeHugger Robot
f3157e1692 Merge "Add comment to Typeface.Builder about file descriptor." into oc-dev 2017-04-19 20:08:57 +00:00
Romain Guy
08587d45b1 Set the color space as nullptr on native bitmaps when sRGB is requested
This regression is a fallout from the recent API council feedback
fallout. The default color space used to be always set to null but
it's now the named SRGB instance. This change passes null to native
when the specified color space is known to be sRGB.

Bug: 37496760
Test: runtest managed-provisioning
Change-Id: Ie933c84e429a682a58ee253b57b77bd61b88ee5e
2017-04-19 11:58:05 -07:00
Chris Craik
f6b0e60bd0 Fix compose shader child local matrix mutation
Bug: 37495696
Test: cts-tradefed run singleCommand cts-dev --module CtsGraphicsTestCases --test android.graphics.cts.ComposeShaderTest

Adds back the verify step that discards a stale native ComposeShader if a child
changes.

Change-Id: I44f40c1edfdb7633994a69efb583cf28ee2c26b2
2017-04-19 10:57:25 -07:00
TreeHugger Robot
944782fac2 Merge "Change nullability of colorspace parameter" into oc-dev 2017-04-18 23:26:00 +00:00
Romain Guy
1fa9d86ea4 Change nullability of colorspace parameter
Bug: 37323693
Test: android.graphics.cts.BitmapColorSpaceTest
Change-Id: I705ac18e5c64c028c2e8366a18ec4ef20f44a630
2017-04-18 14:06:49 -07:00
Chris Craik
8a6ad4a89d Re-hide shader mutation, remove colorfilter mutation
Bug: 36025103
Bug: 37327129
Test: boots, CtsGraphicsTestCases passes

Change-Id: I937f8ae26ed47b4811dc033ed91c257670fc3a39
2017-04-18 12:57:59 -07:00
Seigo Nonaka
83ba4f9a04 Add comment to Typeface.Builder about file descriptor.
Add comment to Typeface.Builder about the responsibility of closing
file descriptor.

Bug: 37082657
Test: N/A
Change-Id: Id33b15895d75ad6693f3ad6231f1ba0c2cec9f79
2017-04-17 19:33:00 -07:00
Romain Guy
5545518123 Properly decode colors spaces in BitmapRegionDecoder
Reusing a bitmap with BitmapRegionDecoder would preserve the
previous color space. This change also tweaks color space
matching to make sure we pick Display P3 with parameter d=0.039
or d=0.04045

Bug: 36905374
Test: CtsGraphicsTestCases
Change-Id: I4d2d66e5babebb0b5ce5cbdc7e8244177b4b7f9c
2017-04-15 21:41:22 -07:00
Seigo Nonaka
92009445e0 Revise method comment on setFontVariationSettings
- Update Paint's description to be the same description as TextView.
- Update example code to use more standard axes.
- Check generated reference page and fix some errors.

Bug: 37324923
Test: Checked generated reference page.

Change-Id: Ib6504df3bd149fd47f037f8d03701b2167d10e5a
2017-04-14 15:27:46 -07:00
TreeHugger Robot
5f9fde884b Merge "Fix boot loop issue on Android Wear." into oc-dev 2017-04-14 22:16:22 +00:00
Romain Guy
c99bcc69f7 Merge "Add BitmapFactory.Options.inColorSpace" into oc-dev 2017-04-14 21:08:42 +00:00
TreeHugger Robot
1eaab2db82 Merge "Clarify doc for Bitmap.createBitmap()" into oc-dev 2017-04-14 20:53:26 +00:00
TreeHugger Robot
03758701fb Merge "Fix API feedback on Color" into oc-dev 2017-04-14 20:42:19 +00:00
Romain Guy
95648b8a59 Add BitmapFactory.Options.inColorSpace
This allows applications to load bitmap in a preferred
target color space, similar to inPreferredConfig for
configurations.

This change also applies recent changes made to BitmapFactory
to BitmapRegionDecoder: support for outColorSpace, inColorSpace
and outConfig.

Bug: 32984164, 36905374
Test: CtsGraphicsTestCase (BitmapColorSpaceTest/BitmapRegionDecoderTest)
Change-Id: I4eded9190d1aa9c7f3033f9bb78a6854cc48a3ef
2017-04-14 10:14:27 -07:00
Seigo Nonaka
43112fd26e Merge "Use provided style for fallback font selection" into oc-dev 2017-04-14 15:13:15 +00:00
Romain Guy
7c42e16eb0 Clarify doc for Bitmap.createBitmap()
Bug: 37323693
Test: compiles
Change-Id: I8cf316cf4c67b69c47c67848c576af6399a0111f
2017-04-13 20:48:29 -07:00
Romain Guy
26ca96ecb8 Fix API feedback on Color
Bug: 37323188
Test: Color_ColorLongTest and ColorSpaceTest in CtsGraphicsTestCases
Change-Id: I1e52d3f63f95b9bdb4410938b727a87c45429aac
2017-04-13 20:40:46 -07:00
TreeHugger Robot
4cae059bb9 Merge "Add more doc to ColorSpace.getName()" into oc-dev 2017-04-14 03:10:16 +00:00
Seigo Nonaka
bf629ed080 Fix boot loop issue on Android Wear.
The boot loop was seen after I65e220aca823fd815a52437b11c8e6dc952de8e2
but only on Android Wear. On Android Wear, some font files are missing
but are listed in fonts.xml. Before that patch, we created a Typeface
object with an empty FontFamily even if there was no valid font entry
in font-family tag. However, after that patch, FontFamily stopped
creating native objects and holds a null pointer instead. As the
result, SIGSEGV happens.

The right fix is skipping Typeface creation if native code failed to
create the font family object.

Since Typeface.init cannot be called twice, this is hard to test
automatically.

Bug: 37328609
Bug: 37326002
Test: Boot succeeded even after removing CutiveMono.ttf from system.

Change-Id: I125de07343252784986d728c3bbaa46b24ace601
2017-04-13 18:58:36 -07:00
Seigo Nonaka
d154829cb1 Use provided style for fallback font selection
If the developer gives some weight/italic to the Typeface.Builder
the fallback used the metadata in the font file. We should use
provided data instead.

This CL also adjusts upper and lower limits on weight, from 100..900 to
1..1000

Bug: 37257745
Bug: 37251569
Test: android.graphics.cts.TypefaceTest passes
Change-Id: I7cf390d96b49afcce359928373698b0c9a9babd8
2017-04-14 00:54:46 +00:00
Romain Guy
819740cc73 Merge "Range check transfer params in float domain" into oc-dev 2017-04-13 23:35:27 +00:00
Romain Guy
bfa58aab0a Range check transfer params in float domain
Our native code uses floats for transfer parameters, the range
check was too small (using the next representable double instead
of the next representable float).

Bug: 37013532
Test: Manual run of broken app, CtsGraphicsTestCases
Change-Id: Id91a3e62068be0abf13ee75e39c758eb106a5f24
2017-04-13 12:59:38 -07:00
TreeHugger Robot
729a515e5e Merge "Introduce setFallbackTypeface" into oc-dev 2017-04-13 19:21:25 +00:00
Romain Guy
cb7a24539b Add more doc to ColorSpace.getName()
Bug: 37084802
Test: make offline SDK docs
Change-Id: Ia2c3406951d615dcee1eafad8035c5c8aea4305b
2017-04-13 10:21:05 -07:00
TreeHugger Robot
d09be1c0e9 Merge "Introduce FontsContract.requestFont and deprecate Typeface.create" into oc-dev 2017-04-13 17:13:37 +00:00
Seigo Nonaka
5b6347a6af Introduce setFallbackTypeface
setFallbackTypeface is returned by Builder.build() method when the
provided font is not loaded due to some reasons.
The fallback family is resolved with width/italic passed to Builder.

Bug: 36794225
Test: android.graphics.cts.TypefaceTest passes
Change-Id: I65e220aca823fd815a52437b11c8e6dc952de8e2
2017-04-13 10:12:27 -07:00
Hyunyoung Song
76c13a5fce Merge "Update API, add more documentation on AdaptiveIconDrawable" into oc-dev 2017-04-13 16:53:43 +00:00
Lucas Dupin
498a44f33a Merge "Add transfer mode support to ShapeDrawable" into oc-dev 2017-04-13 16:52:01 +00:00
Seigo Nonaka
0b73a4287e Introduce FontsContract.requestFont and deprecate Typeface.create
Since background fetch should be synchronized with life cycle of
Activities, so should not create new background thread inside this
method. Not to break existing apps, mark as deprecated and will be
removed from public API untile next release.

New API accepts Handler so that the developer can pass their own thread
.

Test: TBD
Bug: 37253785
Change-Id: I87fdc6a354a829db679253824f42489f25698fa0
2017-04-13 06:48:07 -07:00
TreeHugger Robot
061db23b79 Merge "Introduce FontsContract.fetchFonts and expose URI for watching." into oc-dev 2017-04-13 13:22:10 +00:00