Commit Graph

502 Commits

Author SHA1 Message Date
Bill Lin
ca75e7e466 Allow one-handed mode shortcut expand notification
1) Add OneHandedEventCallback for WMShell to register
   callback, and if one handed mode settings set show
   notifications, when user tap one handed mode shortcut
   notify WMShell send KEYCODE_SYSTEM_NAVIGATION_DOWN
   through OneHandedEventCallback with SysUIMainExecutor.

2) Add isReady() flag in OneHandedDisplayAreaOrganizer
   and Simplify the flow of onActivatedActionChanged()
   to prevent potential race problem while auto-enable
   One-handed and immeditately startOneHanded(), however,
   DisplayAreaOrganizer#onDisplayAreaAppeared() may not
   ready for transtion yet, and result mState keep in
   unfinsihed STATE_ENTERING.

3) Adjust the transiton duration from 800ms to 600ms
   800ms is a little bit long to affect timing of
   apply runtime overlay package.

4) DelayExecute setEnabledGesturalOverlay() until
   transition finised and at most delay once.
   - onSwipeToNotificationEnabledChanged() : DelayExecute
   - onEnabledSettingChanged() : DelayExecute
   - Ctor setupGesturalOverlay() : No DelayExecute
   - mState.isTransitioning() : DelayExecute

Test: WMShellUnitTests
Bug: 182425480
Change-Id: I2615c3b30ad95a858510b4bcc73d8f343843fc96
2021-06-17 01:12:32 +08:00
Riddle Hsu
f08127e398 Cache window and icon color of splash screen starting window
The background color of splash screen starting window may depend
on the declared window background and the content if icon. That
may be expensive operations if the drawables are not using pure
color. Because the attributes to compute the colors are simple,
it only need a few fields to identify whether the incoming request
has been computed. So it is worth to cache them with very small
extra memory. The cache of a package will be cleared if the package
is removed or replaced.

It may save the creation time up to 20ms (depends on the complexity
of the drawable).

Bug: 190176296
Test: atest StartingSurfaceDrawerTests#testColorCache
Test: Cold/warm launch app twice and compare the duration of
      trace name "makeSplashScreenContentView". The second time
      should be faster. Re-install the app and launch again,
      the trace will contain "peekWindowBGColor" that means
      that cache for the package was cleared.

Change-Id: I61158416694a226999843fa8fc6a8b23d6893f02
2021-06-07 22:24:03 +08:00
Adithya Srinivasan
c6273f7f15 Merge "Add TaskSurfaceHelper/Controller in WMShell to plumb game mode to SF" into sc-dev 2021-06-02 22:00:09 +00:00
Mady Mellor
2430a0b314 Merge changes I4794ed89,I0c273f4d,Ibd8609a8 into sc-dev
* changes:
  Flexible maximum number of bubbles to show
  Add shadows back to bubble avatar
  Update sizes for the bubble avatar
2021-05-27 22:51:57 +00:00
Mady Mellor
238f122f47 Flexible maximum number of bubbles to show
* adjust the default spacing so that its small enough that 5 bubbles
  can show on crosshatch (5 is the default)
* Add max bubbles to BubblePositioner, replace the other usages

Test: atest BubbleDataTest
Test: manual - have 5 bubbles
             - adjust screen size to largest
             - open the stack
             => notice that the number of bubbles have changed and
               they all fit on the screen without overlap
             - repeat & check the different densities
Bug: 187715444
Change-Id: I4794ed89541eeb573c367748f980cf7ffe45d3f3
2021-05-27 13:41:22 -07:00
Mady Mellor
5f00d56451 Add shadows back to bubble avatar
* Add shadows back -- icon lib is no longer adding shadows but
  bubbles should still have them for background protection.
* The shadow is active on all bubbles when:
  - the stack is being dragged around & bubbles trail behind it
  - the stack is expanded (the bubbles can be dragged to dismiss &
    can show on top of the expanded view or overflow)
* When the stack is resting, only the top two bubbles show a shadow
  & the bubbles below that animate their Z translation so the change
  is smooth.
* Also put the # of bubbles we show in the stack in a static int &
  updated usages

Test: visual - add 5 of the 'test bubbles' from the test app
               and notice the white backgrounds don't blend together
               due to the shadow & that they are distinct when
               placed on a white background
             - drag / fling the stack around & notice shadows show
               for all the bubbles while moving but once they come
               to rest you don't see a stack of shadows
Bug: 183657577
Change-Id: I0c273f4d0261db9eac1b49ef584fd62fbb67cc9a
2021-05-27 13:40:43 -07:00
Adithya Srinivasan
4e8a1a05b1 Add TaskSurfaceHelper/Controller in WMShell to plumb game mode to SF
TaskSurfaceHelper(Controller) will be used as an interface to communicate
with the SurfaceControl of the underlying Task. This change adds a function
to set the game mode metadata for the task layer.

Bug: 186025682
Test: atest TaskSurfaceControllerTest
Change-Id: I136b65636b98e1883eaf9e4f4f0b34c61350d4e4
2021-05-27 20:12:08 +00:00
Mady Mellor
bb53cce0db Update sizes for the bubble avatar
* Update sizes of badge & bubble; also simplify some of the sizing
  code, we can do it with just the overall size
* Simplified things, instead of the inner / outer sizes just use
  the overall size

Test: visual - create a bubble and look at the size of the bubble and
               badge
      visual - have some bubbles, change display size, create a new
               bubble & verify that all of the sizes are the same
Bug: 183657577
Change-Id: Ibd8609a8737bb0a57519fa70fba17138bb69b379
2021-05-27 10:32:02 -07:00
Wei Sheng Shih
4bc9052468 Merge "Prevent the splashscreenview be replaced after transfer starting window" into sc-dev 2021-05-25 11:24:56 +00:00
TreeHugger Robot
608a439238 Merge "Split flicker tests into groups" into sc-dev 2021-05-22 09:44:36 +00:00
Mady Mellor
1d75e183c9 Only show the first 2 bubbles in the stack when collapsed
Test: manual - add more than 2 bubbles, note you only see the top 2
             - expand & collapse the stack, note you only see top 2
               after collapse
             - fling the stack around, note once it hits the edge
               you only see top 2 bubbles but while dragging around
               you see all of them following
Bug: 180142824
Change-Id: I168a14e1fba1506f53ed0734b55b44971d128de4
2021-05-21 14:00:46 -07:00
Mady Mellor
83f4345f9e Merge "Fix transitions in the background when launching something in TaskView" into sc-dev 2021-05-20 22:55:00 +00:00
Nataniel Borges
8aaaeea849 Split flicker tests into groups
The flicker test suite grew and now trigger a treehuger SLO violation. To address this problem create different groups for different tests using: --module-arg <TEST SUITE>:include-annotation:<GROUP>

Where:
   <TEST SUITE> = FlickerTests or WMShellFlickerTests
   <GROUP> = com.android.server.wm.flicker.annotation.Group1 or com.android.server.wm.flicker.annotation.Group2 or com.android.server.wm.flicker.annotation.Group3

For example:

1) to run only tests in the first group in flicker use: `--module-arg FlickerTests:include-annotation:com.android.server.wm.flicker.annotation.Group1`

2) to run only the third group of tests from wmshell flicker: ``--module-arg FlickerTests:include-annotation:com.android.server.wm.flicker.annotation.Group3`

Bug: 180620475
Test: atest FlickerTests WMShellFlickerTests with the respective parameters
Change-Id: I82f668713ba262bafe2758e2c618bfc060cc2c8a
2021-05-20 09:36:44 +02:00
Wei Sheng Shih
c56f67e7d9 Merge "Delete the delay for keeping tasksnapshot on screen." into sc-dev 2021-05-20 01:26:29 +00:00
Hongwei Wang
c81fdf89d7 Merge "Add test for move PiP upon Display change" into sc-dev 2021-05-20 01:07:00 +00:00
Mady Mellor
9abaa3be2c Fix transitions in the background when launching something in TaskView
* Allow bounds to be set on launch params for multiwindow activities
* Users of TaskView should pass bounds when starting an activity
  otherwise they will see this animation
* Modify bubbles & controls to pass launch bounds

Test: atest TaskLaunchParamsModifierTests LaunchParamsControllerTests
MultiWindowTests
Bug: 182299605
Bug: 182516248
Change-Id: Ie5337593d776309f8aac0c6991cf846463e519a7
2021-05-19 15:13:17 -07:00
Hongwei Wang
ea24f4c7ab Add test for move PiP upon Display change
Bug: 184941272
Test: atest PipControllerTest
Change-Id: I61372311c0e81c7d6b5dedd49d48b3738b796585
2021-05-19 12:50:02 -07:00
wilsonshih
532c5a42fb Delete the delay for keeping tasksnapshot on screen.
Tasksnapshot window can block touch event so user may not able
to touch the screen after showing task snapshot. Remove the delay
so app window can response touch event as soon as possible.

Bug: 187227846
Test: atest TaskSnapshotWindowTest
Change-Id: I5fb0fa3a1e6a5e6210d3baf400a84c5892bd2e34
2021-05-19 14:54:01 +08:00
wilsonshih
de35559cb1 Prevent the splashscreenview be replaced after transfer starting window
The splashscreenview can be replaced if starting window was transferred
and the first starting window didn't added success.
There should verify the appToken before setViewSynchronized set the
splashscreenview back to the container.

Issue sequence:
- Start first activity A, core request to add a starting window for it.
- Start second activity B, core try to transfer starting window from A
to B but since the window haven't added back,  there will trigger to
add a new starting window for B.
- SystemUI add starting window to A but added fail because there was
transferred.
- SystemUI add starting window to B, success.
- Choreographer post setViewSynchronized to add view for A and B to the
container, because we only verify by taskId, so the SplashscreenView was
overwrite by A.
- After reveal animation finish, SplashScreenView#post will not be
executed because this view was not on screen.

Fixes: 188540606
Test: atest StartingSurfaceDrawerTests
Test: Open twitter from notification.
Change-Id: I894da75827556d3c1bc8bb0656196102de5a6847
2021-05-19 14:04:08 +08:00
Chris Li
b9034aba83 Merge "Determine whether to support activities in multi window (9/n)" into sc-dev 2021-05-19 05:47:41 +00:00
Chris Li
30248a1952 Determine whether to support activities in multi window (9/n)
When a Task is detached but is still stored as a recent Task, it should
be allowed to launched into split screen.

Bug: 176061101
Test: atest WMShellFlickerTests:EnterSplitScreenFromDetachedRecentTask
Test: atest WmTests:RecentTasksTest
Change-Id: Ic72901ca76f4acb6e68926062675ecc290b399be
2021-05-18 21:07:52 +00:00
Bill Lin
9e2013a5d2 Merge "Integrate OneHandedTutorialHandler with OneHandedState" into sc-dev 2021-05-18 00:25:32 +00:00
Jerry Chang
63e732e89e Merge changes from topic "staged_split_ime" into sc-dev
* changes:
  Adjust split layout with IME animation in split (5/N)
  Adjust split layout with IME animation in split (4/N)
  Adjust split layout with IME animation in split (3/N)
  Adjust split layout with IME animation in split (2/N)
  Adjust split layout with IME animation in split (1/N)
2021-05-17 17:00:59 +00:00
Chris Li
b4aec6206f Merge "Determine whether to support activities in multi window (8/n)" into sc-dev 2021-05-14 22:28:18 +00:00
Bill Lin
01015deb6b Integrate OneHandedTutorialHandler with OneHandedState
Previously if user do not trigger OHM, target view was attached
to window and setVisbility INVISIBLE.
Refactor to improve memory & perforamcne for systemui, and align
the state changes of one handed controller

1) Bind OneHandedController OneHandedState to handle target view
   attach and remove from window.
2) Do NOT create view and attach to window until STATE_ENTERING,
   remove legacy redundant visibility change flow.
3) Detach view from window when STATE_NONE
4) Refine OneHandedState static field definition
5) Consolidate OneHandedTutorialHandlerTest

Test: atest WMShellUnitTests
Test: atest OneHandedTutorialHandlerTest
Test: adb shell dumpsys activity service com.android.systemui
Test: adb shell settings put secure one_handed_tutorial_show_count 0
Test: manual trigger OHM
Test: Trigger OHM and invoke onConfigurationChanged()
Bug: 185558765
Change-Id: I3e9666e2379bceb23e3f80f0d8617a7884100a72
2021-05-14 19:24:30 +08:00
Jason Chang
e8b62e4d23 Merge "(1/n) Disabling OHM gesture in NavigationBar 3 Button mode" into sc-dev 2021-05-14 07:40:34 +00:00
Jerry Chang
68667bdd3a Merge "Fix wrong split bounds in legacy split flicker tests" into sc-dev 2021-05-14 02:29:18 +00:00
Jerry Chang
93edc1eae5 Fix wrong split bounds in legacy split flicker tests
Fix: 188013792
Test: passed presubmit
Change-Id: I675633a078d172f9c8cd836980658c4f2aa2d246
2021-05-13 16:23:42 +08:00
Jason Chang
1d1ea541f0 (1/n) Disabling OHM gesture in NavigationBar 3 Button mode
1) UX mentioned the swipe gesture in 3-Button NavgationBar area
may confuse user from taping NavBar buttons(Back, Home, Recents).
They decide to disable the swipe gesture and allow user to trigger
One Handed Mode(3 Button Mode) through A11y shortcut.
However, user can still use OHM by enabled shortcut button on
both Gesture Navigation & 3-Button mode.

2) OHM gestural handler consume the touch event while window
Magnification overlap with NavigationBar area in 3-button mode,
this result Magnification function can no long obtain the control.

Bug: 184903678
Bug: 179648683

Test: manual
Test: atest WMShellUnitTests
Change-Id: Ib9a06e19d749707e6f5e08c3ef803c1681f86bbc
2021-05-13 08:47:56 +08:00
Chris Li
375ce7fe52 Determine whether to support activities in multi window (8/n)
Dismiss multi window from Shell if the task no longer supports multi
window.

Bug: 176061101
Test: manually test with fold/unfold
Change-Id: Ie8bdb70ed63805c6e51a20e6db8f02e91f18dd35
2021-05-11 04:21:40 +00:00
Chris Li
43d99647e4 Determine whether to support activities in multi window (5/n)
Update Task/ActivityRecord to use the new elgibility check and update
tests

Bug: 176061101
Test: pass existing
Change-Id: Ibb78a43d5901a604b02904be0a0bfdc6da0eb421
2021-05-11 04:20:49 +00:00
Hongwei Wang
57618b94ef Merge "Unify round corner radius in PipSurfaceTransactionHelper(s)" into sc-dev 2021-05-11 03:23:11 +00:00
Jerry Chang
5d2533cdfc Adjust split layout with IME animation in split (3/N)
Listen to IME position changes in SplitLayout to make sure it updates
divider view status after re-inflated. Also add functions to get IME
position of split which is needed for integrating IME animation with
new split implementations.

Bug: 179262787
Test: atest WMShellUnitTests
Test: observed divider bar won't change to interactive after rotating
devices with IME shown.

Change-Id: Ic01c23e61ffb666cfc292e56dd6dcf4646be749b
2021-05-07 12:09:23 +08:00
Jerry Chang
4c425b2a1e Adjust split layout with IME animation in split (2/N)
Add surface utils to help establishing dim surface layer for splits.

Bug: 179262787
Test: atest WMShellUnitTests
Change-Id: I0c268e0b1891fddcf717e8e54e0d29acbf8c5f24
2021-05-06 13:14:57 +08:00
Jerry Chang
dda6e07e4b Adjust split layout with IME animation in split (1/N)
Update StagePosition to more general SplitPosition so that it could be
shared among split implementations.

Bug: 179262787
Test: atest WMShellUnitTests
Change-Id: I6f461fac62d350f50171136f079cb0254b06d767
2021-05-06 13:14:37 +08:00
Bill Lin
f94486117f Merge changes from topic "ohm-shortcut" into sc-dev
* changes:
  3/ Listen ONE_HANDED_MODE_ACTIVATED for A11y shortcut action
  2/ Implement Shortcut for One Handed mode feature
2021-05-05 23:43:12 +00:00
Bill Lin
02f635462b Merge "OneHandedUiEventLoggerTest sometimes flaky" into sc-dev 2021-05-04 10:12:06 +00:00
Bill Lin
214bff101f Merge "Refactor OHM to use (float)offset for translating windows" into sc-dev 2021-05-03 09:49:20 +00:00
Bill Lin
eb9b719bc5 3/ Listen ONE_HANDED_MODE_ACTIVATED for A11y shortcut action
- Observe ONE_HANDED_MODE_ACTIVATED secure settings key
- Skip action when OneHandedState is in transition
  1. STATE_ENTERING
  2. STATE_EXITING
- Skip action if current OneHandedState = request activate
  1. STATE NONE -> Shortcut request ACTIVATED : StartOneHanded
  2. STATE_ACTIVE -> Shortcut request non ACTIVATED : StopOneHanded
  3. STATE_NONE -> Shortcut request non ACTIVATED : SKip
  4. STATE_ACTIVE -> Shortcut request ACTIVATED : Skip
- Controller will update latest state to secure setting
  ONE_HANDED_MODE_ACTIVATED either trigger by gesture or shortcut

Test: atest WMShellUnitTests
Test: enable shortcut and click
Bug: 182425480
Change-Id: I03bd2679a5a08801efc9868148adfddef87171f4
2021-05-03 15:04:24 +08:00
Bill Lin
0fd7baaf31 OneHandedUiEventLoggerTest sometimes flaky
Check : go/wm-tests

Ignore the unit tests until the better approach available

Test: atest WMShellUnitTests
Bug: 184813408
Change-Id: I3139afa58ed15c535a55822504c3331771f1bfdf
2021-05-03 12:45:33 +08:00
Ben Lin
7fc1313d39 Merge "PiP: Take inset into consideration when calculating stash offset." into sc-dev 2021-04-29 22:51:26 +00:00
Hongwei Wang
cd6e9816a5 Unify round corner radius in PipSurfaceTransactionHelper(s)
Per discussion, will keep the two classes in Launcher and WMShell as for
now and re-address the unification in next release. In this change
- deprecate config_pipEnableRoundCorner since it's now behind a system
  property and waiting to be turned on
- pass the corner radius value from WMShell to Launcher

Video: http://recall/-/aaaaaabFQoRHlzixHdtY/dmUy8qBEMxHShFcFKB3cT3
Bug: 171721389
Test: make sure autoEnterPip has round corner support, see video
Change-Id: If978ee6c3b0307a7423fe51b996f535d7009e74c
2021-04-29 11:25:49 -07:00
Chris Li
f9c4ee1fd3 Merge "Move legacy split screen flicker tests for non-resizable to presubmit" into sc-dev 2021-04-29 17:49:15 +00:00
Nataniel Borges
8a26f00f1f Merge "Fix pip window visibility assertions" into sc-dev 2021-04-29 15:51:59 +00:00
TreeHugger Robot
c8a0871269 Merge "Disable flaky app pair assertions" into sc-dev 2021-04-29 15:18:23 +00:00
Nataniel Borges
4b2f1da126 Fix pip window visibility assertions
1) Fix `Could not find: PipApp`, the test previously used the launcher name, instead of the window name for assertion

2) The command previously missed a `verify` call to actually execute the assertion

Bug: 186115871
Bug: 186445782
Test: atest FlickerTests WMShellFlickerTests
Change-Id: Ie9274e273bcda2be24491705cd28d7dc0d5ea5db
2021-04-29 12:02:31 +02:00
Bill Lin
57f37bf143 Refactor OHM to use (float)offset for translating windows
The core function of OHM is translate all windows down
instead of resize, it's unnecessary to set WCT & app bounds
that will introduce DA require to cache configuration in
DAInfo as well as handle configuration changes stuffs

This change ensure App Compat mode works good:
- Remove wct.setBounds() & wct.setAppBounds()
- Use float instead of bounds for transition/animation
- Remove unused code
- Reset setWindowCrop(leash, -1, -1) after rotate
- Reset setCornerRadius(leash, -1) after rotate
- Add dump() for OneHandedAnimationController
- Add dump() for OneHandedSurfaceTransactionHelper

Test: atest WMShellUnitTests
Test: maunal trigger OHM, rotate, and obseve function works
Bug: 184091042
Bug: 181091031

Change-Id: I401d9b8a79a2a1526b8683362a1e0330458141b1
2021-04-29 12:14:29 +08:00
Ben Lin
a4c8a3c524 PiP: Take inset into consideration when calculating stash offset.
When stashing, currently it assumes the entire display is usable - not
taking into insets into consideration that can be caused by navigation
bar, etc.

Bug: 186698828
Test: Manual. Stashing PIP while w/ insets now stashes correctly.
Test: atest PipSnapAlgorithmTest
Change-Id: Ia6cbb8f21b666a4ba4ee10b84e3087b6a23cd982
2021-04-28 19:31:40 -07:00
Chris Li
328079de27 Merge "Determine whether to support activities in multi window (1/n)" into sc-dev 2021-04-29 01:09:53 +00:00
Ben Lin
cabb4a0317 Merge "PiP: Add ResizeGestureHandlerTest." into sc-dev 2021-04-28 20:59:04 +00:00