Commit Graph

3629 Commits

Author SHA1 Message Date
John Reck
8884cfc13e Merge "Rename & package shuffle" 2018-10-23 20:02:00 +00:00
Seigo Nonaka
9958c4ab21 Introduce FontStyle for future extensibility
This is a ground work for b/114479228
FontStyle is an argument of the font itemization. Currently Android
system uses weight and italic info for itemizing but maybe we will
use width and oblique style in future.
To be extensible in future, introduce FontStyle.

This CL includes:
- new class FontStyle which holds width and italic at this moment. In
  future, we may add width and oblique. (or grdual italic slant)
- Font class still returns weight/slant since they need to be immutable.
- Moved font weight constants from Font to FontStyle

Bug: 114479228
Test: atest CtsGraphicsTestCases
Change-Id: I0ba717fbf9f90ee6f760c1a0f6eda17b4bef6f43
2018-10-19 14:51:59 -07:00
Jeff Sharkey
047edaeaa3 Merge changes I86f597f1,I5c9c09dd
* changes:
  MediaStore deprecations for Q.
  Convenience method for obtaining thumbnails.
2018-10-19 15:21:54 +00:00
Seigo Nonaka
7b86fe573c Change add{StyleRun, ReplacementRun} to append{StyleRun, ReplacementRun}
Giving any range to the Builder is too much freedum and hard to tell
errors. Changes to accept length instead of ranges. By this change, we
can prevent and tell errors about
- The gap in the text that no Paint is assigned.
- The given range is overlapped.
- The given range exceeds the text length.

Bug: 112327179
Test: TreeHugger

Change-Id: Iefc078b1f7be2d006a65b46e0b4ea1018ecb29e7
2018-10-18 14:58:18 -07:00
Jeff Sharkey
4e5efa3186 Convenience method for obtaining thumbnails.
Obtaining a thumbnail for a Uri requires opening it with the slightly
obscure openTypedAssetFileDescriptor(), passing in "image/*" with the
right Bundle of EXTRA_SIZE to hint the target area on screen, and
defensively scaling any returned results.

This is pretty tedious to get right, so offer a convenience method
that does all this for the developer.  Internally uses ImageDecoder
to follow best-practices, and replaces older getDocumentThumbnail()
implementation by delegating to this one.

A future CL will teach ImageDecoder about how to read any embedded
EXIF thumbnails, including any required rotation.

Bug: 111268862
Test: atest FrameworksCoreTests:android.content.ContentResolverTest
Change-Id: I5c9c09ddf9b480f3b5c6ade0a078cccb68de2f2b
2018-10-18 14:32:51 -06:00
Fan Zhang
4a772fc4d2 Merge "Refactor the nativePtr validation code to a method." 2018-10-16 22:04:51 +00:00
Fan Zhang
9fe7cdf3a5 Refactor the nativePtr validation code to a method.
This will make testing much easier.

Bug: 117828816
Test: robotests
Change-Id: I1ca81e2005e559c0ec1e5f468cdd4bc0c21edbea
2018-10-16 13:30:03 -07:00
Peiyong Lin
dbd6e3fd88 Merge "[Graphics] Align Display P3 transfer function coefficients." 2018-10-16 16:48:46 +00:00
Peiyong Lin
f198118ba1 [Graphics] Align Display P3 transfer function coefficients.
The transfer function of Display P3 should be sRGB transfer function,
previously we defined f as 0.039, however, the sRGB transfer function defines f
as 0.04045. This patch fixes it.

BUG: 116726537
Test: Build, flash and boot

Change-Id: I247092d8ce939aa743f23a1f8688cbaf0874fb99
2018-10-15 17:06:53 -07:00
Seigo Nonaka
aa35899430 Merge "Make LineBreaker public" 2018-10-15 21:56:12 +00:00
Tobias Thierer
0d0dd506ac Merge "Remove unused imports of libcore.io.Libcore." am: 2a520365da am: abe7a32c67
am: 320e38309b

Change-Id: I2f8069235c4e8c298b0e092928a23d15cbe30520
2018-10-12 19:24:25 -07:00
Tobias Thierer
320e38309b Merge "Remove unused imports of libcore.io.Libcore." am: 2a520365da
am: abe7a32c67

Change-Id: I57d7d317f5827a54346e287db3f6f2d625e0aebc
2018-10-12 19:13:38 -07:00
Tobias Thierer
abe7a32c67 Merge "Remove unused imports of libcore.io.Libcore."
am: 2a520365da

Change-Id: I79c4679d483e0e8ea2e434237bd61d75f129da0f
2018-10-12 18:59:21 -07:00
TreeHugger Robot
c5f8fa9d81 Merge "Switch to Skia's new representation of linear gamma" 2018-10-12 15:48:25 +00:00
TreeHugger Robot
91fe37b86e Merge "Revert "Expose the ability to resolve icon as a different app"" 2018-10-12 02:56:57 +00:00
Leon Scroggins III
a95934967a Switch to Skia's new representation of linear gamma
Bug: 77276533
Test: CtsGraphicsTestCases ImageDecoderTest#testColorSpace
      ag/5244477

Although the old one works for [0,1], Skia has switched to this new
representation because it has the following nice properties:
- it extends cleanly above 1
- it's unambiguously defined

Having ColorSpace out of sync results in mismatches between those
objects underlying SkColorSpace objects when they should be the same.

Change-Id: Ie5cf223d6053718aded12b66ea58a874ce888903
2018-10-11 12:27:06 -04:00
Philip P. Moltmann
5aa216924a Revert "Expose the ability to resolve icon as a different app"
This reverts commit 4236ccb7c4.

Bug: 116798569
Reason for revert: This API is not needed as system-API

Change-Id: I90140a55a50067f1aa98d9649dfb97ffb45f03a4
2018-10-11 00:03:41 +00:00
Tobias Thierer
30ff7a093e Remove unused imports of libcore.io.Libcore.
Test: Treehugger
Bug: 115503977
Bug: 117548625
Change-Id: I122fa68ddc2bd531f627dcac00834b47249bd56e
2018-10-10 15:49:51 +00:00
Marius Renn
7cc5a53c25 Merge "Add HardwareBuffer support to Bitmaps" 2018-10-09 23:09:30 +00:00
Seigo Nonaka
70200b0f56 Make LineBreaker public
This CL includes:
- Move NativeLineBreaker/NativeMeasuredParagraph to android.graphics.text
package since these two uses the shaping result of the text which is a
part of graphics responsibility. At the same time, by this moving,
minikin is only used by android.graphics package.
- Rename NativeLineBreaker/NativeMeasuredParagraph to
LineBreaker/MeasuredText.
- Updated comments of the break strategy and hyphenation frequency.

Bug: 112327179
Test: atest CtsTextTestCases CtsGraphicsTestCases CtsWidgetTestCases
Change-Id: Id69c328e7c9097b9fc11b5c0bd04d1c2e0939c6a
2018-10-09 12:16:52 -07:00
John Reck
32f140aa67 Rename & package shuffle
Rename DisplayListCanvas -> RecordingCanvas
Move RecordingCanvas to android.graphics
Move RenderNode to android.graphics

Bug: 112709971
Test: make & boot
Change-Id: Iddeb6a89f8923ea81a1f37bbee4e9b1db8ede238
2018-10-04 16:18:12 -07:00
Jeff Sharkey
8ad9ef4aa9 Merge "Support custom creation of AFD for ImageDecoder." 2018-10-04 20:23:59 +00:00
renn
b2e9f5244b Add HardwareBuffer support to Bitmaps
This adds a new public constructor to Bitmap to allow passing in
a HardwareBuffer to back the Bitmap. Currently, the format of the
HardwareBuffer must be RGBA_8888.

One-Pager: https://docs.google.com/document/d/1n72X-gJZhjeajp4FIQwsGPKFiHBSeWYjC6fkXYe_bS0/edit?usp=sharing
Bug: 116713113
Test: manual - ran CTS tests
Change-Id: Ic437825138eafea526326e6cf300f116867ba29e
2018-10-04 17:15:10 +00:00
Nader Jawad
d4e48c593e Merge "Added support for Canvas#drawDoubleRoundRect in application Canvas API" 2018-10-04 16:46:54 +00:00
Jeff Sharkey
685c4aef82 Support custom creation of AFD for ImageDecoder.
ContentResolver.openTypedAssetFileDescriptor() has support for a
Bundle of options that can be used to communicate things like desired
thumbnail size, and also CancellationSignal to cancel large network
fetches when no longer needed.

Instead of adding all these to ImageDecoder, let developers provide
their own Callable<AssetFileDescriptor> so they can implement these
custom features.

Bug: 111268862
Test: atest cts/tests/tests/graphics/src/android/graphics/cts/ImageDecoderTest.java
Change-Id: I51c509962f50dd08be94507169355b5da54d6782
2018-10-04 10:37:32 -06:00
Issei Suzuki
495de00e0a Merge "Refactor DisplayCutout to use Rect instead of Region." 2018-10-04 08:43:54 +00:00
Issei Suzuki
43190bdf40 Refactor DisplayCutout to use Rect instead of Region.
Test: unittest
Bug: 112296834

Change-Id: I4245543c26f99afa59a34f5b6e6650b93d052a6e
2018-10-03 18:52:33 +09:00
Nader Jawad
adfe1d991b Added support for Canvas#drawDoubleRoundRect in application Canvas API
Exposed Skia's underlying drawDRRect method used to draw a double
rounded rectangle

Bug: 117181396
Test: Added test case to verify Canvas#drawDRRect and re-ran CanvasTests
Change-Id: I4e1954c8ffc82811dc541488d1df9b37309faf51
2018-10-02 17:12:15 -07:00
Seigo Nonaka
e96517edd2 Merge "Introduce OEM customization XML parser" 2018-10-01 21:21:14 +00:00
Michael Wachenschwanz
03b9731830 Merge changes from topic "UsageStats2Proto"
* changes:
  Pool Package and Class names when writing UsageStats to disk
  Upgrade UsageStatsDatabase from XML to Protobuf
2018-10-01 21:20:56 +00:00
Michael Wachenschwanz
c8c26365a4 Upgrade UsageStatsDatabase from XML to Protobuf
Add the relevant methods to read from ProtoInputStream to
various classes.

Also add some framework to handle version changes in
UsageStatsDatabase. There is some risk of users losing all their current
UsageStats data, if something goes horribly wrong. The debug flag and a
keep backup files flag are temporarily set in UsageStatsDatabase with
this change. They will both be unset in the future before the Q release.

Some rough number on the impact of this change:
Proto file size on disk reduces to ~47% of XML file size :)
Proto file read time reduces to ~55% of XML file read :)
Proto file write time increases ~17% over the XML file write :(

There will be a follow up CL to address the file write time regression

Bug: 111422946
Fixes: 111449927
Test: atest UsageStatsDatabaseTest
Change-Id: I084aea796ed2163c42947d52396a36cc7c5562a2
2018-09-28 16:48:23 -07:00
Seigo Nonaka
3328d1ce55 Introduce OEM customization XML parser
As the initial version of the OEM customization XML, support
new-named-family customization. This allows OEMs to add new named
family.

Bug: 111544833
Test: atest FrameworksCoreTests:android.graphics
Change-Id: If58711fc038898175fcad0ae095865312bd738e2
2018-09-28 15:59:15 -07:00
Jerome Gaillard
38304b594f Merge "Delete method kept for layoutlib" 2018-09-28 09:48:49 +00:00
TreeHugger Robot
18bec393e4 Merge "Address comments from API council" 2018-09-27 17:24:47 +00:00
Jerome Gaillard
746cd4208a Delete method kept for layoutlib
Typeface.buildSystemFallback was kept only because it was used in
layoutlib. Change I33f27f62 (commit a65f963) removed that last use case,
so this now deletes the unused method.

Bug: 112196940
Test: atest FrameworksCoreTests:TypefaceTest
Change-Id: I19b793d34c1ce16d5dc7430c08746261cd52b4b2
2018-09-27 17:08:07 +01:00
John Reck
6b1644022b De-couple RenderNode from View package
First step of moving RenderNode to the graphics package

Test: builds
Change-Id: Ife7f5ec6698e32393d1b85ed2bad909ef0210be4
2018-09-26 16:29:32 -07:00
Seigo Nonaka
aaa85d6818 Address comments from API council
This CL includes:
- Fix typo
- Make SystemFonts final
- Storing readonly buffer in Font

Bug: 116224077
Bug: 116224515
Test: m update-api && m docs
Change-Id: Ib7442bac6d2d8efea4deff1fd309940794c20a88
2018-09-26 11:11:27 -07:00
Seigo Nonaka
47e79a1626 Merge "Move hasEqualAttribute from Paint with adding some accessors" 2018-09-25 18:34:26 +00:00
TreeHugger Robot
e64d55010f Merge "Create plumbing for disabling force-dark" 2018-09-24 19:54:33 +00:00
TreeHugger Robot
03bc1ab26f Merge "Fix a typo in ImageDecoder documentation" 2018-09-24 17:03:18 +00:00
John Reck
1423e1331f Create plumbing for disabling force-dark
Test: sysui's rounded corners are no longer white
Bug: 102591313

Change-Id: Id99ae38c354cef06b94a5fb79b5b1a9a216a514c
2018-09-24 09:34:18 -07:00
Leon Scroggins III
3da032dcb6 Fix a typo in ImageDecoder documentation
Bug: None
Test: None - no change in behavior
Change-Id: Ibd1e8721b4cead7ba841cf0e1f982610f991698c
2018-09-21 15:47:47 -04:00
Seigo Nonaka
fa95b83df7 Unhide getTextRunCursor APIs
This API is necessary for identifying the cursor locations.

Bug: 112327179
Test: atest android.graphics.cts.PaintTest
Change-Id: Ief6770bd622a296ae356094fe3ce58e9c4371088
2018-09-18 15:06:19 -07:00
Seigo Nonaka
93890b2e2e Unhide getTextBounds for CharSequence
Bug: 112327179
Test: atest android.graphics.cts.PaintTest
Change-Id: I1d2c5c5710dbe15d0352735ce18d9bb9d6f4dbc7
2018-09-18 14:17:38 -07:00
Seigo Nonaka
32b87e01e0 Move hasEqualAttribute from Paint with adding some accessors
Paint#hasEqualAttributes is not a equal method in Paint.
TextLine depends on this method but making this public will make
developer confused. So, moving hasEqualAttributes to TextLine and
provide some accessors for shadow layer parameters.

For the TextPaint, unhide underlineColor and underlineThckness for
implementing equalAttributes in TextLine.

Bug: 112327179
Test: atest android.graphics.cts.PaintTest
Change-Id: I4565e18134856e31d26bd06bcddeb31ddbe7e093
2018-09-18 14:10:14 -07:00
Seigo Nonaka
14a081f271 Merge "Unhide Paint.getTextRunAdvances" 2018-09-17 18:55:54 +00:00
Seigo Nonaka
eb749119e6 Unhide Paint.getTextRunAdvances
This is necessary for getting individual character advances.

The only char[] version of getTextRunAdvances is used, so removing
String/CharSequence versions.

Bug: 112327179
Test: atest android.graphics.cts.PaintTest#testGetTextRunAdvances
Change-Id: Ic49a4742cccb2a5155f6afacef3555e29c7a061c
2018-09-14 11:57:20 -07:00
Mathew Inwood
db0657a4f4 Merge "Move some members to the "Q blacklist"." 2018-09-14 13:54:28 +00:00
Mathew Inwood
8c854f86a4 Move some members to the "Q blacklist".
Based on some analysis, these fields/methods are likely false positives.
Set maxTargetSdk=P so that any apps using them are required to migrate off
them in future. See the bug for more details.

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: I719b5c94e5b1f4fa562dd5d655953422958ad37e
2018-09-14 13:18:34 +01:00
Seigo Nonaka
0eb713d17a Create LocaleList and HashSet lazily to save OS boot time
Creating HashSet and LocaleList in Zygote make performance impact
to the boot time. Since this API is not called so frequently and less
application is expected to call this API. So let's make Set and
LocaleList only when it is requested.

Here is a result of boot time perf test:
Before: TOTAL_BOOT_TIME : 16229.5
After : TOTAL_BOOT_TIME : 11704.0

Bug: 114774424
Test: atest android.graphics.fonts
Test: atest TypefaceSystemFallbackTest
Change-Id: I07247a78f6091c8adfaac748fe4a77a4597b1ae2
2018-09-13 10:58:14 -07:00