By default activities cannot be embedded by non-privileged
processes. Apps can either declare their activities to be available
for untrusted embedding, or limit it to certain trusted hosts.
This CL verifies that an application cannot embed activities that
didn't opt in, and verifies that in untrusted mode the host cannot
request SurfaceControl transactions or position the embedded
container outside of the task bounds.
Bug: 197364677
Test: ActivityEmbeddingCrossUidTests, TaskFragmentOrganizerTest
Change-Id: Ief54c9acae1a9a4152af710f67e7810afdcff9ba
Without this cl, we always override animation as long as there is any
organzied TaskFragment. And users may see different animation on the
same small screen before and after they have unfold and fold.
The idea is to only register the remote handler if the app currently has
at least one split rule that can fit the current Task bounds.
When there can be split, we want to always override the animation to
make it consistent.
When there won't be any split, we want to allow app to override
animation, so they can still provide the same experience as normal phone
on small screen.
Fix: 207804116
Fix: 196173550
Test: manual test with fold/unfold
Change-Id: I3ae194f89b35afc5734338fd3bb350e0cd364c85
Without this cl, the app will crash if a TaskFragment is closing when
the new top TaskFragment doesn't contain any non-finishing activity
(which should be closed later as well).
Before, when #cleanupContainer(), we will also update the new top active
container, but we didn't check if it contain any non finishing activity.
Fix: 212355346
Test: test with Settings with three finger click
Change-Id: I26538b85f1cf8e618a3f1ee6abada5a9f77f2b16
Before this CL, Activity was only blocked from finishing if it is the
last Activity in th Task to start lock task mode.
However, it may make half of screen black if the finishing Activity is
in one of adjacent TaskFragments.
This CL considers the scenario that two adjacent TaskFragments side-by-side.
If a finishing Activity leads to TaskFragment empty, and also make the
adjacent TaskFragment finish, block the Activity from finishing.
Bug: 205813709
Test: manual - use Settings in task pinning mode
Change-Id: I6116d644aeccc13460d302fe3b40953fa67dca6c
Adds an interal method to check if an activity is being organized
by any process. This can be used by WM Jetpack Extensions APIs to
inform apps about their activities being embedded.
Bug: 204399167
Test: Manual, using demo app
Change-Id: I3a0ad021ad43c97bf9b92df05e9858aae143f62b
SplitController#startActivityToSide is called from
SplitController#launchPlaceholderIfNecessary with
a null value for the failure callback. If the activity
launch to side fails, then startActivityToSide tries
to pass the failure to the failure callback, which is
null. This CL fixes this bug by checking if the failure
callback is null.
Bug: b/209296363
Test: existing tests pass
Test: launch settings app from overview and observe no crash
Change-Id: I6577d992f48acbaae6b0e9776e65933e779defe3
...in TaskFragment
There may be a delay between when an activity is marked
to finish and when the WM hierarchy actually removes the
activity from the TaskFragment. In between this delay,
the TaskFragmentInfo will change because the runningActivityCount
will change, triggering an onTaskFragmentInfoChanged.
This callback is unncessary because there will be another
callback soon once the activity is removed from the hierarchy.
Bug: b/205901017
Test: atest CtsWindowManagerJetpackTestCases:ActivityEmbeddingLaunchTests
Change-Id: I64e08acc2a745f6f242996e99240fe4a8f0dea97
Merged-In: Id773ac3f0afea198ad4f8b4594d7a4cf0ad98ea8
TaskFragmentAnimationRunner is initialized using the
looper from the caller thread. This may cause a NPE
because the looper may be null if the
TaskFragmentAnimationRunner is initialized from a
non-main thread.
This CL creates a HandlerThread for the
TaskFragmentAnimationRunner so that it can be
initialized from any thread.
Bug: b/207662199
Test: atest CtsWindowManagerJetpackTestCases:ActivityEmbeddingLaunchTests
Change-Id: Id06b03380dc6dfa9122fca293df8948b4374c966
We don't really have any use case to manipulate TaskFragment leash, and
removing it can reduce chance for related security issue.
Fix: 207061678
Test: pass existing
Change-Id: I24617228991f030335ba74ce7c2ee48b9c33b9d6
The new animation is the same as the activity_open/close_enter/exit
animation, but without the black scrim.
Fix: 201357701
Bug: 196173550
Test: test with settings app
Change-Id: Ieff2f913f92ee745fea94734e5dadeecbed29a36
We want to keep the animation consistent when using activity embedding,
so override the transition animation for activity/task open/close as
well.
Bug: 196173550
Test: manually with settings app
Change-Id: I2f22c8dc8ea22fe549f716ca683833debf7d0f02
Ignore the folding feature states that are not reported through
extensions. There is a crash when trying to process a folding
feature while the corresponding display is not active. We had a
fallback value for the posture of flat but the bounds that we
calculated would be incorrect. We removed the default value
and ignore the folding feature when the corresponding display
is not active.
Bug: 204477995
Test: manual - install the samples app from WindowManager
Test: close a folding device and open the samples app
Test: select the display feature sample.
Test: app should not crash.
Change-Id: I102ed61618915ae6782c40964882a54184538e81
We don't want to show the TaskFragment window outside of its bounds.
Bug: 201261613
Bug: 196173550
Test: test with settings app
Change-Id: Idc627970abec95b8c6087a993802b32955449406
Add support for custom finishing behaviors for containers in split
pairs. 'finishPrimaryWithSecondary' and 'finishSecondaryWithPrimary'
now have several options:
- never
- always
- adjacent (finish only when containers are shown side by side, but
not when stacked).
'finishPrimaryWithSecondary' option was also added to placeholder
rules.
Bug: 204829538
Test: Manual, using demo app and Settings.
Change-Id: I543d15e62acc57f9ad6578221248fbb0a8c719db
Normally placeholders are finished when there is not enough space
to show them by the side of the primary activity. However, in some
cases it makes sense to continue showing the placeholder stacked
on top when the window is small after it first appeared in a split
with a larger window size.
This CL introduces an option to make placeholders sticky and behave
similar to regular split rules in stacked case for consistency.
Bug: 202810486
Test: New option in the demo app
Change-Id: I60e8973679d95f52aaa231581a3063d9f30d4be3
...in a split has no activities
If a TaskFragmentContainer in a SplitContainer has no
activities, then that means that either the entire split
is going to be removed or the empty TaskFragmentContainer
is about to get a running activity. This CL prevents a
split info update from sent in this case because the info
will soon be stale by another update.
Bug: b/204193051
Test: atest CtsWindowManagerJetpackTestCases:ActivityEmbeddingLaunchTests
Change-Id: I4b6f684b8d8e9a9b3fefd54b399d8a7d83c6cfb0
Add support for parsing half-opened and flat states.
Update SampleSidecar to fallback to display feature state if missing.
Add the ability to normalize display feature states.
Bug: 183049815
Test: Manual
Test: Make sure either sidecar or extensions is installed.
Test: adb shell settings put global display_features fold-[0,960,1080,960]-flat
Test: Run sample app from window-samples in jetpack
Test: Verify there is a feature.
Test: Note the dimensions are device dependent.
Change-Id: Iadbca299b37ca1ed6c62adfc83fd091dbe911d0c
Currently SplitInfo callback didn't dispatched if the top Activity is
from other process than TaskFragmentOrganizer's.
This CL adds a flag isEmpty in SplitInfo to make users know if there may
be an Activity from other process even if Activity list is empty.
Bug: 202230350
Test: manual - reproducible steps mentioned in bug 202230350
Change-Id: Ie28a4db9fffb2d661592cf43f9316aa0824e4635
Use Application Context in SidecarProvider to avoid a memory leak. There
is a memory leak when an Activity is used that does not handle
configuration changes. The leak happens because the Activity may be
captured and retained longer than desired.
Bug: 202989046
Bug: 202250276
Test: manual - Use an activity that ignores configuration changes.
Test: Install leak canary.
Test: Subscribe to WindowLayoutInfo changes using an Activity.
Test: Rotate the device a few times.
Change-Id: I953d0cb39d21af00aad7044678e256d16b2d1c85
Bug: b/201579002
Test: atest CtsWindowManagerJetpackTestCases:SidecarTest
Test: atest CtsWindowManagerJetpackTestCases:ExtensionWindowLayoutComponentTest
Test: [Manual] On a device that only has Sidecar, run an app that uses
the WindowManager Jetpack library (for example, YouTube) and verify
that the app features that use the library work as expected.
Change-Id: I2e15cf06b6a7af33b22b52263fbe084982db8df2
We use the default activity open animation for TaskFragment open.
However, when two split TaskFragments are opening together, it would
look like their separate. We can't promote it to the Task level because
the Task contains both opening and closing TaskFragments.
The workaround here is to offset the left/right TaskFragments to make
them look like one window.
Bug: 201623109
Bug: 196173550
Test: manually open two TaskFragment in split with demo app
Change-Id: Ic391262dcbd7f35d4e5a88588d39c74b4c5d5aae
Update window-extensions aar to match updated interface.
Interface was changed due to API council feedback to prefer a single
method that returns a nullable value.
Bug: 199123327
Test: Manual
Change-Id: I6cc5a66857de97c6b55ca3131a3e516d593e1c83
The TaskFragments were set to adjacent only when registering
a new split container.
It should also be done while updating the split container, like
when the user navigated back and a TaskFragment was removed.
Bug: 200504061
Test: repo steps on the bug
Change-Id: I432662fd098c98d96f8b2fd5fc4277f77be430d7
The token was needed because the TaskFragment info may not
sent to the organizer before activity created.
The token is no longer necessary because the TaskFragment
info is now ensured to be updated before activity created.
Bug: 200303250
Test: wm presubmit
Change-Id: I69a42fa35efde4fc7f37ab50334de5de146da90d
When the snapshot surface is created, it should remain at its
original position.
When the animation starts, change animation bounds should be at the
start bounds relative position.
Bug: 196173550
Test: atest WmTests:RemoteAnimationControllerTest
Test: Test with demo app full -> split with RTL enabled.
Change-Id: I3cb44e1f222870f51105bfaa98fc4febaafec03b
Based on the UX feedback:
Delay: 30ms
Duration: 80ms
Easing: linear
Bug: 196173550
Test: Test with demo app shopping mode
Change-Id: I1eac73ba71f6128a54e00b25674ff731695a3dc9
The snapshot surface will be offset with its parent, so no need to
offset itself.
Bug: 196173550
Test: test with demo app on click back from split to split.
Change-Id: I1c65bf2e4b1b8c489ad7fe5eec1418707d590d13
Also make sure that the split info is updated after an activity is
appeared on the client side.
Bug: 199144146
Test: Manual, using the test app
Change-Id: I11e6dd9d1f55c107aaf40aed4d25b6b8fff7b9ca
Moved to androidx.window.extensions.layout package.
Removed ExtensionProvider.
Updated method signatures.
Bug: 190433972
Test: Manual, using the sample app from AndroidX
Change-Id: I6c98ced7b447f231455723a8dc601a46653a48de
Use the default app open/close animation.
TODO:
1. Handle two TaskFragment open/close as one
2. Handle change transition based on the new motion design
Bug: 196173550
Test: test with demo app
Change-Id: I7b446840270edfc3c9e3fe188585b2cd839fa9f1