Commit Graph

478 Commits

Author SHA1 Message Date
TreeHugger Robot
09d541c765 Merge "Fix memory usage issue on WindowTokenClient" into tm-dev am: 20bb840b29 am: 4d92a4110a am: 462c2d8c06
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18186210

Change-Id: I6198a0275b92e7751d414b9daeba78628644d28e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-09 17:30:21 +00:00
Ming-Shin Lu
576bba9bb0 Fix memory usage issue on WindowTokenClient
As WindowTokenClient#{onConfigurationChanged, onWindowTokenRemoved}
requires to post on mainthread, in case posting runnable accquires more
java objects to increase java heap memory, use PooledLambda to obtain
cached runnable for saving memory usage.

Also, use ActivityThread.currentActivityThread.getHandler to get the
main handler rather than creating the new object.

Fix: 215447496
Test: run MemoryOnBoot
Change-Id: Idb2c01a0da02ff669e1a3f1a55f4841f7aa258ba
2022-05-09 03:15:22 +00:00
Shan Huang
78c429f948 Merge "Migrate IME to handle back with OnBackInvokedDispatcher." into tm-dev am: e3a61826eb am: 4472170cb9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17952046

Change-Id: Icf52d1afb13bdab55270c3e6319b4d889d114db0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-06 20:19:10 +00:00
Darrell Shi
8176ed8b17 Add WM transit types for dream activity.
This change adds two WM transit types for opening and closing dream
activities, which allows the system to define transition in and out of
dreams, that are currently being overriden by other transitions.

Set the priority to be just below keyguard transit. The keyguard
occlude/unocclude already correctly handles the dream open/close
animation.

Bug: 222507937
Bug: 220311554
Test: atest WmTests:AppTransitionControllerTest
Test: manually on device by entering and exiting dreams over keyguard,
launcher, and settings. observed animation and relevant types of WM logs.

Change-Id: Iedfa279d56cd9d4c4679cb3b697ee74a98ef727b
2022-05-04 17:13:52 +00:00
Shan Huang
a6666f2221 Migrate IME to handle back with OnBackInvokedDispatcher.
We currently close the IME by having the target application forward KEYCODE_BACK to the IME process through InputMethodManager#dispatchInputEvent and having the IME handle the keycode in InputMethodService#onKeyDown. When apps opt in to OnBackInvokedDispatcher API, we will not dispatch KEYCODE_BACK to apps anymore. Thus we need to migrate IME to the new API for it to close on back invocation.

This implementation forwards OnBackInvokedCallbacks from the IME process
to the app process. This is necessary because all callbacks need to
exist in the app process for them to be considered by hardware back keys. While back gestures go through WM to resolve callbacks from the focused window, hw keys are directly sent to the focused window's ViewRootImpl, bypassing server side back nav logic.

Bug: 228358882
Test: atest CtsInputMethodTestCases:KeyboardVisibilityControlTest
Test: atest CtsInputMethodTestCases:InputMethodServiceTest
Test: atest CtsInputMethodTestCases
Change-Id: Ie207b63b11a56c9b2173f26b734a27b13ebccc60
2022-05-04 05:31:08 +00:00
Chris Li
301ff2fec1 Merge "Keep the focus on the primary when launch ActivityEmbedding placeholder" into tm-dev 2022-04-27 04:16:53 +00:00
Charles Chen
57edb1f789 Merge "Revert^2 Fix testRegisterComponentCallbacksOnWindowContext flaky" into tm-dev 2022-04-26 08:33:59 +00:00
Mariia Sandrikova
42f304140f Merge "Exception for Kids Mode from ignoreOrientationRequest." into tm-dev 2022-04-25 14:11:11 +00:00
Charles Chen
f3787b207a Revert^2 Fix testRegisterComponentCallbacksOnWindowContext flaky
This flakiness is due to race of config updates when WindowContext attaches to
DisplyArea.
This CL fixed it by:
1. Don't dispatch config updates to the client side when registering to
   DA. We have reported the value by the return value of
   #attachWindowContextToDisplayArea.
2. Add lock in WindowTokenClient#onConfigurationChanged to avoid race.
   During applying DA's config to WindowContext, WindowContext may get another
   callback from the server side and dispatch to ComponentCallbacks
   unexpectedly.

Bug: 190019118
fixes: 228911504
Bug: 230022846
Test: atest RegisterComponentCallbacksTest --iterations
Test: atest WindowContextTest WindowContextTests
Test: atest WindowMetricsWindowContextTests
Change-Id: I2d749a058c7a3828c8c8288040236f005aa00ab6
2022-04-25 20:24:43 +08:00
Mariia Sandrikova
9182b74df1 Exception for Kids Mode from ignoreOrientationRequest.
Fix: 229304143
Test: manual and DisplayContentTests
Change-Id: I3136db620afdf016a900f3441ee3010ae9662f0f
2022-04-24 16:28:31 +00:00
Chris Li
c21254f45b Keep the focus on the primary when launch ActivityEmbedding placeholder
Default focus should be on primaryActivity when a placeholder is shown.
This is a short term improvement as focus navigation works from primary
to secondary but not in reverse.

Fix: 229138140
Test: atest WmTests:TaskFragmentOrganizerControllerTest
Change-Id: Ic4e2280e4b37a8fa04fc532245a5d0cfa4e5e012
2022-04-24 16:57:10 +08:00
Chris Li
9e08260cce Add TaskFragmentOrganizer#onActivityReparentToTask
When the activity exits PiP and is reparented to the original Task, the
organizer should handle it as a new launch.

Bug: 225371112
Test: atest WmTests:TaskFragmentTest
Test: atest WmTests:TaskFragmentOrganizerControllerTest
Change-Id: Ia7e32e995a35e167b0d76e701c972b269ae068cc
2022-04-22 17:36:02 +08:00
Tony Huang
34e18413a8 Merge "Remove some functions @hide in WindowContainerTransaction" into tm-dev 2022-04-20 03:35:17 +00:00
Chavi Weingarten
c9eb12f88b Merge "Add SurfaceSyncer markdown file" into tm-dev 2022-04-19 22:08:31 +00:00
chaviw
2d62f58c6b Add SurfaceSyncer markdown file
Test: N/A
Bug: 200284684
Change-Id: I133cb86aa69c55adb390fce72407fb6f1a32e4f4
2022-04-19 09:36:11 -05:00
TreeHugger Robot
e16244c3cd Merge "Make BackEvent#getTouchX and BackEvent#getTouchY floats." into tm-dev 2022-04-16 01:51:10 +00:00
Wei Sheng Shih
2aac68104f Merge "Clear the system bars color when removing the splash screen window." into tm-dev 2022-04-15 02:18:23 +00:00
Shan Huang
316179540e Make BackEvent#getTouchX and BackEvent#getTouchY floats.
Bug: 228533817
Test: Try swipe back to home on Flag Flipper (with Predictive Back
Animation toggle enabled in Flipper) and make sure animation looks good.
Try in both landscape and portrait mode.

Change-Id: If2165827a0f66f8e0bd8f78483577c3ac4c9f213
2022-04-14 19:34:26 +00:00
Chris Li
63ece2d2e5 Notify organizer when the last activity in TaskFragment enter PiP
When the Task contains multiple activities, activity entering PiP will
be reparented to a new PiP Task. In this case, we should notify the
organizer about the behavior, and prevent the dependents from closing as
a result of an empty TaskFragment.

Bug: 225371112
Test: atest WmTests:TaskFragmentTest
Change-Id: I6f0138c0532d2d0249de38fd84d1a4690f266c07
2022-04-13 21:31:30 +08:00
Tony Huang
29f1e898dc Remove some functions @hide in WindowContainerTransaction
To using these function in CTS tests, we need to remove @hide.

Bug: 229024233
Test: build pass
Change-Id: I7102918593ef8886888604492e39c1f952408ec7
2022-04-13 17:30:00 +08:00
Vadim Caen
7d7fa82fe4 Merge "Fix splashscreen listener not being called" into tm-dev 2022-04-11 09:58:15 +00:00
Shaun Corkran
e360c271c6 Merge "Decide on navigation to task by policy in Virtual Device" into tm-dev 2022-04-08 18:29:23 +00:00
Shan Huang
be460cbac4 Merge "Create OnBackInvokedCallbackInfo to wrap callback and its priority." into tm-dev 2022-04-08 04:07:53 +00:00
Vadim Caen
3fb34bfe77 Fix splashscreen listener not being called
Bug: 228313271
Test: AndroidX SplashscreenParametrizedTest
Change-Id: Ia68016ddc73e4d1f5d18f076d4474e0e3086c138
2022-04-07 16:52:47 +02:00
Shaun Corkran
8e9e270de7 Decide on navigation to task by policy in Virtual Device
Adds the implementation to allow or block navigation to a
new task in the policy controller for a virtual device. Will
only change behavior if the cross navigation allow or block
list is included and the navigation does not occur from
the default display.

Bug: 223915401
Test: atest WmTests:DisplayWindowPolicyControllerHelperTests
      atest CtsVirtualDevicesTestCases
      atest WmTests:ActivityStarterTests
      Added test in ag/17503735
Change-Id: I3dfb9dd93c0edf4634320c52a3fc40c4bf473085
2022-04-07 07:45:59 +00:00
TreeHugger Robot
8e814271bb Merge "Disable debug log in WindowContextController" into tm-dev 2022-04-07 06:04:52 +00:00
Shan Huang
b353af0387 Create OnBackInvokedCallbackInfo to wrap callback and its priority.
Main motivation is to store a back callback's exact priority value in WM. This is required by the IME migration (ag/17076160) to compare the priority levels of IME window callback and focused window callback in BackNavigationController.

This also consolidates the WindowState#mSystemOnBackInvokedCallback and WindowState#mApplicationOnBackInvokedCallback fields into one field, as tracking two fields for one callback was error prone. We had to remember to clear the application / system field when the other field is set, and failing to do so has resulted in bugs such as b/222675481.


Bug: 224856664
Test: atest BackNavigationControllerTest
Test: atest WindowOnBackInvokedDispatcherTest
Test: m -j and test back behavior throughout the system on apps that
opted in and out.

Change-Id: Ic57113610d934f33d2c9ca4cef59f39a9b87e832
2022-04-07 05:11:42 +00:00
Shan Huang
f608b18317 Merge "Split predictive back bitmask flags into a few boolean flags." into tm-dev 2022-04-07 00:24:47 +00:00
Chris Li
cbc449164b Merge "Register remote animation per Task" into tm-dev 2022-04-02 10:36:24 +00:00
Shan Huang
69a3984aae Remove OnBackInvokedDispatcherOwner interface.
Test: m -j update-api. Build and flash and test back behavior throughout
the system.
Bug: 227500290

Change-Id: Ibdb13d02e044741d05d99f1cad96e43dc0129fe4
2022-04-01 20:27:34 +00:00
Vadim Caen
d0923a2197 Merge "Split animation methods out of OnBackInvokedCallback" into tm-dev 2022-04-01 20:13:30 +00:00
Vadim Caen
c627777dda Split animation methods out of OnBackInvokedCallback
This makes OnBackInvokedCallback SAM compatible

Bug: 227789359
Test: atest \
        CtsWindowManagerDeviceTestCases:android.server.wm.BackNavigationLegacyTest \
        CtsWindowManagerDeviceTestCases:android.server.wm.BackNavigationTests \
        WmTests:com.android.server.wm.BackNavigationControllerTests \
        FrameworksCoreTests:android.window.BackNavigationTest \
        FrameworksCoreTests:android.window.WindowOnBackInvokedDispatcherTest \
        CtsViewTestCases:android.view.cts.OnBackInvokedDispatcherTest
Change-Id: Iab86b0488f1b3048eb02042191acaeb6a645a0bc
2022-04-01 20:09:26 +00:00
Vadim Caen
a28e989921 Merge "Some cleanup logging and test for back navigation" into tm-dev 2022-04-01 15:57:59 +00:00
Vadim Caen
71297c8aab Some cleanup logging and test for back navigation
- Better logging
 - Remove method form OnBackInvokedDispatcher interface (but not the
   implementation)
 - Add test for ag/17211289

Bug: 222675481
Test: BackNavigationControllerTests#testUnregisterCallbacksWithSystemCallback
Change-Id: I6a3ae30da7e29dddda116acd8fa0c9af4b9faa6e
2022-04-01 15:57:49 +00:00
Chris Li
add68184dd Register remote animation per Task
Before, we register remote animation per organizer, and assume it only
organizes in one Task. Now, we register per organizer Task if there is a
rule that supports split in the Task width.

Bug: 207720388
Test: atest WMJetpackUnitTests
Change-Id: Iac4e10af9aa0e7846c81b036b2cf708b6cbe627e
2022-04-01 16:47:46 +08:00
wilsonshih
d92645873e Clear the system bars color when removing the splash screen window.
There can reset the system bars color once the splash screen window is
going to be removed, so the real system bars color can be
controlled by app, without waiting for the reveal animation.
Also clear this effect when transfer splash screen to client, so client
can control the color on their own.

Bug: 196550450
Test: verify no status bar color changed when playing reveal animation.
Change-Id: Ibb353d350fa2921188c8c4b54f8e029ee3869c16
2022-04-01 13:39:51 +08:00
Nick Chameyev
3f12009a16 Migrate unfold animation to Shell transitions [Part 1]
Adds a trigger to DisplayContent that creates
unfold transition before applying the display size
and marks it as ready when the sizes are applied.

Adds a placeholder animation for fullscreen tasks.

Bug: 204925795
Test: enable shell transitions, open an app, unfold =>
 check that app surface is animated
Change-Id: Ia88178a7c7849a99c17b4d18117a05b2a0fb8b7f
2022-03-31 10:38:56 +00:00
Hongwei Wang
b2a5b198cd Merge "Handle PiP shadow radius in WMShell" into tm-dev 2022-03-30 22:23:51 +00:00
Shan Huang
82f3bb31ea Merge "Remove DISPATCH_BACK_INVOCATION_AHEAD_OF_TIME." into tm-dev 2022-03-30 14:58:54 +00:00
Shan Huang
cb6810c3d8 Split predictive back bitmask flags into a few boolean flags.
This is such that they can be controlled from Flag Flipper UI.

Boolean flags introduced:
persist.wm.debug.predictive_back - Overall switch for the new back infra
persist.wm.debug.predictive_back_anim - Animation switch
persist.wm.debug.predictive_back_always_enforce - Switch to ignore per
app opt-in flag and always enforce new behavior
persist.wm.debug.predictive_back_screenshot - Screenshot switch. Not
added to Flipper yet.

Test: Flip the flags in Flipper and verify behavior is as expected.

Change-Id: Icff098035119fb83f393e20c6ac590be2f22c845
2022-03-29 23:42:37 +00:00
Shan Huang
778d3d83f8 Remove DISPATCH_BACK_INVOCATION_AHEAD_OF_TIME.
We are not gating the new back dispatch by targetSdkVersion in T. The new dispatch is controlled by the enableOnBackInvokedCallback app
manifest flag (which defaults to false).

Test: m -j update-api
Bug: 195946584
Change-Id: Iab59051ec5b6336ca4d42cc47015fe86a3f37942
2022-03-29 20:47:53 +00:00
Chavi Weingarten
8089e6f249 Merge "Force draw during a blast sync and disable rt animations" into tm-dev 2022-03-29 18:38:02 +00:00
Hongwei Wang
2708c3a74d Handle PiP shadow radius in WMShell
Deprecate also the shadow radius for PiP in Task

Bug: 206508708
Test: Verify the PiP enter/exit/move/resize transitions
Change-Id: I8ff83dd4e626a3455373fed6c908cf131ecae8fe
2022-03-28 16:43:46 -07:00
Vadim Caen
09f7f6f69b Merge changes from topic "presubmit-am-b87ddd3bbf2947f1aa639cddcee6ecb8" into tm-dev
* changes:
  Remove callback before WindowState removal
  Improve startBackNavigation stability
2022-03-28 18:53:26 +00:00
chaviw
7b7dabc218 Force draw during a blast sync and disable rt animations
When ViewRootImpl is going to draw a frame due to a blast sync request,
we call forceDrawNextFrame to ensure we get a draw this vsync, even if
RT animation rendered a frame. This will ensure that we aren't required
to reschedule a draw either in rt thread or ui thread since we'll get a
frame back as long as there's an available buffer.

We also disable rt animations if a sync set has started with Syncer and
then re-enable when the sync set is complete. This ensures we don't
continue to acquire buffers for a render thread scheduled animation
during a UI animation since we want the UI request to get the buffer.

Test: Open internet dialog from notification shade on 60hz device
Fixes: 217621394
Bug: 200284684
Change-Id: Ic1534d21b0ee2ad82f20ff34df4cbbbad87557fd
2022-03-28 09:41:25 -05:00
Charles Chen
7f8435496c Disable debug log in WindowContextController
fixes: 220049234
Test: build pass
Change-Id: I4e4edbe1362207b2df411b966a8aef62dcaa8f8f
2022-03-28 09:02:00 +00:00
Wei Sheng Shih
9a14b7c209 Merge "Adjust branding image layout if needed." into tm-dev 2022-03-28 07:05:56 +00:00
Kohsuke Yatoh
5eae33da58 Merge "Move FEATURE_IME to TestApi" into tm-dev 2022-03-25 17:58:40 +00:00
Vadim Caen
d1a57ed491 Remove callback before WindowState removal
ViewRootImpl was removing the callback from the server after the
windowState was removed, which was consistently failing resulting in an
exception in the log.

Now the removal is done before the ViewRootImpl's window removal

Test: Manually check that the error is not appearing in the log
Bug: 226089354
Change-Id: Ie9cb9940791b16d6ae1b243079794583c87b1a5c
2022-03-25 14:11:45 +01:00
Vadim Caen
6a074eca5c Improve startBackNavigation stability
- Use the focused window instead of the topApp window
    - Instead we now rely on WindowManagerService to get
     the focused window.
    - SystemUI does not have ActivityRecord so we can't rely
     on the top window of the Task to find the correct
      window on which the callback will be called.

  - Introduce a Builder for BackNavigationInfo
    - This reduces the number of variable needed outside the synchonized
    block.
    - It also reduces the number of early return of BackNavigationInfo
    instances

  - Adding log messages to help further debug the method.

Test: BackNavigationControllerTests
Test: Manual dismiss of SystemUi dialog in QS
Bug: 216604581
Fixes: 221458292
Change-Id: I9ba2c7f89956f34d6338824502c210b3e58dc076

Introduce builder for BackNavigationInfo

Change-Id: I14b4a4b3abc8f417998b7b32831cb3d5c4faa491
2022-03-24 14:14:26 +01:00