Commit Graph

199 Commits

Author SHA1 Message Date
Jorge Gil
fbbd652eb6 Merge "Move IME & shelf visibility/height into PipBoundsState" 2020-11-10 23:26:34 +00:00
Sergey Nikolaienkov
8817872a73 Merge "Null-check on PipMenuController." 2020-11-10 22:31:42 +00:00
Jorge Gil
26d7201645 Merge "Refactor getDestinationBounds into more readable methods" 2020-11-10 20:34:49 +00:00
Ben Lin
ae927f9723 Null-check on PipMenuController.
For now, TV PiP does not have a menu controller.

Bug: 172909450
Test: None
Change-Id: I0f8a6628607568e71dab795eda255972f00c8b44
2020-11-10 11:24:45 -08:00
Ben Lin
63336329a3 Merge "Add PiP exclusion logic in EdgeBackGestureHandler." 2020-11-10 19:15:42 +00:00
jorgegil@google.com
d6349bb46b Move IME & shelf visibility/height into PipBoundsState
Bug: 169373982
Test: com.android.wm.shell.pip
Change-Id: I411d857c57e2dc593c3506318f5ce1ab6d625b08
2020-11-10 10:19:12 -08:00
jorgegil@google.com
a61e9fec04 Refactor getDestinationBounds into more readable methods
getDestinationBounds(Rect) was only being used to calculate
the "entry" bounds (e.g. onTaskAppeared, swipeToHome) and
all its callers were passing in null.
getDestinationBounds(Rect, boolean) had only one caller,
onTaskInfoChanged, who did pass the current bounds in to
be adjusted to the aspect ratio.

Instead of having overloaded methods and complex logic to
know whether to calculate default bounds or use the provided
bounds, the method is now split into two methods that better
represent what they're calculating:
1. getEntryDestinationBounds, no arguments, calculates either
default or reentry bounds
2. getAdjustedDestinationBounds, takes in the current bounds
and the new aspect ratio, simply adjusts the bounds to the
aspect ratio.

Bug: 169373982
Test: atest com.android.wm.shell.pip
Change-Id: Ie8adda458fc5a56b9d78245c663dbc54b8525378
2020-11-10 10:11:33 -08:00
Winson Chung
b73cc69fbc Merge changes from topic "shell_task_stack_listener"
* changes:
  6/ Fix some flakey issues with dragging to split
  Clean up task stack listeners
2020-11-10 17:24:57 +00:00
Sergey Nikolaienkov
108951ecb3 Merge "Add TvPipMenuTests" 2020-11-10 09:22:41 +00:00
Winson Chung
6dd73e98d7 6/ Fix some flakey issues with dragging to split
- Ensure that the task info activity type always matches the actual task
  activity type (can be different than the window configuration type)
- Ensure that the targets hit rects respect the insets, and that dragging
  out of all targets (but still within the window) will hide the last
  target
- Work around race with launching secondary task when splitting, wait
  until the split screen task org has moved existing tasks to secondary
  split root before starting the new task, and also update the home task
  position when going home (b/172686383)
- Add a timeout to clean up drag surfaces if SysUI crashes while
  mid-drag
- Clean up some other calls to get activity type/win mode

Bug: 169894807
Test: atest DragDropControllerTests
Test: atest DragAndDropPolicyTest
Test: atest SplitScreenTests
Change-Id: I7ae11cc38b1e927d955798ef1056e17c9e435758
2020-11-10 05:46:24 +00:00
Ben Lin
accac9b578 Add PiP exclusion logic in EdgeBackGestureHandler.
Bug: 165793553
Test: Stash PIP

Change-Id: Ia3bf9a02455ac736b33b4d2c87fddd06b503f618
2020-11-09 11:28:07 -08:00
Winson Chung
e3d75ac262 Clean up task stack listeners
- Have shell provided a task stack listener that various controllers can
  add to, and remove registration from outside the controllers (this
  also removes methods on the interface exposed only for use from the
  task stack listeners)
- Move copy of InputConsumerController into shell (shared lib version
  can probably be refactored into use just by launcher for gesture nav)
- Hide remaining wm components that are exposed now that all the
  features are in the Shell

Bug: 169894807
Test: atest WMShellUnitTests WMShellTest
Test: Verify Pip/Split/One handed still behaves as expected
Change-Id: If0f50f6b701ac4b013a9e41fe6f88857ea35bf5b
2020-11-06 16:13:03 -08:00
jorgegil@google.com
2dd597ae41 Fix resizability in apps using the override min size
Fixes an issue where activities using the manifest min
width/height was causing them to not be resizable.
This was caused by:
1. transformBoundsToMinimalSize is called on drag resize, which
causes the bounds to go back to the minimal size.
2. After fixing 1, drag resizes "jumps" from the minimal size to
the default bounds because the normal bounds are not set to the
minimal size
3. Reentry bounds are not restored correctly because when
calculating the destination bounds, the bounds where always
transformed to the minimal size at the end.

This CL changes a few things to fix these issues:
1. The minimal size is now considered when calculating the
entry bounds or transforming bounds to aspect ratio. This means
that instead of calculating the bounds/size using the "default"
size and then adjusting to the minimal size, we'll look at
whether we should calculate using the default or the minimal size
from the very beginning.
2. When the minimal size changes (onTaskAppeared, onTaskInfoChange,
swipeToHome), the normal bounds and movement bounds need to be
recalculated. The normal bounds are the default bounds, and the
default size changes if the minimal size is set or unset.
3. The min edge size used to be set by PipTouchHandler depending
on whether PIP is expanded to either expandedMinEdgeSize or 0. It
is now set to mDefaultMinEdgeSize if not expanded. This was not
causing issues before but it started to with these changes.

Also moved the minEdgeSize and overrideMinSize to PipBoundsState
as part of b/169373982

Fixes: 172598623
Bug: 169373982
Test: com.android.wm.shell.pip
Test: enter pip, expand, resize, reentry bounds,
minimal size in manifest, aspect ratio change all work
correctly.

Change-Id: I4baa46eb641323282fc23fd4499365c83ff38a7d
2020-11-06 16:13:03 -08:00
TreeHugger Robot
445e62382c Merge "Test PipNotification when there is a MediaSession" 2020-11-06 19:38:59 +00:00
Ben Lin
5ad6ca668d Merge "Move attach/detach PiP menu calls to onTaskAppear/Vanish." 2020-11-06 19:07:15 +00:00
Ben Lin
d1bd9998e1 Merge "PiP: Consider stash state when calculating snap fraction." 2020-11-06 19:00:58 +00:00
Winson Chung
f74e31b6f8 Merge "Skip restoring one handed settings if not supported on device" 2020-11-06 17:01:04 +00:00
TreeHugger Robot
5b10f0ed49 Merge "Make PiP overlay trusted to let touches pass-through" 2020-11-06 14:35:04 +00:00
Bernardo Rufino
992ad4953c Make PiP overlay trusted to let touches pass-through
This seems to be the overlay with the settings/close/maximize buttons
(please correct me if I'm wrong). With go/untrusted-touches the overlay
is blocking touches, since that's generated and owned by SystemUI with
original intention of letting touches pass-through to the
"pip_input_consumer" below (owned by the system), the fix is to make it
trusted.

Bug: 172629907
Bug: 158002302
Test: Put app in PiP state (eg. Maps), click on it and verify no
      toast/logcat is shown regarding untrusted touch.
Change-Id: I4227d129b1d43ebc46cd169be7cae7f4e7ed9b9a
2020-11-06 13:08:18 +00:00
Sergey Nikolaienkov
50118593eb Add TvPipMenuTests
Bug: 171520419
Test: atest WMShellFlickerTests:TvPipMenuTests
Change-Id: If74cb25f6c1c46704f35d2c8073c0fdb50c8d7eb
2020-11-06 10:56:31 +00:00
Sergey Nikolaienkov
fbc3469d7b Test PipNotification when there is a MediaSession
Bug: 171520419
Test: atest WMShellFlickerTests:TvPipNotificationTests
Change-Id: Ie70f394e572e9adfeee7ecff9ba4a0e686197ca4
2020-11-06 08:17:01 +00:00
Ben Lin
d4459553dc Move attach/detach PiP menu calls to onTaskAppear/Vanish.
In an ideal case, onActivityPinned should always be followed by
an onActivityUpinned call in a PiP session. However, there are
possible times where it doesn't happen; PIP can crash suddenly,
or some other calls force closes PiP without it
getting a chance to call on Unpinned. In that case, menu isn't properly
cleaned up, so let's just make sure it is before trying to re-attach.
At the same time, move the call to onTaskAppear/Vanish, which is
guaranteed to be called.

Bug: 172268911
Bug: 172258041
Bug: 170315895
Test: Manual; Pause PiP, unpause PiP, menu still showing
Test: Locally hack so that detach doesn't get called the first time
(simulate crash), start PiP again - doesn't crash

Change-Id: I76984de59515f4178561ba92ae692fcc3c5edcb9
2020-11-05 18:28:06 -08:00
Ben Lin
ff9a4829a2 Merge "PiP: Early return on MenusAlgorithm if there are no views." 2020-11-05 23:58:38 +00:00
Ben Lin
e240978118 PiP: Consider stash state when calculating snap fraction.
If the PiP is stashed and something causes it to move (such as, screen
rotation or unexpand animations after timeout), we calculate its current
snap fraction, get the new bounds and movement bounds, and re-apply the
snap fraction. However during the snap fraction calculation, it assumes
that PiP bounds is within the movement bounds, which is not true when
PiP is stashed. So take this into consideration when doing the math.

This also changes the stashed status to reflect more than just yes/no -
but rather NONE/LEFT/RIGHT.

Bug: 165793553
Test: Stash PIP while menu is showing, and wait for timeout
Test: Stash PIP, rotate the device, see that snap fraction is persisted
Change-Id: Ib4eda44b7f280362b52609e4092dd4231ac8f04c
2020-11-05 15:35:49 -08:00
Ben Lin
e0cf6e4427 PiP: Early return on MenusAlgorithm if there are no views.
If there are any missing views, there's nothing to do.

Bug: 161760276
Test: None
Change-Id: If63a1e855b1924dab981dd55b7bc663ed9ee26e5
2020-11-05 11:33:50 -08:00
Winson Chung
cee4f5ed8e Skip restoring one handed settings if not supported on device
Bug: 172581971
Test: atest WMShellUnitTests
Change-Id: I4814c2609a39c523e199eb56f8060a9dc0bbc58b
2020-11-05 19:11:55 +00:00
TreeHugger Robot
5902a6dcb8 Merge "Add tests for TV Pip notification intents" 2020-11-05 10:25:27 +00:00
TreeHugger Robot
281f5eea0f Merge changes I6a3e2fb9,Icc102a51
* changes:
  Introduce .wm.flicker.pip.tv.TvPipNotificationTests
  Prepare .wm.shell.flicker for test migration
2020-11-04 19:40:06 +00:00
Jorge Gil
293612d1a2 Merge "Move animation bounds into PipBoundsState" 2020-11-04 16:07:34 +00:00
Sergey Nikolaienkov
26fd1f1969 Add tests for TV Pip notification intents
Bug: 171520419
Test: atest WMShellFlickerTests:TvPipNotificationTests
Change-Id: I615cda0ed826d875ea8f2eed4c570280be6d6ae9
2020-11-04 15:54:29 +00:00
Sergey Nikolaienkov
757e60e057 Introduce .wm.flicker.pip.tv.TvPipNotificationTests
Move first test out of android.systemui.cts.tv.PipNotificationTests to
com.android.wm.shell.flicker.pip.tv.TvPipNotification tests.

Bug: 171520419
Test: atest WMShellFlickerTests:TvPipNotificationTests
Change-Id: I6a3e2fb96a7688814ce909f28d6d904356fad3fd
2020-11-04 12:32:51 +00:00
Sergey Nikolaienkov
58dc55b6e8 Prepare .wm.shell.flicker for test migration
Move common constants to a separate class.
Rename abstract FlickerAppHelper to BaseAppHelper.
Give BaseAppHelper a UiDevice (from androidx).
Make BaseAppHelper resposiblt for creating launcher.
Teach BaseAppHelper to launch app via intent and force-stop it.
Teach PipAppHelper to properly close Pip on TVs and work around
hasPipWindow() method not working on tv.

Bug: 171520419
Test: atest WMShellFlickerTests
Change-Id: Icc102a51351605b4adb27c3a1c2d73030eac33ff
2020-11-04 12:25:34 +00:00
Sergey Nikolaienkov
c0b6daaf6b Merge "Fix NPE when reference PipMenuActivityController on TV" 2020-11-04 08:13:51 +00:00
Tony Huang
ae7e2fb0bb Merge "Migrate Bubbles to wm-shell (5/n)" 2020-11-04 07:31:30 +00:00
Winson Chung
f97bf81d1e Merge changes I581de3ff,I7d777c59
* changes:
  5/ Validate and resolve shortcut & task activity infos
  4/ Add basic drag and drop policy & handler for the shell
2020-11-04 05:57:22 +00:00
Tony Huang
eb01a25c87 Migrate Bubbles to wm-shell (5/n)
Move bubbles package and related resources to shell package,
also copied some used codes and resources.

Bug: 161980186
Test: atest SystemUITests
Test: atest WMShellUnitTests
Change-Id: Ia108bd4149b3c3bf86631ba1a7a6bce0e76af78f
2020-11-04 11:01:56 +08:00
jorgegil@google.com
9ce747ac92 Move animation bounds into PipBoundsState
Moves mTemporaryBounds and mAnimatingToBounds into
a new state class for animations.

Bug: 169373982
Test: com.android.wm.shell.pip
Test: drag, move, resize, fling, dismiss working fine
Change-Id: Ie487f0cad2a1b2c2e5efc4d0404c8812b2f6c8ff
2020-11-03 14:28:36 -08:00
Ben Lin
8cb470c793 Dump mIsStashed in dumpState.
Bug: 165793553
Test: None
Change-Id: Ic67a174380139ab8489e68308fc9877bfd899c25
2020-11-03 18:20:39 +00:00
Sergey Nikolaienkov
316dca71ba Fix NPE when reference PipMenuActivityController on TV
Check if mPipMenuAcitivityController is not null before referencing.

Bug: 172227207
Test: manually on adt3
Change-Id: I2ba19d8c1795704057ff640764dc8133606e61f1
2020-11-03 06:17:55 +00:00
Hongwei Wang
53b0e83227 Merge "Fix crash from PipMenuActivityController when auto-pip's enabled" 2020-11-03 01:35:14 +00:00
Winson Chung
93fd63d021 4/ Add basic drag and drop policy & handler for the shell
- Add basic policy for handling drags over home/fullscreen tasks
  /split tasks. For now, default to only allowing split to non-docked
  root task
- Refactor drag layout to have same lifecycle as the window instead of
  being per-drag session
- Resolve activity info for tasks as well as activity drag items
  (shortcuts to be resolved in a follow up CL)
- Fix crash due to sending drag events to all displays

Bug: 169894807
Test: atest DragAndDropPolicyTest

Change-Id: I7d777c59296e9ca9e1d169c8a021f9263af94d65
2020-11-02 14:53:56 -08:00
Hongwei Wang
12477f3fd5 Fix crash from PipMenuActivityController when auto-pip's enabled
Deprecates also the SystemWindow reference in PipTaskOrganizer

Bug: 172274913
Bug: 172275014
Test: manually enter PiP with auto-pip enabled
Change-Id: I0c817a51fd3c24036151deec0cf1487759573d44
2020-11-02 14:25:30 -08:00
Ben Lin
068753f97c Merge changes I899d8aa3,Ib6e0058a
* changes:
  Don't allow PiP to be interactive when stashed.
  Set PiP stashing to a set 32dp away from the edge of the screen.
2020-11-02 21:16:36 +00:00
Jerry Chang
38af94c821 Merge "Allow children task of created-by-organizer task to be organized" 2020-11-02 03:40:38 +00:00
Ben Lin
1640ffd49d Don't allow PiP to be interactive when stashed.
User can still move the PiP around, but disable:

- showing menu
- resizing
- double-tap gestures

Bug: 165793553
Test: Stash PIP
Change-Id: I899d8aa3ffffc4087c706f121dee69f63addc9ab
2020-10-30 18:31:03 -07:00
Ben Lin
beefdec180 Set PiP stashing to a set 32dp away from the edge of the screen.
Bug: 165793553
Test: Stash PIP
Change-Id: Ib6e0058a9e0c6b60605c6143e9407ce809abebf3
2020-10-30 18:19:17 -07:00
Ben Lin
f2d1d26479 Merge "PiP: Move menu to SystemWindow." 2020-10-30 06:45:29 +00:00
Ben Lin
4ee2588a05 PiP: Move menu to SystemWindow.
This is the first step to move the menu to fullscreen, but not quite
yet.

This CL does:
- Move PipMenuView to be attached to SystemWindow, instead of child of
PiP leash
- Use SyncRtSurfaceTransactionApplier to ensure the menu moves along the
PIP leash at the same time when the menu is visible
- Remove setup/destroy code in PipTaskOrganizer with SurfaceViewHost
- Expose Window information to Accessibility services
- Refactor ShellRoot to take in a Layer type instead of windowType
instead

Bug: 161710689
Bug: 170151121
Bug: 169894316
Bug: 152738416
Test: Manual

Change-Id: I73c26f96784b35b9bb9a4bea452df55cf5913278
2020-10-30 01:47:34 +00:00
Jorge Gil
6e506c34f7 Merge "Replace PipMotionHelper.mBounds with PipBoundsState" 2020-10-29 19:44:08 +00:00
Chris Li
97c97911c5 Merge "Return the existing DisplayAreas when registering an organizer" 2020-10-29 17:07:24 +00:00