3282 Commits

Author SHA1 Message Date
Leon Scroggins III
0c01dbf8f2 ImageDecoder (BitmapFactory 2.0)
Bug: 63909536
Bug: 63908092

Test: CTS: I0f36ce34c968fd7fae4d8edebabea3a421859615

One-pager:
https://docs.google.com/document/d/1IWSdXb5O9lu-Zbj7SaNWo5pS7-FHlonFnqazjnecozM/
Design doc:
https://docs.google.com/document/d/15S6DSAV4EwOuJLv29UC_9cdSGdPg3KvOJVn2EHoP3fw/

ImageDecoder is designed to streamline certain patterns of BitmapFactory
use:
- choosing sample size based on actual dimensions
- choosing a specific output size
- post-processing (e.g. for rounded corners)
- copying to HARDWARE
- decode directly to ashmem
- creating a Drawable
- use as an alpha mask
- save RAM (e.g. use RGB_565)

In addition, it will include new features:
- animated drawables (TODO)
- report failures *and* optionally create a partial image
- crop

Add PostProcess to handle post-processing. It is separate from
ImageDecoder so that it may be used in the future by other commands that
might want something similar (e.g. capturing a View).

Consolidate NinePatch code for sharing between BitmapFactory and
ImageDecoder.

Some features left out of this CL:
- Create from ContentResolver + URI
- animation
- report more info in ImageInfo
- more overloads (e.g. null OnHeaderDecodedListener)

Change-Id: Icf011dc1b97b492788e47cf51fcf8abe8e9c7b88
2017-12-19 20:22:17 +00:00
Jorim Jaggi
45be1c4cdc Add surface/shown position to proto output
Change-Id: I4fb16a520af182c8f77982646f6ac9ae82fd9173
2017-12-15 18:44:43 +01:00
John Reck
7bb9f374c0 Tweak ripples
* Fixes the ripple interpolator to match UX spec
* Adjusts behavior if the ripple is re-sized mid-ripple
  to look less bad

Bug: 63635160
Test: mashed a bunch of buttons

Change-Id: I26de59fe81372512b287a646ca7377d052227aee
2017-12-12 11:29:02 -08:00
Doris Liu
6b184d7a43 Private API to turn off anti-aliasing for VectorDrawable
Bug: 69322344
Test: visual inspection on VectorDrawableTest with AA off. Jagged edges
      that are otherwise smooth were spotted.

Change-Id: Ib2dfbd3a941be0b4ff92b8458346f8c8f5015a4b
2017-12-04 16:31:07 -08:00
John Reck
0c453ccb87 Make ripples silky smooth
* Updates press state ripple to match UX spec
* Makes it ungodly silky smooth LIKE BUTTAH
* Update hover & focus states to be closer to UX spec,
  still needs a final pass.

Bug: 63635160
Test: Clicked on a bunch of stuff

Change-Id: I162ab9d8d669002f2ae511f93b5d9fe67f99c533
2017-11-16 16:32:43 -08:00
Wale Ogunwale
828ff7e3ef Support insets on secondary displays
Indroduced DisplayFrames object to track frames used to calculate
window insets per display vs. at a global level in PhoneWindowManager.

Bug: 64148922
Change-Id: I19f166920eba0a4f933a223a77e096bcc8dab0c1
Test: bit FrameworksServicesTests:com.android.server.wm.ScreenDecorWindowTests
Test: go/wm-smoke
2017-11-14 01:03:50 +00:00
Wale Ogunwale
7bb06e012a Revert "Support insets on secondary displays"
This reverts commit 9bc2692939d4dececbfde5ea67df4594a7842bd1.

Change-Id: Ia065372e9e220e653b4729a290663c3536d99307
Fixes: 69241956
Bug: 64148922
2017-11-13 16:49:19 +00:00
Wale Ogunwale
9bc2692939 Support insets on secondary displays
Indroduced DisplayFrames object to track frames used to calculate
window insets per display vs. at a global level in PhoneWindowManager.

Bug: 64148922
Test: bit FrameworksServicesTests:com.android.server.wm.ScreenDecorWindowTests
Test: go/wm-smoke
Change-Id: I4a668d6c2dd0bfa666cb6acecf663cf83545ea87
2017-11-10 04:57:30 -08:00
Seigo Nonaka
20866c1404 Use enum class for FontVariation and update MinikinUtils
This CL contains followins:
- Use enum class FontVariation instead of legacy enum.
- Store FontStyle in MinikinPaint.

Bug: 65024629
Test: minikin_tests
Change-Id: I86bf64fd5d9a8c08eff47db851fa4655da84b1e4
2017-11-07 14:13:41 -08:00
TreeHugger Robot
3de6335137 Merge "Add more gradient info in VectorDrawable's javadoc" 2017-10-30 23:58:47 +00:00
Mihai Popa
690e62bb68 Enable variation settings for fonts in XMLs
Bug: 37853920
Test: bit FrameworksCoreTests:android.content.res.FontResourcesParserTest

Change-Id: I1acf9767fb1cecc5f4982b79405f92280b31bfa7
2017-10-30 11:48:54 +00:00
ztenghui
a1a1cfa407 Add more gradient info in VectorDrawable's javadoc
b/30269243
Test: make offline-sdk-docs -j24

Change-Id: Ie9a353c05508b818efd7e401c2624b9be5dbdcc2
2017-10-27 15:48:17 -07:00
Joachim Sauer
208f0970d5 Merge "Framework: Prefer android.system.Os over libcore.io.Libcore.os" 2017-10-19 11:48:58 +00:00
Tobias Thierer
96aac9b375 Framework: Prefer android.system.Os over libcore.io.Libcore.os
This is a pure refactoring with no a behavior change other than
that these calls now go through android.system.Os, which immediately
delegates to Libcore.os.

This is a first step towards separating framework (via
android.system.Os) vs. libcore (via Libcore.os) clients of these
low level APIs. Separating these is a prerequisite towards moving
the API parts of android.system into framework, and moving the
rest into a different package in libcore.

Test: Treehugger
Bug: 67901714

Change-Id: Ifd8349ec5416e5693f40dba48fdf2bef651b7d81
2017-10-18 10:35:22 +01:00
Mihai Popa
e34ad1871b Enable the public TTC index attribute for fonts
This change adds support for specifying the TTC index on font entries,
relevant in the context of .ttc font files used to deliver multiple
fonts in the same file.
Bug: 37853920
Test: adb shell am instrument -w -e class android.content.res.FontResourcesParserTest com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner

Change-Id: I3f74e87dec78e1f5a68ccead80b0f637af1aa7a3
2017-10-13 12:44:21 +01:00
TreeHugger Robot
8c6f329ea9 Merge "Add missing annotations" 2017-10-11 19:57:52 +00:00
John Reck
5d3501172c Add missing annotations
Bug: 67608144
Test: make offline-sdk-docs verified docstring shows up
Change-Id: I22bcfcc58888fa2d4c479e4687afb2fabd5b2f71
2017-10-11 10:47:12 -07:00
ztenghui
65d56ec5fe Matching interpolator for ripple
Matching the interpolators to be declerate on both enter and exit.
According to the UX team feedback.

b/63635160
Test: demo app, settings app and calculator app

Change-Id: I49b88ef73f0bd45cd2b2c26feb2443633f171575
2017-10-09 16:28:04 -07:00
ztenghui
bcc64e2cf4 Update ripple according to UX feedback.
1. Consistent enter and exit duration and speed. Both bounded and
unbouned. It used to be that exit is much faster than enter.

2. Instead of starting from 0 size radius, we start from some size
according to the current drawable's bound.

b/63635160
Test: demo app, settings app and calculator app

Change-Id: I1135fefc9d9103f170ab889269b38a9900835450
2017-10-06 10:00:10 -07:00
Eino-Ville Talvala
6cf001e8d5 Merge "ImageFormat: Document units/coordinate system for DEPTH_POINT_CLOUD" into oc-mr1-dev am: 56afee3c1f
am: 57e79cf0a3

Change-Id: Ic43ab67194613c4888ad5ecf54b4ff66171df31d
2017-10-02 22:24:38 +00:00
Eino-Ville Talvala
3e99a5fcb9 ImageFormat: Document units/coordinate system for DEPTH_POINT_CLOUD
For camera devices, DEPTH_POINT_CLOUD coordinates are in meters and
are in the camera's local coordinate system.

Test: Built docs, manually verified output.
Bug: 67308479
Change-Id: I028e13a2fb79688a7ce440f905fa82826fc38a03
2017-10-02 11:39:41 -07:00
Tenghui Zhu
0df0cd3c82 Merge "Don't show the background when pressed and focus" 2017-09-29 16:20:20 +00:00
ztenghui
ac4c063eb9 Don't show the background when pressed and focus
According to the spec, the foreground will cover the whole area at
the end of expansion, and do not show the background.

In bounded case, the ripple exit should start from the current value.

b/63635160

Test: demo app, calculator and settings
Change-Id: I64d8b941e2b28ea11165d29de3e6ef77d5ee78f5
2017-09-28 16:38:51 -07:00
Tenghui Zhu
9a30254241 Merge "Trigger circular ripple when touched down, instead of up." 2017-09-28 16:26:27 +00:00
John Reck
bfc7a118fc Merge "Add nullptr check" into oc-mr1-dev am: b20694ab00
am: 5fa85b7e2e

Change-Id: Ieb93edf167a158a1f1759c6ffc6f492eac0b4144
2017-09-27 19:56:58 +00:00
John Reck
3885bf6f04 Add nullptr check
Bug: 65717856
Test: builds
Change-Id: I188d3366e956f087c6317ae0b56d5fb19a20708d
2017-09-27 09:30:30 -07:00
Jorim Jaggi
484851b914 Improve window manager layout attribute dumping
Test: adb shell dumpsys window
Change-Id: I9c76e6a6950265b49667cc19998282ef0c682815
2017-09-25 13:31:04 +02:00
ztenghui
3d30ca1d3c Add systrace for VectorDrawable inflation and draw
We didn't trace the draw from cache.
Here we add trace for draw into bitmap, which is normally heavy.

fix: 65060698
Bug: 65060698
Test: run test app and get systrace and check

Change-Id: Ia81127c4aa285b3277e9c9edbdf356d85cb28b5e
(cherry picked from commit cf0c41dbc221c2619212c7e25e6d90a9c4d05b05)
2017-09-22 19:44:24 +00:00
ztenghui
5cfb3d7e98 Trigger circular ripple when touched down, instead of up.
This will also show circular ripple when focus is on.
Previously, bounded case behaved differently than unbounded case. Now
they are consistent, too.

b/63635160
Test: sample app and calculator app

Change-Id: I5c96c8079c789d6e571af2c2356e3ce6add37b46
2017-09-22 11:26:40 -07:00
Tenghui Zhu
56c093cad2 Merge "Add systrace for VectorDrawable inflation and draw" 2017-09-15 16:55:56 +00:00
sergeyv
10c6d8b68e Merge "Merge "Throw if BitmapFactory.Options.inBitmap is HARDWARE" into oc-mr1-dev am: cebe432650" into oc-mr1-dev-plus-aosp
am: 7a9b7da051

Change-Id: If0cad94709d037fd47a96870d7b4f56622e9131a
2017-09-15 11:46:10 +00:00
ztenghui
cf0c41dbc2 Add systrace for VectorDrawable inflation and draw
We didn't trace the draw from cache.
Here we add trace for draw into bitmap, which is normally heavy.

fix: 65060698
Test: run test app and get systrace and check

Change-Id: Ia81127c4aa285b3277e9c9edbdf356d85cb28b5e
2017-09-14 15:56:50 -07:00
sergeyv
08beea71c9 Throw if BitmapFactory.Options.inBitmap is HARDWARE
Test: BitmapRegionDecoderTest#testHardwareBitmapIn
bug:34415265
Change-Id: I58061504dd42ba918f89e1e5daf668f7601ca8d3
2017-09-14 21:13:58 +00:00
Romain Guy
0390655dba Merge "Fix documentation typo" 2017-09-01 01:35:28 +00:00
Romain Guy
d4012d6505 Fix documentation typo
Test: compiles
Bug: 65213121
Change-Id: I5bfc7074a42ec0ef5cd624b0bb72234e072684d3
2017-08-31 16:08:42 -07:00
Philip P. Moltmann
7bc18b20fa Deal with finalize() after failed constructor
If the constructor throws an exception, the object will still be
finalized. Hence we have to make sure to set objects that are cleaned up
to 0/null and clean up everything else. Otherwise the finalizer might
double clean up a failed PdfRenderer.

It also appears that the Pdfium error state is only set if a open-doc
function fail. Hence remove it in every other case. Otherwise successes
might read the error of the last call.

Fixes: 63875707, 37052344
Test: cts-tradefed run singleCommand cts-dev -m Pdf --test=android.graphics.pdf.cts.PdfRendererTest
Change-Id: I6d9fc26be768ba1e338344740e340cf9b56386e9
2017-08-29 08:22:15 -07:00
John Reck
1d4be040e0 Merge "Avoid setting high contrast in every view draw" 2017-08-25 04:33:31 +00:00
John Reck
938e884a1f Avoid setting high contrast in every view draw
Test: high contrast text still works
Change-Id: I6674d1aca8dddf7eb9725a5346aed12ef1dbc195
2017-08-24 16:15:58 -07:00
Seigo Nonaka
4a40e0febf Make Typeface.create thread safe.
Typeface.create has not been thread-safe. This CL makes it thread safe.
At the same time, reorganize cache and lock in Typeface.

Bug: 64606109
Test: bit FrameworksCoreTests:android.graphics.TypefaceTest
Test: bit CtsGraphicsTestCases:android.graphics.cts.TypefaceTest
Change-Id: Id18e9b8bfab508a26fc0c83af6b1ca97e132b732
2017-08-23 14:41:25 -07:00
Roozbeh Pournader
737dfead64 Support extra linespacing based on fallback fonts
* Increase the ascent and descent of individual lines in StaticLayout
  as needed, if any fallback fonts that end up getting used call for
  it. For backward compatibility, this is hidden behind a builder
  flag.
* Document in Paint.java that the returned parameters are only for
  the default font, and a layout may need more space based on
  fallbacks used.

Also update for changes in minikin API:

* MinikinFont now requires a method for getting vertical extents
  (ascent, descent, and line gap).
* minikin API now allows asking for vertical extents of laid out
  text.
* minikin API's LineBreaker now returns ascents and descents for each
  line.

Finally, added performances test for creating a StaticLayout.
Follwing are the numbers on a marlin with a stable clock before and
after this CL.

For fixed text almost always hitting the cache:
Before: mean=260684 median=260188 min=258532 standardDeviation=1897
After:  mean=262432 median=261509 min=260429 standardDeviation=2185

For random text almost never hitting the cache:
Before: mean=5971827 median=5991126 min=5886871 standardDeviation=83724
After:  mean=6337093 median=6317010 min=6311222 standardDeviation=40213

Bug: 28963299
Bug: 29063863
Bug: 32057121
Bug: 37756858
Test: bit FrameworksCoreTests:android.text.
Test: bit CtsTextTestCases:*
Change-Id: I482a98ff8f472e8bab4f0ba9d1d7b368858038ff
2017-08-17 12:10:31 -07:00
Steven Timotius
af03df6a7a Update WindowManager to output dumpsys in protobuf format
Implement enough functionality in protobuf dumpsys to replicate
old functionaltiy in android.server.cts.WindowManagerState

Test: cts-tradefed run commandAndExit cts-dev --module CtsWindowManagerHostTestCases
cts-tradefed run commandAndExit cts-dev --module CtsServicesHostTestCases
Change-Id: Ib527ab3f44620a08cf03b77c37c2bae883d90e13
2017-08-14 17:06:17 -07:00
Roozbeh Pournader
c9c6ee667f Merge "Support multiple languages per font in fonts.xml" 2017-08-11 23:27:50 +00:00
Roozbeh Pournader
99975a3e25 Support multiple languages per font in fonts.xml
Minikin already supports multiple languages specified per font in
I7f13b51464c9b01982bb573251d77052b9ddbd70. This CL adds a couple of
such cases into fonts.xml and clarifies in the method and the
variable names and parameters that the frameworks is handling a
multi-language string when it is.

Fixes: 26687969
Test: make -j checkbuild
Test: bit FrameworksCoreTests:android.graphics.TypefaceSystemFallbackTest
Change-Id: Ifa540a95f87921983f9069330d1dd0892538a8df
2017-08-11 12:34:26 -07:00
TreeHugger Robot
891f481ef8 Merge "Refactoring: Deprecate Paint.mNativeTypeface." 2017-08-08 19:48:05 +00:00
Seigo Nonaka
318ca04079 Refactoring: Deprecate Paint.mNativeTypeface.
Bug: 64269689
Test: m checkbuild
Test: bit CtsGraphicsTestCases:*
Test: bit CtsViewTestCases:*
Test: bit CtsTextTestCases:*
Change-Id: Idc9f2b4612741be949204cd06efc41e1738d6587
2017-08-08 18:07:28 +00:00
Roozbeh Pournader
e88b5df5b7 Make ellipsize retry if text doesn't fit
This fixes the cases where the replacement of parts of text with
ellipsis may result in more-than-expected width of text due to
contextual width changes in the font, such as kerning or Arabic
shaping.

The calculations in TextUtils.ellipsize() and StaticLayout are fixed
to recalculate the new width and reduce it further until the text
actuall fits. BoringLayout and DynamicLayout get fixed too since
they use the other two implementations indirectly.

Also reverse a recently-introduced incorrect check for
multi-character ellipsis in Layout.java.

Fixes: 31537595
Fixes: 64156587
Test: Manual (Arabic edge cases ellipsize correctly)
Test: bit CtsTextTestCases:*
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.EditTextTest
Test: bit CtsWidgetTestCases:android.widget.cts.CheckedTextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.AutoCompleteTextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.MultiAutoCompleteTextViewTest
Test: bit FrameworksCoreTests:android.text.
Test: adb shell am instrument -w com.android.documentsui.tests/android.support.test.runner.AndroidJUnitRunner
Change-Id: Iaddcc8b01c78d477e2c29b339d321c9631426f34
2017-08-07 16:22:00 -07:00
Seigo Nonaka
762dc8bdae Introduce new public API for specifying exact weight.
Adding Typeface.create(Tyepface, int weight, boolean italic).
This API is a most primitive API for specifying exact weight value
for drawing text.

Test: CtsGraphicsTestCases:android.graphics.cts.TypefaceTest
Bug: 63135308
Change-Id: I5766870f68026fd1b13815e794f5df243cd8c912
2017-08-01 02:04:18 +00:00
Seigo Nonaka
065c59beaf Revert "Implement family fallback." DO NOT MERGE
This reverts commit 0d253e46aa0b4cb2ea56e220812aeab92de64ae1.

The original CL changed Typeface internal methods and broke
TypefaceCompatApi26Impl in support library which uses reflections.
Ideally, TypefaceCompatApi26Impl must fall back to public API
implementation but due to lack of method availability check, it ended up
crashing the application.

The original patch didn't change any behaviors in MR1, so reverting
that change is the best solution for MR1.

Bug: 64033594
Change-Id: Ie86afeb1b809e57915d62c1db5a70c8d210d2354
Test: N/A
2017-07-26 22:21:14 +00:00
TreeHugger Robot
89e4c1ce17 Merge "Refactor TextUtils.join() and add documentation" 2017-07-21 08:08:31 +00:00
Roozbeh Pournader
42673c33ee Refactor TextUtils.join() and add documentation
Added documentation to clarify what happens in the case of null or
empty arguments.

Change-Id: I694dc0f6a6d95ab6ca7ed95b51d81938618eb75f
Fixes: 36861796
Test: bit CtsTextTestCases:*
Test: bit CtsGraphicsTestCases:android.graphics.cts.FontVariationAxisTest
2017-07-20 17:22:30 -07:00