Commit Graph

3293 Commits

Author SHA1 Message Date
TreeHugger Robot
2f28dd71ec Merge "Add ImageDecoder.ImageInfo.getMimeType" 2018-01-10 14:38:32 +00:00
TreeHugger Robot
7fe2a370bc Merge "Additions and cleanups for ImageDecoder API" 2018-01-10 12:53:04 +00:00
TreeHugger Robot
a13c47694f Merge "Fix small but crashy edge case in Icon.scaleDown" 2018-01-10 00:09:16 +00:00
Leon Scroggins III
1fad09d4d3 Add ImageDecoder.ImageInfo.getMimeType
Bug: 63909536
Test: CTS: Ib2877276da8464b5f3eef0bbb848de202c90e97e

Allows a listener to determine the mimetype.

Change-Id: I0d2aa32f2dbfb37dba97a896037c48814390273d
2018-01-09 16:54:22 -05:00
Leon Scroggins III
b1cc8e6437 Additions and cleanups for ImageDecoder API
Bug: 63909536
Test: CTS: I0f36ce34c968fd7fae4d8edebabea3a421859615

Add overloads for null listener, byte[] without offset + length
Clean up comments

Change-Id: I3dd1dae94cf1fe977d96fcae9b36cbed0adfe749
2018-01-09 15:52:49 -05:00
Leon Scroggins
5dfd8194b2 Merge "Support using ImageDecoder with ContentResolver + URI" 2018-01-08 21:14:50 +00:00
Leon Scroggins III
ed074fd700 Support using ImageDecoder with ContentResolver + URI
Bug: 63909536
Test: CTS: I0f36ce34c968fd7fae4d8edebabea3a421859615

Add ImageDecoder.createSource(ContentResolver, URI), allowing a client
to decode images from files, content, resources, etc.

Prefer using a file descriptor to using an InputStream so the input can
be cheaply seeked and rewound if necessary.

Make ImageDecoder implement AutoCloseable to handle closing the input.

Make decodeDrawable/decodeBitmap always return an object or throw an
IOException. Avoid checking for a file in the Source constructor.

Fix a bug where inner Exception classes were not static.

Update JavaInputStreamAdaptor to be usable by ImageDecoder:
- previously it always swallowed exceptions. Allow them to propagate
  (optionally) so that they can be reported back to the client.
- Add refs to the InputStream and byte[]. ImageDecoder returns from
  native and then uses the JavaInputStreamAdaptor again, making the
  local refs go out of scope.
- Hold on to the JavaVM and convert to the JNIEnv when necessary. Pass
  local env pointers to avoid looking it up multiple times in one call.
- If an exception is thrown inside the doRead() loop, return the number
  of bytes successfully read.

Change-Id: I869dad55521cf942efd010c06baf3f44c1c08374
2018-01-08 12:41:39 -05:00
Robin Lee
76dc52ac36 Fix small but crashy edge case in Icon.scaleDown
Plus a regression test which throws an Exception for the old version. It
shouldn't be an issue in the real world because there's absolutely no
reason any app should be creating 1920*3px icons.

Found while porting the code somewhere else.

Test: runtest -x ./core/tests/coretests/src/android/graphics/drawable/IconTest.java
Change-Id: I1283d982507221914ddad1313e16f63af13e245a
2018-01-04 16:55:24 +00:00
Mihai Popa
e72b5c5163 Update the ttc index attribute documentation
The CL updates the documentation of the ttcIndex attribute added for P,
according to the API review comments.

Bug: 71555180
Test: none
Change-Id: I44a617c4f0a10314008fe5d5b380c6a830f3e04f
2018-01-04 14:36:39 +00:00
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 9bc2692939.

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 cf0c41dbc2)
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