Commit Graph

3504 Commits

Author SHA1 Message Date
TreeHugger Robot
17133935aa Merge "Removed hidden mutable APIs from PorterDuffColorFilter" 2018-04-11 00:13:05 +00:00
Nader Jawad
85ff47e3fc Removed hidden mutable APIs from PorterDuffColorFilter
Removed PorterDuffColorFilter#setColor and PorterDuffColorFilter#setMode
as the public facing ColorFilter API is immutable. These framework
internal APIs were causing issues with Drawables as updates to state of
the ColorFilter would not be propagated up to the Drawable to cause an
invalidation.

Fixes: 77723600
Test: Ran atest on SystemUITest and CtsGraphicsTest modules

Change-Id: I935c9e35ffa225735b951bb3b1eb753ea5815a84
2018-04-10 19:37:19 +00:00
Nader Jawad
94f25a6515 Updated DrawableWrapper implementation to support the hidden setXfermode
method to delete the corresponding Xfermode to the wrapped drawable

Added coretest to verify the hidden API properly propagates the Xfermode
to the wrapped drawable

Change-Id: I1f14105b7019b57bfcdd7182bb50ea2465c91ffe
Fixes: 30840201
Test: Ran atest on coretests
2018-04-10 12:32:00 -07:00
Seigo Nonaka
9f5da23937 Merge "Add common weight name to the API description" into pi-dev am: 1cf0b6cbfd
am: 24187a720b

Change-Id: Ic9c045e3045f329185444044628d4943fdeebfab
2018-04-09 10:08:12 -07:00
Seigo Nonaka
1cf0b6cbfd Merge "Add common weight name to the API description" into pi-dev 2018-04-09 16:46:26 +00:00
Seigo Nonaka
f2944cd61b Add common weight name to the API description
Bug: 76448718
Test: m docs
Change-Id: Id0ce0b2bcbf4f6b0cf1aa97c4d2c3c5117dc62c2
2018-04-09 14:29:41 +00:00
Leon Scroggins III
366e1e716d Merge "Never scale nine-patches in ImageDecoder" into pi-dev am: 9cb6759072
am: c13c945b19

Change-Id: I437c33c878db8c6bc4cbd3cd3d6989908bc6ff89
2018-04-05 16:19:52 -07:00
TreeHugger Robot
9cb6759072 Merge "Never scale nine-patches in ImageDecoder" into pi-dev 2018-04-05 22:42:39 +00:00
TreeHugger Robot
4ce55ba63f Merge "Added line to mark the mGradientIsDirty flag to true in order to recompute GradientDrawable drawing bounds" 2018-04-05 21:51:47 +00:00
Leon Scroggins III
fc7f4c89ed Merge "Rename set/get-ConserveMemory" into pi-dev am: d2c218f78a
am: 844ecb325a

Change-Id: Ieb7c02b42c77230173688e493e3e2b5549279de1
2018-04-05 14:24:49 -07:00
TreeHugger Robot
d2c218f78a Merge "Rename set/get-ConserveMemory" into pi-dev 2018-04-05 20:44:58 +00:00
Nader Jawad
5a22b40803 Added line to mark the mGradientIsDirty flag to true in order to
recompute GradientDrawable drawing bounds

Updated logic in GradientDrawable#setStrokeInternal to set the
mGradientIsDirty flag to true when the stroke is changed in order to
have ensureValidRect be called and recompute the drawing bounds
configured on mRect. In the event that a stroke width is defined, the
drawing rect must be inset by half the stroke width. Otherwise the
stroke will be drawn at the edges of the boundary and be clipped.

Bug: 70915849
Test: Ran test app provided in bug and confirmed that modifying the
strokeWidth on a pre-existing GradientDrawable matches the behavior of a
brand new GradientDrawable instance used as the background on a view

Change-Id: Icaa53d936589a9b4790f89e894f1d745c6e4fe43
2018-04-05 10:43:28 -07:00
Leon Scroggins III
7d940ba43d Never scale nine-patches in ImageDecoder
Bug: 76448902
Bug: 70889348
Test: Manual + CtsThemeHostTestCases
(Ica5e7e81848c3880accee922ee6f1cc9e26262ca)

Scaling a nine-patch requires scaling its divs. When the scale factor is
not an integer, we have to round. This gets out of sync with the way the
decoder scaled the image, resulting in stretching or keeping fixed the
wrong portions of the image. Making this worse, when we scale down, we
end up with divs colliding with each other, and we have to arbitrarily
adjust them further so they do not collide.

NinePatchDrawable and the drawing code already know how to handle
drawing from the originally-sized image and do a better job stretching
appropriately, so allow them to do their job.

We already do something similar for Bitmaps created by ImageDecoder on
apps targeting P and above - instead of scaling them up, we allow the
BitmapDrawable's scaling code to handle density differences. We
preserved the old behavior (scale up) on apps targeting pre-P because
those apps may rely on the size of the Bitmap contained in a
BitmapDrawable without accounting for its density (see Bug: 74061412).
But that is not an issue for NinePatchDrawables, which do not allow
peeking at their internal Bitmaps.

Rewrite ImageDecoder.computeDensity. There is no need for it to be
static, since it takes an ImageDecoder as a parameter and reads its
fields, including the new field mIsNinePatch. Set mIsNinePatch in the
constructor to avoid another down call into native. Split up the
conditions that result in returning srcDensity without calling
setTargetSize for clarity.

Remove ImageDecoder constructor from the graylist. It was accidentally
added due to the fact that it is called transitively from public APIs.

Change-Id: I3c5ddd67f3352c991515f30ce1c477c9a608833f
2018-04-05 12:50:32 -04:00
Leon Scroggins
de80e55325 Merge "Add docs for setTargetSize and setTargetSampleSize" into pi-dev am: d9cb59629d
am: 4cd2ed6067

Change-Id: I4717b7a453469bd5c204cca2294675a2a01aa8a6
2018-04-05 06:58:01 -07:00
Leon Scroggins
d9cb59629d Merge "Add docs for setTargetSize and setTargetSampleSize" into pi-dev 2018-04-05 13:29:38 +00:00
TreeHugger Robot
b04d93366c Merge "Modified ShapeState#newDrawable to pass a deep copy of ShapeState" 2018-04-05 00:26:20 +00:00
Leon Scroggins III
ac959199e5 Rename set/get-ConserveMemory
Bug: 76448408
Test: Ie83dbdeab5cc3dcd6bd56dd874412ed67eb52c02
Change-Id: I714b159bb70a48e5644801cc7fef8e32ee93896a
2018-04-04 19:58:30 -04:00
Nader Jawad
14516dba62 Updated GradientDrawable setColor(ColorStateList) implementation to
match corresponding documentation to fall back to
setColor(Color.TRANSPARENT) in the event that null is passed as the
ColorStateList parameter

Refactored implementation to directly call setColor(Color.TRANSPARENT)
if setColor(null) is invoked, otherwise configure the solid colors and
the fill Paint color to the ColorStateList and resolved color for the
given state

Bug: 64951083
Test: Compiled, flashed an updated build of master onto taimen and
re-ran tests with updated implementation in GradientDrawableTest

Change-Id: Ia7e9a995fc78e49d601931ca6af81470d90f8439
2018-04-04 14:45:43 -07:00
Nader Jawad
a2d61be939 Modified ShapeState#newDrawable to pass a deep copy of ShapeState
Because ShapeState#newDrawable passes a reference to the existing
ShapeState instance, modifications to a single ShapeDrawable instance
affect all instances of the ShapeDrawable obtained through
ShapeState

Bug: 74570674
Test: Tested by flashing a local build onto a Taimen and running
the sample application provided in the corresponding bug to verifying
that both usages of OvalShape within the sample app produce the same
visual result

Change-Id: I10a8aac8eb51d551a13f2b6292f0cd84bff84045
2018-04-04 13:23:46 -07:00
Leon Scroggins III
d97e26428d Add docs for setTargetSize and setTargetSampleSize
Bug: 77507530
Test: No change in behavior, no new tests

Add @Px and @IntRange annotations, and be explicit that setTargetSize
refers to pixels. Add a comment to setTargetSampleSize that is like
calling setTargetSize with particular values, to try to make it clear
how the two are related.

Change-Id: Ie7e9429bc8c548f44d382358c161425f666ba82f
2018-04-03 11:59:29 -04:00
Leon Scroggins
ab600d979f Merge "Update javadocs for ImageDecoder and related" into pi-dev am: 8880a9e0b9
am: de054456f2

Change-Id: I69f828620f62848193dc14850c07ad87c20ded49
2018-04-03 08:12:58 -07:00
Leon Scroggins
8880a9e0b9 Merge "Update javadocs for ImageDecoder and related" into pi-dev 2018-04-03 14:43:01 +00:00
Derek Sollenberger
1aefca09eb Merge "Merge "Restore saveLayer APIs back into the public API." into pi-dev am: ffe1c2a266" into pi-dev-plus-aosp
am: c13bf77769

Change-Id: I1d93eb9fadc99f578e7162a6aae82d6eb612a3b8
2018-04-02 23:19:26 +00:00
TreeHugger Robot
ffe1c2a266 Merge "Restore saveLayer APIs back into the public API." into pi-dev 2018-04-02 14:28:48 +00:00
Leon Scroggins III
f648b2e6f2 Remove chaining from ImageDecoder setters am: d9b53a097d
am: fe49dd165e

Change-Id: I1ca209b9bce4c50fdaf5b5a983669f0a305d022b
2018-03-31 01:01:39 +00:00
Leon Scroggins III
d84c652a4e Update javadocs for ImageDecoder and related
Bug: 76461699
Bug: 76448408
Test: No change in behavior, no new tests

Add class level docs for ImageDecoder, including sample code. Update
wording to be more clear and less wordy. Fix broken attempts at using
sample code.

Incorporate advice at go/android-api-guidelines and
https://developers.google.com/style/api-reference-comments

Change-Id: Iaf1334993f6cd2d3f6e53d3fb70ef9c7a95c9a76
2018-03-30 20:13:39 -04:00
Leon Scroggins III
d9b53a097d Remove chaining from ImageDecoder setters
Bug: 76448408
Test: Infeasible
Change-Id: Ib0ef0a9a9b0f36481ed1bbb16ecaccd180df8915
2018-03-30 15:02:56 -04:00
Derek Sollenberger
2d4f01ba7f Restore saveLayer APIs back into the public API.
The saveLayer APIs are restored from @removed but will treat input
as ALL_SAVE_FLAGS and generate exceptions on newer API levels.

We internally used these calls in one situation that now use a
different @hide API to support the previous behavior until we
refactor that code.

Partial revert of "Remove deprecated android.graphics.Canvas APIs"
This reverts commit 7b837616ae.

Bug: 77276963
Bug: 73777445
Test: CtsGraphicsTestCases
Change-Id: I7acd4ffd5ac41a58d2be8b48cf50119c2b896708
2018-03-30 14:40:04 -04:00
Leon Scroggins
3adb7aab60 Merge changes from topics "DocumentSource", "ID_API" into pi-dev am: 3c4e33a4fe
am: 41a28e7fe6

Change-Id: I99619af2463c8afd6c97725417994cdae0c8bbc6
2018-03-30 14:56:36 +00:00
Leon Scroggins III
7466c1679a Rename getters and setters on ImageDecoder am: d62f27250a
am: 02b9f36f5a

Change-Id: I9048711149267eb20848e63a3f1f166d6f46e158
2018-03-30 14:50:57 +00:00
Leon Scroggins III
02b9f36f5a Rename getters and setters on ImageDecoder
am: d62f27250a

Change-Id: I51fd44e48732f0eab0db60f829bece5c8760d38e
2018-03-30 14:23:17 +00:00
Leon Scroggins
3c4e33a4fe Merge changes from topics "DocumentSource", "ID_API" into pi-dev
* changes:
  Add documentation for ImageDecoder and its Source
  Rename getters and setters on ImageDecoder
2018-03-30 00:53:53 +00:00
Leon Scroggins III
0a87cb3128 Add documentation for ImageDecoder and its Source
Bug: 76448408
Bug: 76462125
Test: Iec21bad971dc9cffc807a412bb6329757c499baa

- Document DecodeException.getSource
- Add thread annotations
- slice() ByteBuffer inside createImageDecoder, so it can be reused
- Make ResourceSource thread safe by locking around mResDensity
- Specify that OnHeaderDecodedListener is necessary for changing default
  settings

Change-Id: I3b55d3ba1b0a2276938cb521449bceb7aa9f96e2
2018-03-29 18:47:52 -04:00
Leon Scroggins
2542ce4f2b Merge "Add in/out ColorSpace to ImageDecoder" into pi-dev am: bf1fe9aecd
am: 8f935b0fbb

Change-Id: I1a0d03fb9ca51276dc1907fd4cd2d2685fc46a46
2018-03-29 21:55:38 +00:00
Leon Scroggins
bf1fe9aecd Merge "Add in/out ColorSpace to ImageDecoder" into pi-dev 2018-03-29 20:27:43 +00:00
Leon Scroggins III
d62f27250a Rename getters and setters on ImageDecoder
Bug: 76448408
Test: Ib8782ff10072c81a5ed2a1031a70475fffee7ccf

- Use "is" prefix for booleans instead of "get"
- Reverse "require" and "unpremultiplied" for a more natural sound
- Add "Required" to "Mutable" methods
- Add "Enabled" to "DecodeAsAlphaMask" methods

Change-Id: I644ddccd37898d89609e4534ece4ea70f74587c4
2018-03-29 15:35:30 -04:00
Leon Scroggins III
1a69f4598f Add in/out ColorSpace to ImageDecoder
Bug: 76448408
Test: I851173b771668f0e6712bebfe06bfb8559801199

Add ImageInfo.getColorSpace() for retrieving the default ColorSpace.
This matches BitmapFactory.Options.outColorSpace.

Add ImageDecoder.setTargetColorSpace() for choosing a new ColorSpace.
This matches BitmapFactory.Options.inPreferredColorSpace.

Rename setSampleSize to setTargetSampleSize to match setTargetSize and
setTargetColorSpace.

Change-Id: If2f4e755dfc163f754849f896de24659198973db
2018-03-29 13:44:22 -04:00
John Reck
98d1b8b2d1 Merge "Move Path to NAR" into pi-dev am: 9434b66bf7
am: 6541c42146

Change-Id: I6cf9880e75ade2430af26eda7d9777ce81250168
2018-03-29 17:34:00 +00:00
John Reck
9434b66bf7 Merge "Move Path to NAR" into pi-dev 2018-03-29 16:53:41 +00:00
Leon Scroggins
eb366a01ab Merge "Rename ImageDecoder.setResize" into pi-dev am: 6078631927
am: 07e1c83bad

Change-Id: I8d5bd9332d982cf953947d888afd25c566ca5460
2018-03-29 13:14:13 +00:00
John Reck
205d83e108 Move Path to NAR
Bug: 74686528
Test: PathTest#testUseAfterFinalize
Change-Id: Ic1c9df6f1b63ea5795a6c3a54b8fc50fdaf0a5f4
2018-03-28 14:36:58 -07:00
Leon Scroggins III
64481195e1 Rename ImageDecoder.setResize
Bug: 76448408
Bug: 73537624
Test: Ib40d65c68a6c709b6456f2145ad8a5557a941494

setResize is two verbs, and "resize" implies we're changing the size of
an existing object. In truth, the method specifies the desired size. So
rename setResize(int, int) to setTargetSize, which clearly specifies the
behavior.

Rename setResize(int sampleSize) to setSampleSize.

Hide getSampledSize, which looks too similar to the newly named
setSampleSize. In addition, b/76448408 suggests hiding it. It isn't
really necessary anyway, since a client can just call setSampleSize - no
need to query and call setTargetSize manually.

Since there is no way for a client to know that a RAW image couldn't be
decoded to the desired size (could previously be done with
getSampledSize), make setSampleSize do the extra scaling. This is a
better API anyway.

Change-Id: I84c29fdc6bdfb999a7f712fdc069304ae9676ba6
2018-03-28 11:24:12 -04:00
Derek Sollenberger
93e2e97d1b Merge "Remove deprecated android.graphics.Canvas APIs" into pi-dev am: 812e87ecba
am: d32b6e012a

Change-Id: I596d43c935516141b9c834c0af7441606d41a33a
2018-03-27 19:36:37 +00:00
Jesse Hall
bef42cd87f Merge "Docs: add more detail to SurfaceTexture#getTimestamp" into pi-dev 2018-03-27 18:54:28 +00:00
Jesse Hall
b5afc250bc Docs: add more detail to SurfaceTexture#getTimestamp
Copies language from <android/surface_texture.h> that connects
EGL/Vulkan presentation timestamps to SurfaceTexture#getTimestamp.

In the process, reorganized the existing language to talk about
general properties of the timestamp, and then talk about behavior of
specific producers instead of mixing them together.

Bug: 72755997
Test: make docs
Change-Id: I88253f9e23df7d7c4fe3c1c51ff2ac494da1913c
(cherry picked from commit 63d2a0e000)
2018-03-27 17:08:04 +00:00
Derek Sollenberger
7b837616ae Remove deprecated android.graphics.Canvas APIs
Bug: 73777445
Test: compile
Change-Id: Ie68f2fbe3c3be82f3c20529d535875d4cc204b7c
2018-03-27 14:36:50 +00:00
Leon Scroggins III
b132b47649 Merge "Update AnimatedImageDrawable docs" into pi-dev am: 6f5e83df3a
am: 5115645c5a

Change-Id: I8ba7f7eb28c5a03365c2b8cf79b846fe1f51b5a1
2018-03-27 13:02:39 +00:00
TreeHugger Robot
6f5e83df3a Merge "Update AnimatedImageDrawable docs" into pi-dev 2018-03-27 12:47:22 +00:00
Jesse Hall
01e3148827 Merge "Docs: add more detail to SurfaceTexture#getTimestamp" 2018-03-26 20:12:00 +00:00
Leon Scroggins III
53f09ee1f1 Update AnimatedImageDrawable docs
Bug: 73529437
Test: No change in behavior, no new tests

Document that it can be inflated from xml, and reference the attributes
that it supports.

Add a comment describing what the class does with respect to animation.

Update the comment for start() to better reflect when the callback is
called.

Change-Id: I660cbc4e185dca8bc7a43a185f91ae0485ef8753
2018-03-26 10:44:47 -04:00