Commit Graph

230 Commits

Author SHA1 Message Date
TreeHugger Robot
b82aaa58a5 Merge "Move DividerImeController into its own top-level class" into rvc-dev 2020-05-19 21:53:05 +00:00
Evan Rosky
c48c939343 Move DividerImeController into its own top-level class
First of all, this component is getting rather large so
just organizationally it makes sense to separate it.

Secondly, other pieces will need this injected (DividerView)
to fix some bugs, so it needs to be separated anyways.

Bug: 156775140
Test: just refactor, so check that nothing has changed
Change-Id: I30b9c746ba2cc01c5a38b174c1d06c003683411b
2020-05-19 13:40:48 -07:00
Sunny Goyal
2148254452 Sending split screen stack change to Launcher whenever it changes,
instead of Launcher pulling it

Bug: 155816922
Test: Verified with Launcher changes
Change-Id: I45920f8730740c819c63878857c3b5acbe12097a
2020-05-19 18:14:04 +00:00
Evan Rosky
0a0df88b47 Merge "Update home bounds when entering split on rotation" into rvc-dev 2020-05-15 23:44:07 +00:00
TreeHugger Robot
4acfd1f0f2 Merge "Set DividerView accessibility embedded matrix to surface position" into rvc-dev 2020-05-15 22:38:34 +00:00
Evan Rosky
90d5b6d0ca Update home bounds when entering split on rotation
Sometimes the rotation call comes in before split
is fully entered. However, we already know that we
are going into split-mode, so use a partial split
check rather than the full check to determine
whether home should be updated.

Also fixes another race where the incorrect position
was used to find closest snap on rotate before that
snap was reset to middle when leaving split (due to
a previous change that sets mMinimized early).

Bug: 156491146
Test: make various attempts at entering split by
      opening apps in a different orientation.
Change-Id: I380653e47dc0d07488c3ac56d39c4571d2f25f0b
2020-05-15 11:24:49 -07:00
TreeHugger Robot
3a6ec37a71 Merge "Remove divider view when exiting splitscreen" into rvc-dev 2020-05-14 02:25:24 +00:00
Evan Rosky
2af969c432 Revert^2: Fix pip enter/expand from split-screen secondary.
Split up validateWindowingMode into a validity check and
the one that "resolves" split-screen. This way, calling
setWindowingMode on an ActivityStack won't assign a
random mode (it won't convert undefined into split-secondary).
Without this, the task itself was getting set to secondary
(when it should just be inheriting).

Then, piptaskorganizer will reparent to secondary if in
split-mode (thus using the same logic it used to get the
final animation bounds).

Upon enter, instead of changing root-task mode to pinned,
only the leaf task changes (this is because pinned is now
an alwaysCreateStack activity type). WM, unfortunately,
has to reparent to displayarea here so that it doesn't
mess-up the topActivityType reported via onTaskInfoChanged.

Also made pip params come directly from the top activity
rather than be stored on the task. Otherwise, nested
pip activities wouldn't properly report their params
because they would have been set on the root rather
than their direct parent which meant that once the
direct parent became root, it wouldn't have the params

Bug: 154515783
Bug: 144711770
Test: go to split with a pippable in secondary. go to home
      in secondary.
Change-Id: I74912f828b40745f502bc667bd8371c98891a73e
2020-05-08 13:34:02 -07:00
Vishnu Nair
4880a30fe0 Remove divider view when exiting splitscreen
Remove and re add divider view as needed so we do not allocate memory
while split screen is not active. Also release surface reference from
server when we are done with the SurfaceControl so we don't have to rely
on GC to remove the last reference.

Fixes: 150190730
Test: test split screen manually, check for offscreen or onscreen
divider layers in winscope

Change-Id: I1a6a1c1d4346aafeae85aaf61ec4df23722e75ab
2020-05-08 18:10:47 +00:00
Jorim Jaggi
785edb4d0a Revert "Fix pip enter/expand from split-screen secondary."
This reverts commit dc1d29f0c3.

Reason for revert: b/156037652

Change-Id: I775a7cc92a4e891a1ffb42e8f4e20b336c47e858
2020-05-08 12:34:47 +00:00
Evan Rosky
dc1d29f0c3 Fix pip enter/expand from split-screen secondary.
Split up validateWindowingMode into a validity check and
the one that "resolves" split-screen. This way, calling
setWindowingMode on an ActivityStack won't assign a
random mode (it won't convert undefined into split-secondary).
Without this, the task itself was getting set to secondary
(when it should just be inheriting).

Then, piptaskorganizer will reparent to secondary if in
split-mode (thus using the same logic it used to get the
final animation bounds).

Upon enter, instead of changing root-task mode to pinned,
only the leaf task changes (this is because pinned is now
an alwaysCreateStack activity type). WM, unfortunately,
has to reparent to displayarea here so that it doesn't
mess-up the topActivityType reported via onTaskInfoChanged.

Also made pip params come directly from the top activity
rather than be stored on the task. Otherwise, nested
pip activities wouldn't properly report their params
because they would have been set on the root rather
than their direct parent which meant that once the
direct parent became root, it wouldn't have the params

Bug: 154515783
Bug: 144711770
Test: go to split with a pippable in secondary. go to home
      in secondary.
Change-Id: Ibfc1e7f6805bf2641cff676232c1040e2fa025f1
2020-05-06 10:28:34 -07:00
Tony Huang
8ebf215f50 Merge "Start IME animation if its insets update after show" into rvc-dev 2020-05-05 08:23:16 +00:00
Tony Huang
d1cb4404fe Start IME animation if its insets update after show
Some IME might update its insets after showInsets callback, it
should abnormal but we still should be robust to handle such case.

Fix it by re-calling startAnimation. If it call while animation,
it should cancel previous one and start new one. If animation end,
it will run a new animation.

Bug: 151628536
Test: force stop Gboard, enter split mode and click text filed on
      secondary split.
Change-Id: I31d8e800ef9fc67406cd7c7902b1c597e9c8dcbe
2020-05-04 11:57:41 +08:00
Louis Chang
98578b7e28 Reset Divider#mMinimized when dismiss split
The divider view did not animate while minimizing dock stack
because the mMinimized did not reset after split-screen dismissed.

Bug: 153579514
Test: enter split-screen
Change-Id: I4fa8d773df0a781aa718331fc70f7f94928fdb29
2020-05-04 09:15:22 +08:00
Evan Rosky
5a61909275 Merge "Give Divider back its touch-region" into rvc-dev 2020-05-01 00:11:36 +00:00
TreeHugger Robot
d113ce61d0 Merge "Set divider hidden status after it update" into rvc-dev 2020-04-30 06:02:38 +00:00
Tony Huang
df3cfc1e13 Set divider hidden status after it update
If device is landscape then enter keygaurd, it will rotate to portrait
back but it does not handle previous hidden status so the divider will
show after it update.

Fix it by check hidden status before divider removed and set it after
divider added again.

Bug: 154862056
Test: enter split, rotate then screen off, enter keygaurd to check
      divider is hidden
Change-Id: If19bf9304c38ecee968aefba1b66f154701c5c09
2020-04-30 11:01:57 +08:00
Chavi Weingarten
5a4a5682a2 Merge "Remove getLeash from WindowContainerToken" into rvc-dev 2020-04-30 00:16:21 +00:00
Evan Rosky
650e162195 Merge "Shift Primary stack as well as secondary during ime adjustment" into rvc-dev 2020-04-29 20:55:18 +00:00
chaviw
7de50009a3 Remove getLeash from WindowContainerToken
If the WindowContainer was revoked from a registered organizer, the
client could still call getLeash to system server and control the leash
for the WindowContainer. Instead, pass the leash back to the client in
onTaskAppeared and onDisplayAreaAppeared. Once the WindowContainer is
revoked from the client, the leash will reference the old
WindowContainer SurfaceControl and will not be able to control the
WindowContainer anymore.

Test: Split screen
Test: DisplayAreaOrganizerTest
Test: WindowOrganizerTest
Bug: 154558563
Change-Id: I1f6eb987a2a3fecfef912a3009ee52989c85ff4b
2020-04-29 09:36:35 -07:00
chaviw
da7b3c286b Re-parent children when Organized Window is no longer controlled
When an Organized Window is no longer controlled by a specific client,
we create a new SurfaceControl and reparent the children so the client
no longer has control over the WindowContainer

Test: Pip, TaskOrganizerMultiWindowTest
Bug: 154558563
Change-Id: I76e0da115fd48f982a82bd6e2351e7171934acfc
2020-04-29 09:36:34 -07:00
Evan Rosky
0f4db1b1e2 Set DividerView accessibility embedded matrix to surface position
Even though it isn't technically embedded, pretend like it is
embedded into the display. We need to do this because the surface
is moving, but the view content is always drawn at 0,0. For
utilities like View.getBoundsOnScreen to work, this matrix needs
to be updated to offset things properly.

Bug: 151632128
Test: Enter split-screen and dump accessibility nodes if possible.
      UiAutomator-based tests using divider should work again
Change-Id: Icc42e1236f3863dcafbe7f14512082f6f92b76c3
2020-04-28 16:26:29 -07:00
Evan Rosky
e067ddfc05 Shift Primary stack as well as secondary during ime adjustment
Previously, was only 'adjusting' the secondary split for
ime. So the secondary had functional insets and drag/drop.
However, the primary wasn't being adjusted (accorcding to
WM). This caused its insets to be calculated against its
originla position (which allowed ime insets to potentially
overlap it) and it meant that WM didn't use its visual
position when calculating drag/drop coordinates.

So, this does the same with the primary stack as what was
done with secondary.

However, doing this required some other fixes in WM. Basically,
if appbounds is explicitly overridden, just use them instead of
intersecting with parent. Also, WSA doesn't apply crop for
splits (maybe it shouldn't apply crop to anything anymore).

Additionally, insets calculation was applying top insets to the
bottom if the inset frame's top wasn't exactly equal to the
window's top -- because of a catch-all else condition. So this
adds checks for matching the bottoms as well.

Bug: 154056542
Bug: 151862790
Test: Open two apps in split screen and open IME in secondary. Drag
      from secondary to primary.
Change-Id: I2391783e726e4a1c8ed3150628af2f398218fe90
2020-04-28 11:59:22 -07:00
Evan Rosky
128372810d Give Divider back its touch-region
Divider used to have a touch-region that allowed apps
to receive touch events that would normally overlap the
divider window as long as they weren't in the center.

Re-introduce this by allowing windowless windows to
pass through a touch-region. This region is always
constrained to the window size to prevent security issues.

Bug: 154840035
Test: Enter split and observe touch events away from
      center of divider.
Change-Id: I85310c78beda7bd5574df78e2a83462e965d1154
2020-04-28 09:39:37 -07:00
Evan Rosky
8d1c24e0a5 Inform receivers of restart attempt previous visibility
This way receivers like recents know whether the activity
was already visible before a restart attempt.

Bug: 154575664
Test: added test. Can also launch a running activity into
      split-primary and it won't expand it.
Change-Id: If59ee1615fa36bbe3af9412194a7f96b9377528a
2020-04-27 09:13:31 -07:00
Evan Rosky
a5858ed4e4 Ignore task-info changed callbacks in uninitialized Divider
Apparently there is a chance that SysUI crashes without
system server receiving binder-death (or maybe it receives
binder-death too late?). In this situation, when sys-ui
restarts, the split root-tasks will still exist so there is
a small window of time during init() where WM might send
messages to the new organizer before init() finishes
running.

This avoids a cycle of crashes by returning early, but if
this is hit, the system is likely in a weird state and
Divider probably won't work.

Bug: 153811023
Test: Will need to wait and see. Too low repro rate.
Change-Id: Id42569b4699699dbc7eaa63eaff801c7c52314c7
2020-04-21 19:09:23 -07:00
Wale Ogunwale
6cb85a4e17 SysUI: Don't try to put non-resizeable task in split-screen
WM would just ignore the request anyways.
Also, move secondary split task forward when entering split so random
non-resizeable task doesn't end up on-top.

Test: Repro. steps in bug.
Fixes: 154362321
Change-Id: I552f4ebbb132eb1944e42e53563f75a109b25815
2020-04-20 05:52:12 +00:00
Winson Chung
3908fb22b6 Merge "Send task description changed though task org taskInfoChanged" into rvc-dev 2020-04-13 16:58:07 +00:00
Winson Chung
1df39e2cf6 Send task description changed though task org taskInfoChanged
- This removes the need for a separate task stack listener and aligns
  with other task info change properties
- Also implement equals/hashCode for the token so we can use it in
  containers

Bug: 148977538
Test: atest TaskOrganizerTests

Signed-off-by: Winson Chung <winsonc@google.com>
Change-Id: Ie035e6389fdbdc374c1a4b4a684758efa0cb7a9e
2020-04-11 00:01:05 -07:00
Tony Huang
0bbb7efe26 Fix split task position behavior when landscape
On nav bar 2/3 key mode and device landscape, the top task should
always opposite to nav bar, so top task location should be right
when seascape and left when landscape.

On gesture nav mode, because the nav bar always locate bottom so
keep it behavior.

Bug: 150990456
Test: Use each gesture mode and enter split mode then check it
Change-Id: Ia46f765c43c947350ee4970ea86aa9a0d707ad7d
2020-04-09 13:57:21 +08:00
Tony Huang
a171ec4203 Merge "Fix split divider janky" into rvc-dev 2020-04-06 07:24:15 +00:00
Wale Ogunwale
465b1e1870 Only allow roots tasks to be organized
Non-root tasks are relative to their parents so no need to have them
return true to the isOrganized() method.
We can also:
- Reset the windowing mode for a task we are moving to split screen
before we reparent to the split task.
- Remove code in sys-ui that was added to compensate for the
method previous returning true.

Bug: 152619437
Test: They pass
Change-Id: I7a0381f535f2d0b245773ecb1fbb4fdb524954f9
2020-04-02 17:39:03 -07:00
Wale Ogunwale
adf116ec95 Add TestApi interfaces for window organizers
Enables testing the API surfaces from CTS.

Bug: 149338177
Test: they pass!
Change-Id: I7e1f2852585a10c20d299bd87e9a87f828d06d6a
2020-04-01 13:25:23 +00:00
Tony Huang
89d580c056 Fix split divider janky
The janky caused by SurfaceFlingerVsyncChoreographer does not work
reliably. Sometimes it didn't update but sometimes update twice per
frame so cause janky.

Fix this by removed using SurfaceFlingerVsyncChoreographer and use
real surface flinger sync signal to update screen.

Bug: 150874701
Test: enter split mode and drag divider to observer janky
Change-Id: I5a8bce36738a97b0ddaf4c4e77949eb5295b4894
2020-04-01 19:07:49 +08:00
Winson Chung
a531f922c9 Merge "Add task organizer based task embedder" into rvc-dev 2020-03-31 20:59:17 +00:00
TreeHugger Robot
74e31b7c64 Merge "Clear home surface crop size while being organized" into rvc-dev 2020-03-31 01:24:43 +00:00
Winson Chung
a1f869d10e Add task organizer based task embedder
- Split TaskEmbedder into its current VirtualDisplay implementation
  and an implementation that uses task org to create and manage
  the task
- Use the task org embedder implementation in separate bubble task view
- Skip task org tasks from triggering task resizing
- Add task org callback for back press on task root if requested

Bug: 148977538
Test: atest CtsWindowManagerDeviceTestCases:ActivityViewTest
Test: atest WmTests:TaskOrganizerTests
Change-Id: Id422bb2547197c617f914ed7cf5085e02a1c3fb5
2020-03-30 23:29:08 +00:00
Louis Chang
31de2d67cf Clear home surface crop size while being organized
Launcher has the surface size set as its display bounds before
entering split-screen. Since the crop size was not updated while
being organized, the surface was then cropped after rotation.

Bug: 152515401
Test: move app to split-screen-primary and rotate
Change-Id: I41237f21f188b0d2cf92c93873a3c76be3e4cb74
2020-03-30 05:00:11 +00:00
Evan Rosky
b8540a0985 Fix crash on devices that don't support multiwindow
Only initializes split-screen organizer if device supports it.

Also added some graceful degredation for when organizer binding
fails. Needed to clean-up some things for this though since
now unregistering task-organizers needs to work.

Previously, registering one task-org for multiple windowing
modes worked, but unregistering only cleaned-up one windowing-mode.
So this reworks some of the data-structures to support that
use-case.

Bug: 152401027
Test: Use device that doesn't support split-screen multiwindow.
Change-Id: I7d417721b7b51b20b0c054d9a25f62c443837670
2020-03-26 20:01:23 -07:00
Louis Chang
a009c76580 Remove use of TaskTile
We just have the TaskOrganizer create root task directly

Test: Existing tests pass
Bug: 133381284
Bug: 149429752
Change-Id: Id884cbe8e7d2fdd93e729fcb2793fad4afd59b21
2020-03-25 17:33:50 +08:00
TreeHugger Robot
7cf2aeac02 Merge "Introduce DisplayArea organizer" into rvc-dev 2020-03-24 15:37:57 +00:00
Jorim Jaggi
367257cfc4 Merge "Performance optimizations for new insets" into rvc-dev 2020-03-24 14:25:47 +00:00
Wale Ogunwale
dec3408b50 Introduce DisplayArea organizer
Similar to task organizer this allows for the organization of display
areas.

Test: they pass!
Bug: 147406652
Bug: 152113464
Bug: 152117221
Change-Id: Id0dbec20f0aedc5162f4ff7be81b2dafb0c8f3c9
2020-03-24 06:30:13 -07:00
Jorim Jaggi
22488d31bb Performance optimizations for new insets
- Prevent unnecesary dispatchApplyInsets caused by legacy system
also requesting inset changes
- Make insetsModified oneway. It's safe to do so because we
absolutely don't care about interleaving with other WindowSession
methods.
- Do not trigger layout if nothing relevant has changed
- Only trigger requestFitSystemWindows if state actually changed

Test: Systrace. Automated perf test will be added
Bug: 151865131
Change-Id: I24944875e739e4a74606e3a02bbf14585c1c13db
2020-03-23 22:31:52 +01:00
Wale Ogunwale
568f9f41c6 Introduce WindowOrganizer
WM currently only allows the organization of tasks, however we will soon
be allowing the organization of DisplayAreas. To help with the code
structure, we are introducing WindowOrganizer interface which will
contain common APIs for all types of windows organizers (e.g.
applyTransaction) and also be the interfaece for getting the controller
for other organizers.

Test: they pass!
Bug: 147406652
Bug: 152113464
Bug: 152117221

Change-Id: Id2797b288ce92430206c25345d60e7b0e3be98c8
2020-03-23 08:59:18 -07:00
Wale Ogunwale
5794658be0 Move some window related files to android.window package
Window management files on the client side have normally been dumped in
either android.view or android.app package. This CL starts to
centralized them in android.window package so there is better
separation.

Test: they pass
Bug: 147406652
Bug: 152113464
Bug: 152117221
Change-Id: I4d64bd256e9b3581af0ccf9396f7dd2454132719
2020-03-22 09:47:43 -07:00
Evan Rosky
f64f5dab26 Restrict ime adjustment to maintain primary split visibility
This does a few things.

1. Fixes the logic around restricting the amount of adjustment. Its
   supposed to make sure that at-least 1/3 of the primary split is
   visible.

2. Fixes an issue where windowcontainertransactions weren't applying
   configuration updates to tiles specifically

3. Includes configuration changes among the things that will send
   onTaskInfoChanged updates to task-organizers. Previously, the
   changes were actually applied late.
   - The reported changes are restricted to only configs that
     task organizers can set.

4. To adapt to config changes being reported, divider code needed
   to be changed.

Bug: 151181674
Test: Using various snaps of split, open ime in secondary and
      verify that primary remains visible.
Change-Id: I7001bd29872a15950f91ab2407848fde8c3f1d02
2020-03-19 19:26:10 -07:00
Evan Rosky
fdc71c44d3 Fix some more divider/ime interractions
Fixes the following issues:
- Opening an app, then going to recents and putting it into split
  wasn't going to minimized.
- Compose thing in secondary split would leave split in weird state

Also added several debug logs behind a variable for easier
debugging in future.

Bug: 151181674
Bug: 151060730
Test: Open an already-open app from recents into split-screen.
      Cancel opening IME partway by defocusing editfield.
Change-Id: I4de4c3e543504087eae2458ca62d08c155899397
2020-03-16 11:52:31 -07:00
Evan Rosky
c0eec05ed5 Fix up interractions between Adjust for IME and minimize
These aren't compatible at the moment, but at the very least
prevent them from running at the same time so that switching between
secondary adjusted to recents works.

This works by augmenting the divider's ime handling with a paused
state. When paused, it will keep track of ime changes, but it won't
apply them to the divider until it's resumed.

Despite this, the interraction is still quite glitchy, but at least
it ends up in the right end-states. A full fix for this will require
a significant rewrite of the whole DividerView's bounds handling.

Bug: 150781668
Test: Open 2 apps in splits. show IME in secondary, then swipe-up
      to recents. While not perfect, it should work.
Change-Id: I4e7a6b9ed04b38edb83655b2326de4448124b904
2020-03-16 10:01:37 -07:00
TreeHugger Robot
dcb631d551 Merge "Don't apply ime adjustments/dims if split is not active" into rvc-dev 2020-03-11 20:55:17 +00:00