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

Commit 893d0f9f authored by Felix Stern's avatar Felix Stern
Browse files

Change ImeTracker phase in ImeInsetsSourceProvider to be more accurate

Also, updated some TODO's to match the tracking bug.

Test: None
Bug: 353463205
Flag: android.view.inputmethod.refactor_insets_controller
Change-Id: I1d1e9aa6b814a117dc0a020b4fbc3190ae895eb9
parent daf9939d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -221,6 +221,7 @@ public interface ImeTracker {
            PHASE_WM_INVOKING_IME_REQUESTED_LISTENER,
            PHASE_CLIENT_ALREADY_HIDDEN,
            PHASE_CLIENT_VIEW_HANDLER_AVAILABLE,
            PHASE_SERVER_UPDATE_CLIENT_VISIBILITY,
    })
    @Retention(RetentionPolicy.SOURCE)
    @interface Phase {}
@@ -430,6 +431,11 @@ public interface ImeTracker {
     * continue without.
     */
    int PHASE_CLIENT_VIEW_HANDLER_AVAILABLE = ImeProtoEnums.PHASE_CLIENT_VIEW_HANDLER_AVAILABLE;
    /**
     * ImeInsetsSourceProvider sets the reported visibility of the caller/client window (either the
     * app or the RemoteInsetsControlTarget).
     */
    int PHASE_SERVER_UPDATE_CLIENT_VISIBILITY = ImeProtoEnums.PHASE_SERVER_UPDATE_CLIENT_VISIBILITY;

    /**
     * Called when an IME request is started.
+1 −1
Original line number Diff line number Diff line
@@ -4969,7 +4969,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
                    final var userData = getUserData(userId);
                    if (Flags.refactorInsetsController()) {
                        setImeVisibilityOnFocusedWindowClient(false, userData,
                                null /* TODO(b329229469) check statsToken */);
                                null /* TODO(b/353463205) check statsToken */);
                    } else {

                        hideCurrentInputLocked(userData.mImeBindingState.mFocusedWindow,
+1 −1
Original line number Diff line number Diff line
@@ -7072,7 +7072,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        @Override
        public void setImeInputTargetRequestedVisibility(boolean visible) {
            if (android.view.inputmethod.Flags.refactorInsetsController()) {
                // TODO(b/329229469) we won't have the statsToken in all cases, but should still log
                // TODO(b/353463205) we won't have the statsToken in all cases, but should still log
                try {
                    mRemoteInsetsController.setImeInputTargetRequestedVisibility(visible);
                } catch (RemoteException e) {
+6 −4
Original line number Diff line number Diff line
@@ -254,7 +254,7 @@ final class ImeInsetsSourceProvider extends InsetsSourceProvider {
            // Refer WindowState#getImeControlTarget().
            target = target.getWindow().getImeControlTarget();
        }
        // TODO(b/329229469) make sure that the statsToken of all callers is non-null (currently
        // TODO(b/353463205) make sure that the statsToken of all callers is non-null (currently
        //  not the case)
        super.updateControlForTarget(target, force, statsToken);
        if (Flags.refactorInsetsController()) {
@@ -290,12 +290,14 @@ final class ImeInsetsSourceProvider extends InsetsSourceProvider {
        changed |= mDisplayContent.onImeInsetsClientVisibilityUpdate();
        if (Flags.refactorInsetsController()) {
            if (changed) {
                ImeTracker.forLogging().onProgress(statsToken,
                        ImeTracker.PHASE_SERVER_UPDATE_CLIENT_VISIBILITY);
                invokeOnImeRequestedChangedListener(mDisplayContent.getImeInputTarget(),
                        statsToken);
            } else {
                // TODO(b/329229469) change phase and check cancelled / failed
                // TODO(b/353463205) check cancelled / failed
                ImeTracker.forLogging().onCancelled(statsToken,
                        ImeTracker.PHASE_CLIENT_REPORT_REQUESTED_VISIBLE_TYPES);
                        ImeTracker.PHASE_SERVER_UPDATE_CLIENT_VISIBILITY);
            }
        }
        return changed;
@@ -460,7 +462,7 @@ final class ImeInsetsSourceProvider extends InsetsSourceProvider {
            // This can later become ready, so we don't want to cancel the pending request here.
            return;
        }
        // TODO(b/329229469) check if this is still triggered, as we don't go into STATE_SHOW_IME
        // TODO(b/353463205) check if this is still triggered, as we don't go into STATE_SHOW_IME
        //  (DefaultImeVisibilityApplier)
        if (android.view.inputmethod.Flags.refactorInsetsController()) {
            // The IME is drawn, so call into {@link WindowState#notifyInsetsControlChanged}
+2 −2
Original line number Diff line number Diff line
@@ -317,9 +317,9 @@ class InsetsStateController {
            // aborted.
            provider.updateFakeControlTarget(target);
        } else {
            // TODO(b/329229469) if the IME controlTarget changes, any pending requests should fail
            // TODO(b/353463205) if the IME controlTarget changes, any pending requests should fail
            provider.updateControlForTarget(target, false /* force */,
                    null /* TODO(b/329229469) check if needed here */);
                    null /* TODO(b/353463205) check if needed here */);

            // Get control target again in case the provider didn't accept the one we passed to it.
            target = provider.getControlTarget();
Loading