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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
- 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
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
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
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
- 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
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
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
We just have the TaskOrganizer create root task directly
Test: Existing tests pass
Bug: 133381284
Bug: 149429752
Change-Id: Id884cbe8e7d2fdd93e729fcb2793fad4afd59b21
Similar to task organizer this allows for the organization of display
areas.
Test: they pass!
Bug: 147406652
Bug: 152113464
Bug: 152117221
Change-Id: Id0dbec20f0aedc5162f4ff7be81b2dafb0c8f3c9
- 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
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
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
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
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
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