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

Commit 0fd1e3e3 authored by Johannes Gallmann's avatar Johannes Gallmann
Browse files

Add logging to ImeOnBackInvokedDispatcher

Bug: 407224281
Test: Manual, i.e. checked dump content
Flag: EXEMPT bugfix
Change-Id: I0443e9c9a37a251ff575ca80fd2e766e1a8981c1
parent df9f3750
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5079,6 +5079,7 @@ public final class InputMethodManager {
                + " mCursorSelEnd=" + mCursorSelEnd
                + " mCursorCandStart=" + mCursorCandStart
                + " mCursorCandEnd=" + mCursorCandEnd);
        mImeDispatcher.dump(p, "  ");
    }

    /**
+21 −2
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.os.RemoteException;
import android.os.ResultReceiver;
import android.util.Log;
import android.util.Pair;
import android.util.Printer;
import android.view.ViewRootImpl;

import com.android.internal.annotations.VisibleForTesting;
@@ -196,7 +197,8 @@ public class ImeOnBackInvokedDispatcher implements OnBackInvokedDispatcher, Parc
        }
        if (callback == null) {
            Log.e(TAG, "Ime callback not found. Ignoring unregisterReceivedCallback. "
                    + "callbackId: " + callbackId);
                    + "callbackId: " + callbackId
                    + " remaining callbacks: " + mImeCallbacks.size());
            return;
        }
        receivingDispatcher.unregisterOnBackInvokedCallback(callback);
@@ -243,6 +245,23 @@ public class ImeOnBackInvokedDispatcher implements OnBackInvokedDispatcher, Parc
        mQueuedReceive.clear();
    }

    /**
     * Dumps the registered IME callbacks.
     *
     * @param prefix prefix to be prepended to each line
     * @param p      printer to write the dump to
     */
    public void dump(@NonNull Printer p, @NonNull String prefix) {
        if (mImeCallbacks.isEmpty()) {
            p.println(prefix + TAG + " mImeCallbacks: []");
        } else {
            p.println(prefix + TAG + " mImeCallbacks:");
            for (ImeOnBackInvokedCallback callback : mImeCallbacks) {
                p.println(prefix + "  " + callback);
            }
        }
    }

    @VisibleForTesting(visibility = PACKAGE)
    public static class ImeOnBackInvokedCallback implements OnBackAnimationCallback {
        @NonNull
+0 −3
Original line number Diff line number Diff line
@@ -322,9 +322,6 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher {
            if (DEBUG) {
                Log.d(TAG, "sendCancelIfRunning: callback canceled");
            }
        } else {
            Log.w(TAG, "sendCancelIfRunning: isInProgress=" + isInProgress
                    + " callback=" + callback);
        }
    }