Commit Graph

3857 Commits

Author SHA1 Message Date
TreeHugger Robot
be1d460a88 Merge "Revive the old behavior of unsupported filed in public APIs" 2019-03-20 20:11:14 +00:00
Seigo Nonaka
7d3d2aa286 Revive the old behavior of unsupported filed in public APIs
The behavior of the Typeface creating function when unsuppoted font
files are passed has changed unexpectedly. This CL revives the old
behaviors. Here is the list of public APIs and expected behaviors.

Resources#getFont for unsupported font
  Exception: Resources#NotFoundException
Resources#getFont for unsupported font in XML
  Exception: Resources#NotFoundException
Resources#getFont for unsupported font from provider
  No Exception: Typeface.DEFAULT is returned

Typeface#Builder for unsupported font
  No Exception: null is returned
Typeface#Builder for unavailable font
  No Exception: null is returned

Typeface#createFromAsset for unsupported font
  Not Exception: Typeface.DEFAULT is returned
Typeface#createFromAsset for unavailable font
  Exception: RuntimeExcetpion

FontsContract#buildTypeface for unspported font
  No Exception: null is returned
FontsContract#buildTypeface for unspported font in XML
  No Exception: null is returned
FontsContract#buildTypeface for unspported font from provider
  No Exception: null is returned

TextView inflation for unsupported font
  No Exception: Typeface.DEFAULT is set
TextView inflation for unsupported font in XML
  No Exception: Typeface.DEFAULT is set
TextView inflation for unsupported font from provider
  No Exception: Typeface.DEFAULT is set

Bug: 127714175
Test: Manually done
Change-Id: Iaab037f4168546409ead67ed8eee7340418418ed
2019-03-20 10:22:55 -07:00
Daniel Solomon
244daaeddc Change Display White Balance to track the Planckian locus
Currently when DWB adjusts the display's white point it uses standard
Illuminant D to convert CCT to CIE xy coordinates. This causes a slight
green tint, detectable by some users. Change this behavior to calculate
CIE xy based on the Planckian locus.

Bug: 128712066
Test:
a. Manual, by overriding target DWB CCT and observing resulting target
xy coordinates
b. atest FrameworksServicesTests:ColorDisplayServiceTest, making sure
there are no new failures (existing failures tracked in a separate bug)

Change-Id: I6fa336ee694730df45d5eacceb442aa556b5718e
2019-03-19 14:57:30 -07:00
Seigo Nonaka
67e8cb2bfc Hide MeasuredText.getChars
The MeasuredText.getChars is used only from text layout internals:
- LineBreaker#computeLineBreaks
- Canvas.drawtextRun

Thus, no need to be exposed to public. Making it @hide

Change-Id: I7c27a4b95d7d5ebc2ad5d74c947cdea3ce08f2ab
Fix: 124795470
Test: N/A
2019-03-18 10:13:27 -07:00
TreeHugger Robot
8ae1fcaf8d Merge "Revert "Always suppress font error during resource loading"" 2019-03-15 23:27:35 +00:00
Seigo Nonaka
848e83f663 Revert "Always suppress font error during resource loading"
This reverts commit 96e93959fb.

Reason for revert: 
This breaks CTS. Looks like even in old devices, we tells errors to
developers. Just suppression is not a right solution here.

Change-Id: Ia1b1916d94d115174afe8e822fc669b37e5f3937
2019-03-15 21:07:44 +00:00
Leon Scroggins
c052fa2032 Merge changes I241824bf,I9021864f
* changes:
  Convert ColorLong in native code in Paint
  Restore Paint#nSetColor(@ColorInt)
2019-03-15 12:14:20 +00:00
TreeHugger Robot
0099e49e19 Merge "Revert "Make Paint default to filtering Bitmaps"" 2019-03-15 07:26:46 +00:00
Roger Wang
1b6927dbb1 Revert "Make Paint default to filtering Bitmaps"
This reverts commit 1a73221199.

Reason for revert: cts failure, b/128641982

Change-Id: If27a39d8d4f6cc03c642b63be1a32af187ce8758
2019-03-15 04:13:51 +00:00
TreeHugger Robot
8c13853db7 Merge "Make Paint default to filtering Bitmaps" 2019-03-14 19:58:47 +00:00
TreeHugger Robot
7e7a8efd5f Merge "Stop double-counting native memory in graphics classes" 2019-03-14 17:03:30 +00:00
Leon Scroggins III
10965f3922 Convert ColorLong in native code in Paint
Bug: 127580253
Test: CtsGraphicsTestCases
Perf: systrace

Follow on to I0b42c17159b290868a6bed7b90da096995504c4d, which did this
for other classes. I expect this to be more efficient due to passing
fewer JNI parameters, which appears to be the case based on the systrace
data for setColor(@ColorLong):

Duration:
(w/o this change)       (w/ this change)
avg:	0.010 ms        0.005 ms
max:	9.130 ms        0.239 ms
min:	0.002 ms        0.002 ms
std:	0.052 ms        0.004 ms

The average is twice as fast, the max is significantly shorter, and the
standard deviation is much smaller as well.

Change-Id: I241824bf2a934746df93da1063b14f3080486cb5
2019-03-14 10:59:37 -04:00
Leon Scroggins III
1a73221199 Make Paint default to filtering Bitmaps
Bug: 77949917
Test: I5737be68dccdc5ebb38291bf3515ae25553dcfc2

In P, the switch to Skia HW rendering lost a feature of HWUI's old
renderer: using a Paint with a BitmapShader resulted in filtering the
Bitmap, regardless of whether FILTER_BITMAP_FLAG was set.

This somewhat restores that behavior, in that it results in filtering
BitmapShaders so long as the client doesn't explicitly turn it off. This
also means that it continues to be possible to get a pixellated drawing
if the client *does* explicitly turn it off.

Change-Id: I62c726a0ba281de239092f066a3df041ecbcee5b
2019-03-14 14:51:22 +00:00
Leon Scroggins III
bbdb731275 Stop double-counting native memory in graphics classes
Bug: 121304803
Test: Infeasible

Previously, the NativeAllocationRegistry needed to report how much
native memory was being held onto by the Java class in order to get a
more accurate count of how much memory was in use. But recent changes
allow the system to have an even more accurate view of the native memory
with mallinfo(). Further, the AOSP change
Idccb8b50d26c8c3e93cc34040d784f74dfcdbf51 introduces new APIs that allow
distinguishing between large native malloc allocations, which should
cause more frequent mallinfo() checks, and whose sizes need be available
to ahat etc, and smaller native malloc allocations.

Bitmap and AnimatedImageDrawable use the version for large native malloc
allocations. The rest pass an implied size of 0. Note that many of the
old Registries used somewhat arbitrary sizes, reinforcing the fact that
the new way of keeping track of this is better.

Add Bitmap::pixelStorageType to differentiate between types of memory
that should be accounted for by the Registry.

Update Bitmap::getAllocationByteCount to report the actual size of
ashmem allocation.

Fix a typo in LineBreaker.java, discovered while looking to find
existing callers of Bitmap's constructor.

Change-Id: I57c407258450aeaf08b47df32432466639d9faed
2019-03-14 14:50:46 +00:00
Leon Scroggins III
03b3e236a0 Restore Paint#nSetColor(@ColorInt)
Bug: 127580253
Test: CtsGraphicsTestCases
Perf: systrace

Restored with a partial revert of "Add Paint#get(ShadowLayer)ColorLong"
(commit 6ee411010e).

The original CL combined the @ColorInt and @ColorLong version for
simplicity, but required doing extra work for the @ColorInt version.
Separating them back out speeds it up at the cost of more code.
Using systrace I see the following stats:

Duration:
(w/o this change)       (w/ this change)
avg:    0.020 ms        0.001 ms
max:    9.141 ms        0.072 ms
min:    0.005 ms        0.001 ms
std:    0.074 ms        0.001 ms

This change shows a significant speed improvement. It does not do the
same for setShadowLayer, which is likely used less frequently.

Change-Id: I9021864fcad7d0149b93674f09339f805c272994
2019-03-14 10:33:57 -04:00
TreeHugger Robot
7c8b154141 Merge "Change Font.Builder#build return type from @Nullable to @NonNull" 2019-03-13 23:01:14 +00:00
TreeHugger Robot
7e8c759140 Merge "Change TabStop type from int to float" 2019-03-13 23:00:28 +00:00
TreeHugger Robot
3735f250e2 Merge "Tweak RenderNode's docs" 2019-03-13 19:36:21 +00:00
John Reck
08a68d5948 Tweak RenderNode's docs
Bug: 125026642
Test: looked at offline-sdk-docs
Change-Id: I1e03ac2291c31e79489b9cf545d2b7760fb4252d
2019-03-13 10:16:10 -07:00
Andrey Kulikov
ea23c429a1 Merge "Introduce View.getAnimationMatrix()" 2019-03-13 14:30:26 +00:00
TreeHugger Robot
c91fa25bee Merge "Always suppress font error during resource loading" 2019-03-13 01:05:39 +00:00
Seigo Nonaka
3a8254ad38 Change Font.Builder#build return type from @Nullable to @NonNull
Bug: 124794844
Test: N/A
Change-Id: Ib7a7a4605698dbda7a7f649708964b2b83916354
2019-03-12 13:18:17 -07:00
Seigo Nonaka
d5621edc35 Change TabStop type from int to float
This is from API council feedback.

Bug: 124794899
Test: atest CtsTextTestCases
Test: atest CtsGraphicsTestCases
Change-Id: Ifa95f87067239cca9c0791bf079045e4f645c3ad
2019-03-12 12:27:47 -07:00
Seigo Nonaka
96e93959fb Always suppress font error during resource loading
I suppressed the font error during resource loading only if the
targetSdkVersion is API 28 or before, but it turned out that this
makes developers hard to use font resources since:
- We don't give a list of supported font files and OEM may extend/shrink
  the font support.
- There is no way to resolve this error during layout inflation.

So, now always supress the IllegalArgumentException during building
Typeface in resource loading.

Bug: 127714175
Test: atest CtsTextTestCases
Test: atest CtsGraphicsTestCases
Test: atest FontsContractTest
Test: atest CtsWidgetTestCases
Change-Id: I08b9f27aaf25ff491fa36d0a4befb3c6e64abfcf
2019-03-12 12:13:14 -07:00
TreeHugger Robot
75f61c5919 Merge "Hide packing structure from public API" 2019-03-12 17:59:44 +00:00
Andrey Kulikov
c15c9ca54c Introduce View.getAnimationMatrix()
Adding a corresponding getter for the recently opened View.setAnimationMatrix(Matrix).

Bug: 126376184
Test: new cts tests added
Change-Id: I9d5abb1ae3606d2e3884859ce9a81c11c65613d6
2019-03-12 14:53:06 +00:00
Seigo Nonaka
fb1b479314 Hide packing structure from public API
The hyphen edit is packed into 8bit integer in native library, but this
should not be exposed to public API as API council suggested.

This CL includes:
- Removing packing structure from HyphenEdit and move constants from
  Hyphenator to Paint.
- Replace LineBreaker's getLineHyphenEdit with two separate start/end
  function.
- Replace Paint's getHyphenEdit with two separate start/end function.
- StaticLayout still relies on this packing mechanism but no longer need
  to be the same packing structure as in Minikin.

Bug: 124794844
Test: atest CtsGraphicsTestCases
Test: atest CtsTextTestCases
Change-Id: I8206061f554cf6e119b2b565162f54317eac630a
2019-03-11 16:51:47 -07:00
Nader Jawad
e756f460d0 Merge "Added @NonNull annoation to Insets.NONE static field" 2019-03-11 21:36:35 +00:00
TreeHugger Robot
b80a06a88a Merge "Address API review from the council" 2019-03-08 19:29:48 +00:00
Nader Jawad
2cd860317f Added @NonNull annoation to Insets.NONE static field
Addressing API review feedback regarding missing annotations
on Insets.NONE

Bug: 126699576
Test: N/A
Change-Id: I46748b504e04be7f29a41fa83362e9910295eafa
2019-03-07 19:21:40 -08:00
TreeHugger Robot
ad07707cac Merge "Document how RenderNode properties form the transform matrix" 2019-03-08 02:48:54 +00:00
Seigo Nonaka
de41eeaafd Address API review from the council
Here are the list this CL includes:
- Adding missing @NonNull, @Nullable, @IntRange annotations
- Added @Px annotation to Paint.set/getWordSpacing
- Change Builder classes to final.
- Change FileDescriptor to ParcelFileDescriptor as described in guideline.
- With this change, additional error handling is required in old
  Typeface.Builder but we can keep the same behavior (silently fallback to
  system fallback in error case).
- Fix comment in getLineHyphenEdit in LineBreaker.Result
- Rename setJustified to setJustificationMode in LineBreaker.Builder

Fix: 126702154
Fix: 126701272
Fix: 126701569
Fix: 126701953
Fix: 126701507
Fix: 126701667
Fix: 126700866
Fix: 126701009
Fix: 126700795
Fix: 126700292
Fix: 126699209
Fix: 124795407
Fix: 124795470
Bug: 124794844
Bug: 124794899

Test: m update-api
Test: TreeHugger

Change-Id: If6e8566b0eef9151d35d75b7f258128d7d3df358
2019-03-07 18:23:35 -08:00
John Reck
b7a14d5d51 Document how RenderNode properties form the transform matrix
Fixes: 125026642
Test: none
Change-Id: I30b12e2230ec8513eb789b82e107778ab7bce5ec
2019-03-07 15:12:54 -08:00
John Reck
d7300de54b Merge "Address API council feedback" 2019-03-07 22:09:33 +00:00
Nader Jawad
8bcc12a98f Merge "Added Nullability annotations to new Canvas APIs" 2019-03-07 22:06:32 +00:00
Nader Jawad
fbe2eabd3b Added Nullability annotations to new Canvas APIs
Added @NonNull annotation to drawDoubleRoundRect float array
parameters

Bug: 126702234
Test: N/A
Change-Id: Ib81fcc4ad6d5f2c471e4f6fb5ace4bdfc1d89b33
2019-03-07 09:43:34 -08:00
John Reck
28a1f9428e Address API council feedback
Fixes: 127532446
Test: build & checked docs
Change-Id: Ibf14ad52040694ccd503aaa187b99c19338b727a
2019-03-06 17:31:36 -08:00
TreeHugger Robot
1b042a7c6e Merge "Pass ColorSpace to AnimatedImageDrawable" 2019-03-06 03:37:23 +00:00
TreeHugger Robot
153f106109 Merge "Cleanup functor system-api surface" 2019-03-05 18:45:55 +00:00
Leon Scroggins
a3882ad859 Merge "Explain why Bitmap#setColorSpace is @NonNull" 2019-03-05 18:19:53 +00:00
TreeHugger Robot
0ab1f9250c Merge "Implemented API-review suggested changes on GradientDrawable" 2019-03-05 17:53:31 +00:00
TreeHugger Robot
6d6b53969a Merge "Added nullability annotations to StateListDrawable APIs" 2019-03-05 17:49:23 +00:00
TreeHugger Robot
3b6672deb5 Merge "Add nullability annotations to HardwareRenderer" 2019-03-05 17:37:48 +00:00
TreeHugger Robot
aa20063ef8 Merge "Add missing nullability to RenderNode" 2019-03-05 17:37:10 +00:00
Leon Scroggins III
4580ae1293 Explain why Bitmap#setColorSpace is @NonNull
Bug: 127282638
Test: No change in behavior
Change-Id: I167893b1d80ae37982804ec0dfa98b68d6eaab53
2019-03-05 10:02:12 -05:00
TreeHugger Robot
07cd0c7f3c Merge "Fix RenderNode sample" 2019-03-05 08:01:17 +00:00
Chong Zhang
58077d5d53 Add "image/heic" to supported mimes of ImageDecoder
bug: 127364815
Test: atest android.graphics.cts.ImageDecoderTest
Change-Id: I510a492b1770af70b9a36c239d043f8b09088fc2
2019-03-04 17:21:54 -08:00
Jeff Sharkey
678151592d Merge "API to determine if MIME type is supported." 2019-03-05 01:11:14 +00:00
John Reck
e9aeadb1e7 Cleanup functor system-api surface
Fixes: 127282736
Test: none
Change-Id: I5982d3f4f0671a3c351c11d8baf04aff5640e0a6
2019-03-04 10:29:40 -08:00
John Reck
ab6caf3e50 Add missing nullability to RenderNode
Fixes: 126701521
Test: none
Change-Id: I57dc2fddd28de79005a932759a05d2ddb84d28a9
2019-03-04 10:25:31 -08:00