Commit Graph

17003 Commits

Author SHA1 Message Date
Julian Odell
465ec74e2f Merge "Notify content capture on detach before setting attachInfo to null." into sc-qpr1-dev am: 84a7a431cc am: 13b149c56b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15935219

Change-Id: I1098ac6009cb9b8a126ab2a0c848f4e1842864bf
2021-09-29 05:25:31 +00:00
Julian Odell
84a7a431cc Merge "Notify content capture on detach before setting attachInfo to null." into sc-qpr1-dev 2021-09-29 04:55:18 +00:00
Vishnu Nair
b866c0323a Merge "ViewRootImpl: Update opaque flag if SurfaceControl changes from relayout" into sc-qpr1-dev am: 8dc8182ad0 am: 9bbf9cd727
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15934803

Change-Id: Ic659035d5ed05e2927d672f52b52ee31e87ee9d4
2021-09-28 21:06:48 +00:00
Julian Odell
7c3d133d65 Notify content capture on detach before setting attachInfo to null.
If a view is detached before being removed (which seems common with some
recycler list views) then no content capture view removed event is sent
(notifyAppearedOrDisappearedForContentCaptureIfNeeded does nothing
if mAttachInfo is null).

Fix: 200166989
Test: Manual verification using AiAi logging
Change-Id: Ic04af005bb4ad425ba8398439f1f47bb6bcb334c
2021-09-28 20:24:07 +00:00
Vishnu Nair
f0ae9acf36 ViewRootImpl: Update opaque flag if SurfaceControl changes from relayout
The opaque flag is necessary for the compositor to blend the layers
correctly and prevent translucent pixels from showing the layer
underneath during animations.

Test: manually punch holes in apps and verify opaque apps don't show the layer underneath
Test: automated tests to follow
Bug: 198924563
Change-Id: I1116c51b2efd4e9c0fe2acbca080291f3950245c
2021-09-28 17:45:10 +00:00
TreeHugger Robot
4f7274abe3 Merge "IME: make WindowInsetsController.show(ime()) more robust" into sc-v2-dev 2021-09-28 09:43:51 +00:00
Pablo Gamito
84afe777a1 Merge changes Ibd9f22af,Id42f5276 into sc-qpr1-dev am: e1841dc539
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15897408

Change-Id: I373e1af0ccbeb47445d9cf7bddb1f6d62e6f7e85
2021-09-28 05:13:42 +00:00
Pablo Gamito
66d4318c18 Revert "Add API to specify background color for animations"
This reverts commit 2ccc829e71.

Reason for revert: No longer needed

Test: Existing tests
Bug: 200763116
Change-Id: Ibd9f22af05eba99c4509b503665c1e915993c940
2021-09-27 23:42:32 +02:00
Pablo Gamito
a5f3e90212 Stop relying on background color attribute to set task transition background
Because the background attribute used to have a different use some apps still set it and it means we could run transitions with unexpected background colors

Test: Existing

Fixes: 200763116
Merged-In: Id42f52760cb9a681c6c33f3c261d7db5e2f71af3
Change-Id: Id42f52760cb9a681c6c33f3c261d7db5e2f71af3
2021-09-27 23:42:15 +02:00
Pablo Gamito
ec0a575dfb Merge "Stop relying on background color attribute to set task transition background" into sc-v2-dev 2021-09-27 19:57:41 +00:00
Joanne Chung
8f49213589 Merge "Fix translation doesn't work on ViewGroup" into sc-qpr1-dev am: f0c99d831e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15853328

Change-Id: I1714a18d2263b42ea743c09e4f500b98507284fb
2021-09-27 15:45:51 +00:00
Joanne Chung
4d1de3c133 Merge "Fix the existing translation doesn't update for new translated result." into sc-qpr1-dev am: 0287b4722c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15853776

Change-Id: I9f1f1b34c600770e7bb123cf06205f7ec5db1de1
2021-09-27 15:45:22 +00:00
Pablo Gamito
481ea6651c Merge "Update status bar transition start time" into sc-qpr1-dev am: 5784ba0c38
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15879493

Change-Id: Ibb150dff4381a65391ce6e1bba134ff64b8e3259
2021-09-27 15:43:14 +00:00
Pablo Gamito
c26db36f27 Stop relying on background color attribute to set task transition background
Because the background attribute used to have a different use some apps still set it and it means we could run transitions with unexpected background colors

Test: Existing

Bug: 200763116
Change-Id: Id42f52760cb9a681c6c33f3c261d7db5e2f71af3
2021-09-27 15:42:38 +00:00
Sally Yuen
69b9a3fb5e Merge "Add accessibility support for Drag & Drop" into sc-v2-dev 2021-09-27 04:44:18 +00:00
Pablo Gamito
8ae2f6e830 Merge "Add API to specify background color for animations" into sc-qpr1-dev am: 14886c5085
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15836428

Change-Id: I2a65a392ae206b242eab0218474b0a6a335318bf
2021-09-25 02:16:41 +00:00
Vishnu Nair
e84c7c6393 Merge "WM: Handle primary display orientation when calculating the transform hint" into sc-v2-dev 2021-09-23 19:14:57 +00:00
Adrian Roos
e4e7d6fda6 IME: make WindowInsetsController.show(ime()) more robust
We need to make sure the served view is up-to-date, otherwise we might
erroneously reject or allow a request to show the IME via WindowInsetsController.

Fixes: 190217891
Bug: 200051968
Test: atest WindowInsetsControllerTests#\
        testShowIme_immediatelyAfterDetachAndReattach
Merged-In: Ib41412d5d5636bdc236aa94c4ee4702686b6d10f
Change-Id: Ib41412d5d5636bdc236aa94c4ee4702686b6d10f
(cherry picked from commit e6b4e24b30)
2021-09-23 16:10:15 +00:00
Joanne Chung
f0c99d831e Merge "Fix translation doesn't work on ViewGroup" into sc-qpr1-dev 2021-09-23 06:15:01 +00:00
Joanne Chung
0287b4722c Merge "Fix the existing translation doesn't update for new translated result." into sc-qpr1-dev 2021-09-23 01:14:44 +00:00
TreeHugger Robot
dedfe23d54 Merge "Expose getSurfaceTransformHint API" into sc-v2-dev 2021-09-22 23:55:07 +00:00
Adam He
b9eafd3c02 Merge "Content Capture change to send window token on creating session." into sc-v2-dev 2021-09-22 20:13:53 +00:00
Adam He
d9e69e2b50 Content Capture change to send window token on creating session.
Bug: 189477723
Test: atest CtsContentCaptureTestCases
Change-Id: I70a0be583faae1a18c61e70c72a3d2a8e9e46438
2021-09-22 17:06:50 +00:00
Vishnu Nair
d6f2c5882f WM: Handle primary display orientation when calculating the transform hint
Query the surface flinger property
ro.surface_flinger.primary_display_orientation to determine the
primary display's install orientation. If the window is on the
primary display, then update the transform hint passed on to the
client.

Bug: 196167822
Test: check initial buffer transforms on displays with a different
install orientation

Change-Id: Idf010cd6be73172ba708820f87046c3ba3cf8001
2021-09-22 17:06:10 +00:00
Pablo Gamito
3ea6b0ab10 Update status bar transition start time
Update to feel less flickery with the new task transition animation

We want to try and have the navbar transition right when the animation is in between the two tasks

Bug: 200674544
Test: Existing tests
Change-Id: If99965c4b4776c902a3c6b32a3fcdb0b65811407
2021-09-22 15:36:36 +02:00
Adam He
19f65ec098 Add Content Capture event TYPE_WINDOW_BOUNDS_CHANGED to notify window
bounds.

Bug: 189477723
CTS-Coverage-Bug: 189477723
Test: manual verification

Change-Id: I38cfdde21aed1827744f8db4eb61f62cc2413e78
2021-09-21 21:54:52 +00:00
Vishnu Nair
1f19e1141e Expose getSurfaceTransformHint API
The transform hint can be used by a buffer producer to pre-rotate
the rendering such that the final transformation in the system
composer is identity. This can be very useful when used in
conjunction with the h/w composer HAL in situations where it cannot
handle rotations or handle them with an additional power cost.

Bug: 196167822
Test: atest AttachedSurfaceControlTest
Change-Id: Idb7fcf58ecbcc22cd43c226ee4faad958c265e72
2021-09-21 11:28:35 -07:00
TreeHugger Robot
348a0e6e3c Merge "SurfaceControl: Add setDropInputMode api" into sc-v2-dev 2021-09-21 15:37:27 +00:00
Chris Li
83d5a591f2 Merge changes Ib5ad3250,Iff58afdb into sc-v2-dev
* changes:
  Flag whether a RemoteAnimationTarget has parent in animation
  Use TaskFragment bounds instead of TaskBounds for Activity animation
2021-09-21 05:18:46 +00:00
Chris Li
79ab7ea034 Flag whether a RemoteAnimationTarget has parent in animation
There is case when a TaskFragment is resizing while one of its children
is open/close. In such case, both the TaskFragment and its child will be
included in the transition, but we don't want to animate both of them.
Use the new flag to determine if the child need to be animated.

Bug: 196173550
Test: test with demo app
Change-Id: Ib5ad32501e046e5b612f6d5ae2faed6266d99f3d
2021-09-21 08:33:16 +08:00
TreeHugger Robot
bc617435cf Merge "SurfaceView: Fix SurfaceControl synchronization issues" into sc-v2-dev 2021-09-20 22:59:15 +00:00
Vishnu Nair
e2b63cb1f9 SurfaceControl: Add setDropInputMode api
Introduces an API to drop input events on this SurfaceControl. This
policy will be inherited by its children. The caller must hold the
ACCESS_SURFACE_FLINGER permission.

Options include:
ALL: SurfaceControl and its children will not receive any
input regardless of whether it has a valid input channel.
OBSCURED: SurfaceControl and its children will not
receive any input if the layer is obscured, cropped by its parent or
translucent.

These policies are used to enable features that allow for a less trusted
interaction model between apps. See the bug for more details.

Test: atest libgui_test InputDispatcherDropInputFeatureTest
Bug:197364677

Merged-In: Ifcb4133306a43874e74e8fb0f42b60842daf6f25
Change-Id: Ifcb4133306a43874e74e8fb0f42b60842daf6f25
2021-09-20 17:37:34 +00:00
Pablo Gamito
2ccc829e71 Add API to specify background color for animations
To be used for new task transtion animations
(go/android-new-task-motion) to set a background color behind the
animations instead of showing the wallpaper.

Test: atest FlickerTests:TaskTransitionTest
Bug: 199507257
Change-Id: I7fabfdcaf90be63c11eb3b18d65259c620570cab
2021-09-20 19:30:17 +02:00
Joanne Chung
7672bbc915 Fix the existing translation doesn't update for new translated result.
It is possible the existing text is changed that triggers a new
translation. We cache the translation response when onShowTransltion
is called. We should keep the translation response is updated if this
is a new translation result.

Bug: 200232741
Test: atest CtsTranslationTestCases
Test: manual. The issue app works fine.
Change-Id: Iaf7423cd35d4484e33de84e478256b77a000f390
2021-09-19 15:16:57 +00:00
sallyyuen
f163deb788 Add accessibility support for Drag & Drop
go/a11yDragAndDrop

Add AccessibilityAction#ACTION_DROP to potential drop targets.
Add A11yAction#ACTION_CANCEL to the source of the drag.
Developers will be required add the A11yAction#ACTION_DRAG action
(androidX can do this)

Send AccessibilityEvents when appropriate. These events will be
sent when a drag is performed via a11y actions, or via touch events
with a11y enabled.

Drop and cancel events are mutuall exclusive.

To avoid a scenario where a user starts a drag via an a11yAction but
doesn't drop or cancel, the system will cancel the event after a minute
timeout.

Corner cases:
1) A user cannot start a drag on another view without first cancelling
the current one

2) An ACTION_DRAG on a View won't be successful if the last touch point
was in that View

For a11y, we send window events directly from the View to avoid source
merging in ViewRootImpl. (Specifically for the start events, where the
event gets sent from the common ancestor of the source and target
instead of the source)

Bug: 26871588
Test: atest DragDropControllerTests CtsWindowManagerDeviceTestCases:CrossAppDragAndDropTests AccessibilityDragAndDropTest
Use Android's official sample drag and drop apps. Drag within window and across split screens
Use ReceiveContentDemo target app with sample app

Change-Id: Ie8554d25ab6c43b08d2dacb8c8907b1636bd72b4
2021-09-17 11:26:18 -07:00
Naomi Musgrave
aca03a172c [2/n] Display stack provides DisplayInfos
For all possible states a device can assume, the DisplayManagerService
provides the DisplayInfo associated with that layout of the logical
display. WindowManager applies each possible rotation to these
DisplayInfo. This, in turn, is used to calculate the possible max
WindowMetrics on the device.

Done:
* Display stack builds collection of DisplayInfo, for all
 possible display states (folded, unfolded on jumbo)
* Display stack pushing set of DisplayInfos to WindowManager
* WindowManager calculates max bounds for all possible
  (display layouts x rotations)

Not started:
* WindowManager calculates insets for each rotation

Bug: 181127261
Test: atest DeviceStateManagerGlobalTest
Test: atest DeviceStateManagerServiceTest
Test: atest LogicalDisplayMapperTest
Change-Id: I3a407262e755cb57c506b7255eb5c067523381d3
2021-09-17 14:56:33 +00:00
Joanne Chung
ec3f41e70e Fix translation doesn't work on ViewGroup
The system will add requested view reference into cache but it is
possible the requested translation view is a viewgroup, we don't add
this into view reference list that cause the translation doesn't work
on ViewGroup.

Bug: 200233857
Test: atest CtsTranslationTestCases
Test: manual. Use a sample code to request translation for a
viewgroup and make sure it is added into view reference list.
Test: manual verify with issue client app, it works.

Change-Id: Ie593a1a436fd046373412ae2955a78057d22b892
2021-09-17 09:29:44 +00:00
Yunfan Chen
049e2a46aa Make requested visibility available in snapshot starting window
This change make the snapshot starting window holds the requested
visibilities when created from the task. Such that, when the window get
back from the background, the insets state in the window state can have
the correct visibilities.

Test: check getInsetsStateWithVisibilityOverride as described in the bug.
Bug: 196637509
Bug: 185729224
Change-Id: I54ab0791b169331c22cd89f7e6da640322bf7dd3
2021-09-15 06:28:09 +00:00
Charles Chen
37430c5ba8 [RESTRICT AUTOMERGE] Send DA's config directly when attaching to DA
WindowContext relies on WindowTokenClient#onConfigurationChanged after
calling WMS#attachWindowContextToDisplayArea.
However, it took some time to wait for onConfigurationChanged callback
from the server side so that we may get a stale value right after
creating WindowContext.
This confuses developers especially when the foreground activity is in
size compat mode or freeform because the process config is overridden
by activity's config.
This CL makes #attachWindowContextToDisplayArea return DA's configuration
and applies to WindowContext direcly.
It also benefits WindowProviderService because it can obtain DA's
 configuration before onCreate() based on [1] and this CL.

Bug: 190019118
Bug: 190745506
Bug: 198298520
Test: manual - 1. launch an Activity in size compat mode
               2. create a WindowContext and verify if WindowMetrics
                  matches DA bounds.
Test: atest WindowContextTest WindowContextTests
Test: atest WindowContextControllerTest ContextGetDisplayTest
[1]: dd4a748af0

Change-Id: I8dd3987b731662502bc01e9d2ed67e718ada5f46
2021-09-14 03:06:50 +00:00
Vishnu Nair
28ab86f0d4 SurfaceView: Fix SurfaceControl synchronization issues
Hold the surface control lock in PositionUpdateListener
callbacks before checking if the SurfaceControl will
be null. UI tread might release it after the checks
causing crashes.

Also fix a case where the ViewRootImpl may be null
in the positionChanged callback.

Bug: 199261027
Test: run steps in bug
Test: go/wm-smoke
Change-Id: I5a4cac35fe14356389b29268fddf9703b25c03aa
(cherry picked from commit 2cafd8b44d)
2021-09-13 17:21:06 +00:00
Naomi Musgrave
aca90d6d64 Merge "[1/n] Introduce API for all available max WindowMetrics" into sc-v2-dev 2021-09-10 15:35:32 +00:00
Joanne Chung
fb894242ba Merge "Allow translation should also work on non-resume state" into sc-v2-dev 2021-09-10 14:51:45 +00:00
Naomi Musgrave
f70f8ecefc [1/n] Introduce API for all available max WindowMetrics
New API provides all maximum WindowMetrics, for all
possible rotations in each DeviceState. This information
allows launcher apps to determine different device
layouts ahead of time, without having to reload the
grid model on every device state change (fold/unfold).

Done:
* WindowManager calculates bounds for the given display, in
  possible rotations
* Defining API surface

Not started:
* WindowManager calculates insets for each rotation
* Display stack builds collection of DisplayInfo, for all
  possible display states (folded, unfolded)
* Display stack pushing set of DisplayInfos to WindowManager

Bug: 181127261
Test: atest FrameworksCoreTests:WindowMetricsTest
Test: atest FrameworksCoreTests:WindowInsetsTest
Change-Id: Ic4580f9c1ee919e5e93cd96b8f11c743fa42f9f1
2021-09-10 09:53:49 +01:00
Adam He
e6664abbc8 Merge "Fill in javadocs for translation feature." into sc-dev am: 1553fc7fad am: 4b02f45293
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15597859

Change-Id: I538dd665f0f322cfe01ce79d83f1fde064749329
2021-09-09 16:23:06 +00:00
Adam He
4b02f45293 Merge "Fill in javadocs for translation feature." into sc-dev am: 1553fc7fad
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15597859

Change-Id: I214790439c5b6520131cf8a9f03a255ebe16421f
2021-09-09 16:04:28 +00:00
Sally Yuen
cd9481d29a Merge "Add API to inform the system a drag is initiated by an A11yAction#ACTION_DRAG_START." into sc-v2-dev 2021-09-09 15:57:38 +00:00
sallyyuen
5d00ad6e13 Add API to inform the system a drag is initiated by an
A11yAction#ACTION_DRAG_START.

This allows the system to run a11y-specific code
and still accept drags via touch events when a11y is
enabled.

Test: builds
Bug: 26871588
Change-Id: I40e8f1adf5b773c8fa02173cbd96aa5e9ed54a4d
2021-09-08 12:19:36 -07:00
Joanne Chung
5f68630b15 Allow translation should also work on non-resume state
Currently, we only allow translation for the resumed Activity. It
works fine for full screen Activity. On foldable devices, we may
have two Activity in the same time. It is possible one Activity is
on the paused state but there is still new incoming message, we
should also allow the message can be translated.

Bug: 199264898
Test: atest CtsTranslationTestCases
Test: manual. Use one Activity targetsdk prior to Q then receiving
broadcast to start Ui translation on paused state in split mode.

Change-Id: I6720b41d9995c9ced2e3b2b87eb95540101d15a0
2021-09-08 14:15:41 +00:00
Adam He
47cb06a213 Fill in javadocs for translation feature.
Bug: 190236094
Test: atest CtsTranslationTestCases
Change-Id: I4d3e68cb4de4ca003f6f2cf1c0be626b91c0de97
2021-09-07 23:38:09 +00:00
Winson Chung
67b04aaef5 Merge "Always inset the IME by the extra nav bar frame height" into sc-v2-dev 2021-09-03 23:46:16 +00:00