Commit Graph

574 Commits

Author SHA1 Message Date
Louis Chang
e20ffee9dd Merge "Move the task to back while pressing back on the last activity" into tm-qpr-dev am: b73cda834c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20278150

Change-Id: I2b133d0cd5ea3dcb8ce038f1972f778c30048006
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-17 00:45:22 +00:00
Louis Chang
b73cda834c Merge "Move the task to back while pressing back on the last activity" into tm-qpr-dev 2022-11-17 00:21:08 +00:00
Louis Chang
99b9449724 Move the task to back while pressing back on the last activity
... of the secondary (or the primary) container.

The primary container was removed along with the secondary container
while the last Activity in the secondary container was finished by
back event. Therefore, starting window will be shown if starting the
app again from Launcher.

However, the last Activity in the secondary container should be
considered as a relative task root if the Activity is displayed
adjacently or being a companion with the task root activity.
The task should be moved to back vs. finishes the Activities to
speed up the launch next time, like commit 2dec42fa does.

Bug: 240669850
Test: launch Settings
Test: atest WindowOrganizerTests
Change-Id: I13b33afb8602f63062f6b33742453c3e93fdfc20
2022-11-16 02:26:37 +00:00
Cole Faust
d3c499dabc Merge "Fix errorprone warnings that should be errors" am: 677d6cd780 am: f9df26ae3c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2256563

Change-Id: I8090e254f06a3b5fc7e9b23fdae6c5bd3db230c5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-15 19:37:15 +00:00
Cole Faust
f9df26ae3c Merge "Fix errorprone warnings that should be errors" am: 677d6cd780
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2256563

Change-Id: I0e9c5077610407a117ee34ff688b40b52e161a03
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-15 19:11:55 +00:00
Cole Faust
7da659bb6c Fix errorprone warnings that should be errors
This commit is part of a large scale change to fix errorprone
errors that have been downgraded to warnings in the android
source tree, so that they can be promoted to errors again.
The full list of changes include the following, but not all
will be present in any one individual commit:

BadAnnotationImplementation
BadShiftAmount
BanJNDI
BoxedPrimitiveEquality
ComparableType
ComplexBooleanConstant
CollectionToArraySafeParameter
ConditionalExpressionNumericPromotion
DangerousLiteralNull
DoubleBraceInitialization
DurationFrom
DurationTemporalUnit
EmptyTopLevelDeclaration
EqualsNull
EqualsReference
FormatString
FromTemporalAccessor
GetClassOnAnnotation
GetClassOnClass
HashtableContains
IdentityBinaryExpression
IdentityHashMapBoxing
InstantTemporalUnit
InvalidTimeZoneID
InvalidZoneId
IsInstanceIncompatibleType
JUnitParameterMethodNotFound
LockOnBoxedPrimitive
MathRoundIntLong
MislabeledAndroidString
MisusedDayOfYear
MissingSuperCall
MisusedWeekYear
ModifyingCollectionWithItself
NoCanIgnoreReturnValueOnClasses
NonRuntimeAnnotation
NullableOnContainingClass
NullTernary
OverridesJavaxInjectableMethod
ParcelableCreator
PeriodFrom
PreconditionsInvalidPlaceholder
ProtoBuilderReturnValueIgnored
ProtoFieldNullComparison
RandomModInteger
RectIntersectReturnValueIgnored
ReturnValueIgnored
SelfAssignment
SelfComparison
SelfEquals
SizeGreaterThanOrEqualsZero
StringBuilderInitWithChar
TreeToString
TryFailThrowable
UnnecessaryCheckNotNull
UnusedCollectionModifiedInPlace
XorPower

See https://errorprone.info/bugpatterns for more
information on the checks.

Bug: 253827323
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I8446f9076a45ebf7e7ffa06cb0d4ddb1001b6c00
2022-11-14 17:57:30 -08:00
Jorge Gil
5a95db047e Add WCT#setDragResizing to optimize fluid resizing
Allows WM Shell to indicate the start/end of drag resizing, which
core can use as a signal to reuse a single (larger) surface size
for the entire drag resize operation to avoid continuous buffer
allocations after each size change.

Bug: 249808500
Test: drag resize a freeform window, verify WindowLayout requests
a fullscreen sized surface; atest TaskPositionerTest

Change-Id: I27e2b44270d7ea4f701fa8037f93b20dc691284b
2022-11-11 00:48:49 +00:00
Riddle Hsu
e65d74270d Exclude unnecessary animations of shell transition
There may have multiple transitions when launching a task with
embedded activities. In the last transition info, it may contain
activities occluded by starting window and a closing wallpaper.
By default, all of them will be animated with edge extension,
that looks like showing some noise.

Because the animation of embedded activities under a task level
starting window is not visible, it can be skipped. But for
non-embedded activity, the activity level starting window can be
changed or closed with the host activity, so the case should not
be skipped.

Besides by default, wallpaper is no animation, especially it
shouldn't apply any task/activity style animation.

Also make sure the leash of starting window is always on top of
the task with embedded activities. This just makes the surface
hierarchy consistent.

Bug: 255269113
Test: No flickering when cold launch Settings on a large screen
      device with support of activity embedded.
Change-Id: I8fd1137e806aeb4060a83a71dc5aa02acdc42429
2022-10-28 17:50:56 +08:00
Shan Huang
188dee2b3b DO NOT MERGE Spring controlled back progress API
This CL introduces BackProgressAnimator which runs in app's main thread.
It receives target progress values from SysUI and drives the actual
progress value passed to the app with a high stiffness, no bounce
spring.

Bug: 238475284
Test: atest WindowOnBackDispatcherTest
Test: atest BackAnimationControllerTest
Test: atest TouchTrackerTest

Change-Id: Ib0d3ebe43929c405b10681000fb4e7ef8bccce34
2022-10-21 22:12:53 +00:00
Riddle Hsu
1689d780d3 Do not change surface of system window token for transition
The collected WindowToken's (e.g. status bar, navigation bar)
isVisibleRequested may be changed according to its WindowState's
visibility policy or the visibility of who is controlling the insets.
They are not aware of the WindowToken surface visibility, so keep
them untouched unless shell transition supports general window
animation or even insets animation.

Bug: 251214841
Test: atest FlickerTests:CloseImeAutoOpenWindowToAppTest
Test: Launch an activity that requests to hide system bars.
      And use shell command to change display size at the same time.
      After the launch transition is finished, the system bars
      can still be visible when swiping from bottom or top.
Change-Id: I2403e2dcbc6684774c9c3b74768a32c7b7a3b8ae
2022-10-13 17:24:43 +08:00
Chris Li
84ec824a33 Polish ActivityEmbedding enter/exit PiP (1/n)
1. When moveActivityToPinnedRootTask with creating a new Task for PiP,
   make sure the Task's initial bounds is the same as the activity
   parent TaskFragment so the animation starts from the correct bounds.
2. When exit PiP to previous Task, make sure we are animating the
   correct window surface. For the previous implementation. there can
   also be TRANSIT_CHANGE change for entering ActivityEmbedding split
   (from PiP) in the same transition.

Bug: 207070762
Test: atest WmTests:RootWindowContainerTests
Test: atest WmTests:TransitionTests
Merged-In: Ifba090ad9ac9fb7033d343eab1c87c1a67bb9c11
Change-Id: Ifba090ad9ac9fb7033d343eab1c87c1a67bb9c11
2022-10-13 09:02:27 +08:00
Charles Chen
c0ee7bde68 Merge "Fix SplitContainer not updated when folded." into tm-qpr-dev 2022-10-07 09:19:39 +00:00
Charles Chen
6e0b27a126 Fix SplitContainer not updated when folded.
The root cause is that TaskFragmentParentInfo wasn't be dispatched
when there's a display or visibility change because we didn't
implement getTaskFragment() in TaskFragment and it led to
the TskFragment can't return itself if the predicate function
returns true.

This CL fixes WC#getTaskFragment and changes to dispatch
Task#shouldBeVisible instead of Task#isVisibleRequested.
The reason is that the visibleRequested change is not early enough for
the scenario that device is folded from unfolded state, and lead to
Settings flickering.

Test: manual - open Settings and fold the device
Test: atest TaskTests#testGetTaskFragment
Test: atest TaskFragmentOrganizerControllerTest ActivityRecordTests
fixes: 249055633
Change-Id: Ie1c56758697d14b426c9ed713da84e49c9f880d8
2022-10-06 17:08:42 +08:00
Wei Sheng Shih
925181d781 Merge "[Shell Transition] Schedule another transition to update visibility." into tm-qpr-dev 2022-10-06 08:34:09 +00:00
wilsonshih
66e601fb13 [Shell Transition] Schedule another transition to update visibility.
Activity could call setTranslucent during a transition playing, if the
task of an activity was in transition and that activity should become
invisible, it would be defer until transition finish.
However, since the activity wasn't participant the running transition,
there won't do commitVisibility for it after transition finish.
To correct the visibility status, trigger another transition so the
activities which visibility changed can be collect and commit.

Bug: 246518648
Test: atest testConvertTranslucentOnTranslucentActivity
Test: atest testConvertTranslucentOnNonTopTranslucentActivity
Change-Id: Ic1cda79da37162cca2a1a3fbc73311cc325b3874
2022-09-29 09:20:49 +00:00
Riddle Hsu
7e2eeb1395 Make startTransition one-way
If shell is starting an existing transition, it doesn't need the
returned transition token so it can be an async call then it won't
block shell's thread to execute other operations.

If shell is starting a new transition, then use the new added 2-way
startNewTransition which is the same as the original path.

Bug: 248550757
Test: atest ShellTransitionTests
Test: CtsWindowManagerDeviceTestCases with shell transition
Change-Id: I5f64d19475d5b857a461775dd6f3002567e93ad8
2022-09-27 15:06:37 +08:00
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
6a3dfb250a Skip ActivityEmbedding animation if it is behind an app starting window
Bug: 207070762
Test: atest WMShellUnitTests:ActivityEmbeddingAnimationRunnerTests
Test: atest WmTests:TransitionTests
Change-Id: I602201646040f3358a688dcb6ec779f8244953ac
2022-09-22 11:25:38 +08:00
Charles Chen
501b654ce3 Merge "Send TaskFragmentParentInfo for visibility changes" into tm-qpr-dev 2022-09-21 11:45:05 +00:00
Charles Chen
2e95b5f6fe Merge "Add TaskFragmentParentInfo" into tm-qpr-dev 2022-09-21 11:43:45 +00:00
Charles Chen
6012e9b748 Send TaskFragmentParentInfo for visibility changes
This CL propagates visibility from Activity to Task, and dispatch
 #onTaskFragmentParentInfoChanged is there's a task visiblity
update. This CL also send the callback when the associated Display
of Task changes.

Test: atest TaskFragmentOrganizerControllerTest
fixes: 243609832

Change-Id: I3b0198cfd11a3ec4917f92d0a1e540cf16827d08
2022-09-21 08:33:47 +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
7eb3933a3e Merge "Only play ActivityEmbedding animation if there is AE split" into tm-qpr-dev 2022-09-15 23:31:24 +00:00
Chris Li
941a2e72f6 Merge "Play ActivityEmbedding animation if all changes in Task with embedded" into tm-qpr-dev 2022-09-15 23:31:09 +00:00
Chris Li
b74873a410 Only play ActivityEmbedding animation if there is AE split
Same as the legacy app transition, we want to play the app customized
animation if there is no AE split.

We don't support app customized animation when there is AE split yet to
make the animation consistant.

Bug: 207070762
Test: atest WMShellUnitTests:ActivityEmbeddingControllerTests
Test: atest WmTests:TransitionTests
Change-Id: I68348cd650b9dbc8c39ef8d22a171d128e196882
2022-09-15 06:31:01 +00:00
Chris Li
1efadcb97c Play ActivityEmbedding animation if all changes in Task with embedded
Same as the legacy app transition, we want to play AE animation if all
changes are in Task with embedded activity

Bug: 207070762
Test: atest WmTests:TransitionTests
Change-Id: I66c5c083a517b3254d647c7335264eba8837f0cd
2022-09-15 06:30:05 +00:00
Chris Li
5ef4e81b20 Merge "Cleanup unused TestApi in TaskFragmentOrganizer" into tm-qpr-dev 2022-09-13 04:35:19 +00:00
Chris Li
3550fa269a Cleanup unused TestApi in TaskFragmentOrganizer
The callback handling is moved to SplitController#onTransactionReady, no
longer need those TestApi.

This is different from the merged-in cl for CTS compatibility in the
current release.

Bug: 240519866
Test: pass existing
Change-Id: I66ddd51c94003254001436ff0505dde3b26d0437
Merged-In: I66ddd51c94003254001436ff0505dde3b26d0437
2022-09-13 09:38:26 +08:00
Evan Rosky
da06944a7c Merge "Send core-created snapshots to transition player" into tm-qpr-dev 2022-09-07 17:15:05 +00:00
Chris Li
2c9b75902e Merge "Add TaskFragmentOrganizer#applyTransaction with request transition" into tm-qpr-dev 2022-09-01 06:59:10 +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
Evan Rosky
c8b3fc0acc Send core-created snapshots to transition player
This way, the player doesn't have to take a second
screenshot for use during animation.

This also includes luma (only for rotation) since
that requires the actual buffer and we only want to
send the snapshot surface.

Bug: 242056267
Test: atest TransitionTests
Change-Id: Ib76bb821b4aa8c01c6db1827c26b9fb498aae878
2022-08-31 15:20:06 -07:00
Maryam Dehaini
ef023c1411 Merge "Move Task Close to WindowContainerTransaction" into tm-qpr-dev 2022-08-31 20:39:37 +00:00
Maryam
193d515420 Move Task Close to WindowContainerTransaction
Added removeTask HierarchyOp so that CaptionWIndowDecorModel now uses WindowContainerTransaction to remove task rather than IActivityTaskManager#removeTask(int)

Bug: 242094334
Test: Manual testing using acloud and unit testing (atest WmTests:WindowContainerTransactionTests)

Change-Id: I9e2f1946a517bdba6a75b7049f00943d729045f0
2022-08-30 22:17:21 +00:00
Chris Li
69d314f23e Merge "Make WCT#requestFocusOnTaskFragment a TestApi" into tm-qpr-dev 2022-08-29 16:34:35 +00: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
Chris Li
da64f9599f Make WCT#requestFocusOnTaskFragment a TestApi
So that we can verify the API in CTS.

Bug: 232476698
Test: CtsWindowManagerDeviceTestCases:TaskFragmentOrganizerPolicyTest
Change-Id: I0e064f8cae48cc0281a0b462b8d072baceeeca9f
2022-08-26 10:19:37 +08:00
Wei Sheng Shih
4ec0b52029 Merge "[RESTRICT AUTOMERGE]BackGestureAnimation: a lightweight recents animation controller" into tm-qpr-dev 2022-08-25 14:04:21 +00:00
Ming-Shin Lu
95264856d1 Merge "Fix no cross-profile thumbnail animation" into tm-qpr-dev 2022-08-25 04:41:36 +00:00
Ming-Shin Lu
389ef0bb5e Fix no cross-profile thumbnail animation
As the task of the launching activity requests attaching cross-profile
thumbnail animation but in Transication#onTransitionReady didn't be
promoted into change list, so it ends up no-op since attaching thumbnail
for cross-task requires the animating target is the task.

Fix the issue by
1) Add {FLAG_CROSS_PROFILE_OWNER_THUMBNAIL,
   FLAG_CROSS_PROFILE_WORK_THUMBNAIL} in TransitionInfo.Change for shell
   to know which thumbnail icon should load, according to the userId of
   launching activity.
2) Remove isTask and add 1)'s change flag check in
   attachCrossProfileThumbnailAnimation to make the thumbnail animation
   can be played and attached on the activity-level.

Fix: 239798040
Test: as issue steps
 1) Use Gmail app
 2) Tap the account icon
 3) Select "Switch to personal profile" (or "Switch to work profile")
 4) Expect the dimmed background thumbnail icon with
    task opening transition are animated in parallel
Change-Id: I90eecf4e8ba104c7234a39d1b2638295820d2ac7
2022-08-24 23:58:15 +08:00
wilsonshih
c9c9a757a8 [RESTRICT AUTOMERGE]BackGestureAnimation: a lightweight recents
animation controller

Copy most of code from RecentsAnimationController to back gesture
animation controller(BackNaviAnimationController), the infrastructure
can be reused for either back-to-home/back-to-task/back-to-activity
animations if needed. Since the infrasturcture of legacy recents
animation controller should be stable already, we don't need to
worry about issues like leak leashes/flickers/fixed rotation.

BackAnimationAdaptor is a temporary class to help migrate to shell
transition, the target is to replace it by RemoteTransition.

Next step: Migrate to shell transition, decouple animation info from
BackNavigationInfo.
Test: manually play back to home animation to verify no flicker/black
background/leak surface. Also test that there can play back to home
animation even when quick swipe.
Test: atest BackNavigationTest
Test: atest BackNavigationControllerTests BackAnimationControllerTest
Bug: 237642535

Change-Id: I436a3dcf5011c56c08d131b40168f19128cc8723
2022-08-24 02:35:46 +00:00
Chris Li
4e9c5b44b1 Wait for TaskFragmentOrganizer to finish handling transaction
When a TaskFragmentTransaction is sent to the organizer during a
transition, have the transition wait for the organizer to finish
handling the transaction.

Bug: 207070762
Test: atest WmTests:TaskFragmentOrganizerControllerTest
Change-Id: I4b7955171cd8ce386686ff2cd64b7c04a6436ddf
2022-08-23 09:46:05 +08: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
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
Gaurav Bhola
15a8232e38 Merge "Handle alwaysOnTop in DisplayAreas." into tm-qpr-dev 2022-08-12 03:23:30 +00:00
Tony Huang
103a3b441f Merge "Add setForceTranslucent API" into tm-qpr-dev 2022-08-11 06:51:28 +00:00