Commit Graph

16981 Commits

Author SHA1 Message Date
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
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
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
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
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
Winson Chung
5d5f0987b2 Always inset the IME by the extra nav bar frame height
- If the taskbar is collapsed and isn't providing full insets to the
  app, we still want the IME to be inset for the nav button that shows

Fixes: 197727397
Test: Collapse taskbar, open IME
Change-Id: I9f2367344385c9a23e2d6323637a0b2d1713b169
2021-09-03 23:46:00 +00:00
Vishnu Nair
aacc61be3d Surface: Release references to BlastBufferQueue and SurfaceControl on Surface#destroy
SurfaceView clients may hold on to surface references. In S this means
they would extend the lifetime of the SurfaceControl resulting in
"leaking" buffers until the references are cleared or the app is
terminated.

Fix this by calling a new destroy function on Surface which will
explicitly remove references to the SurfaceControl and BBQ it holds.
This is safe because SurfaceView controls the lifecycle of the Surface
and knows when the Surface will become invalid. Once invalid, the Surface
cannot become valid again.

Test: repro steps in bug
Bug: 198133921
Change-Id: I5c7e43736f025fc0965eae2f19719ba40df3cb70
Merged-In: I5c7e43736f025fc0965eae2f19719ba40df3cb70
2021-09-03 17:03:23 +00:00
Tiger Huang
4fba1c4453 Merge "Prevent adding methods in WindowInsetsAnimationController" into sc-v2-dev 2021-09-03 10:40:38 +00:00
Shawn Lin
97b0de7326 Merge "[DO NOT MERGE]Support rounded corner for multi-display devices" into sc-v2-dev 2021-09-03 03:57:09 +00:00
Vishnu Nair
8047839069 Merge "Surface: Release references to BlastBufferQueue and SurfaceControl on Surface#destroy" into sc-v2-dev 2021-09-03 02:01:53 +00:00
Evan Rosky
2dd3adff43 Merge "Fix some NPEs in shell transitions" into sc-v2-dev 2021-09-02 20:43:51 +00:00
Tiger Huang
4ba9fc6168 Prevent adding methods in WindowInsetsAnimationController
It is a public interface which should not have different versions
sharing the same API level. This CL moves the methods to an
@hide interface.

Fix: 198614722
Test: atest android.signature.cts.api.current.SignatureTest
Change-Id: Ib02708aeb1ec960bda20b6b60d4df6f0c9b4d9d6
2021-09-03 04:24:34 +08:00
Tiger Huang
a42a8d6bf3 Merge "Invoke insets animation callbacks when resizing system bars" into sc-v2-dev 2021-09-02 11:12:17 +00:00
Winson Chung
851f1df2f1 Return the existing display ids when registering a display window listener
- This ensures that the caller can synchronously initialize the existing
  displays without waiting for the onDisplayAdded() callback, which can
  happen asynchronously (since the callback is oneway).

Bug: 196186963
Test: atest WMShellUnitTests
Test: atest ActivityTaskManagerServiceTests
Change-Id: I0a8d5f9b4ede7b487a8de14bdb6eaacae7d03d9f
2021-09-01 13:37:31 -07:00
Vishnu Nair
26ed47443c Surface: Release references to BlastBufferQueue and SurfaceControl on Surface#destroy
SurfaceView clients may hold on to surface references. In S this means
they would extend the lifetime of the SurfaceControl resulting in
"leaking" buffers until the references are cleared or the app is
terminated.

Fix this by calling a new destroy function on Surface which will
explicitly remove references to the SurfaceControl and BBQ it holds.
This is safe because SurfaceView controls the lifecycle of the Surface
and knows when the Surface will become invalid. Once invalid, the Surface
cannot become valid again.

Test: repro steps in bug
Bug: 198133921
Change-Id: I5c7e43736f025fc0965eae2f19719ba40df3cb70
2021-08-30 23:42:01 +00:00
Evan Rosky
223ff6bd39 Fix some NPEs in shell transitions
Missed some null checks which resulted in crashes during some
tests.

Bug: 183993924
Test: atest WindowInsetsPolicyTest
Change-Id: Iaa84b2d9e824223cead9ba78247129b77b1f217e
2021-08-30 12:04:38 -07:00
Ming-Shin Lu
6902904e97 Refine WindowInsets logs
- Add WM_DEBUG_WINDOW_INSETS ProtoLogGroup to use for logging
  general Insets logs in WM core.
- Refine InsetsSourceProvider#updateVisibility proto log format
  to add insets type information.
- Add InsetsSurceControl#toString to print control target info.

Bug: 197189357
Test: adb shell wm logging enable-text WM_DEBUG_WINDOW_INSETS
Test: atest ProtoLogImplTest \
            ProtoLogViewerConfigReaderTest \
            WmTests:ProtoLogIntegrationTest \
            LogDataTypeTest \
            protologtool-tests
Change-Id: I1f01ce4d9fe5cb17f7bd60a424689260682b1dfc
2021-08-30 22:43:46 +08:00
Charles Chen
d51d2f5efb Merge "Remove WindowManager usage in ViewConfiguration" into sc-v2-dev 2021-08-26 12:43:52 +00:00
Charles Chen
0f4ce51bc2 Remove WindowManager usage in ViewConfiguration
[1] made context created via #createConfigurationContext
access ViewConfiguration without StrictModeViolation.
However, we may obtain WindowManager in ViewConfiguration and
still breaks the violation.
This CL gets rid of WindowManager usage to prevent the violation.

Test: atest StrictModeTest
Bug: 197282789
Bug: 191683535

Change-Id: Ifed3f318601ad2214db137ed3d75efdf2157799e
2021-08-26 12:43:36 +00:00
Chris Li
118428b624 Include TaskFragment bounds change in app transition
Bug: 196173550
Test: behave currently with demo app
Change-Id: I9a0f5b7033e5575806d904196594466004458c34
2021-08-25 10:09:13 -07:00
Charles Chen
c2fc67837e Merge "Reland "Introduce TaskFragment transition type"" into sc-v2-dev 2021-08-25 10:23:48 +00:00
shawnlin
6603444a76 [DO NOT MERGE]Support rounded corner for multi-display devices
- Add new array configs for every rounded corner configs.
- Update rounded corner drawable when a display changes in
  ScreenDecorations.

Bug: 131221697
Test: atest DisplayCutoutTest RoundedCornersTest LocalDisplayAdapterTest
      ScreenDecorationsTest
Change-Id: I1f32ff680609267010b05a39a5b8e84511bf1243
2021-08-25 15:58:28 +08:00
Charles Chen
5e55e3976d Reland "Introduce TaskFragment transition type"
Previously AppTransitionController didn't recognize TaskFragment
transitions, so it uses Task opening/closing animation for
TaskFragment transitions.
This CL introduces and uses TaskFragment transition if the animation
target is TaskFragment. The new transition type can be used for registering
RemoteAnimation implemented by TaskFragmentOrganizer as well.
It also provides a fallback mechanism for TaskFragment transitions
if the RemoteAnimation fails or one of opening/closing animation target
is not a pure organized TaskFragment.

Note that previous reverted CL[1] didn't cover the case that the
animation target is promoted to TaskDisplayArea. This CL fixes it by
introducing WindowContainer#canBeAnimationTarget to filter out the case.

Bug: 194649929
Test: manual - the reproducible step in b/194649929#comment1
Test: atest WmTests:AppTransitionTests AppTransitionControllerTest
Test: atest MultiDisplayPolicyTests#testAppTransitionForActivityOnDifferentDisplay
[1]: I0094694fa5cd95d8bbb7da94d2aaf7aac6e1fe09

Change-Id: I5520803f3018d2dd67c96db55daceef740b2cf0b
2021-08-25 15:01:36 +08:00
Android Build Prod User
4de4893707 Merge "Revert "Introduce TaskFragment transition type"" into sc-v2-dev 2021-08-24 23:08:05 +00:00
Daniel Solomon
f74aa266d3 Revert "Introduce TaskFragment transition type"
This reverts commit 3f7830eaf1.

Reason for revert: Broke test android.server.wm.MultiDisplayPolicyTests#testAppTransitionForActivityOnDifferentDisplay on git_master on cf_x86_64_phone-userdebug

Bug: 197639726
Change-Id: I7705b36a3fa8de5ce98774c809a0cc309a08937c
2021-08-24 17:08:32 +00:00
Sally Yuen
0e08f81393 Merge "Add AccessibilityAction and AccessibilityEvent API for drag & drop" into sc-v2-dev 2021-08-24 12:21:46 +00:00
Charles Chen
03adaa2230 Merge "Introduce TaskFragment transition type" into sc-v2-dev 2021-08-24 10:08:57 +00:00