Commit Graph

235 Commits

Author SHA1 Message Date
Chris Li
840218d5df Allow ActivityEmbedding to finish Activity through WCT
Before, we call Activity#finish() to finish activities when removing
TaskFragment. This may start a CLOSE transition before the organizer has
a chance to request the actual transition type.

Now, we allow the organizer to finish activities through WCT so that the
operation is atomic and the organizer can request the correct transition
type.

Bug: 240519866
Test: atest WmTests:TaskFragmentOrganizerControllerTest
Test: atest CtsWindowManagerDeviceTestCases:TaskFragmentOrganizerTest
Change-Id: I54671fb2dd34dca952468305429a90d89953de69
2022-09-23 21:23:03 +08:00
Chris Li
7c90ab5b09 Merge "Undo the Extensions API version change" into tm-qpr-dev 2022-09-22 00:43:42 +00:00
Charles Chen
4f6fc19215 Apply SplitAttributesCalculator to SplitController
This CL implements SplitController#set(clear)SplitAttributesCalculator,
and also invokes #computeSplitAttributesForParams
in #computeSplitAttributes to compute the split attributes based
on the current device state.

fixes: 241043111
fixes: 241043028
Bug: 207494880
Test: atest WMJetpackUnitTests
Change-Id: I0e3aadba451f2e585b048bfe2417239ed2f3ba3c
2022-09-21 08:34:28 +00:00
Charles Chen
eaeeaa5608 Extend bounds computation to support horizontal layout
This CL introduces SplitLayout and update bounds computation methods
to support horizontal layout. It also introduces #computeSplitLayout
to compute the current split layout, which always returns the default
splitLayout currently. #computeSplitLayout will extend to consider
SplitLayoutCalculator in later CL.

fixes: 241042437
Bug: 241043028
Bug: 207494880
Test: atest SplitPresenterTest
Change-Id: I037a2b2fa38d05c4fe97e4734cc044148ad15806
2022-09-21 08:34:15 +00:00
Charles Chen
fe23ec48f5 Listen to folding state change for SplitController
This CL enables to update the current top SplitContainer if
there's a folding state change.

Test: manual - following CLs use this CL
Bug: 207494880
Bug: 241043111
Change-Id: Ia4d08d7f71d935101f3aeda94384295db2fa2214
2022-09-21 08:34:04 +00:00
Charles Chen
a13ffe82ff Track visibility in onTaskFragmentParentInfoChanged
As we add visibility info in TaskFragmentParentInfo, we can update
the parent Task visibility in onTaskFragmentParentInfoChanged.
It can be furthur used in update SplitContainers of visible containers.

Test: atest WMJetpackUnitTests
Bug: 243609832
Bug: 207494880

Change-Id: Iad4b8d46bad75c352fc6a1a732ef796cdbfad4f9
2022-09-21 08:31:41 +00:00
Charles Chen
3589fb907f Add TaskFragmentParentInfo
This CL adds a TaskFragmentParentInfo class and extends
onTaskFragmentParentInfoChanged to dispatch display ID and
visibility of the parent Task.
It makes SplitController able to track visibility and display
changes and used to update SplitContainers if there's a folding
state change.

Test: atest SplitControllerTest TaskFragmentOrganizerControllerTest
Bug: 243609832
Bug: 207494880

Change-Id: If3d5db621b20d4005ce0b60e46ac98e1d1e962e3
2022-09-21 08:30:51 +00:00
Chris Li
c7fae523bd Undo the Extensions API version change
Because most of the dependent features are not yet ready, revert it back
in T_QPR1.

Bug: 247950006
Test: pass existing
Change-Id: I451cb0d640f935c542a0e79df8c08945d5c4776c
2022-09-21 15:36:56 +08:00
Charles Chen
894d516094 Merge "Add stub for WindowExtensions v2 APIs" into tm-qpr-dev 2022-09-15 06:34:13 +00:00
Chris Li
48bf845657 Merge "Update ActivityEmbedding split open/close animation adapter for legacy" into tm-qpr-dev 2022-09-15 06:27:37 +00:00
Charles Chen
e4ce409770 Add stub for WindowExtensions v2 APIs
To make WM extensions consistent with androidx branch.

Test: build pass
Bug: 207494880
Change-Id: I1d3ed66804baa99154dbdfd208f8c37767895c27
2022-09-14 11:11:50 +08:00
Chris Li
d5e6eea948 Update ActivityEmbedding split open/close animation adapter for legacy
Make sure the open/close a pair of activities act as one.
Cleanup unused adapter that was introduced for scaling animation, which
is replaced with x coordinate animation in T.

Bug: 241043533
Test: manually verify the animation with legacy transition
Change-Id: I3202895d204d618b4a2d95c9709614a0114543da
2022-09-13 09:51:13 +08:00
Chris Li
08966df3e8 Handle embedding startActivity Intent when calling from application
Before, we only resolve the Intent if it is called with Activity
context, which skip handling cross-process embedding if the
startActivity is called with Application context.

Now, when startActivity is called with Application context, we will
check if the Intent should be embedded in the known Task in the
organizer process.

Bug: 244411454
Test: atest WMJetpackUnitTests:SplitControllerTest
Change-Id: Ic1ee4f23330b4ce35888c0eabd1ee8eb13d13140
2022-09-07 11:14:46 +08:00
TreeHugger Robot
379c38b1ae Merge "Update TaskFragmentToken for Activity relaunch" into tm-qpr-dev 2022-09-01 21:51:47 +00:00
Chris Li
dc7cb3659d Add TaskFragmentOrganizer#applyTransaction with request transition
Instead of having WM Core to "guess" when to request transtiion, let the
organizer to tell whether or not it needs to be applied immediately.

With the shouldApplyIndependently parameter, we can make sure the future
runtime API to change split layout won't affect other ongoing
transition.

Bug: 207070762
Test: atest WmTests:TaskFragmentOrganizerControllerTest
Change-Id: I658b0ba1ae9decc741f09cb53bfff2c45ea076a0
2022-09-01 12:00:31 +08:00
Chris Li
f1bf8d6d9d Update TaskFragmentToken for Activity relaunch
Before, we store the TaskFragmentToken in ActivityClientRecord from
LaunchActivityItem, which won't update if the Activity is relaunched.
Now, we update the token when the activity is reparented to make sure
the token is up-to-date when relaunched.

Also make sure that when activity is destroyed, it is no longer
available using SplitController#getContainerWithActivity(Activity).

Bug: 243330085
Test: atest WMJetpackUnitTests:TaskFragmentContainerTest
Change-Id: I37f1a442c6f1bfb40f04f61eb4f9a3d8d09733ee
2022-08-31 11:37:17 +08:00
Chris Li
93a5865a6f Make sure the secondary TaskFragment is above the primary
Before, we may reuse the existing TaskFragment for secondary activity,
which may be below the primary TaskFragment. Now, we make sure the
secondary TaskFragment is always on top.

Bug: 244254584
Test: atest WMJetpackUnitTests:SplitPresenterTest
Test: atest WMJetpackUnitTests:TaskFragmentContainerTest
Change-Id: Id4c240af71fbd344126ae8bbbad57d9c2150d550
2022-08-30 17:32:48 +08:00
Chris Li
513a9ffcbb Handle TaskFragmentOrganizer#onTransactionReady in sync
Refactor TaskFragmentOrganizer#onTransactionReady to
SplitController#onTransactionReady to make sure that the
transaction is handled in one sync block.

Bug: 240519866
Test: pass existing for refactor
Change-Id: I9e7191e2b71ba262e1a3f8c947f9354698382972
2022-08-27 07:38:50 +08:00
Charles Chen
e85f761308 Merge "Add WindowContext support to WindowLayoutComponentImpl" into tm-qpr-dev 2022-08-25 08:28:25 +00:00
Diego Vela
fe97a18570 Avoid Concurrent Exception in BaseDataProducer.
Add locks to protect the list of consumers.
We are seeing concurrent modification exceptions because
DeviceStateManager sends changes on a separate thread.

Bug: 241464751
Test: n/a could not generate a non-flaky test.
Change-Id: Ie49c0f4f16db39187c98609ac57734e468c3f507
2022-08-24 17:46:07 +00:00
Charles Chen
8ee9dd3b6d Add WindowContext support to WindowLayoutComponentImpl
To make activity embedding library able to listen to folding state
change consistently, we should add WindowContext support to
WindowLayoutComponentImpl, which only supported Activity previously.

This CL can also benefit VoiceInteractionSession support on
WindowLayoutComponent.

Bug: 207494880
Bug: 204073440
Test: use in follow-up CL and report folding state change successfully

Change-Id: I7a4fea6ed00b52996c7cffb33aadb934abe811c8
2022-08-25 01:34:27 +08:00
Kenneth Ford
51d289b772 Merge changes from topic "rear-display-qpr" into tm-qpr-dev
* changes:
  Increments Extensions API version for Rear display API's
  Adds support for enabling and disabling rear display mode.
  Adds extensions implementation for WindowAreaComponent and rear display status listeners
2022-08-22 23:12:02 +00:00
Chris Li
f215542792 Merge "Apply TaskFragmentOrganizer changes in one WCT (2/2)" into tm-qpr-dev 2022-08-21 02:07:04 +00:00
Chris Li
660101fdc7 Apply TaskFragmentOrganizer changes in one WCT (2/2)
Before, when receive TaskFragment transaction, we apply changes in
multiple WindowContainerTransactions. Now, update to apply all changes
in one WCT for the whole TaskFragment transaction.

Bug: 240519866
Test: pass existing
Change-Id: I943d6232ff226ed6f67367fa9b7f73e1f861de64
Merged-In: I943d6232ff226ed6f67367fa9b7f73e1f861de64
2022-08-20 20:19:57 +08:00
Fiona Campbell
a01ccaae13 Merge changes I36ea0ffc,I1f3797c5,I01aeeedd into tm-qpr-dev
* changes:
  Add constraints to window duration scale
  Add constraints to animation duration scales
  Ensure animation scales are within bounds
2022-08-19 14:49:40 +00:00
Chris Li
2224d4712a Merge "Apply TaskFragmentOrganizer changes in one WCT (1/2)" into tm-qpr-dev 2022-08-19 08:56:42 +00:00
Chris Li
153bf507fd Merge "Address TaskFragmentOrganizer style comments" into tm-qpr-dev 2022-08-19 03:30:11 +00:00
Chris Li
e9a1037439 Apply TaskFragmentOrganizer changes in one WCT (1/2)
Before, when receive TaskFragment transaction, we apply changes in
multiple WindowContainerTransactions. Now, update to apply all changes
in one WCT for the whole TaskFragment transaction.

Will update the TestAPI in the followup cl.

Bug: 240519866
Test: pass existing
Change-Id: I2e15b187bee95193874d76bc6963d3e01eba3910
2022-08-17 08:51:03 +08:00
Chris Li
99da16cdc8 Address TaskFragmentOrganizer style comments
1. Rename onActivityReparentToTask to onActivityReparentedToTask
2. Annotate @NonNull and @Nullable for the Extensions methods that are
   not yet annotated.

Bug: 240519866
Test: Refactor and add annotation. Pass existing tests.
Change-Id: I85c5927e6e7261cae3bce715b1955523d430e1e2
2022-08-17 08:46:28 +08:00
Fiona Campbell
43ca1914b2 Ensure animation scales are within bounds
Ensure that all uses of TRANSITION_ANIMATION_SCALE setting are bounded
between 0 and 20.

Bug: 238178261
Test: adb shell dumpsys window windows | grep "Animation setting"

Change-Id: I01aeeeddcbcdce0824d61db6b8f4a8946595131d
2022-08-15 11:16:33 +00:00
Kenneth Ford
22740a10df Increments Extensions API version for Rear display API's
Bug: 207686851
Test: Build & Run
Change-Id: If417305d4974ee4c3fae4e2fe535e1095cfea459
2022-08-09 20:54:05 +00:00
Kenneth Ford
3ea6a2da82 Adds support for enabling and disabling rear display mode.
This adds the functionality for enabling rear display mode in
WindowAreaComponentImpl.

Bug: 207686851
Test: ExtensionWindowAreaComponentTest
Change-Id: If8ac9d23e16e7aa5e12bdedbe4688226aff32d38
2022-08-09 20:53:54 +00:00
Kenneth Ford
571d4a6d62 Adds extensions implementation for WindowAreaComponent and rear display status listeners
This cl includes the functionality of adding/removing
listeners for Rear Display status.

Bug: 207686851
Test: ExtensionWindowAreaComponentTest
Change-Id: I2d4d519a5e4933cd2b1319f2da99845f647006eb
2022-08-09 20:53:34 +00:00
An An Yu
1ad95b58f3 Merge "Update WM Jetpack extensions prebuilt (From updated aosp branch, ran window:extensions:extensions:build)" into tm-qpr-dev 2022-08-09 17:26:09 +00:00
An An Yu
eb374a23aa Update WM Jetpack extensions prebuilt
(From updated aosp branch, ran window:extensions:extensions:build)

Test: Manual on sample apps (SplitList, SplitMain, SplitTrampoline)
Bug: 241570741
Change-Id: I2229a019c48f012d1fd1ffcfeed74444d2f43212
2022-08-09 10:25:18 -07:00
Chris Li
8980a9fe87 Pass Task configuration changed for all TaskFragments at once
Before, we passed Task configuration changed for every embedded
TaskFragment. Now, we only passed one Task configuration changed for the
whole Task. The organizer will then update TaskFragments in the Task
accordingly.

Bug: 240519866
Test: atest WmTests:TaskFragmentOrganizerControllerTest
Change-Id: I755c11a1bcee0dd0305a090b229e867b79eee46d
2022-08-04 10:50:11 +08:00
Louis Chang
61bfe6e0dc Sending TaskFragmentInfo and operation type in #onTaskFragmentError
So, the TaskFragmentOrganizer can know what exact operation was
failed and perform error handles if needed.

Removes the pending appeared activities when starting/reparenting
activity into a TaskFragment was failed.

Deprecating the #onTaskFragmentError method with another overloaded
version, but still making sure the deprecated one is called in order
to make it compatible with Android T CTS.

Bug: 236668365
Bug: 233989810
Test: atest TaskFragmentTest
Test: atest TaskFragmentOrganizerControllerTest
Test: atest TaskFragmentOrganizerTest
Test: atest TaskFragmentOrganizerPolicyTest
Change-Id: Id328d037536d32b3acb9c424d36052b6dca8628a
Merged-In: Id328d037536d32b3acb9c424d36052b6dca8628a
2022-07-28 01:36:38 +00:00
Louis Chang
f2a5491fda Merge "Prevent waiting if no new activity instance launched" into tm-qpr-dev 2022-07-20 08:14:27 +00:00
Louis Chang
5a36e6bc9e Prevent waiting if no new activity instance launched
An existing task can be brought to front while starting
an Intent. In that case, the launching TaskFragment will
remain empty because no new activity instance created.

Monitor the activity launch result and prevent waiting
if the activity instance was not created and cleared the
pending appeared intent.

Bug: 233989810
Test: atest TaskFragmentContainerTest
Test: atest SplitControllerTest
Change-Id: I1bdf516673b71892921da14bdcdb9d1c23ce0a9a
2022-07-19 15:12:37 +00:00
Andrii Kulian
356b008ce9 Add a dedicated method to check task windowing mode
Trying to get a task information via ActivityManager#getAppTasks()
will not report tasks that aren't associated with calling package
by the root activity package name. For activities that are from
a different package the task wasn't found, so the windowing mode
couldn't be checked and WM Extensions didn't report any display
features.

This CL adds a dedicated method to check the task windowing mode
for a given activity token.

Bug: 236295340
Test: ActivityEmbeddingIntegrationTests#testDisplayFeaturesWithEmbedding_differentPackage
Change-Id: If2dbc337c4b8cb909914cc28ae4db28a82ff9de3
2022-07-15 02:44:38 +00:00
Chris Li
8129e9da51 Merge "Do not freeze window in WM Core if Shell transition is enabled" into tm-qpr-dev 2022-06-30 14:05:18 +00:00
Issei Suzuki
d5fec58feb Merge "Pass keyguard occluded status in onAnimationCancelled." into tm-qpr-dev 2022-06-28 17:24:33 +00:00
Charles Chen
09478bf50c Merge "Expand SplitContainer if min dimensions not satisfied" into tm-qpr-dev 2022-06-25 06:26:53 +00:00
Issei Suzuki
a60723b1c8 Pass keyguard occluded status in onAnimationCancelled.
Test: No visible changes yet. Pass existing tests.
Bug: 235463625
Change-Id: Iabee71bc76e19f20702f8a2739f565aa915f9b52
Merged-In: Iabee71bc76e19f20702f8a2739f565aa915f9b52
2022-06-25 01:36:07 +00:00
Charles Chen
bd2723cf6e Expand SplitContainer if min dimensions not satisfied
Before this CL, SplitController creates new SplitContainer if
min dimensions of new lauched Activity/Intent is not satisfied.
This CL changes to expand the existing SplitContainer

Bug: 232871351
Test: atest SplitPresenterTest
Change-Id: Id8d122f7d95d1c6a3574b02ddd2b6afbc548f853
2022-06-24 23:50:12 +08:00
Louis Chang
966a4e4e81 Merge "Do nothing when a finishing Activity configuration changed" into tm-dev am: 725d1534ad am: 3ff8feac5a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19008927

Change-Id: I88bad53e137f2fe321928ba8b833f0f8b2ecea22
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-23 01:07:10 +00:00
Louis Chang
725d1534ad Merge "Do nothing when a finishing Activity configuration changed" into tm-dev 2022-06-23 00:30:19 +00:00
Chris Li
89b0876763 Do not freeze window in WM Core if Shell transition is enabled
Also disable legacy animation override from the organizer since it will never be used with Shell transition enabled.

Bug: 207070762
Test: pass existing
Change-Id: I16aaad606acb51bb47e881d5d533a5a3b1e1fbc9
2022-06-22 15:25:56 +00:00
Louis Chang
b6297b6a46 Do nothing when a finishing Activity configuration changed
Primary Activity and secondary Activity were both finished
while starting another Activity with FLAG_ACTIVITY_CLEAR_TASK
flag. The secondary container was then removed and the primary
container was resized to fullscreen while the organizer gets
the secondary TaskFragment info-changed event. And the primary
container was removed by primary TaskFragment info-changed event
afterward.

Since the primary Activity was resized before completely being
destroyed. The organizer got an onActivityConfigurationChanged c
allback and resulted in another placeholder activity being launched.

Bug: 236272623
Test: making Duo calls
Change-Id: I851828f739a4937725510d99cbdfae9ed212a023
2022-06-21 09:19:05 +00:00
Andrii Kulian
fad7f25eeb Check Task windowing mode when reporting display features
If an application uses ActivityEmbedding it would not be able to
observe display features (like folds or hinges) because they are
filtered out for activities in multi-window mode. One of the reasons
is because the client won't always know the correct position of the
window on screen in multi-window, and the position of the hinge could
be translated incorrectly to the task coordinate space.

However, it would still be OK to report the display features
when activities are in multi-window due to ActivityEmbedding as
long as the task is not in multi-window.

Bug: 236295340
Test: Sample app with embedding and display features.
Merged-In: I00f62574124df6df61f121228bd91ff9bc751c2a
Change-Id: I00f62574124df6df61f121228bd91ff9bc751c2a
2022-06-17 17:15:18 +00:00