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

Commit cb4b7b57 authored by Cosmin Băieș's avatar Cosmin Băieș
Browse files

Dump InputMethodMenuController info

This adds the ability to dump the showing state and the list of shown
items of the InputMethodMenuController.

Flag: EXEMPT dump
Bug: 353493832
Test: adb shell dumpsys input_method
Change-Id: I4079f882300efc7bab8448b38e69967af6e92321
parent 92c92ce3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -6344,6 +6344,9 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
            if (Flags.imeSwitcherRevamp()) {
                p.println("  menuControllerNew:");
                mMenuControllerNew.dump(p, "  ");
            } else {
                p.println("  menuController:");
                mMenuController.dump(p, "  ");
            }
            p.println("  mCurToken=" + bindingController.getCurToken());
            p.println("  mCurTokenDisplayId=" + bindingController.getCurTokenDisplayId());
+14 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Printer;
import android.util.Slog;
import android.view.LayoutInflater;
import android.view.View;
@@ -58,6 +59,7 @@ final class InputMethodMenuController {
    private AlertDialog.Builder mDialogBuilder;
    private AlertDialog mSwitchingDialog;
    private View mSwitchingDialogTitleView;
    private List<ImeSubtypeListItem> mImList;
    private InputMethodInfo[] mIms;
    private int[] mSubtypeIds;

@@ -97,6 +99,7 @@ final class InputMethodMenuController {

        // Find out which item should be checked by default.
        final int size = imList.size();
        mImList = imList;
        mIms = new InputMethodInfo[size];
        mSubtypeIds = new int[size];
        // No items are checked by default. When we have a list of explicitly enabled subtypes,
@@ -244,7 +247,9 @@ final class InputMethodMenuController {
            mService.updateSystemUiLocked(userId);
            mService.sendOnNavButtonFlagsChangedToAllImesLocked();
            mDialogBuilder = null;
            mImList = null;
            mIms = null;
            mSubtypeIds = null;
        }
    }

@@ -277,6 +282,15 @@ final class InputMethodMenuController {
        }
    }

    void dump(@NonNull Printer pw, @NonNull String prefix) {
        final boolean showing = isisInputMethodPickerShownForTestLocked();
        pw.println(prefix + "  isShowing: " + showing);

        if (showing) {
            pw.println(prefix + "  imList: " + mImList);
        }
    }

    private static class ImeSubtypeListAdapter extends ArrayAdapter<ImeSubtypeListItem> {
        private final LayoutInflater mInflater;
        private final int mTextViewResourceId;