Commit Graph

4718 Commits

Author SHA1 Message Date
Chet Haase
c373758055 Merge "Add APIs to make Android Path queryable and more useful" 2022-08-29 16:38:40 +00:00
Chet Haase
0834e9f298 Add APIs to make Android Path queryable and more useful
The underlying Skia implementation of Path has APIs for
querying the data in a path (via SkPath::Iter). It also exposes
the ability to add conic sections (conicTo()), which is useful
since a Path can contain conics (even if it was not created with
conics directly).  And it adds a method to get the generationId
from a Path, used to see whether a Path changed since the
last time that Id was retrieved. Finally, it exposes a simple
interpolate() function to allow linear interpolation between
two paths.

This CL adds PathIterator to enable querying Path data, and
adds conicTo, isInterpolatable(), and interpolate() to Path,
all of which wrap the underlying, existing Skia functionality.

Bug: 157391114
Bug: 223586753
Test: Added PathIteratorTest plus new tests on PathTest
Change-Id: Iddadfde24dd75ac04d0a2f3ebca767613af25360
2022-08-26 16:32:11 +00:00
Cole Faust
584140c83a Fix array-related errorprone warnings
The ArrayEquals, ArrayHashCode, ArrayToString, and
ArraysAsListPrimitiveArray errorprone findings were
demoted from errors to warnings. Fix existing
occurrences of them so they can be made errors again.

Bug: 242630963
Test: RUN_ERROR_PRONE=true m javac-check
Change-Id: Ia6f216cc36ad0a5758f39fd9b34962cd4adf9d8e
2022-08-25 10:57:12 -07:00
Jon Eckenrode
32cd0a63d4 Merge "Docs: Touch-up of parameter descriptions and tags for consistency." 2022-08-24 18:04:56 +00:00
joneckenrode
66504044ed Docs: Touch-up of parameter descriptions and tags for consistency.
Staged:

https://android.devsite.corp.google.com/reference/android/widget/TextView

https://android.devsite.corp.google.com/reference/android/graphics/text/LineBreakConfig

https://android.devsite.corp.google.com/reference/android/graphics/text/LineBreakConfig.Builder

Test: Built API docs
Change-Id: I68d5228b2f952876c81f8590ccf69d68733f2741
2022-08-23 17:48:53 +00:00
Shuzhen Wang
093242d17d Merge "Handle @format annotation for PixelFormat and ImageFormat" 2022-08-22 15:34:45 +00:00
Shuzhen Wang
572a0642ab Handle @format annotation for PixelFormat and ImageFormat
This is to address the lint error when passing a PixelFormat integer to
ImageReader.newInstance().

Also add the IntDef for YCBCR_P010.

Test: Copy annotations.zip to SDK, and observe no lint error in AS
Bug: 176408464
Change-Id: I224190b5124d6871c4ef04dc5086c6d7c91d4daa
2022-08-18 01:23:02 +00:00
Jon Eckenrode
0004b75dbf Merge "docs: Edited API documentation related to line-break and line-break word styles." 2022-08-16 21:48:11 +00:00
John Reck
50ef099e56 Annotate Bitmap
* Mark sameAs @WorkerThread
* Always noteSlowCall #sameAs
* @NonNull all the non-null things
* Styling fixups

Fixes: 219890711
Test: make
Change-Id: Iad220e7e667a5a6c558fc93dfe2eb9df2d7db35d
2022-08-16 10:30:09 -04:00
joneckenrode
f81fbd3eb0 docs: Edited API documentation related to line-break and line-break word styles.
Staged to:

https://android.devsite.corp.google.com/reference/android/graphics/text/LineBreakConfig

https://android.devsite.corp.google.com/reference/android/graphics/text/LineBreakConfig.Builder

https://android.devsite.corp.google.com/reference/android/widget/TextView

https://android.devsite.corp.google.com/reference/android/R.attr

https://android.devsite.corp.google.com/reference/kotlin/android/R.attr

Test: Built API docs
Change-Id: I06fdf27ba94d806753a1dcc99873dff24cdae626
2022-08-12 17:58:25 +00:00
John Reck
ce2a426ace Merge "Allow PixelCopy for a window from any View" 2022-08-09 13:32:18 +00:00
Kohsuke Yatoh
29727ab342 Remove unused Typeface.getFallback().
The usage was removed in
commit d5ecababb4

Bug: 174672300
Test: m -j
Change-Id: Ie7194d749c14a2c1b5c786bf4bce97bd0eb3a29e
2022-08-08 17:11:33 +00:00
John Reck
2a01556d81 Merge "Remove Path's isSimplePath" 2022-08-05 21:30:34 +00:00
John Reck
c93103c9eb Remove Path's isSimplePath
The optimization has bugs and is of questionable value
given the current state of JNI. Just remove it.

Fixes: 149585703
Test: uirendering CTS, Path graphics test
Change-Id: I613e4854695ae6e4ad9ec8b17be44e856ed03860
2022-08-05 11:22:50 -04:00
John Reck
4d73cb1043 Allow PixelCopy for a window from any View
Also make it actually async, and allow the bitmap
to be auto-allocated

Bug: 195673633
Test: PixelCopyTest CTS suite

Change-Id: Ie872f20c809eaaeb8dc32f3ec6347f21a9a7bc1a
2022-08-04 13:41:58 -04:00
TreeHugger Robot
6b7aa49581 Merge "Fixing getSafeZone() method in AdaptiveIcon" into tm-qpr-dev am: 065fd52a00 am: b423fc6d60
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19520338

Change-Id: Ib2f69b152c5902412d9c030f9ee7c32c60d02f94
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-04 17:10:15 +00:00
Sunny Goyal
63985967cb Fixing getSafeZone() method in AdaptiveIcon
Bug: 240335326
Test: atest FrameworksCoreTests:android.graphics.drawable.IconTest#testWithAdaptiveBitmap -- --abi x86_64
Change-Id: I1204bd759a347a9635dfb48e71ff65cef1f75f9d
2022-08-03 23:17:55 +00:00
Kohsuke Yatoh
711a120d16 Pass buffer base address to minikin::BufferReader.
Bug: 174672300
Test: atest CtsGraphicsTestCases:android.graphics.cts.TypefaceTest
Change-Id: Ie6bf1bb01ccc2803bc6206a0d2276ac59c6877a1
2022-08-03 16:30:49 +00:00
TreeHugger Robot
2a0f7e9438 Merge "Add TestApi that change default typeface" 2022-07-27 01:10:54 +00:00
Sunny Goyal
efdccdbf2d Merge "Using clippath for adaptive icon drawable instead of bitmap shader" into tm-qpr-dev am: aa3a5a36bd am: 7426a459e9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19370745

Change-Id: Ia2e44300f2498c3bfb142a301f343fb67eb08369
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-26 16:54:30 +00:00
Seigo Nonaka
a2ffe9084a Add TestApi that change default typeface
Bug: 238597089
Test: atest android.theme.cts.ThemeHostTest#testThemes
Change-Id: Ia56b4424ab27b2f8dd01c0e61a1f9d26bd661fc9
2022-07-26 16:55:13 +09:00
Sunny Goyal
6d611a3054 Using clippath for adaptive icon drawable instead of bitmap shader
clipPath is already anti-aliased since Android S, so we do not
need to create extra bitmaps for this

Bug: 211896569
Bug: 238937089
Test: Updated tests / presubmit
Change-Id: I60ce42d91ca96babbde9faa4e5580b00f681de35
2022-07-21 20:59:17 +00:00
Kohsuke Yatoh
c2832239d9 Merge "Preload minikin LocaleListCache in Zygote." 2022-07-20 17:35:59 +00:00
Kohsuke Yatoh
bb4e06fde0 Preload minikin LocaleListCache in Zygote.
This saves ~31 KB per process on oriole.

Bug: 174672300
Test: atest CtsGraphicsTestCases:android.graphics.cts.TypefaceTest
Change-Id: Ic70ea842985a0aca441a31327e41980ed47bc961
2022-07-19 06:13:03 +00:00
Kohsuke Yatoh
d7afbefd40 Merge "Add Typeface memory perf test." 2022-07-19 03:05:42 +00:00
Kohsuke Yatoh
9feb92f945 Add Typeface memory perf test.
This test measures:
- SharedMemory (mmap) byte size of serialized font map.
- Native allocation (malloc) byte size of deserialized font map.

Typeface is updated to avoid OOM during test.

Results on oriole-userdebug:

[1/5] android.graphics.perftests.TypefaceSerializationPerfTest#testSerializeFontMap: PASSED (29.222s)
	testSerializeFontMap_stddev (ns): 74859
	testSerializeFontMap_mean (ns): 1560404
	testSerializeFontMap_median (ns): 1549601
	testSerializeFontMap_percentile90 (ns): 1602499
	testSerializeFontMap_percentile95 (ns): 1624715
[2/5] android.graphics.perftests.TypefaceSerializationPerfTest#testSerializeFontMap_memory: PASSED (13.376s)
	testSerializeFontMap_memory_stddev (ns): 0
	testSerializeFontMap_memory_mean (ns): 931071
	testSerializeFontMap_memory_median (ns): 931071
	testSerializeFontMap_memory_percentile90 (ns): 931071
	testSerializeFontMap_memory_percentile95 (ns): 931071
[3/5] android.graphics.perftests.TypefaceSerializationPerfTest#testDeserializeFontMap: PASSED (32.451s)
	testDeserializeFontMap_stddev (ns): 60524
	testDeserializeFontMap_mean (ns): 232285
	testDeserializeFontMap_median (ns): 228149
	testDeserializeFontMap_percentile90 (ns): 272094
	testDeserializeFontMap_percentile95 (ns): 291708
[4/5] android.graphics.perftests.TypefaceSerializationPerfTest#testDeserializeFontMap_memory: PASSED (29.089s)
	testDeserializeFontMap_memory_stddev (ns): 134
	testDeserializeFontMap_memory_mean (ns): 170209
	testDeserializeFontMap_memory_median (ns): 170208
	testDeserializeFontMap_memory_percentile90 (ns): 170208
	testDeserializeFontMap_memory_percentile95 (ns): 170208
[5/5] android.graphics.perftests.TypefaceSerializationPerfTest#testSetSystemFontMap: PASSED (28.687s)
	testSetSystemFontMap_stddev (ns): 2345934
	testSetSystemFontMap_mean (ns): 649662
	testSetSystemFontMap_median (ns): 396260
	testSetSystemFontMap_percentile90 (ns): 436483
	testSetSystemFontMap_percentile95 (ns): 457479

Bug: 174672300
Fix: 238679890
Test: atest CorePerfTests:android.graphics.perftests.TypefaceSerializationPerfTest
Change-Id: Idb0c2a040d3ca488134f2b91a5bcbbe33a7a59c4
2022-07-15 06:20:07 +00:00
Haoyu Zhang
c8abba4907 Introduce TextLine#measureAllbounds
This new method computes the horizontal character bounds by making
use of the character advances returned from native layer. It'll be
used in TextView to populate character bounds, and it's much efficent
compared to calling getPrimaryHorizontal for each character.

Bug: 233922052
Test: atest android.text.TextLineTest
Change-Id: Icdd53e61e2d1513b2231affb19bb00ea5d938d48
2022-07-08 12:50:32 -07:00
Brian Osman
0547bffe40 Fix example AGSL code in the javadoc comments
Bug: b/237562620
Change-Id: I5f562b70d04bc86779190002a2640fb51dc00531
2022-06-29 20:35:03 +00:00
Jernej Virag
ddb2e4b624 Merge "Describe image loads in Traces" into tm-qpr-dev am: bb5c810092 am: 083e6141a4
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18805637

Change-Id: I986e8060f9529c320bba0a0c5375121f03de4516
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-27 10:03:35 +00:00
Jernej Virag
4dc2e413c6 Describe image loads in Traces
This adds tracing to ImageDecoder for image loads. When a drawable is
being loaded, it'll emit a short description of the resource and desired
loading sizes. This will make it significantly easier to find large,
slow bitmap loads when debugging regressions.

Bug: 235451049
Test: physically on a Raven device
Change-Id: I615342f1bd11d867e0bd33209507330848df8525
2022-06-20 09:14:03 +00:00
Charles Chen
fa3f9ca94c Respect minimum dimensions for embedded Activities
Before this CL, minimum dimensions of Activity wasn't respected,
that said, an Activity could be embedded in a TaskFragment of which
bounds are smaller its minimum dimensions.
This CL add the minimum dimensions on several places:

WM core:
1. Verify minimum dimension requirement before adding an Activity to
   a TaskFragment. It'll be early return if the requirement is not
   satisfied.
2. Propagate the minimum dimensions to the client side through
   TaskFragmentInfo to notify the requirement.
3. If TaskFragmentOrganizer tries to shrink a TaskFragment to
   the bounds that smaller than minimum dimensions of its children
   Activity, switch to match the parent bounds.
AndroidX Window extensions:
1. Early return if TaskFragment is resized to the bounds that smaller
   than minimum dimensions which dispatched from the server side.
2. When organizer tries to show Activities side-by-side, verify if
   minimum dimensions requirement of the primary Activiy. If the
   requirement is not satisfied, show Activities in fullscreen
   instead.
TODO: Add an API to check if an Activity intent is allowed to embed
   in a TaskFragment.

Bug: 232871351
Test: atest TaskFragmentOrganizerControllerTest
Test: atest TaskFragmentOrganizerTest TaskFragmentOrganizerPolicyTest
Test: atest SplitActivityLifecycleTest
Test: atest CtsWindowManagerJetpackTestCases
Test: atest WmJetpackUnitTests

Merged-In: Ib46c2cec2a0735b9e3f3420f2cb94754801b86b9
Change-Id: Ib46c2cec2a0735b9e3f3420f2cb94754801b86b9
2022-06-15 00:32:34 +08:00
TreeHugger Robot
8745d54ced Merge "Reduce RippleDrawable background opacity when no window focus" into tm-qpr-dev 2022-06-09 15:18:20 +00:00
Louis Chang
18614db0dd Merge "Reduce RippleDrawable background opacity when no window focus" 2022-06-07 10:36:54 +00:00
Charles Chen
acf17e37e1 Merge "Respect minimum dimensions for embedded Activities" into tm-qpr-dev am: cc0966bfd7 am: 3b35b433bd
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18659388

Change-Id: Ib2d68131f04f5335cb5eecd676733d548f31b3e5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-01 09:39:08 +00:00
Louis Chang
642279e214 Reduce RippleDrawable background opacity when no window focus
Lower the background opacity when the window loses focus
while the view still has focus, in order to prevent user
confusion in a multi-window environment.

Bug: 230355625
Test: manually verified
Change-Id: I59cd7faf35f05a12451f015f8ef2da47077b1bf2
Merged-In: I59cd7faf35f05a12451f015f8ef2da47077b1bf2
2022-06-01 15:18:54 +08:00
Louis Chang
72c111de2c Reduce RippleDrawable background opacity when no window focus
Lower the background opacity when the window loses focus
while the view still has focus, in order to prevent user
confusion in a multi-window environment.

Bug: 230355625
Test: atest RippleDrawableTest
Change-Id: I59cd7faf35f05a12451f015f8ef2da47077b1bf2
2022-06-01 07:16:35 +00:00
Charles Chen
482fbfabd7 Respect minimum dimensions for embedded Activities
Before this CL, minimum dimensions of Activity wasn't respected,
that said, an Activity could be embedded in a TaskFragment of which
bounds are smaller its minimum dimensions.
This CL add the minimum dimensions on several places:

WM core:
1. Verify minimum dimension requirement before adding an Activity to
   a TaskFragment. It'll be early return if the requirement is not
   satisfied.
2. Propagate the minimum dimensions to the client side through
   TaskFragmentInfo to notify the requirement.
3. If TaskFragmentOrganizer tries to shrink a TaskFragment to
   the bounds that smaller than minimum dimensions of its children
   Activity, switch to match the parent bounds.
AndroidX Window extensions:
1. Early return if TaskFragment is resized to the bounds that smaller
   than minimum dimensions which dispatched from the server side.
2. When organizer tries to show Activities side-by-side, verify if
   minimum dimensions requirement of the primary Activiy. If the
   requirement is not satisfied, show Activities in fullscreen
   instead.
TODO: Add an API to check if an Activity intent is allowed to embed
   in a TaskFragment.

Bug: 232871351
Test: atest TaskFragmentOrganizerControllerTest
Test: atest TaskFragmentOrganizerTest TaskFragmentOrganizerPolicyTest
Test: atest SplitActivityLifecycleTest
Test: atest CtsWindowManagerJetpackTestCases
Test: atest WmJetpackUnitTests

Change-Id: Ib46c2cec2a0735b9e3f3420f2cb94754801b86b9
2022-05-31 23:25:18 +08:00
Nader Jawad
a2cae5e641 Merge "Fix memory leak with RenderNodeAnimator" into tm-dev am: b9a8ed8b70 am: e983d06e90
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18290468

Change-Id: I7bcedf4852b5bc11053579d93ad6a56db02ae777
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-11 21:35:30 +00:00
Nader Jawad
b9a8ed8b70 Merge "Fix memory leak with RenderNodeAnimator" into tm-dev 2022-05-11 16:49:16 +00:00
Nader Jawad
528b0d2824 Fix memory leak with RenderNodeAnimator
Update View logic to cancel all RenderNodeAnimators
when it is detached from a window.
Updated HWUI Animation logic to enable a cancellation
flag to cancel all animators operating on a RenderNode
whenever the staging parameters are pushed to RenderThread

Fixes: 229136453
Test: Added core test to RenderNodeAnimatorTests
Change-Id: Id674e8474757bfc8dfe30394dde29da49d139bfc
2022-05-10 14:02:40 -07:00
Rob Carr
1f4462425c Merge "ViewRootImpl/SurfaceView: Listen for queue stalls" into tm-dev am: 7a0ee72bff am: 38491dfa49
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17778270

Change-Id: Ic101688a91b0aec337897955c75f1cb6aeb52520
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-06 13:40:50 +00:00
Rob Carr
7a0ee72bff Merge "ViewRootImpl/SurfaceView: Listen for queue stalls" into tm-dev 2022-05-05 15:11:39 +00:00
Jay Aliomer
2884744b7d Merge "Set mask shader after matrix is set" into tm-dev am: b6dfbd9597 am: 08e2c2d119 am: 899482d5ab am: 038343c565
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17821505

Change-Id: Ic226704aa46e981f3970793541a247df9d4dcf83
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-02 12:46:25 +00:00
Jay Aliomer
b6dfbd9597 Merge "Set mask shader after matrix is set" into tm-dev 2022-04-30 13:28:28 +00:00
Jay Aliomer
dd1b5b147e Set mask shader after matrix is set
When the size of the drawable bounds changes, the mask shader is not updated properly
Assumed passed by reference instead of pass by value which resulted in
the wrong behavior

Fixes: 227624349
Test: RippleMicrobenchmark
Change-Id: Iedc3f06441414455fcfedf8cabd61e5b334a7441
2022-04-28 21:01:30 +00:00
TreeHugger Robot
26dc24dd83 Merge "Revert "Revert "Icon: make Icon's Bitmaps immutable""" into tm-dev am: edea3fd450 am: 490e830f87
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17943164

Change-Id: Ibf656a302bb0396619f55cdbd93905397b9a3896
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-28 00:08:15 +00:00
Tim Murray
e8c5addab3 Revert "Revert "Icon: make Icon's Bitmaps immutable""
This reverts commit 8fd35436fa.

Reason for revert: NotificationTemplateTest fixed
Test: atest CtsAppTestCases:android.app.cts.NotificationTemplateTest
Bug: 227920378

Change-Id: I61dc3cb7620d64a55deb669cb1f08f4676d36456
2022-04-25 17:49:24 +00:00
Xiaowen Lei
6bf1f57c55 Merge "Revert "Icon: make Icon's Bitmaps immutable"" into tm-dev am: 4e8c47efbb am: 015dabf6e3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17919920

Change-Id: Ib8c158354b8144dfedab17a52547742c6f5793ff
Ignore-AOSP-First: this is an automerge
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-23 03:19:23 +00:00
Xiaowen Lei
8fd35436fa Revert "Icon: make Icon's Bitmaps immutable"
This reverts commit 47032a2095.

Reason for revert: DroidMonitor: Potential culprit for Bug 230140012 -
verifying through ABTD before revert submission. This is part of the
standard investigation process, and does not mean your CL will be
reverted.

Change-Id: I22f5aa5bd57e37d638292773986b479428e5cdbc
2022-04-22 23:26:47 +00:00
Tim Murray
dc9f4f0f30 Merge "Icon: make Icon's Bitmaps immutable" into tm-dev am: 227085759c am: 307dba797c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17803565

Change-Id: I423e04c11dfed46f476d41a15546ae5d2e51bdea
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-22 18:21:45 +00:00