Commit Graph

4349 Commits

Author SHA1 Message Date
Tiger Huang
b73471b4ec Remove legacy frames from WindowFrames and DisplayFrames
These frames are used for computing the legacy insets which won't be
used anymore. We should only maintain the new insets system now.

This CL also unhides Rect#inset APIs.

Bug: 149813814
Test: atest WindowFrameTests DisplayPolicyLayoutTests InsetsPolicyTest
            SplashscreenTests ManifestLayoutTests WindowMetricsTests
            WindowInsetsAnimationImeTests WindowInsetsControllerTests
            WindowUntrustedTouchTest DisplayContentTests
Change-Id: I06e40be6342b2ae35f7cc3e6f4ebdbe68edf0499
2020-11-18 10:59:15 +08:00
John Reck
2d2bd12935 Merge "Remove SaveFlags from saveLayer(Alpha)" 2020-11-17 21:48:30 +00:00
John Reck
a00eef21de Remove SaveFlags from saveLayer(Alpha)
This has been hardcoded as ALL_SAVE_FLAGS for a couple releases now.

Since it's now permanent behavior, remove the last bit of plumbing
for SaveFlags on saveLayer

Test: builds & boots
Change-Id: Iec92f27199d0b4781c2293dcdcfd45a1562a1b4e
2020-11-16 18:26:08 -05:00
Felka Chang
2547398797 Add the related tests for Icon in TEST_MAPPING
It's necessary to run the following two tests if
android.graphic.drawable.Icon is modified.
* CtsGraphicsTestCases:android.graphics.drawable.cts.IconTest
* FrameworksCoreTests:android.graphics.drawable.IconTest

Test: atest -p framewroks/base/graphics/java/android/graphics/drawable
Test: cd framewroks/base/graphics/java/android/graphics/drawable; \
      atest --enable-file-patterns --collect-tests-only
Bug: 172183870
Change-Id: Ic5bcaf3231ead515aeb2cba5b7f977dbbd41f5a9
2020-11-17 00:49:50 +08:00
TreeHugger Robot
474cac5066 Merge "Fix SystemUI count down doesn't work" 2020-11-16 15:56:51 +00:00
Felka Chang
920dcad2d3 Fix SystemUI count down doesn't work
StatusBarIconView uses Icon#loadDrawableAsUser to load drawable defined
by the customized Drawable class. context.createContextAsUser with flag
Context.CONTEXT_INCLUDE_CODE can fix the ClassNotFound found problem.
And, it needs to prevent any security issue by checking if the context
is the same app with the process.

If the parameter userId is the same with context.getUserId(), it
shouldn't create the extra Context instance.

Fixes: 171712189
Test: atest \
    CtsGraphicsTestCases:android.graphics.drawable.cts.IconTest \
    FrameworksCoreTests:android.graphics.drawable.IconTest
Change-Id: I267fc6eed90a6a6bba39b9976c1d843734e49dec
2020-11-16 14:20:13 +00:00
Kohsuke Yatoh
d56d2e9a67 Retry "Support loading system font map from SharedMemory."
This is the second try of
commit c7a5b3a90d, which was reverted in
commit 735d447d48

Changes:
- Use reflection to update static final fields, because some apps and
  tests rely on Typeface.create() to return references to static final
  fields (which is a behavior resulted from the use of internal cache).
- Make setSystemFontMap() thread safe.
- Hold a reference to ByteBuffer so that the memory won't be unmapped.

Bug: 172891184
Test: atest FrameworksCoreTests:TypefaceTest
Test: atest CtsWidgetTestCases:android.widget.cts.TextViewPrecomputedTextTest
Change-Id: I1dea26c08a8585ea10e866c063bef6d682d8b15e
2020-11-13 19:52:27 +00:00
TreeHugger Robot
7ff909b97a Merge "Revert "Support loading system font map from SharedMemory."" 2020-11-12 15:37:35 +00:00
Mohammad Samiul Islam
735d447d48 Revert "Support loading system font map from SharedMemory."
This reverts commit c7a5b3a90d.

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

Change-Id: If71083df98155ae9e7f55ed1ca49b15456d12a82
2020-11-12 11:46:46 +00:00
TreeHugger Robot
a14eb1ec75 Merge "Support loading system font map from SharedMemory." 2020-11-12 01:41:13 +00:00
Kohsuke Yatoh
c7a5b3a90d Support loading system font map from SharedMemory.
Bug: 172891184
Test: atest FrameworksCoreTests:TypefaceTest
Change-Id: Ibcf10ccb160d83f7d01188b612c615b093696202
2020-11-11 15:28:37 -08:00
Leon Scroggins
6e597584c8 Merge changes I3f6c3260,I0f4d685d
* changes:
  Remove @SystemApi from Compatibility
  Revert "Make createSource(ContentResolver, Uri, Resources) a SystemApi"
2020-11-11 20:43:06 +00:00
Leon Scroggins III
2af10003c4 Remove @SystemApi from Compatibility
Bug: 152322291
Bug: 172934376
Test: make

The UI Rendering mainline module is on hold for now, so this does not
need to be @SystemApi. The system can still access it through @hide.

This leaves in place the new Compatibility class (added in
Ie7172fb93364a1e04ab844b8fa64887bf9d8b005), which seems just as good as
the old approach, and we can switch it back to @SystemApi if/when we
restart the module.

Change-Id: I3f6c32603c4eace55ece04936bff6f9336cf6627
2020-11-10 14:57:09 -05:00
Leon Scroggins
99b7556cb2 Revert "Make createSource(ContentResolver, Uri, Resources) a SystemApi"
Bug: 152322291
Bug: 172934376
Test: make

This reverts commit 97eacc36a3.

Reason for revert: The UI Rendering mainline module is on hold for
now, so this does not need to be @SystemApi. The system can still
access it through @hide.

Change-Id: I0f4d685d62cf468a3fd9a7e664bcc46569e94591
2020-11-10 14:41:59 -05:00
Kohsuke Yatoh
df08f349d3 Merge "Support serializing Java Typeface." 2020-11-10 08:37:55 +00:00
Kohsuke Yatoh
1ca390e9f6 Support serializing Java Typeface.
Bug: 169871852
Test: atest FrameworksCoreTests:TypefaceTest
Change-Id: I3b4315440e2ef6d45f0f9bf526b1980a974d9807
2020-11-09 14:11:25 -08:00
Chavi Weingarten
7df723dd69 Merge "Fixed a few issues with blast sync with SurfaceView" 2020-11-09 16:54:23 +00:00
chaviw
ad81608488 Fixed a few issues with blast sync with SurfaceView
If SurfaceView changed and needs to update its SurfaceControl, it will
append its changes to the main window's blast sync transaction. This is
to ensure it can synchronize with the main window.

However, if SV changes, but the main window doesn't need to submit a new
frame, the logic to synchronize doesn't work. This changes fixes a few
issues

1. Make sure to force a full redraw when
mNextDrawUseBLASTSyncTransaction. This is to ensure we get the proper
callbacks even if there's no new content to draw

2. Clear nextTransaction in BBQ when a frameCompleteCallback is invoked.
In most cases the transaction in BBQ is already cleared since the
frameCompleteCallback is called after a frame is latched and BBQ will
clear the nextTransaction that was set. This is needed when hwui won't
draw a new frame since there's nothing new to draw. In that case, we
will get an immediate frameCompleteCallback without invoking the
processNextBuffer. If VRI doesn't clear the transaction, BBQ will try to
use the stale transaction when a new frame does come in

Test: blast sync in SV enabled doesn't freeze YT
Bug: 172579592
Change-Id: Idca7accdf094dbb4585897e4e884c1147b1a2cd0
2020-11-06 16:44:16 -08:00
Nader Jawad
ef3da57139 Merge "Introduce more RenderEffect APIs" 2020-11-06 21:16:25 +00:00
TreeHugger Robot
18dfafee86 Merge "Introduce getSourceIdentifier instead of isSameSource." 2020-11-05 22:19:27 +00:00
Nader Jawad
0081a9c61d Introduce more RenderEffect APIs
Add support for the following RenderEffects:
--RenderEffect.createColorFilterEffect
--RenderEffect.createBitmapEffect
--RenderEffect.createComposeEffect
--RenderEffect.createCombineEffect

Bug: 143468037
Test: Added new CTS tests to RenderNodeTests
Change-Id: I0c1398986d93c17020a4cf770f9782cdc10253bc
2020-11-05 12:59:05 -08:00
Mathew Inwood
5d123b6775 Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

Bug: 170729553
Test: Treehugger
Merged-In: I626caf7c1fe46c5ab1f39c2895b42a34319f771a
Change-Id: I54e5ecd11e76ca1de3c5893e3a98b0108e735413
2020-11-04 09:45:53 +00:00
Seigo Nonaka
bb6840347b Introduce getSourceIdentifier instead of isSameSource.
After some experiment, equality function is not enough for
high performance animation. To use native glyph cache efficiently,
need to cache the Font object during font variation animations.
This identifier will be used for the key of the cache.

Bug: 171911683
Test: atest FontTest
Change-Id: Idbaa1bc83aea2c6af82641bd7d3a553f2cfe4793
2020-11-03 23:32:03 -08:00
Joshua Baxter
492cb32c3a docs: fix "buidler" typos in Typeface.Builder am: 8aeade4629 am: f36f2de31a am: 88dce482e3 am: 7e20c36a51 am: 7a30eae665
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/9975934

Change-Id: Iece05fb4b30c057728cee465cb0cb788a9220304
2020-11-04 01:12:04 +00:00
Joshua Baxter
71d03cbb82 docs: fix "buidler" typos in Typeface.Builder am: 8aeade4629 am: f36f2de31a am: 88dce482e3 am: 4af722e4aa
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/9975934

Change-Id: Ie470db5f49e1acd6742183608e8b61af41af1635
2020-11-04 00:58:00 +00:00
Joshua Baxter
7a30eae665 docs: fix "buidler" typos in Typeface.Builder am: 8aeade4629 am: f36f2de31a am: 88dce482e3 am: 7e20c36a51
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/9975934

Change-Id: I7178d3d8360cc5986785bce67e809b7542a4f51a
2020-11-04 00:57:54 +00:00
Joshua Baxter
4af722e4aa docs: fix "buidler" typos in Typeface.Builder am: 8aeade4629 am: f36f2de31a am: 88dce482e3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/9975934

Change-Id: Id17dd42b36327534837996e9eaf1fc75b5a5f3b7
2020-11-04 00:43:11 +00:00
Joshua Baxter
88dce482e3 docs: fix "buidler" typos in Typeface.Builder am: 8aeade4629 am: f36f2de31a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/9975934

Change-Id: I7593fd1af6e5e310322ffba85d6140f6e71b4cb5
2020-11-04 00:16:41 +00:00
Joshua Baxter
8aeade4629 docs: fix "buidler" typos in Typeface.Builder
Change-Id: Ic27a4ea036ca5506793795bf838ff63355eeeaf8
test: make ds-docs
bug: 119301911
2020-11-03 20:00:09 +00:00
Seigo Nonaka
af7629e7f9 Add Font#isSameSource API for faster checking underlying buffer equality.
Bug: 171911683
Test: atest FontTest
Change-Id: I4e0f28fffbcaa3b4ee8830ca5cab366278306b7a
2020-11-02 23:42:11 -08:00
Mathew Inwood
5f0edaaaf5 Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

Bug: 170729553
Test: Treehugger
Merged-In: I8285daa8530260251ecad6f3f38f98e263629ca7
Change-Id: I626caf7c1fe46c5ab1f39c2895b42a34319f771a
2020-11-02 10:30:09 +00:00
Mathew Inwood
8e742f928e Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

This is a resubmit of ag/12929664 with some APIs excluded that caused
test failures; see bugs 171886397, 171888296, 171864568.

APIs excluded:
Landroid/bluetooth/le/ScanRecord;->parseFromBytes([B)Landroid/bluetooth/le/ScanRecord;
Landroid/os/Process;->myPpid()I
Landroid/os/SharedMemory;->getFd()I
Landroid/hardware/input/InputManager;->INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH:I

Bug: 170729553
Test: Treehugger
Change-Id: I8285daa8530260251ecad6f3f38f98e263629ca7
2020-10-29 11:51:12 +00:00
Hongwei Wang
050275cd83 Revert "Add maxTargetSdk restriction to unused APIs."
This reverts commit 72f07d6a8a.

Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?testMethod=testAppZygotePreload&testClass=android.app.cts.ServiceTest&atpConfigName=suite%2Ftest-mapping-presubmit-retry_cloud-tf&testModule=CtsAppTestCases&fkbb=6936597&lkbb=6936969&lkgb=6936551&testResults=true&branch=git_master&target=cf_x86_phone-userdebug>, bug b/171886397

Bug: 171886397
Change-Id: Ibe0f0430a3451477c1ee8ef56a596e91ea1e7672
2020-10-28 20:16:22 +00:00
Mathew Inwood
72f07d6a8a Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

Bug: 170729553
Test: Treehugger
Change-Id: I4c8fd0006f950de9955242e93968fb0996ceb372
2020-10-27 15:46:07 +00:00
Nader Jawad
4209e156f7 Merge "Added support for focal points in RadialGradient" 2020-10-23 19:26:36 +00:00
Nader Jawad
e7ab841f37 Added support for focal points in RadialGradient
Updated RadialGradient API to accept optional starting
(focal) point parameters. Internally create a two point
conical shader if focal points are provided.

Fixes: 167695230
Test: Added CTS test to verify focal points on RadialGradient
Change-Id: I18baba3d0a7285c3f787af8f441c797414bae2cf
2020-10-23 10:02:24 -07:00
TreeHugger Robot
f623bfa355 Merge "Remove PackageManager.getResourcesForApplicationAsUser API" 2020-10-23 05:31:13 +00:00
Vishnu Nair
ce1a648484 Allow creating child surfaces from BlastBufferQueue
App such as Chrome create child surfaces and parent them to
surfaces provided by SurfaceView. When we enable the blast
adapter for SurfaceView, the IGBP returned to the app is
created in the client and SurfaceFlinger does not know about it.
When the app creates a child surface and provides the IGBP as the
parent surface identifier, SF fails to validate the IGBP and the
surface is not created. This can be avoid if the client creates the
child surface from the SV SurfaceControl but we still need to
support existing APIs.

To fix this, when we create a Surface from the adapter, pass in
the handle of the Blast SurfaceControl. When calling
ASurfaceControl_createFromWindow, use this handle to identify
the parent.

Bug: 168917217
Test: adb shell settings put global use_blast_adapter_sv 1 & launch chrome
Change-Id: I879b411c47e8558397516bd7b7278813e79e005f
2020-10-22 18:03:22 -07:00
Felka Chang
f922ae3179 Remove PackageManager.getResourcesForApplicationAsUser API
To switch another user to do something should create the context of the
specified user by using Context.createContextAsUser rather than call
*AsUser API directly.

To change Icon not to use PackageManager.getResourcesForApplicationAsUser
lets StatusBarIconViewTest no need to mock
getResourcesForApplicationAsUser in mock PackageManager instance.

Test: make -j droid cts gts vts
Test: make -j docs
Test: atest SystemUITests \
    FrameworksServicesTests:com.android.server.pm \
    CtsGraphicsTestCases:android.graphics.drawable.cts.IconTest \
    FrameworksCoreTests:android.graphics.drawable.IconTest
Bug: 170928809
Change-Id: I4a2ec54b6e137a9c9efcfba0589c08ea8cac86ce
2020-10-23 01:39:09 +08:00
TreeHugger Robot
5746484a09 Merge "Fix wrong offset of BiDi text by TextShaper" 2020-10-21 20:05:28 +00:00
Jeff Sharkey
1c08f48253 Apply fixes for EfficientStringsChecker.
The recently-built Error Prone checker has found many instances where
we're always paying the cost of StringBuilder concatenation, even in
the typical cases where preconditions are successfully met.

Benchmarks have shown that even when replacing these with varargs
formatter strings, the default case is 20x faster.

Bug: 170978902
Test: none
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: If8c00bc73467bfb91ec16c162969c9d26ca53646
2020-10-20 22:00:16 -06:00
Seigo Nonaka
170e0949f3 Fix wrong offset of BiDi text by TextShaper
This CL includes:
- Fix relative offset of BidiRun by reviving width calculation in TextLine.
- Fix bidi level buffer offset. It shuold be relative to the substring, but
  the absolute offset was passed.
- Removed paint argument from PositionedGlyph which is not used.

Bug: 171275519
Test: atest android.graphics.text.cts.TextRunShaperTest
Test: atest android.text.cts.TextShaperTest

Change-Id: I36949089d744bdfae61995210b2051866a7510ac
2020-10-19 23:31:35 -07:00
TreeHugger Robot
767286e0ef Merge "Improve Font#equals and Font#hashCode for HashMap." 2020-10-18 01:47:34 +00:00
Vishnu Nair
6e2fec6efd Merge "BLAST: Ensure buffers are submitted before reporting draw finished" 2020-10-16 23:03:51 +00:00
Seigo Nonaka
31bf860bb6 Improve Font#equals and Font#hashCode for HashMap.
Font#equals and Font#hashCode reads bytes in the buffer and end up
with bad performance if we use it as key of HashMap.

To improve them, does following.

- Font#hashCode
Use buffer size as hash. Since we only accept OpenType compliant font
files (invalid font data will be IllegalArgumentException in ctor),
the hash collision due to same file size is unlikely happens.

The ByteBuffer#hashCode includes head position as hashCode but
intentionally exclude them from new hashCode since the head position
is not used by platform include native code.

- Font#equals
The ByteBuffer is frequently duplicated for many reasons, e.g. having
different reading head, etc, but the underlying mmaped memory address
has not changed. Fortunately we have this address in underlying font
object. Compare them as a shortcut of content equality.

With this change, the local benchmark for the Font key-ed HashMap look
up gets faster from 30ms to 4us. (on Pixel 3a)

Bug: 170494256
Test: atest FontTest

Change-Id: Ibc7f7aae0b3427e71209444eebb93753c340b711
2020-10-15 18:24:35 -07:00
TreeHugger Robot
d27f5a6049 Merge "Update Shader.TileMode documentation." 2020-10-16 00:59:02 +00:00
TreeHugger Robot
7347b89fec Merge "Update TextShaper APIs to address API council feedback" 2020-10-15 23:11:03 +00:00
Nader Jawad
394d6432c3 Update Shader.TileMode documentation.
Updated documentation for TileModel.DECAL to indicate that
"original domain" refers to the bounds of the shader and
transparent black will be drawn for regions outsdie of the
shader.

Fixes: 169331275
Test: N/A
Change-Id: I6afdf4354668197cd7f584071fc35f80e07053fe
2020-10-15 15:42:58 -07:00
Vishnu Nair
9bce5e0c04 BLAST: Ensure buffers are submitted before reporting draw finished
If blast sync is not enabled abut we need to report draw finished
for the next frame, call setNextTransaction. Blast buffer queue
will process any queued up buffers and ensure the buffer is
submitted before reporting draw finished.

Test: Test no flickers with blast enabled in splitscreen
Change-Id: If7a36eb0a9a2914dd37adfd20abcbe2b5074b16a
2020-10-15 11:48:42 -07:00
Seigo Nonaka
c489d627c9 Update TextShaper APIs to address API council feedback
This CL contains followings:
- Rename TextShaper to TextRunShaper, StyledTextShaper to TextShaper
- Renamed getTotalAdvance to getAdvance
- Rename getStyle to getGlyphStyle
- Rename getOriginX/Y to getOffsetX/Y
- Rename getPositionX/Y to getGlyphX/Y
- Fixed some documentation errors.
- Remvoed GlyphStyle. Added GlyphConsumer instead.

Bug: 170255480
Test: atest TextShaperRunTest GlyphStyleTest TextShaperTest

Change-Id: I0ffd7a3374e9cd1e04872240c2d0da26bc530244
2020-10-14 21:12:36 -07:00