Commit Graph

523 Commits

Author SHA1 Message Date
wilsonshih
3be521ad48 Get starting window background color directly.
SystemUI does not need to re-calculate background color of starting
window because Shell library is bound to SystemUI, so status bar can
get background color directly, also this can support to get the
background color from snapshot starting window.

Also fix the starting window listener did not receiveing background
color successful because makeSplashScreenContentView is execute on
another background thread, so there should block the splash screen
thread until the background color is estimated.

Bug: 192213918
Bug: 192659309
Test: manual launch apps from Notification and Launcher, ensure the
color is correctly send to SystemUI or Launcher.

Change-Id: I626cb23d7aebfe4e032fad285bfad374c0e11cea
2021-07-13 18:53:19 +08:00
Bill Lin
5ad4a8093c Merge "Redesign One-haned tutorial UX behavior" into sc-dev 2021-07-10 01:05:11 +00:00
Bill Lin
80b340a9aa Improve SystemUIBootiming_StartServices_avg
Previously, we tried to tuning boottime of SysUI
See go/systemuiboottiming_ohm
- Reduce access setting provide at SysUI start-up
- Remove unused obervers
  1. Timeout
  2. TapAppExit
- Update mShortcutEnabled state at ctor

Test: manual enable OHM shortcut, rebot
      make sure shortcut function works
Test: atest WMShellUnitTests
Test: asit/perf/boottime_test
Bug: 193225130
Change-Id: I2753f8b1e47622c00b9c6d2f4cd319c6e43634ea
2021-07-09 21:31:05 +08:00
Bill Lin
477c88a7d5 Redesign One-haned tutorial UX behavior
- Always show tutorial for user to know device state
  is in One-handed mode.
- Clean the redundant params from ctor

Test: manual trigger OHM
Test: atest WMShellUnitTests
Bug: 192648901
Change-Id: I10c3f3f29190b672fb88471df3cf374a994cdaa7
2021-07-09 19:05:05 +08:00
Bill Lin
7f162ddaf0 Merge "Improve SystemUIBootTiming performance in OneHandedController" into sc-dev 2021-07-09 02:00:33 +00:00
Chris Li
a23a2bb5db Revert "Revert "Not show size compat UI when task is not visible""
This reverts commit 76370b6fe6.

Reason for revert: Fix the merge break in ShellTaskOrganizerTests.java

Fix: 193069342
Test: atest WMShellUnitTests:ShellTaskOrganizerTests
Change-Id: I02c4bddc407eaac0ebb7cd5abb0b394f242d4d6e
2021-07-08 12:09:40 -07:00
Chris Li
e7ed99bfc2 Merge "Remove TaskInfo#topActivityToken usage in size compat for security" into sc-dev 2021-07-08 18:05:40 +00:00
Leon Jeng
76370b6fe6 Revert "Not show size compat UI when task is not visible"
This reverts commit adb92508c0.

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=git_master&target=coral-userdebug&lkgb=7530814&lkbb=7530923&fkbb=7530923, bug b/193105445

Bug: 193105445
Change-Id: I697229da6986d6466d7f13872e9ae7a727b80838
2021-07-08 09:48:10 +00:00
Bill Lin
3aafe19994 Improve SystemUIBootTiming performance in OneHandedController
Fix race condition in SystemUIBootTiming issue.

1. Avoid updateOneHandedEnabled() called twice during init
   a. [O] come from setOneHandedEnabled()
   b. [X] come from setSwipeToNotificationEnabled()
2. Passively waiting shortcut enabled changed callback, and then
         query setting ACCESSIBILITY_BUTTON_TARGETS status.
3. Add a new flag isShortcutEnabled to cache shortcut enabled
   state.
4. By new OHM Settings UX design setSwipeToNotificationEnabled()
   should NOT setEnabledGesturalOverlay().
5. Remove redundant auto enabled Toast and print in log instead.
   (In general case, user is not able to see the Toast)

Test: atest google/perf/boottime/boottime-test
Test: atest SystemUITests
Test: atest WMShellTests
Test: manual factory reboot, OHM should disabled by default
Bug: 192612924
Change-Id: I8b24c99bc8bd5bfb17c73a6bb8494109d9a8170d
2021-07-08 14:14:25 +08:00
Chris Li
927c644bfa Merge "Not show size compat UI when task is not visible" into sc-dev 2021-07-08 05:53:15 +00:00
Chris Li
1245aefa49 Remove TaskInfo#topActivityToken usage in size compat for security
Security report shows that this can cause leak token of different app.

Replace the functionality with a callback to the TaskOrganizerController
to restart activity when size compat restart button is clicked.

Bug: 186776724
Test: manually verify the restart button still works
Change-Id: I097b9f02e8435e6765695b9d5a531a4e165bac66
Merged-In: I097b9f02e8435e6765695b9d5a531a4e165bac66
2021-07-07 21:09:24 -07:00
Chris Li
adb92508c0 Not show size compat UI when task is not visible
Before, when a size compat task was hidden, the size compat UI might
still be showing. Now, remove the UI when the task is no longer visible.

Bug: 193069342
Test: manually verify the size compat button is not showing in recents
Change-Id: Ia17a97f5e7a9af497d8da16b31bb5169dd502d53
2021-07-07 17:46:08 -07:00
Vadim Caen
f08dae3158 Implement the legacy splash screen behavior
For apps opted out of the new splash screen, we show the full background
drawable.
Ensure there has send the splash screen background color to
StartingWindowListener.

Bug: 182880656
Test: manual set useLegacy to true then verify legacy splash screen.
Test: atest WmTests:ActivityRecordTests
Test: atest StartingSurfaceDrawerTests

Change-Id: Icf662f3c5f368f447e718f82f78dc25b909ca9be
2021-07-01 15:05:06 +08:00
Jorge Gil
47aa9f156e Merge "Check the min menu size when exp. to normal bounds" into sc-dev 2021-06-30 03:32:16 +00:00
jorgegil@google.com
dcb5e60c38 Check the min menu size when exp. to normal bounds
The normal bounds may be too small to fit all menu
icons, so before expanding to the normal bounds,
first check that the expected menu size will fit and
if not adjust the bounds so that it will.

Bug: 191296663
Test: atest PipBoundsAlgorithmTest
manual - verify vertical YT video fits all three actions

Change-Id: I531d86501927a6a3ffeb069193c592366ef8f584
2021-06-29 10:39:00 -07:00
Bill Lin
e606dcbecb Merge "Check shortcut enabled before auto trun on OHM" into sc-dev 2021-06-28 07:34:47 +00:00
Shawn Lin
117ff31a3e Merge "Updating the display bounds when it changes" into sc-dev 2021-06-28 07:00:09 +00:00
Bill Lin
6061ddc2f7 Check shortcut enabled before auto trun on OHM
When device (factory)boot, controller regsiter settings
'one_handed_mode_activated' will receive callback, and
the shortcut do not enabled by default, the flow will
go to auto enable one-handed mode feature and leading
unexpedted UX(disabled by default) and testing issue.

Solution:
- Add additional check for shortcut enabled when
  onActivatedActionChanged() callback.
- When setting is pull screen, notify shortcut
  one_handed_mode_activated to reset and align current
  mState when function enabled.

Note:
The setting provider one_handed_mode_activated could set
2 different values when shortcut button pressed
 - "0" mapping to pull screen STATE_NONE
 - "1" mapping to pull screen STATE_ACTIVE
Since show notification do not have state, whenever
onChange callback, we trigger expand notification.

Test: atest WMShellUnitTests
Test: manual factory reset | reboot check Log should show \
      "Shortcut not enabled, skip onActivatedActionChanged()".
Test: manual disable both OHM & shortcut toggle in settings \
      '# adb shell settings --user 0 put secure \
      one_handed_mode_activated 1'
      should not auto enable OHM main toggle.
Bug: 191736174
Bug: 191831415
Bug: 191950195
Fixes: 191812697
Change-Id: Ib9d66fbbcc7e6a52a37bb47efebf90c9d2644508
2021-06-28 08:30:01 +08:00
Ming-Shin Lu
7e9bd7fe7c Waiting a proper time to remove the snapshot starting window
As CL[1] removed the delay time to remove starting window in shell,
even the benifits is to make good touch responsiness when launched the
activity, but may easier cause flickering since removing the starting
window when the activity allDrawn doesn't means the UI are all set.
(like some apps might needs adjust the surface frame or even IME
needs more time wait for animation finish, if the snapshot window
has these previews).

In case flickering happens when the Shell removes the task snapshot
window too quickly, partially reverts CL[1] delay removal logic
in TaskSnapshotWindow#remove, and use TaskSnapshot#hasImeSurface
to set a proper delay removal time:
   - General (no IME visible): 100ms
   - IME visible: 350ms

[1]: I5fb0fa3a1e6a5e6210d3baf400a84c5892bd2e34

Fix: 189825624
Test: manual switch tasks with/without ime window, also test
with some market input methods.

Change-Id: I7865e17b57961e12a0cdcf068e412195123a6ec7
2021-06-25 02:00:56 +00:00
shawnlin
a8f0672b9a Updating the display bounds when it changes
In previous design, we only get the display bounds once when the first
time the hide cutout is enabled. But if user selects "Hide" first and
then switch to "Render apps below cutout area", the display bounds we
get will be incorrect.

Add a listener to monitor and update the display size.

Bug: 191273507
Test: atest HideDisplayCutoutTest
Test: manual - 1. select "Hide"
               2. select "Render apps below cutout area"
	       3. observe the result
Change-Id: I0ff1c4b822615d6bd43adb2e9e9d17d6bd9b91a8
2021-06-24 15:03:34 +08:00
Bill Lin
c4bdf37af2 Fix SysUI NPE crash during the boot/init progress
When Device boot and SystemUI servies starting, settings provider
may callback onChange() when OneHandedController register observer.
If the callback timing earlier han mEventCallback registered by
WMShll#initOneHanded, then the NPE will happen.

The simple fix is to add NPE check in
OneHandedController#notifyExpandNotifcation()
we can just ignore the callback during init time since the singal
is to expand notification and come from shorcut after user enable
and tap shortcut.(No need to act for the signal during boot progress.)

Test: manual reboot device and observe
Test: atest WMShellUnitTests
Bug: 191600033
Change-Id: I73849afa9904031759da304298221dbb222aeaaa
2021-06-22 11:50:46 +08:00
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