3604 Commits

Author SHA1 Message Date
Peiyong Lin
ac74bc8f45 [Game Driver] Add blacklist mechanism.
When a blacklist is set, we must not use driver package for those applications
on the blacklist.

BUG: 120869311
Test: Build, flash, boot. Verify with command line.
Change-Id: I1c9f10a3086007038c328a20346ffadeff1861ae
Merged-In: I1c9f10a3086007038c328a20346ffadeff1861ae
2019-04-17 16:22:33 -07:00
Alan Stokes
a9b5b2aab0 Fix javadoc HTML escaping.
HTLM special characters ('<', '>' and '&') don't need to be escaped
inside {@code}, even though they do elsewhere in javadoc. And in fact
they shouldn't be - because if they are escaped then the escaped
version shows up verbatim in the developer docs.

See for example:
https://developer.android.com/reference/android/graphics/drawable/GradientDrawable
https://developer.android.com/reference/android/support/v13/view/inputmethod/InputConnectionCompat

This change just removes the escaping to fix the public documentation.

Test: N/A (only comment lines changed)
Change-Id: I131b3b3e26547e30cff7b67514d177c48926bb26
2019-02-28 17:42:50 +00:00
Cuiping.x.Shu
0a5c8c15eb Check recycled when createBitmap
This is to avoid framework crash when application used
the recycled bitmap memory in createBitmap.

Bug:123656975

Change-Id: I98f93ce48c7bc91913d0b31bca1dc0a10eb319d7
2019-02-23 00:09:26 +00:00
Hans Boehm
e5b337dd88 Fix spelling of "HARDWARE"
Happened to notice this while reading the code for other purposes.

Test: Treehugger
Change-Id: I2d1b1e239bfd8d2506a62173fe854f608a45f5b0
2019-01-07 17:42:05 -08:00
Mathew Inwood
55418eada5 Limit access to suspected false positives.
Members modified herein are suspected to be false positives: i.e. things
that were added to the greylist in P, but subsequent data analysis
suggests that they are not, in fact, used after all.

Add a maxTargetSdk=P to these APIs. This is lower-risk that simply
removing these things from the greylist, as none of out data sources are
perfect nor complete.

For APIs that are not supported yet by annotations, move them to
hiddenapi-greylist-max-p.txt instead which has the same effect.

Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.

Bug: 115609023
Test: m
Change-Id: Ia937d8c41512e7f1b6e7f67b9104c1878b5cc3a0
Merged-In: I020a9c09672ebcae64c5357abc4993e07e744687
2018-12-28 14:26:35 +00:00
Xin Li
15b123ef45 DO NOT MERGE - Merge pie-platform-release (PPRL.181205.001) into master
Bug: 120502534
Change-Id: Idc8bfb6d97a869b76cfb87ca1a494201baf9e8bd
2018-12-11 14:13:44 -08:00
Nathan Harold
f5cf9f24ed Merge "Move some members to the "Q blacklist"." 2018-10-23 21:53:51 +00:00
Mathew Inwood
45d2c252b1 Move some members to the "Q blacklist".
Based on some analysis, these fields/methods are likely false positives.
Set maxTargetSdk=P so that any apps using them are required to migrate off
them in future. See the bug for more details.

Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.

Bug: 115609023
Test: m
Merged-In: I719b5c94e5b1f4fa562dd5d655953422958ad37e
Change-Id: I719b5c94e5b1f4fa562dd5d655953422958ad37e
(cherry picked from commit 8c854f86a477fbbee38092f449333e1425e5cd7e)
2018-10-22 17:28:24 -07:00
John Reck
7ba6f430f6 Clarify createScaledBitmap's 'filter' docs
Reddit complained the docs were bad, so make the docs less bad.

Test: none
Change-Id: I61928ea859af4ce0a63a9b545ea1b6dd965cc3df
2018-10-22 13:24:48 -07:00
Peiyong Lin
bc56d73af2 Merge "[Graphics] Align Display P3 transfer function coefficients."
am: fde18facba

Change-Id: I242a8f1ccf0d2b662d745a0a956da7e7c8e3d790
2018-10-16 11:03:47 -07:00
Peiyong Lin
7a45d2c310 [Graphics] Align Display P3 transfer function coefficients.
The transfer function of Display P3 should be sRGB transfer function,
previously we defined f as 0.039, however, the sRGB transfer function defines f
as 0.04045. This patch fixes it.

BUG: 116726537
Test: Build, flash and boot

Change-Id: I247092d8ce939aa743f23a1f8688cbaf0874fb99
Merged-In: I247092d8ce939aa743f23a1f8688cbaf0874fb99
2018-10-16 16:50:25 +00:00
Tobias Thierer
abe7a32c67 Merge "Remove unused imports of libcore.io.Libcore."
am: 2a520365da

Change-Id: I79c4679d483e0e8ea2e434237bd61d75f129da0f
2018-10-12 18:59:21 -07:00
Tobias Thierer
30ff7a093e Remove unused imports of libcore.io.Libcore.
Test: Treehugger
Bug: 115503977
Bug: 117548625
Change-Id: I122fa68ddc2bd531f627dcac00834b47249bd56e
2018-10-10 15:49:51 +00:00
Mathew Inwood
2e5fdd0051 Merge "Add @UnsupportedAppUsage annotations"
am: 9137ecafbd

Change-Id: I467341cc8f70554f58266ddc28ff3a648ec5cc18
2018-08-30 08:57:54 -07:00
Mathew Inwood
71da3a1fe4 Add @UnsupportedAppUsage annotations
For all remaining unannotated code.

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Change-Id: I32861fa341a08f11a9c50c07a1ef7404dadf6bb6
Merged-In: I67c8b71ea535ebffb10bf577948bd4ccb8ca069d
2018-08-30 13:38:01 +01:00
Mathew Inwood
08e080c314 resolve merge conflicts of 1ddeb9e01f34bb4b3fe0ae46f7b37bbfb584d64a to stage-dr1-aosp-master
Bug: None
Test: I solemnly swear I tested this conflict resolution.

Change-Id: Id12be0fe86a73fcf39cc2c82a1f681df910fc03f
Merged-In: I7fc1162d2c63df8751a4660607e8ce72070efed8
2018-08-02 17:31:50 +01:00
Mathew Inwood
1ddeb9e01f resolve merge conflicts of 95f8ca9f74b75fda6b05d08d49a1488dd0238c10 to stage-aosp-master
Bug: None
Test: I solemnly swear I tested this conflict resolution.
Merged-In: I7fc1162d2c63df8751a4660607e8ce72070efed8
Change-Id: I0e5a5d8fda273644e8c592ce7d059e508870085e
2018-08-02 14:24:12 +00:00
Mathew Inwood
9ebe36c305 Add @UnsupportedAppUsage annotations
For packages:
  android.graphics
  android.graphics.drawable
  android.graphics.drawable.shapes
  android.graphics.fonts
  android.graphics.pdf

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Merged-In: I7fc1162d2c63df8751a4660607e8ce72070efed8
Change-Id: I5d7739d2d1fc7bb12ee059bcc2a9ac9017ca35fb
2018-07-31 14:36:52 +01:00
Laura Davis
42d27af0da Docs: fixed typo
Test: make ds-docs

Bug: 111817624
Change-Id: I908e06419ab56220b41be6f821cff3258691b3b9
2018-07-27 12:07:27 -07:00
Laura Davis
22dbf294bb docs: repaired link to internal section
Test: make ds-docs

Bug: 79236136
Change-Id: Idf48cf7a055a0aa3841d6b4d0540724b43c61241
2018-06-07 13:29:41 -07:00
John Reck
44fc6317f1 Ensure picture isn't recording in createBitmap
Picture#draw() will silently due an #endRecording() if it
wasn't called. Bitmap.createBitmap doesn't do this until
after it's too late.

So do an up-front #endRecording() to ensure state is
good to go

Bug: 80539264
Test: HardwareBitmapTests#testReadbackThroughPictureNoEndRecording
Change-Id: Ic66c41462e88880b73c5093d7541c4ce3d71adeb
2018-06-01 12:55:13 -07:00
Leon Scroggins III
4afdd1caa4 AnimatedImageDrawable: Eliminate unnecessary calls to redraw
Bug: 78866720
Test: Manual + systrace; existing CTS

Previously, we set hasAnimations to true when the AnimatedImageDrawable,
so that we would get a call to redraw. But if the image does not need to
show its next frame yet, the redraw was unnecessary.

Instead, add a new field to TreeInfo::Out, representing the delay time
until the image will need to be redrawn - i.e. when the duration of the
current frame has passed. Each call to prepareTree will post at most one
message to redraw, in time for the earliest animated image to be
redrawn. Post the message for one rendered frame ahead of time, so that
when it is time to show the next frame, the image has already gotten the
message to update.

On a screen with a single animated image, this drops the number of calls
to dispatchFrameCallbacks to as infrequent as possible. It is called
only when we need to draw a new frame of the image. On a screen with
multiple animated images, the calls may be redundant, but they will not
be more frequent than they would be without this change.

Switch to nsecs_t and systemTime internally, matching the rest of HWUI.

Remove mDidDraw and related. Its purpose was to prevent advancing the
animation while the image is not being drawn. But it isn't really
necessary. If it's not drawn, onDraw is not called, which is where we
trigger decoding. And onDraw already has a defense against getting too
far ahead - if its timer indicates that it should skip a frame or show
it very briefly, it will back up its timer. More importantly, mDidDraw
caused a bug, when combined with less frequent redraws. If the display
list containing the drawable doesn't need to be redrawn for other
reasons, the drawable's timer never advanced, so its animation stopped.

Fix software drawing. Compute the milliseconds in the future to draw the
next frame, and add that to SystemClock.uptimeMillis() to compute the
time to pass to scheduleSelf.

Change-Id: I13aab49922fa300f73b327be25561d7120c09ec4
2018-05-16 18:51:07 -04:00
TreeHugger Robot
7a7b2369fe Merge "Temporarily allow StackView to use a canvas.clipRectUnion" into pi-dev 2018-04-25 17:36:47 +00:00
TreeHugger Robot
eabeec49c4 Merge "Fix rounding of padding in NinePatchDrawable" into pi-dev 2018-04-24 19:58:53 +00:00
Selim Cinek
cf893ac40c Merge "Made the DrawableWrapper return the right ColorFilter" into pi-dev 2018-04-23 02:26:58 +00:00
Adrian Roos
a6d6aab0e0 Defer resizing invisible stacks while drag resizing
Works around a source of jank when drag resizing in split
screen mode: instead of immediately resizing the (potentially
numerous) invisible secondary stacks, we defer that until
the user lets go of the handle.

Change-Id: I3b9faa83005fa86185d4e51b2849e3a826b7f6a9
Fixes: 78214347
Test: Open a gazillion (resizeable) tasks. Enter split screen. Drag handle, verify there is no jank
Test: atest RectTest
2018-04-20 15:09:02 +02:00
Selim Cinek
c85057c14c Made the DrawableWrapper return the right ColorFilter
Previously it simply returned null

Test: atest cts/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableWrapperTest.java
Change-Id: Ia4694e8dee08449262bbe1cfd719795fd86e1ee0
Fixes: 78252558
2018-04-19 10:48:02 +08:00
Derek Sollenberger
2ad19e5146 Temporarily allow StackView to use a canvas.clipRectUnion
StackView currently expands the clip of the view which is a prohibited
operation in API Level 28.  This CL currently allows this specialized
use case to work in this situation until we can update StackView
to not clip to its bounds and then just intersect with this clip
provided by its parent.

Test: CtsWidgetTestCases
Bug: 77642155
Change-Id: Icc003ad3946bb226368ec2030d4707753f4f55e9
2018-04-18 16:19:59 -04:00
Leon Scroggins III
4534745f53 Fix rounding of padding in NinePatchDrawable
Bug: 73088142
Test: Test app at https://buganizer.corp.google.com/issues/73088142#comment6
Test: GridWidgetTest.testItemDecorationAndMarginsAndOpticalBounds

In computeBitmapSize, treat padding as a size in scaleFromDensity. This
results in rounding instead of truncating. This matches the way optical
insets are handled. It also matches the padding we would have gotten if
we had scaled at decode time.

Change-Id: I7d3a83ba824b8dc81187ce9b2d9889d4a87f88ac
2018-04-13 13:12:49 -04: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
TreeHugger Robot
9cb6759072 Merge "Never scale nine-patches in ImageDecoder" into pi-dev 2018-04-05 22:42:39 +00:00
TreeHugger Robot
d2c218f78a Merge "Rename set/get-ConserveMemory" into pi-dev 2018-04-05 20:44:58 +00: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
d9cb59629d Merge "Add docs for setTargetSize and setTargetSampleSize" into pi-dev 2018-04-05 13:29:38 +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
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
8880a9e0b9 Merge "Update javadocs for ImageDecoder and related" into pi-dev 2018-04-03 14:43:01 +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
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 7b837616ae88cbdaf12600cee23b5188e5531937.

Bug: 77276963
Bug: 73777445
Test: CtsGraphicsTestCases
Change-Id: I7acd4ffd5ac41a58d2be8b48cf50119c2b896708
2018-03-30 14:40:04 -04: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
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
9434b66bf7 Merge "Move Path to NAR" into pi-dev 2018-03-29 16:53:41 +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