3033 Commits

Author SHA1 Message Date
Seigo Nonaka
8b48e62445 Follow minikin::FontFamily constructor signature change.
This is 2nd attempt of Id10ca97f6f6f5bbe4999c1ad2736423a204d6e87.
The root caus of crash is due touching null pointer in nUnrefFamily.
After above change, native object may not be created on error case.
In that case, nUnrefFamily can not be called. In addition to this issue
there is also memory leak on error case. This fixes it by introducing
abortCreation method.

Also this contains fix of layout lib breakage done by jgaillard@.
Originally submitted by Ic8872a43993bcb0a157c5e3f0ce423af9b47f606

Here is original commit message of reverted change.

minikin::FontFamily no longer has addFont function, instead it accept
vector of Fonts in its constructor. To follow this signature change,
holding minikin::Font instance in native and build minikin::FontFamily
instance in FontFamily.freeze() method.

Bug: 34042446
Bug: 28119474
Bug: 34378805
Test: hwui test has passed
Test: m layoutlib layoutlib-tests
Change-Id: Ic34ebaa8191273d4c9f49c43124f15a1da5f7b78
2017-01-24 15:10:29 +09:00
Chris Craik
540dbd08ad Merge "Use @CriticalNative in Canvas" 2017-01-24 00:15:02 +00:00
Chris Craik
bfa0b29883 Use @CriticalNative in Canvas
Bug: 33460152
Test: ViewShowHidePerfTests

Switches non-drawing @FastNative methods to @CriticalNative, except
where out arguments prevent it.

Performance in ViewShowHidePerfTests not significantly impacted.

Change-Id: I3edc963accb4f87f73d175c7b2534868602a7db3
2017-01-23 14:25:06 -08:00
TreeHugger Robot
4a65687b85 Merge "Expose fonts.xml via public API with a service" 2017-01-23 19:57:23 +00:00
Clara Bayarri
764ff2740f Delete accidentally submitted FontResourcesParser
This should have not been part of commit
Idc06bfbfd16452a328bfcc6ea9dcfb723b633f0c

Test: none
Change-Id: I0701e5fad0df898ba64ea695ec31d0dd7d3bb333
2017-01-23 15:43:54 +00:00
Clara Bayarri
04d72abde1 Expose fonts.xml via public API with a service
This change creates a new FontManagerService, in charge of providing
font management data. It exposes a public API to retrieve the
information in fonts.xml without accessing it directly. To do this,
it also refactors FontListParser's internal classes into a new public
FontConfig class holding all the font data.

getSystemFonts() returns all the available information in fonts.xml
as well as file descriptors for all the fonts. This allows us to
share the memory consumed by these files between all clients.

Bug: 34190490
Test: See attached CTS change in topic
Change-Id: I0e922f8bcc9a197a1988d04071eb485328d66fb7
2017-01-23 15:02:23 +00:00
Clara Bayarri
18e9f9f377 Expose Resources.getFont
Based on the work already done in aapt2, load a Font from a
resource id.

Test: WIP
Change-Id: Idc06bfbfd16452a328bfcc6ea9dcfb723b633f0c
2017-01-23 11:18:09 +00:00
Siyamed Sinir
c0d685b87a Revert "Follow minikin::FontFamily constructor signature change."
This reverts commit a0a4828614edfd633ab86f04408e7f4e55b491dd.

Bug: 34378805
Change-Id: Icbdbfbde2efe8eaebbe4334a679e3b3247057388
2017-01-20 02:01:25 +00:00
Siyamed Sinir
24fac986ec Merge "Revert "Introduce set/getFontVariationSettings."" 2017-01-20 01:59:52 +00:00
Siyamed Sinir
a3b9f2e3c6 Revert "Introduce set/getFontVariationSettings."
This reverts commit ba3028c1fc9fca2d45acc841557da2c9a83923bf.

Bug: 34378805
Change-Id: I8250c87af5d65fb45789632580be4ae1b8711372
2017-01-20 01:13:23 +00:00
TreeHugger Robot
03ab3520a8 Merge "Color API to create/store wide-gamut colors in a long" 2017-01-18 04:17:47 +00:00
Romain Guy
77b161e0b1 Color API to create/store wide-gamut colors in a long
This change also includes the ability to create instances of
the Color class to represent more complex colors (any number
of components, etc.).

Test: CtsGraphicsTestCase
Bug: 32984164

Change-Id: I59399547c4aa2580901c93dd16e626fe07f8f23a
2017-01-17 14:32:10 -08:00
Sergei Vasilinetc
1f6df68a90 Merge "Prohibit rendering hardware bitmaps in software mode." 2017-01-17 21:27:52 +00:00
Robert Carr
6486d31dcb Expose SurfaceControl method to screenshot to GraphicBuffer.
A graphic buffer is most useful, as we can both attach it
to starting windows, and directly use it in Sys-UI. The old
codepath for starting windows/saved surfaces, is co-existing
at the moment, so I don't make large attempts to clean up
the existing screenshot code.

Bug: 31339431
Test: Manual test in combination with other branches
Change-Id: I562fdd5460dbce3201ba090272e8731850780f20
2017-01-12 11:16:34 -08:00
Seigo Nonaka
ba3028c1fc Introduce set/getFontVariationSettings.
This CL enables developers to specify axis values to the underlying
font collection. The specification of the font variation settings is
the same as the CSS font-variation-settings attribute in CSS working
draft as of 2016-11-30.

Code example: Here is an example to set width 100 and weight 1.5.

  TextView tv = (TextView) findViewById(R.id.textView);
  tv.setFontVariationSettings("'wdth' 100, 'wght' 1.5");

Bug: 33062398
Test: Manually done. Ran FrameworksGraphicsTests, CtsGraphicsTestCases
      and CtsWidgetTestCases
Change-Id: I249d464f8cdaa56017a987588b94ed685aadeb58
2017-01-12 18:11:03 +09:00
sergeyv
b3061e82eb Prohibit rendering hardware bitmaps in software mode.
Test: CanvasTest#testHwBitmapShaderInSwCanvas1,
CanvasTest#testHwBitmapShaderInSwCanvas2
CanvasTest#testDrawHwBitmapInSwCanvas

bug:30999911
Change-Id: Ia8cf4578db160d52a4c56060beb66ed9a58f1eaa
2017-01-11 10:28:09 -08:00
Seigo Nonaka
a0a4828614 Follow minikin::FontFamily constructor signature change.
minikin::FontFamily no longer has addFont function, instead it accept
vector of Fonts in its constructor. To follow this signature change,
holding minikin::Font instance in native and build minikin::FontFamily
instance in FontFamily.freeze() method.

Test: hwui test passed
Change-Id: Id10ca97f6f6f5bbe4999c1ad2736423a204d6e87
2017-01-11 17:57:59 +09:00
Derek Sollenberger
c543713bab Merge "Remove clipRegion from the public API." 2017-01-09 18:01:50 +00:00
sergeyv
6e3658a638 Hidden method to get a graphic buffer from a hardware bitmap
Test: locally tested Bitmap.getGraphicBuffer()
bug:30999911
Change-Id: I68d56d769045bada6a5db90ed884a570c49be4fd
2017-01-05 17:03:48 -08:00
sergeyv
0a0f23163a Move GraphicBuffer to graphics package
Test: locally tested Bitmap.createHardwareBitmap method
bug: 30999911
Change-Id: Iad432577f26f2362ede9e77cd8a5425c010692e5
2017-01-04 14:01:52 -08:00
Derek Sollenberger
b29b16e542 Remove clipRegion from the public API.
This API is difficult to support for printing and has other negative
effects as it does not respect the current matrix/clip.

Test: compile
Bug: 14650725
Change-Id: I71f9bd687d446c7ce8910d755421aad8e09458db
2017-01-04 14:57:43 -05:00
sergeyv
980bead518 Prohibit copyPixelsToBuffer & copyPixelsFromBuffer
Test: BitmapTest#testHardwareCopyPixels(From|To)Buffer
bug:30999911
Change-Id: I3bfa2846bff574bc0bfd54674eac794d1a6a0ff9
2017-01-03 15:54:57 -08:00
sergeyv
81f97ee47c HardwareBitmaps: support createBitmap methods that return immutable bitmap
Test: testCreateScaledBitmap, testCreateTransformedBitmap, testCreateSubsetBitmap in HardwareBitmapTests
bug:30999911
Change-Id: Ic128dfed78b18ad6f12dad50023ee7c2f5bfa4ad
2017-01-03 15:53:03 -08:00
Sergei Vasilinetc
99418fb205 Merge "Throw exception if getPixel(s) is called on a hardware bitmap" 2016-12-20 18:56:31 +00:00
Sergei Vasilinetc
3029730399 Merge "Add docs about Config.HARDWARE in Bitmap.writeToParcel method" 2016-12-20 18:55:21 +00:00
Mark Lu
b927731284 docs: update Paint.setTextSize() to indicate pixel units am: 5f05256106 am: 9c834b1241 am: 4da3266828
am: 84f12cd33e

Change-Id: I463334d7c43cb934848e10eb3040f4a898f6ed2c
2016-12-19 20:34:29 +00:00
Mark Lu
84f12cd33e docs: update Paint.setTextSize() to indicate pixel units am: 5f05256106 am: 9c834b1241
am: 4da3266828

Change-Id: I65e2a1c43bd049e5c4cada55e8689ecc98a70fa5
2016-12-19 20:27:51 +00:00
sergeyv
57eafc6f90 Throw exception if getPixel(s) is called on a hardware bitmap
Test: android.graphics.cts.BitmapTest#testHardwareGetPixel
bug:30999911
Change-Id: Ifa5a80d048c44c91122e9e7c79ca3ef9ecab963e
2016-12-19 11:52:06 -08:00
sergeyv
f161dce70e Add docs about Config.HARDWARE in Bitmap.writeToParcel method
Test: android.graphics.cts.BitmapTest#testWriteHwBitmapToParcel
bug:30999911
Change-Id: I5282df7d881d76f3e78979a2e5d3777f78673a5d
2016-12-19 10:56:27 -08:00
Sergei Vasilinetc
8b6fe1d894 Merge "Support Bitmap.copy for hardware bitmaps" 2016-12-19 18:41:21 +00:00
Mark Lu
cab02c5b3a docs: update description for BitmapFactory.Options#inBitmap am: a8f4286272 am: 58d24b22ed am: 2b77de3a44
am: f34e9fc48d

Change-Id: I856c71a7b0dd930ecc0b5cc8805060a65a197324
2016-12-19 18:14:24 +00:00
Mark Lu
5f05256106 docs: update Paint.setTextSize() to indicate pixel units
bug: 2321154
Change-Id: Ic71404677a8079c744b99d4848d69c6ff52089ab
2016-12-17 07:23:29 +00:00
Mark Lu
2b77de3a44 docs: update description for BitmapFactory.Options#inBitmap am: a8f4286272
am: 58d24b22ed

Change-Id: I8e3a23304924623e2379155dcc7df1f739a5b7f0
2016-12-17 02:28:22 +00:00
sergeyv
05126d151e Support Bitmap.copy for hardware bitmaps
Test: android.uirendering.cts.testclasses.HardwareBitmapTests#testBitmapConfig*
bug:30999911
Change-Id: I2e80dff914bfa0666290701072ac93d30d218e8d
2016-12-16 17:46:10 -08:00
Mark Lu
a8f4286272 docs: update description for BitmapFactory.Options#inBitmap
bug: 18730109
Change-Id: Iab062d41af3a32208d3500179d3737278a035188
2016-12-16 15:43:27 -08:00
Romain Guy
f7e79d6eb3 Remove RGBX_FP16 format
Bug: 32984164
Test: compile
Change-Id: I22ffe0991d3c4add68317a0554dcac6a7ac56d12
2016-12-16 10:23:21 -08:00
Romain Guy
9505a65527 Add new RGBA_F16 bitmap config
This configuration uses 64 bits per pixel. Heach component is stored as a
half precision float value (16 bits). Half floats can be decoded/encoded
using android.util.Half.

RGBA_F16 bitmaps are used to decode wide-gamut images stored in 16 bit
formats (PNG 16 bit for instance). aapt is currently not aware of PNG
16 bits so such files must be placed in raw/ resource directories.

This first pass provides only partial drawing support with hardware
acceleration. RGBA_F16 bitmaps are stored in linear space and need
to be encoded to gamma space with the appropriate OETF to be rendered
properly on Android's current surfaces. They are however suitable for
linear blending. Full rendering support will be provided in a future
CL (BitmapShaders might be a bit tricky to handle properly during
shader generation).

Bug: 32984164
Test: bit CtsGraphicsTestCases:android.graphics.cts.BitmapRGBAF16Test

Change-Id: I328e6b567441a1b9d152a3e7be944a2cf63193bd
2016-12-16 09:15:07 -08:00
Chris Craik
15589c36d7 Merge "Outline & Path perf improvements" 2016-12-14 18:03:22 +00:00
Sergei Vasilinetc
82f8f3e04e Merge "Prohibit Config.HARDWARE in factory methods, that create mutable bitmaps" 2016-12-14 17:40:49 +00:00
Chris Craik
2414e1b051 Outline & Path perf improvements
Bug: 33460152
Test: device boots, ViewShowHidePerfTests#add[Factory:NestedLinearLayoutTree,depth:6] 770us -> 650us (userdebug 960MHz bullhead)

Improve perf for outline & simple path methods

native_methodName -> nMethodName in Path.java

Change-Id: Id2374bbaca3256d2e4f19dae9abe67f794a171b3
2016-12-13 16:52:08 -08:00
sergeyv
9fbb0b5ab3 Prohibit Config.HARDWARE in factory methods, that create mutable bitmaps
Test: android.cts.graphics.BitmapTest#testCreateMutableBitmapWithHardwareConfig
bug:30999911
Change-Id: I7cd4e2625563b6659613ccd180a57c56dcf7c2b1
2016-12-12 17:46:59 -08:00
Derek Sollenberger
dcc3630100 Remove Rasterizer and its subclasses from the public API.
Test: compile
Bug: 14650725
Change-Id: I99e1942d4d1b85f4efdcb3faf3fee1aa6c839b7e
2016-12-12 10:53:58 -05:00
TreeHugger Robot
0221d16cf4 Merge "Allow only U+0020..U+007E characters for axis tag." 2016-12-02 19:48:57 +00:00
Seigo Nonaka
0ec4f416ff Allow only U+0020..U+007E characters for axis tag.
CSS Font4 only allows U+0020..U+007E characters for tag string.
Reject outside of this range.

Bug: 33062398
Test: am instrument -w -e class android.graphics.VariationParserTest \
com.android.frameworks.graphicstests/android.test.InstrumentationTestRunner
Change-Id: Ia119151bc67caebfdaacda17aa3ee261a9e5d872
2016-12-02 18:24:00 +00:00
Teng-Hui Zhu
14efe881d4 Update the documentation related to VD / AVD
fix:32705240
fix:32683765
fix:32831830
fix:32705244

Test: make offline-sdk-docs and view the HTML file.
Merged-In: I6ae3e5850494f13a241b2e9e4d2c5b95d5199aae

Change-Id: I6ae3e5850494f13a241b2e9e4d2c5b95d5199aae
2016-12-01 11:18:51 -08:00
Amith Yamasani
f81df2d5e5 Merge "Secure MATCH_UNINSTALLED_PACKAGES across users" 2016-12-01 17:01:07 +00:00
TreeHugger Robot
b059a0826d Merge "Add API to visualize/debug/compare color spaces and colors" 2016-12-01 02:23:47 +00:00
Amith Yamasani
0d1fd8d091 Secure MATCH_UNINSTALLED_PACKAGES across users
Introduce a new internal flag MATCH_ANY_USER for genuine uses
of searching through all apps on the device.

Some temporary accommodations for Launchers that reach across
to the work profile until we have a new LauncherApps API to do
that officially.

Bug: 31000380
Test: CTS tests added
Change-Id: I2e43dc49d6c2e11814a8f8d1eb07ef557f31af34
2016-11-30 13:24:53 -08:00
Romain Guy
15296a2d34 Add API to visualize/debug/compare color spaces and colors
ColorSpace.createRenderer() returns a ColorSpace.Renderer which
can be used to visualize multiple color spaces and colors (each
associated with a specific color space) in the same CIE 1931 xyY
chromaticity diagram. This API was used to generate all the
diagrams shown in the documentation.

Bug: 32984164
Test: ColorSpaceTest in CTS
Change-Id: Ic94d939d5cfd563d826701f5e876b67b47ed56ec
2016-11-30 09:33:28 -08:00
Yirui Huang
e4b016ec41 Merge "Introduce font variation settings parser" 2016-11-30 01:13:04 +00:00