Commit Graph

377 Commits

Author SHA1 Message Date
Shan Huang
a1c62623bf Merge "Create BackEvent interface for back navigation parameters." 2022-02-10 14:59:06 +00:00
Shan Huang
27d450afa5 Merge "Avoid leaking Activity from OnBackInvokedCallback." 2022-02-10 14:58:38 +00:00
Shan Huang
a39fa74923 Create BackEvent interface for back navigation parameters.
Bug: b/210539672, b/195946584
Test: m -j
Change-Id: I0264d0995aed8a73563bece0d15d2a9aac0ebf06
2022-02-10 07:01:01 +00:00
Shan Huang
b533660125 Avoid leaking Activity from OnBackInvokedCallback.
- Remove mTopCallback field
- Cleanup compat and default callbacks
- Remove the callback held by WindowState when the window is removed.

Bug: 218328707
Test: atest packages/apps/Launcher3/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
Test: atest frameworks/base/core/tests/coretests/src/android/window/WindowOnBackInvokedDispatcherTest.java
Change-Id: I38fd760a617500c874aef10bc8de165880837008
2022-02-10 04:46:24 +00:00
Vishnu Nair
77cbb96034 SurfaceView: Synchronize add/remove SurfacePackage with VRI draw
Apply the SurfacePackage reparent transactions with the next
ViewRootImpl draw so the caller can optionally synchronize attaching
SurfacePackages with contents on the main window.

Test: atest CtsWindowManagerDeviceTestCases:SurfaceControlViewHostTests
Bug: 217973491
Change-Id: I87f77cb6a5a2505592f6e9431d2964517fe497cd
2022-02-09 10:38:26 -08:00
Evan Rosky
d61906a562 Merge "Adapt shell transitions into legacy remote animations in systemui" 2022-02-09 00:41:34 +00:00
Charles Chen
18ef32b5b3 Merge "Report Activity config changes only if it handles the change" 2022-02-08 14:27:57 +00:00
Evan Rosky
8d71275060 Adapt shell transitions into legacy remote animations in systemui
systemui also defines several remote animations. Given the number
and complexity of animation entry-points in sysui, insert a
cheeky hack to swap remotetransitions in for remoteanimations
when shell transitions are enabled.

Bug: 217810915
Test: Open quick-settings, poke Settings icon. Observe animation
      and no paus.
Change-Id: I462034210f28051a03812eb6ae650fa1f0446ef5
2022-02-07 11:24:24 -08:00
Shan Huang
025b9e5ceb Add compatibility back callbacks.
For pre-T apps, the default back callback dispatches KEYCODE_BACK to the
application's root view.
For T+ apps, the default KEYCODE_BACK listener invokes the registered
OnBackInvokedCallback.

Test: m -j
Bug: 195946584
Change-Id: I62342b249e6cd6f8b036f7e950cc3f9754418ee4
2022-02-05 01:53:25 +00:00
Vadim Caen
717e53a6a7 Save the OnBackInvokedCallback in WindowState
This CL enable OnBackInvokedCallback to be saved in a WindowState and
queried by the BackNavigationController to be returned when
ATM.startBackNavigation() is called.

The DecorView provides a PendingOnBackInvokedDispatcher that can receive
callback registration before being added to a ViewRootImpl.

Test: atest FrameworksCoreTests:BackNavigationTest
Bug: 131727607
Change-Id: I01528a22ea4a6583a56ade4eab69136d727855d0
2022-02-02 22:08:02 +01:00
Pablo Gamito
d72672e545 Merge "Add option to override background color for animation through overridePendingTransition" 2022-01-28 14:26:11 +00:00
Evan Rosky
aad20ce51b Merge "Move fixed-rotation-related display information into config" 2022-01-27 22:04:14 +00:00
Pablo Gamito
8e3a0e498c Add option to override background color for animation through overridePendingTransition
Test: atest CtsWindowManagerDeviceTestCases:AnimationBackgroundTests
Change-Id: I3debc8c1f4646cfd7c20c3f8e57abd465aec23ad
2022-01-27 15:41:20 +01:00
Evan Rosky
c5a17006c8 Move fixed-rotation-related display information into config
Augment the "apparent" display information in configuration
from just the display bounds (maxBounds) to also include the
display rotation and cutout. Like maxBounds, these will be
expected to always be set as basically "the display that this
configuration was built against".

This heavily simplifies fixed-rotation since now we don't
need to deal with the "are we overriding?" question and also
don't need extra activity servertransactions. The configuration
is also in sync (since it is the source of truth used by
resources). Additionally, this means that even the current
legacy fixed-rotation model should work with in any
mixed-rotation situtaion, not just fullscreen.

Bug: 202201326
Test: atest DisplayTest
Change-Id: I6232f74c74324b70b1b0c9f46448c509c2694310
2022-01-26 12:51:42 -08:00
Charles Chen
286845eb3e Report Activity config changes only if it handles the change
In S, we don't dispatch #onConfigurationChanged callback if the screen
size changes doesn't corss size buckets. However,user may still want
to know the change even if it's very small.
This CL changes to dispatch the callback if the Activity handles
the config changes.
Also clean-up the unused code.

Bug: 202468254
Test: atest AppConfigurationTests
Change-Id: Ief68922ed80a0fcfc05c7ccb5e3692334352a2c3
2022-01-26 18:14:34 +08:00
Wei Sheng Shih
e8e313d496 Merge "Allow app to receive onSplashscreenExit even for empty splash screen." 2022-01-26 01:33:58 +00:00
Charles Chen
19e1e118e1 Merge "Override (un)registerComponentCallbacks for ContextWrapper" 2022-01-25 14:18:58 +00:00
wilsonshih
946a4063f7 Allow app to receive onSplashscreenExit even for empty splash screen.
Allow developers to customize the exit animation for empty style splash
screen, there is a target sdk version check to prevents apps from
crash if the app didn't do null pointer check for #getIconView.

Bug: 205907456
Test: atest SplashscreenTests
Change-Id: I235f25fdf42b7177a6e195d3ffc07b92690e6f79
2022-01-25 20:40:23 +08:00
Charles Chen
a4059c2f19 Override (un)registerComponentCallbacks for ContextWrapper
Bug: 193247900
Test: WindowContextTest
Test: ContextWrapperTest

Change-Id: Ia070b12eea5631d70a96d6e41d03ab08f6b44caa
2022-01-25 12:30:47 +08:00
Shan Huang
54b9c9d66e Implement OnBackInvokedDispatcher
Bug:209867448
Test: mp core services sysuig. atest FrameworksCoreTests:WindowOnBackInvokedDispatcherTest

Change-Id: Ib74250e93926854f07ebba6b9f680040aa98f9a4
2022-01-23 23:30:37 +00:00
Peiyong Lin
4f8f656dca Merge "Raise SurfaceControlFpsListener to System API." 2022-01-21 20:30:59 +00:00
Vadim Caen
e0b59d46ce Merge changes Ifc2ed99b,Ibd7fc78e
* changes:
  Integration of back gesture animation on Sysui (BackNav 2/n)
  Server infrastructure for back nav animation (BackNav 1/n)
2022-01-21 13:36:58 +00:00
Peiyong Lin
399e06d648 Raise SurfaceControlFpsListener to System API.
Previously the SurfaceControlFpsListener is a hidden API which only
allows platform code access. This patch renames it to follow the
callback convention and raises it to be a system API in order to allow
system applications to access the FPS count of a task and its children.
The FPS count access is guarded by a permission ACCESS_FPS_COUNTER.

To follow the API convention and properly check the permission, the
register/unregister callback APIs are moved to WindowManager and
permission check is done in the System Server.

Minor: Rename to SurfaceControlFpsCallback to TaskFpsCallback in order
to follow the API naming convention.

Bug: b/199920468
CTS-Coverage-Bug: b/199920468
Test: atest TaskFpsCallbackTest
Change-Id: I6b0a0ad6500278b3da09059e9c2ede28d9a743aa
2022-01-21 09:18:08 +00:00
Shan Huang
5b44dd8b79 Merge changes from topic "shanh-back-api"
* changes:
  Provide OnBackInvokedDispatcher from Activity, View and Dialog
  Introduce IOnBackInvokedCallback and OnBackInvokedDispatcher
2022-01-20 07:20:51 +00:00
Shan Huang
c0999600ee Provide OnBackInvokedDispatcher from Activity, View and Dialog
Test: mp core sysuig services
Bug: 195946584

Change-Id: Ia882ec621154ea1daa780c8976b900e4c8f44a7d
2022-01-20 01:33:56 +00:00
Vadim Caen
a4ca5286d2 Server infrastructure for back nav animation (BackNav 1/n)
This CL introduces the BackNavigationController that gathers the
required data to be passed to WMShell to create the back animation

These data are passed via the BackNavigationInfo Parcelable.

The CL also containes a basic screenshoting mechanism as a temporary
solution until a proper screenshoting infrastructure is created
(b/207481538).

Test: atest BackNavigationControllerTests
Bug: 131727607
Change-Id: Ibd7fc78e590794daf35f7718ddfa53e7f439813b
2022-01-18 10:42:21 +01:00
Pablo Gamito
157738c8a0 Support backgrounds during animations in shell
This is required for the go/t-activity-transitions where we want to allow apps to fade to a clear background color and fade back in from the background to another activity

Test: atest FlickerTests
Bug: 202844659
Change-Id: Iea18a8e7d32a63da55ab3430c47f903da5cff807
2022-01-17 13:26:59 +01:00
TreeHugger Robot
c945d14020 Merge "Ask the policy controller for launching activities" 2022-01-15 15:45:14 +00:00
TreeHugger Robot
ea85bfc929 Merge "Fix IME shrunk by WindowTokenClient mis-detach" into sc-v2-dev am: ff6577fd10 am: 4b30a3ee91
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16598426

Change-Id: I7c73497ab7770240e8aadc96c3ef64e5c219cf75
2022-01-15 04:57:51 +00:00
TreeHugger Robot
ff6577fd10 Merge "Fix IME shrunk by WindowTokenClient mis-detach" into sc-v2-dev 2022-01-15 04:27:54 +00:00
Ming-Shin Lu
29de30597b Fix IME shrunk by WindowTokenClient mis-detach
As CL[1] introduced WindowTokenClient for WindowProviderService (aka the
parent class of InputMethodService starts from CL[2]) as a token that
IME context can associate with the windowContainer of
the InputMethod window in server side. Like the activity context,
IME context can adopt configuration/resources update when the IME
window changed by display/window changes.

And, the IME context caller can also create another type of context
with wrapping IME context (i.e. calling createDisplayContext to create
a display context), that makes this context can be mixed the window
token of WindowProviderService since it's the base context.

However, the finalization of the context mixed WindowTokenClient
will detach the token when the attached context type is non-window
context, this action will mis-detach the token when it managed by
WindowProviderService.

So like SoftKeyboard previously using
createDisplayContext in CL[3] to workaround context resources issues,
will in-directly expose this mis-detach token issue as the above.

Beside, the handling of WindowTokenClient#{onConfigurationChange,
onWindowTokenRemoved} does not thread-safe since this is called from
IPC.

As the result, the fix is to ignore the check in ContextImpl#finalize
to not detach the token when it managed by WindowProviderService,
also make sure to post to the main handler when received
onConfigurationChanged/onWindowTokenRemoved in WindowTokenClient.

Note that this fix could help to resolve "The Window Context should
have been attached to a DisplayArea." exception if the token has been
detached as the above case that happens before the next
WindowProviderService#attachToWindowToken invoked.

[1]: I64a1614f32d097785915f6105b1813a929e0fe32
[2]: Ie565e30ed5dd3f2cfe27355a6dded76dc3adc14b
[3]: Ic592a1d2fb2da149220c8b503b522b3e864bcc77

Bug: 213118079
Bug: 211062619
Test: manual as steps:
1) adb install -r EditTextVariations.apk
2) adb install -r SoftKeyboard.apk
3) adb shell ime enable com.example.android.softkeyboard/.SoftKeyboard
4) adb shell ime set com.example.android.softkeyboard/.SoftKeyboard5
5) Enable screen auto-rotation
6) Launch EditTextVariations from launcher's shortcut
7) Tap the first EditText field to show IME
8) Rotate the device to the landscape mode
9) Expect the IME should not be shrunk

Change-Id: I7beb7a122af93e596239a36db62073233cea0726
2022-01-14 12:49:13 +00:00
Chilun
1cb6152895 Ask the policy controller for launching activities
Ask the policy controller whether an activity can be displayed on the
virtual display when it is going to launch or reparent.

Also notify the policy controller the activity changes on the virtual
display.

Bug: 201712607
Test: atest DisplayWindowPolicyControllerHelperTests
      atest ActivityRecordTests
      atest ActivityTaskSupervisorTests
      atest TaskTests
      atest TaskFragmentTest
      atest WindowManagerServiceTests

Change-Id: I11fcc38782b21ccb2f0474777242dbf5901c59e1
2022-01-14 10:51:40 +08:00
Mariia Sandrikova
7617679a61 DO NOT MERGE Revert "[2/n] Camera Compat UI: Add interfaces for client-server..."
Revert submission 16468379

Reason for revert: Feature development is moving to T.

Reverted Changes:
Id9b9a8930:[3/n] Camera Compat UI: Add a camera compat contro...
Id6be4a954:Enable a camera app compat control on Large screen...
I083aa6718:[2/n] Camera Compat UI: Add interfaces for client-...

Bug: 206602997

Change-Id: I9ad876043fd61f708a8f468fffd1ef371bfa0866
2022-01-13 15:21:38 +00:00
Jason Chang
f25e1e90c2 (1/n) Phase out FEATURE_ONE_HANDED_BACKGROUND_PANEL
Remove DisplayArea feature FEATURE_ONE_HANDED_BACKGROUND_PANEL
We are going implement One handed panel throught
WindowlessWindow mechanism instead.

Bug: 197165590

Test: manually test One-handed mode basic operations.
Test: atest WMShellUnitTests
Change-Id: I3ba106a266e69bf61cdd43c0043852eed14dc365
2022-01-11 23:57:53 +08:00
wilsonshih
bf666289d7 Public API set and get splashscreen style
Allow developer to control the splash screen style when the option is
used for cold or warm launch an activity.

Bug: 203497083
Test: atest SplashscreenTests#testLaunchFromLauncherWithEmptyIconOptions
Test: atest SplashscreenTests#testLaunchAppWithIconOptions

Change-Id: I9c4ccca2470df5dbac96da2d4a96b616b6670688
2022-01-03 20:44:01 +08:00
Pablo Gamito
3447e5cf43 Merge "Add support for WindowAnimationStyle theme attribute in shell" 2021-12-22 12:05:40 +00:00
Pablo Gamito
a4843175bf Add support for WindowAnimationStyle theme attribute in shell
Test: Make sure apps with custom animations set using WindowAnimationStyle actually use the custom animation when shell is enabled

Bug: 206960607
Change-Id: I1d982870837d67c74f76dd0a90aa5260d9441aba
2021-12-21 20:27:20 +01:00
Mariia Sandrikova
d77c92a3f1 Merge changes from topic "camera-compat" into sc-v2-dev am: 3486eacda3 am: 02a17e7b1f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16468379

Change-Id: Ic9916a3883eef0148a86c86149aa2e883fc56d1b
2021-12-18 22:19:12 +00:00
Mariia Sandrikova
3486eacda3 Merge changes from topic "camera-compat" into sc-v2-dev
* changes:
  [3/n] Camera Compat UI: Add a camera compat control.
  [2/n] Camera Compat UI: Add interfaces for client-server communication.
2021-12-18 21:39:13 +00:00
Mariia Sandrikova
24f4d8a952 [2/n] Camera Compat UI: Add interfaces for client-server communication.
Changes:
- Listens to changes from the client coming through IActivityClientController#requestCompatCameraControl to ActivityRecord#updateCameraCompatState
- ActivityRecord#updateCameraCompatState sends updated state via TaskInfo to WM Shell
- ITaskOrganizerController#updateCameraCompatControlState to dispatch the user interactions with the control from WM Shell triggers callback to ActivityRecord#updateCameraCompatStateFromUser
- ActivityRecord#updateCameraCompatStateFromUser remembers the user's choice and asks client to apply treatment through ICompatCameraControlCallback

Feature is guarded with config_isCameraCompatControlForStretchedIssuesEnabled

Test: atest WMShellUnitTests:ShellTaskOrganizerTests, atest WmTests:ActivityRecordTests
Bug: 206602997
Change-Id: I083aa6718bd67456bedd9444e9b78740c041f870
2021-12-17 00:18:57 +00:00
Evan Rosky
9af5b0896f Merge "Hook-up shell-transitions to DisplayChangeController rotation" 2021-12-14 23:51:54 +00:00
Chavi Weingarten
f9c21bbe90 Merge "Add displayInfo to Java WindowInfosListener." 2021-12-14 19:08:50 +00:00
Evan Rosky
c468b590f0 Hook-up shell-transitions to DisplayChangeController rotation
A direct display rotation goes through requestStartTransition
instead of "remote rotation". As a result, we need to hook-up
the handleRequest to shell's displayChangeController so that
other shell components (like task organizers) have a chance
to calculate new bounds for their organized windows.

Bug: 206872147
Test: via logging, ensure that shell DisplayChangingListener
      is fired during a display rotation.
Change-Id: I839ebd28d4947ed3ec41d48724702d035f726f11
2021-12-14 09:32:55 -08:00
chaviw
51db10d931 Add displayInfo to Java WindowInfosListener.
The displayInfo contains information about transform and display size.
This info was not being passed to the WindowInfosListener, making it
difficult to get coordinates on screen.

Send the displayInfo through JNI to the Java side listener

Test: WindowInfosListener gets displayInfo
Bug: 188792659
Change-Id: Ib4fdb6f0c27bd4276421c4a5235c5112514b32f3
2021-12-14 10:02:48 -06:00
Riddle Hsu
9c310ef902 Reduce cost of WindowTokenClient config change am: 778c95ce7c am: b6a1d36a9a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16439833

Change-Id: I419e9c42305f3ad271fcb3f774e12474cdf3baaf
2021-12-13 13:51:18 +00:00
Riddle Hsu
778c95ce7c Reduce cost of WindowTokenClient config change
The SizeConfigurationBuckets was used to avoid activity relaunch
by insignificant configuration change. Because WindowTokenClient
doesn't have relaunch operation, it is unnecessary to use it.
Especially Resources#getSizeConfigurations() is a heavy invocation,
which may create hundreds of temporal Configuration when calling it
in system server.

Also fix leakage of SystemUiContext if it is detached, e.g. the
associated display is removed.

Bug: 207620458
Test: atest WindowContextControllerTest
Change-Id: I8388a2ab25f3deed2e29eb5636c4b2130f4f1b87
2021-12-13 18:52:54 +08:00
Hongwei Wang
827556ca5a Merge "Fix the transition from Split to PiP" into sc-v2-dev am: 54fed092f8 am: df3e2e6be8
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16418705

Change-Id: I3f1abb78032b7edae240827ae456722a41bb3479
2021-12-10 09:01:08 +00:00
Hongwei Wang
d4848611d2 Fix the transition from Split to PiP
- Do not bring split to top on entering PiP
  When swiping up to home (or other cases) triggers one of the
  split-screen children enters PiP, do not try to bring the other task
  to top since the pair should be considered invisible.
- When entering PiP from split screen or non-auto PiP case, use the
  alpha information in PictureInPictureSurfaceTransaction to hide the
  task which would later be turned back on to avoid flicker.

Bug: 190855091
Bug: 205894095
Video: http://recall/-/aaaaaabFQoRHlzixHdtY/42RWtayanp2qG0mHSf4Q5
Test: manual, enter PiP from split-screen, see Video
Change-Id: I1559748cd583c20d79ee458822d66e7801733d3a
2021-12-09 21:07:45 -08:00
Evan Rosky
95cd24e26e Add support for launching a shortcut in WindowContainerTransaction
Some shell actions require the ability to launch a shortcut either
in a transaction and/or with other window operations (eg. Bubbles
and Split-screen).

This required changes to LauncherAppsService to support forwarding
the caller information internally from systemserver.

Bug: 209073176
Test: existing LauncherAppsService tests still pass
Change-Id: I11893abca24cab0b899c3385af0ca46932bcc9e3
2021-12-09 13:09:54 -08:00
TreeHugger Robot
02751aec1c Merge "Allow checking if an activity is organized" into sc-v2-dev am: 2176d951d0 am: 732d80927d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16186763

Change-Id: Ia7c9abe2ee40f3ddaa0d078148bb8d3a32297d3e
2021-12-08 15:25:34 +00:00