Commit Graph

4657 Commits

Author SHA1 Message Date
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
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
Michael Hoisie
f5733b0bda Remove unused native method Font$Builder.nGetReleaseNativeFont
The nGetReleaseNativeFont native method has been moved to the enclosing
Font class. JNI registration also does not occur for
Font$Builder.nGetReleaseNativeFont.

Test: m -j framework
Bug: 230032992
Change-Id: Ic987812cabe57c5c964b3cb8036cd7e297c11c36
2022-04-22 00:17:43 +00:00
Tim Murray
47032a2095 Icon: make Icon's Bitmaps immutable
Because Bitmap mutability is propagated across Parcel and Binder, the
following problem can happen when sending an Icon containing a Bitmap
as part of a Notification:

1. App creates Icon with a mutable Bitmap (1 alloc)
2. App sends Icon to system_server, often creating ashmem Bitmap (2 allocs)
3. system_server converts ashmem Bitmap back to heap Bitmap (3 allocs)
4. system_server sends heap Bitmap to each NotificationListener individually,
converting the heap Bitmap to ashmem each time (3+N allocs)
5. NotificationListener converts ashmem Bitmap to heap Bitmap (3+2N allocs)

This is inefficient. This is especially bad because the API to update
a Notification involves sending a full Notification object, including
Icons, repeatedly, and some apps do that several times per second.

Instead, ensure that all Bitmaps transmitted as part of Icons are
immutable. Instead, we get:

1. App creates Icon, which may copy to immutable Bitamp (1 or 2 allocs)
2. App sends Icon to system_server over ashmem (still 1 or 2 allocs)
3. system_server uses received ashmem Bitmap directly (still 1 or 2 allocs)
4. system_server sends same ashmem Bitmap to NotificationListeners (1 or 2)
5. Each NotificationListener uses the same ashmem Bitmap (1 or 2)

This solves the per-NotificationListener amplification, but it does
not solve sending what is likely the same Bitmap N times per second
when apps update Notifications. That will require either app changes
or Notification API changes to avoid bytewise comparisons for all
Bitmaps.

Test: boot, notifications work, memory in maps/gearhead remains good
Bug: 227920378

Change-Id: If92835f647a76da599f358c7c02888e3e2f59235
2022-04-21 18:54:53 +00:00
Robert Carr
7e53d0e9f5 ViewRootImpl/SurfaceView: Listen for queue stalls
Native machinery now reports queue stalls from native layer
up to java layer, which can more appropriately handle errors.
The first case we handle is the case of "stuck fences", generally
indicating GPU hangs. In this case we trigger a bespoke ANR rather
than waiting for an ANR in dequeueBuffers later. dequeueBuffers
ANR could have any number of causes, and this large cluster
is difficult to debug.

Bug: 216160569
Test: Existing tests pass
Change-Id: I7b4429ce96d0bbfa1b74534ddf2b447facb22d10
2022-04-15 15:13:04 -07:00
Chavi Weingarten
e3cc958b53 Merge changes from topic "presubmit-am-699bcbdaa9a54be3a56de1e065ef795a" into tm-mainline-prod am: 3f096a943a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17693701

Change-Id: I6a4b314d3495da4dd6ac319859f0e3387902c5bc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-13 00:57:14 +00:00
chaviw
845d5ad06e Default to true for updateDestinationFrame in BBQ
In most cases, we do want the destination frame to be updated by BBQ.
The exception is SV due to multiple threads involved in property
changes. Change the default updateDestinationFrame to true and let SV
set it to false for their scenario.

Test: Apps with NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW work
Fixes: 228008717
Change-Id: I90ae6f0797633aa963c540a94f1cbaea9e498f23
2022-04-11 14:35:01 -05:00
Chavi Weingarten
62e3f326fa Merge "Add call to disable RT Animations" into tm-dev am: c1f9e4c0b9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17264107

Change-Id: Ideeb0b457b0b9311bba472f41787d7a45912a981
2022-03-24 01:23:12 +00:00
Chavi Weingarten
0f9cba9546 Merge "Add forceDrawNextFrame function for HardwareRenderer" into tm-dev am: 3e3c3ab2da
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17263076

Change-Id: Iaf253798ddd4a0d752a4138aeff906ee8adb8a74
2022-03-24 00:54:04 +00:00
Chavi Weingarten
c1f9e4c0b9 Merge "Add call to disable RT Animations" into tm-dev 2022-03-23 23:23:35 +00:00
chaviw
adba0b1861 Add forceDrawNextFrame function for HardwareRenderer
The forceDraw flag in HardwareRenderer will ensure a frame is drawn when
requested even if it would end up drawing multiple frames in a single
vsync.

This is to help blast sync when we want to synchronize the
buffer. We want to make sure we are guaranteed a callback since we don't
want to wait for retries, especially in the case when trying to synchronize
multiple buffers.

There was already a global flag to handle this, but would use the flag
for all draws. This new function is set per draw so once a frame is
drawn it's unset. The global flag was only used for tests so updated the
test to set the flag before every draw and deleted the global property.

Test: Underlying code was in place. This is just piping a new setter. No
usages yet.
Test: TestSceneRunner
Bug: 200284684

Change-Id: Ie1c9950cabb7331cfed1721564a51a1a15cd1624
2022-03-22 18:08:38 -05:00
chaviw
01053d4350 Add call to disable RT Animations
HWUI already supports disabling RT animations, but there was no correct
way to call it from the application. Adding a call to enable or disable
RT animations on the RenderThread so RT animations can be disabled
during a blast sync.

Test: Builds
Bug: 200284684
Change-Id: Ia1ae3498c38b84b4975f08d37bc764f0c690ed9f
2022-03-22 15:41:24 -05:00
Allen Su
508818fc58 Merge "Text Wrapping automation" 2022-03-22 05:44:23 +00:00