When the enableOnBackInvokedCallback is set to false (or not set),
registering an OnBackInvokedCallback should be a no-op to avoid
overriding the default compat callback.
Test: Manual testing registering a callback on an app with the flag
disabled and doing a back gesture. Currently we don't have test
executing a back gesture so automated tests are not possible
Bug: 235206960
Change-Id: I54d843f11130a78ed5a68cbe4722e601a2086ee1
Merged-In: I54d843f11130a78ed5a68cbe4722e601a2086ee1
(cherry picked from commit aa48dc3c2d)
Before this CL, minimum dimensions of Activity wasn't respected,
that said, an Activity could be embedded in a TaskFragment of which
bounds are smaller its minimum dimensions.
This CL add the minimum dimensions on several places:
WM core:
1. Verify minimum dimension requirement before adding an Activity to
a TaskFragment. It'll be early return if the requirement is not
satisfied.
2. Propagate the minimum dimensions to the client side through
TaskFragmentInfo to notify the requirement.
3. If TaskFragmentOrganizer tries to shrink a TaskFragment to
the bounds that smaller than minimum dimensions of its children
Activity, switch to match the parent bounds.
AndroidX Window extensions:
1. Early return if TaskFragment is resized to the bounds that smaller
than minimum dimensions which dispatched from the server side.
2. When organizer tries to show Activities side-by-side, verify if
minimum dimensions requirement of the primary Activiy. If the
requirement is not satisfied, show Activities in fullscreen
instead.
TODO: Add an API to check if an Activity intent is allowed to embed
in a TaskFragment.
Bug: 232871351
Test: atest TaskFragmentOrganizerControllerTest
Test: atest TaskFragmentOrganizerTest TaskFragmentOrganizerPolicyTest
Test: atest SplitActivityLifecycleTest
Test: atest CtsWindowManagerJetpackTestCases
Test: atest WmJetpackUnitTests
Merged-In: Ib46c2cec2a0735b9e3f3420f2cb94754801b86b9
Change-Id: Ib46c2cec2a0735b9e3f3420f2cb94754801b86b9
VRI is not currently waiting for SV to draw since SV may start its draw
before VRI opened the SyncSet. If that happens, VRI will not include SV
in its SyncSet and report draw finished even if SV is not complete.
This fix has SV create its own SyncSet when redrawNeeded. Then if VRI
creates a sync, SV will merge its own SyncSet into that one. If SV
already finished drawing, then nothing will get merged, but it means SV
is ready already. If SV is not finished, VRI will now also wait for SV's
draw to finish before calling finishDraw.
Test: Long delay in surfaceRedrawNeededAsync
Test: SurfaceSyncerTest
Bug: 230998394
Change-Id: I44331b8f54951e6dc633a4845bbf690abde0f95e
For Android Auto, tasks should exclude from Recents by default.
For App streaming device profile, tasks should be showed from Recents.
This change also keep the most recent task of "Default display" in
Recents even if it's excluded from Recents.
Bug: 232385935
Test: atest WmTests:RecentTasksTest
Change-Id: Ic01ed6bbae1f2b77f8664196cbc59b248f5ec3b4
When recreating the Activity, if the window is preserved,
onAttachedToWindow won't be called and PhoneWindow.onViewRootImplSet
won't be called either, where we set the actual dispatcher to the
Activiy's proxy dispatcher.
So when the window is preserved, we directly assign the actual Dispatcher
from the preserved Window to the new PhoneWindow
Fixes: 228571903
Test: In progress
Test: Open an app with OnBackInvokedCallback enabled, split to top,
close the other application, do a back gesture
Change-Id: I050247501df8f6cf6cd0024a6233f88a035f6279
Previously when curRootView changes IMM, the back callbacks are not
moved to the new focused ViewRootImpl. As a result if IME is up during
the focus change, the back callback would fail to unregister when
IME tries to hide itself.
Test: atest InputMethodServiceLifecycleTest
Test: atest CtsInputMethodTestCases:InputMethodServiceTest
Test atest CtsInputMethodTestCases:KeyboardVisibilityControlTest
Bug: 232660571
Bug: 232331013
Change-Id: Id30e51c74afbcce1f22d87af77e8404b4f0ae7d2
As WindowTokenClient#{onConfigurationChanged, onWindowTokenRemoved}
requires to post on mainthread, in case posting runnable accquires more
java objects to increase java heap memory, use PooledLambda to obtain
cached runnable for saving memory usage.
Also, use ActivityThread.currentActivityThread.getHandler to get the
main handler rather than creating the new object.
Fix: 215447496
Test: run MemoryOnBoot
Change-Id: Idb2c01a0da02ff669e1a3f1a55f4841f7aa258ba
We currently close the IME by having the target application forward KEYCODE_BACK to the IME process through InputMethodManager#dispatchInputEvent and having the IME handle the keycode in InputMethodService#onKeyDown. When apps opt in to OnBackInvokedDispatcher API, we will not dispatch KEYCODE_BACK to apps anymore. Thus we need to migrate IME to the new API for it to close on back invocation.
This implementation forwards OnBackInvokedCallbacks from the IME process
to the app process. This is necessary because all callbacks need to
exist in the app process for them to be considered by hardware back keys. While back gestures go through WM to resolve callbacks from the focused window, hw keys are directly sent to the focused window's ViewRootImpl, bypassing server side back nav logic.
Bug: 228358882
Test: atest CtsInputMethodTestCases:KeyboardVisibilityControlTest
Test: atest CtsInputMethodTestCases:InputMethodServiceTest
Test: atest CtsInputMethodTestCases
Change-Id: Ie207b63b11a56c9b2173f26b734a27b13ebccc60
This flakiness is due to race of config updates when WindowContext attaches to
DisplyArea.
This CL fixed it by:
1. Don't dispatch config updates to the client side when registering to
DA. We have reported the value by the return value of
#attachWindowContextToDisplayArea.
2. Add lock in WindowTokenClient#onConfigurationChanged to avoid race.
During applying DA's config to WindowContext, WindowContext may get another
callback from the server side and dispatch to ComponentCallbacks
unexpectedly.
Bug: 190019118
fixes: 228911504
Bug: 230022846
Test: atest RegisterComponentCallbacksTest --iterations
Test: atest WindowContextTest WindowContextTests
Test: atest WindowMetricsWindowContextTests
Change-Id: I2d749a058c7a3828c8c8288040236f005aa00ab6
Default focus should be on primaryActivity when a placeholder is shown.
This is a short term improvement as focus navigation works from primary
to secondary but not in reverse.
Fix: 229138140
Test: atest WmTests:TaskFragmentOrganizerControllerTest
Change-Id: Ic4e2280e4b37a8fa04fc532245a5d0cfa4e5e012
When the activity exits PiP and is reparented to the original Task, the
organizer should handle it as a new launch.
Bug: 225371112
Test: atest WmTests:TaskFragmentTest
Test: atest WmTests:TaskFragmentOrganizerControllerTest
Change-Id: Ia7e32e995a35e167b0d76e701c972b269ae068cc
Bug: 228533817
Test: Try swipe back to home on Flag Flipper (with Predictive Back
Animation toggle enabled in Flipper) and make sure animation looks good.
Try in both landscape and portrait mode.
Change-Id: If2165827a0f66f8e0bd8f78483577c3ac4c9f213
When the Task contains multiple activities, activity entering PiP will
be reparented to a new PiP Task. In this case, we should notify the
organizer about the behavior, and prevent the dependents from closing as
a result of an empty TaskFragment.
Bug: 225371112
Test: atest WmTests:TaskFragmentTest
Change-Id: I6f0138c0532d2d0249de38fd84d1a4690f266c07
Adds the implementation to allow or block navigation to a
new task in the policy controller for a virtual device. Will
only change behavior if the cross navigation allow or block
list is included and the navigation does not occur from
the default display.
Bug: 223915401
Test: atest WmTests:DisplayWindowPolicyControllerHelperTests
atest CtsVirtualDevicesTestCases
atest WmTests:ActivityStarterTests
Added test in ag/17503735
Change-Id: I3dfb9dd93c0edf4634320c52a3fc40c4bf473085
Main motivation is to store a back callback's exact priority value in WM. This is required by the IME migration (ag/17076160) to compare the priority levels of IME window callback and focused window callback in BackNavigationController.
This also consolidates the WindowState#mSystemOnBackInvokedCallback and WindowState#mApplicationOnBackInvokedCallback fields into one field, as tracking two fields for one callback was error prone. We had to remember to clear the application / system field when the other field is set, and failing to do so has resulted in bugs such as b/222675481.
Bug: 224856664
Test: atest BackNavigationControllerTest
Test: atest WindowOnBackInvokedDispatcherTest
Test: m -j and test back behavior throughout the system on apps that
opted in and out.
Change-Id: Ic57113610d934f33d2c9ca4cef59f39a9b87e832
Test: m -j update-api. Build and flash and test back behavior throughout
the system.
Bug: 227500290
Change-Id: Ibdb13d02e044741d05d99f1cad96e43dc0129fe4
- Better logging
- Remove method form OnBackInvokedDispatcher interface (but not the
implementation)
- Add test for ag/17211289
Bug: 222675481
Test: BackNavigationControllerTests#testUnregisterCallbacksWithSystemCallback
Change-Id: I6a3ae30da7e29dddda116acd8fa0c9af4b9faa6e
Before, we register remote animation per organizer, and assume it only
organizes in one Task. Now, we register per organizer Task if there is a
rule that supports split in the Task width.
Bug: 207720388
Test: atest WMJetpackUnitTests
Change-Id: Iac4e10af9aa0e7846c81b036b2cf708b6cbe627e
There can reset the system bars color once the splash screen window is
going to be removed, so the real system bars color can be
controlled by app, without waiting for the reveal animation.
Also clear this effect when transfer splash screen to client, so client
can control the color on their own.
Bug: 196550450
Test: verify no status bar color changed when playing reveal animation.
Change-Id: Ibb353d350fa2921188c8c4b54f8e029ee3869c16
Adds a trigger to DisplayContent that creates
unfold transition before applying the display size
and marks it as ready when the sizes are applied.
Adds a placeholder animation for fullscreen tasks.
Bug: 204925795
Test: enable shell transitions, open an app, unfold =>
check that app surface is animated
Change-Id: Ia88178a7c7849a99c17b4d18117a05b2a0fb8b7f
This is such that they can be controlled from Flag Flipper UI.
Boolean flags introduced:
persist.wm.debug.predictive_back - Overall switch for the new back infra
persist.wm.debug.predictive_back_anim - Animation switch
persist.wm.debug.predictive_back_always_enforce - Switch to ignore per
app opt-in flag and always enforce new behavior
persist.wm.debug.predictive_back_screenshot - Screenshot switch. Not
added to Flipper yet.
Test: Flip the flags in Flipper and verify behavior is as expected.
Change-Id: Icff098035119fb83f393e20c6ac590be2f22c845
We are not gating the new back dispatch by targetSdkVersion in T. The new dispatch is controlled by the enableOnBackInvokedCallback app
manifest flag (which defaults to false).
Test: m -j update-api
Bug: 195946584
Change-Id: Iab59051ec5b6336ca4d42cc47015fe86a3f37942