Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6577b62a authored by Shan Huang's avatar Shan Huang
Browse files

Allow IME to register system back callbacks in

ImeOnBackInvokedDispatcher#switchRootView.

This has the same purpose as ag/20766528, which only addressed one of
the two occurances of IME registering callbacks.

Bug: 262727745
Test: CtsInputMethodTestCases
Test: KeyboardVisibilityControlTest

Change-Id: I0ad892f17211a132d8a69b7f68a6c10f5740c457
parent a9ad4038
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -220,16 +220,14 @@ public class ImeOnBackInvokedDispatcher implements OnBackInvokedDispatcher, Parc
     * @param previous the previously focused {@link ViewRootImpl}.
     * @param current the currently focused {@link ViewRootImpl}.
     */
    // TODO(b/232845902): Add CTS to test IME back behavior when there's root view change while
    // IME is up.
    public void switchRootView(ViewRootImpl previous, ViewRootImpl current) {
        for (ImeOnBackInvokedCallback imeCallback : mImeCallbacks) {
            if (previous != null) {
                previous.getOnBackInvokedDispatcher().unregisterOnBackInvokedCallback(imeCallback);
            }
            if (current != null) {
                current.getOnBackInvokedDispatcher().registerOnBackInvokedCallback(
                        imeCallback.mPriority, imeCallback);
                current.getOnBackInvokedDispatcher().registerOnBackInvokedCallbackUnchecked(
                        imeCallback, imeCallback.mPriority);
            }
        }
    }