summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/inputmethod/ImeBindingState.java9
-rw-r--r--services/core/java/com/android/server/inputmethod/InputMethodBindingController.java22
-rw-r--r--services/core/java/com/android/server/inputmethod/InputMethodManagerService.java182
-rw-r--r--services/core/java/com/android/server/inputmethod/InputMethodMenuController.java4
-rw-r--r--services/core/java/com/android/server/inputmethod/InputMethodMenuControllerNew.java4
5 files changed, 117 insertions, 104 deletions
diff --git a/services/core/java/com/android/server/inputmethod/ImeBindingState.java b/services/core/java/com/android/server/inputmethod/ImeBindingState.java
index f78ea84efb77..5deed39a2dce 100644
--- a/services/core/java/com/android/server/inputmethod/ImeBindingState.java
+++ b/services/core/java/com/android/server/inputmethod/ImeBindingState.java
@@ -20,6 +20,7 @@ import static android.server.inputmethod.InputMethodManagerServiceProto.CUR_FOCU
import static android.server.inputmethod.InputMethodManagerServiceProto.CUR_FOCUSED_WINDOW_SOFT_INPUT_MODE;
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED;
+import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.UserIdInt;
import android.os.IBinder;
@@ -86,10 +87,10 @@ final class ImeBindingState {
InputMethodDebug.softInputModeToString(mFocusedWindowSoftInputMode));
}
- void dump(String prefix, Printer p) {
- p.println(prefix + "mFocusedWindow()=" + mFocusedWindow);
- p.println(prefix + "softInputMode=" + InputMethodDebug.softInputModeToString(
- mFocusedWindowSoftInputMode));
+ void dump(@NonNull Printer p, @NonNull String prefix) {
+ p.println(prefix + "mFocusedWindow=" + mFocusedWindow);
+ p.println(prefix + "mFocusedWindowSoftInputMode="
+ + InputMethodDebug.softInputModeToString(mFocusedWindowSoftInputMode));
p.println(prefix + "mFocusedWindowClient=" + mFocusedWindowClient);
}
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodBindingController.java b/services/core/java/com/android/server/inputmethod/InputMethodBindingController.java
index ec1993a9b444..477660daa1de 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodBindingController.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodBindingController.java
@@ -61,6 +61,7 @@ import com.android.internal.inputmethod.UnbindReason;
import com.android.server.EventLogTags;
import com.android.server.wm.WindowManagerInternal;
+import java.io.PrintWriter;
import java.util.concurrent.CountDownLatch;
/**
@@ -733,4 +734,25 @@ final class InputMethodBindingController {
void setBackDisposition(@BackDispositionMode int backDisposition) {
mBackDisposition = backDisposition;
}
+
+ @GuardedBy("ImfLock.class")
+ void dump(@NonNull PrintWriter pw, @NonNull String prefix) {
+ pw.println(prefix + "mSelectedMethodId=" + mSelectedMethodId);
+ pw.println(prefix + "mCurrentSubtype=" + mCurrentSubtype);
+ pw.println(prefix + "mCurSeq=" + mCurSeq);
+ pw.println(prefix + "mCurId=" + mCurId);
+ pw.println(prefix + "mHasMainConnection=" + mHasMainConnection);
+ pw.println(prefix + "mVisibleBound=" + mVisibleBound);
+ pw.println(prefix + "mCurToken=" + mCurToken);
+ pw.println(prefix + "mCurTokenDisplayId=" + mCurTokenDisplayId);
+ pw.println(prefix + "mCurHostInputToken=" + getCurHostInputToken());
+ pw.println(prefix + "mCurIntent=" + mCurIntent);
+ pw.println(prefix + "mCurMethod=" + mCurMethod);
+ pw.println(prefix + "mImeWindowVis=" + mImeWindowVis);
+ pw.println(prefix + "mBackDisposition=" + mBackDisposition);
+ pw.println(prefix + "mDisplayIdToShowIme=" + mDisplayIdToShowIme);
+ pw.println(prefix + "mDeviceIdToShowIme=" + mDeviceIdToShowIme);
+ pw.println(prefix + "mSupportsStylusHw=" + mSupportsStylusHw);
+ pw.println(prefix + "mSupportsConnectionlessStylusHw=" + mSupportsConnectionlessStylusHw);
+ }
}
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
index 83044c202a04..131b9ba419a9 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
@@ -6063,42 +6063,40 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
@BinderThread
@Override
- public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+ public void dump(@NonNull FileDescriptor fd, @NonNull PrintWriter pw, @Nullable String[] args) {
if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;
PriorityDump.dump(mPriorityDumper, fd, pw, args);
}
@BinderThread
- private void dumpAsStringNoCheck(FileDescriptor fd, PrintWriter pw, String[] args,
- boolean isCritical) {
+ private void dumpAsStringNoCheck(@NonNull FileDescriptor fd, @NonNull PrintWriter pw,
+ @NonNull String[] args, boolean isCritical) {
final int argUserId = parseUserIdFromDumpArgs(args);
final Printer p = new PrintWriterPrinter(pw);
- p.println("Current Input Method Manager state:");
+ p.println("Input Method Manager Service state:");
p.println(" mSystemReady=" + mSystemReady);
p.println(" mInteractive=" + mIsInteractive);
p.println(" mConcurrentMultiUserModeEnabled=" + mConcurrentMultiUserModeEnabled);
p.println(" ENABLE_HIDE_IME_CAPTION_BAR="
+ InputMethodService.ENABLE_HIDE_IME_CAPTION_BAR);
+ final int currentImeUserId;
synchronized (ImfLock.class) {
+ currentImeUserId = mCurrentImeUserId;
+ p.println(" mCurrentImeUserId=" + currentImeUserId);
p.println(" mStylusIds=" + (mStylusIds != null
? Arrays.toString(mStylusIds.toArray()) : ""));
}
+ // TODO(b/305849394): Make mMenuController multi-user aware.
if (Flags.imeSwitcherRevamp()) {
p.println(" mMenuControllerNew:");
- mMenuControllerNew.dump(p, " ");
+ mMenuControllerNew.dump(p, " ");
} else {
p.println(" mMenuController:");
- mMenuController.dump(p, " ");
- }
- if (mConcurrentMultiUserModeEnabled && argUserId == UserHandle.USER_NULL) {
- mUserDataRepository.forAllUserData(
- u -> dumpAsStringNoCheckForUser(u, fd, pw, args, isCritical));
- } else {
- final int userId = argUserId != UserHandle.USER_NULL ? argUserId : mCurrentImeUserId;
- final var userData = getUserData(userId);
- dumpAsStringNoCheckForUser(userData, fd, pw, args, isCritical);
+ mMenuController.dump(p, " ");
}
+ dumpClientController(p);
+ dumpUserRepository(p);
// TODO(b/365868861): Make StartInputHistory and ImeTracker multi-user aware.
synchronized (ImfLock.class) {
@@ -6112,12 +6110,18 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
p.println(" mImeTrackerService#History:");
mImeTrackerService.dump(pw, " ");
- dumpUserRepository(p);
- dumpClientStates(p);
+ if (mConcurrentMultiUserModeEnabled && argUserId == UserHandle.USER_NULL) {
+ mUserDataRepository.forAllUserData(
+ u -> dumpAsStringNoCheckForUser(u, fd, pw, args, isCritical));
+ } else {
+ final int userId = argUserId != UserHandle.USER_NULL ? argUserId : currentImeUserId;
+ final var userData = getUserData(userId);
+ dumpAsStringNoCheckForUser(userData, fd, pw, args, isCritical);
+ }
}
@UserIdInt
- private static int parseUserIdFromDumpArgs(String[] args) {
+ private static int parseUserIdFromDumpArgs(@NonNull String[] args) {
final int userIdx = Arrays.binarySearch(args, "--user");
if (userIdx == -1 || userIdx == args.length - 1) {
return UserHandle.USER_NULL;
@@ -6127,44 +6131,37 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
// TODO(b/356239178): Update dump format output to better group per-user info.
@BinderThread
- private void dumpAsStringNoCheckForUser(UserData userData, FileDescriptor fd, PrintWriter pw,
- String[] args, boolean isCritical) {
+ private void dumpAsStringNoCheckForUser(@NonNull UserData userData, @NonNull FileDescriptor fd,
+ @NonNull PrintWriter pw, @NonNull String[] args, boolean isCritical) {
final Printer p = new PrintWriterPrinter(pw);
- IInputMethodInvoker method;
ClientState client;
+ IInputMethodInvoker method;
p.println(" UserId=" + userData.mUserId);
synchronized (ImfLock.class) {
- final InputMethodSettings settings = InputMethodSettingsRepository.get(
- userData.mUserId);
+ final var bindingController = userData.mBindingController;
+ client = userData.mCurClient;
+ method = bindingController.getCurMethod();
+ p.println(" mBindingController:");
+ bindingController.dump(pw, " ");
+ p.println(" mCurClient=" + client);
+ p.println(" mFocusedWindowPerceptible=" + mFocusedWindowPerceptible);
+ p.println(" mImeBindingState:");
+ userData.mImeBindingState.dump(p, " ");
+ p.println(" mBoundToMethod=" + userData.mBoundToMethod);
+ p.println(" mEnabledSession=" + userData.mEnabledSession);
+ p.println(" mVisibilityStateComputer:");
+ userData.mVisibilityStateComputer.dump(pw, " ");
+ p.println(" mInFullscreenMode=" + userData.mInFullscreenMode);
+
+ final var settings = InputMethodSettingsRepository.get(userData.mUserId);
final List<InputMethodInfo> methodList = settings.getMethodList();
- int numImes = methodList.size();
+ final int numImes = methodList.size();
p.println(" Input Methods:");
for (int i = 0; i < numImes; i++) {
- InputMethodInfo info = methodList.get(i);
+ final InputMethodInfo info = methodList.get(i);
p.println(" InputMethod #" + i + ":");
info.dump(p, " ");
}
- final var bindingController = userData.mBindingController;
- p.println(" mCurMethodId=" + bindingController.getSelectedMethodId());
- client = userData.mCurClient;
- p.println(" mCurClient=" + client + " mCurSeq="
- + bindingController.getSequenceNumber());
- p.println(" mFocusedWindowPerceptible=" + mFocusedWindowPerceptible);
- userData.mImeBindingState.dump(/* prefix= */ " ", p);
- p.println(" mCurId=" + bindingController.getCurId());
- p.println(" mHaveConnection=" + bindingController.hasMainConnection());
- p.println(" mBoundToMethod=" + userData.mBoundToMethod);
- p.println(" mVisibleBound=" + bindingController.isVisibleBound());
- p.println(" mCurToken=" + bindingController.getCurToken());
- p.println(" mCurTokenDisplayId=" + bindingController.getCurTokenDisplayId());
- p.println(" mCurHostInputToken=" + bindingController.getCurHostInputToken());
- p.println(" mCurIntent=" + bindingController.getCurIntent());
- method = bindingController.getCurMethod();
- p.println(" mCurMethod=" + method);
- p.println(" mEnabledSession=" + userData.mEnabledSession);
- final var visibilityStateComputer = userData.mVisibilityStateComputer;
- visibilityStateComputer.dump(pw, " ");
- p.println(" mInFullscreenMode=" + userData.mInFullscreenMode);
}
// Exit here for critical dump, as remaining sections require IPCs to other processes.
@@ -6172,7 +6169,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
return;
}
- p.println(" ");
+ p.println("");
if (client != null) {
pw.flush();
try {
@@ -6184,25 +6181,23 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
p.println("No input method client.");
}
synchronized (ImfLock.class) {
- if (userData.mImeBindingState.mFocusedWindowClient != null
- && client != userData.mImeBindingState.mFocusedWindowClient) {
- p.println(" ");
- p.println("Warning: Current input method client doesn't match the last focused. "
- + "window.");
+ final var focusedWindowClient = userData.mImeBindingState.mFocusedWindowClient;
+ if (focusedWindowClient != null && client != focusedWindowClient) {
+ p.println("");
+ p.println("Warning: Current input method client doesn't match the last focused"
+ + " window.");
p.println("Dumping input method client in the last focused window just in case.");
- p.println(" ");
+ p.println("");
pw.flush();
try {
- TransferPipe.dumpAsync(
- userData.mImeBindingState.mFocusedWindowClient.mClient.asBinder(), fd,
- args);
+ TransferPipe.dumpAsync(focusedWindowClient.mClient.asBinder(), fd, args);
} catch (IOException | RemoteException e) {
p.println("Failed to dump input method client in focused window: " + e);
}
}
}
- p.println(" ");
+ p.println("");
if (method != null) {
pw.flush();
try {
@@ -6215,56 +6210,51 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
}
}
- private void dumpClientStates(Printer p) {
- p.println(" ClientStates:");
+ private void dumpClientController(@NonNull Printer p) {
+ p.println(" mClientController:");
// TODO(b/324907325): Remove the suppress warnings once b/324907325 is fixed.
@SuppressWarnings("GuardedBy") Consumer<ClientState> clientControllerDump = c -> {
- p.println(" " + c + ":");
- p.println(" client=" + c.mClient);
- p.println(" fallbackInputConnection="
- + c.mFallbackInputConnection);
- p.println(" sessionRequested="
- + c.mSessionRequested);
- p.println(" sessionRequestedForAccessibility="
+ p.println(" " + c + ":");
+ p.println(" client=" + c.mClient);
+ p.println(" fallbackInputConnection=" + c.mFallbackInputConnection);
+ p.println(" sessionRequested=" + c.mSessionRequested);
+ p.println(" sessionRequestedForAccessibility="
+ c.mSessionRequestedForAccessibility);
- p.println(" curSession=" + c.mCurSession);
- p.println(" selfReportedDisplayId=" + c.mSelfReportedDisplayId);
- p.println(" uid=" + c.mUid);
- p.println(" pid=" + c.mPid);
+ p.println(" curSession=" + c.mCurSession);
+ p.println(" selfReportedDisplayId=" + c.mSelfReportedDisplayId);
+ p.println(" uid=" + c.mUid);
+ p.println(" pid=" + c.mPid);
};
synchronized (ImfLock.class) {
mClientController.forAllClients(clientControllerDump);
}
}
- private void dumpUserRepository(Printer p) {
- p.println(" mUserDataRepository=");
+ private void dumpUserRepository(@NonNull Printer p) {
+ p.println(" mUserDataRepository:");
// TODO(b/324907325): Remove the suppress warnings once b/324907325 is fixed.
- @SuppressWarnings("GuardedBy") Consumer<UserData> userDataDump =
- u -> {
- p.println(" mUserId=" + u.mUserId);
- p.println(" unlocked=" + u.mIsUnlockingOrUnlocked.get());
- p.println(" hasMainConnection="
- + u.mBindingController.hasMainConnection());
- p.println(" isVisibleBound=" + u.mBindingController.isVisibleBound());
- p.println(" boundToMethod=" + u.mBoundToMethod);
- p.println(" curClient=" + u.mCurClient);
- if (u.mCurEditorInfo != null) {
- p.println(" curEditorInfo:");
- u.mCurEditorInfo.dump(p, " ", false /* dumpExtras */);
- } else {
- p.println(" curEditorInfo: null");
- }
- p.println(" imeBindingState:");
- u.mImeBindingState.dump(" ", p);
- p.println(" enabledSession=" + u.mEnabledSession);
- p.println(" inFullscreenMode=" + u.mInFullscreenMode);
- p.println(" imeDrawsNavBar=" + u.mImeDrawsNavBar.get());
- p.println(" switchingController:");
- u.mSwitchingController.dump(p, " ");
- p.println(" mLastEnabledInputMethodsStr="
- + u.mLastEnabledInputMethodsStr);
- };
+ @SuppressWarnings("GuardedBy") Consumer<UserData> userDataDump = u -> {
+ p.println(" userId=" + u.mUserId);
+ p.println(" unlocked=" + u.mIsUnlockingOrUnlocked.get());
+ p.println(" hasMainConnection=" + u.mBindingController.hasMainConnection());
+ p.println(" isVisibleBound=" + u.mBindingController.isVisibleBound());
+ p.println(" boundToMethod=" + u.mBoundToMethod);
+ p.println(" curClient=" + u.mCurClient);
+ if (u.mCurEditorInfo != null) {
+ p.println(" curEditorInfo:");
+ u.mCurEditorInfo.dump(p, " ", false /* dumpExtras */);
+ } else {
+ p.println(" curEditorInfo: null");
+ }
+ p.println(" imeBindingState:");
+ u.mImeBindingState.dump(p, " ");
+ p.println(" enabledSession=" + u.mEnabledSession);
+ p.println(" inFullscreenMode=" + u.mInFullscreenMode);
+ p.println(" imeDrawsNavBar=" + u.mImeDrawsNavBar.get());
+ p.println(" switchingController:");
+ u.mSwitchingController.dump(p, " ");
+ p.println(" mLastEnabledInputMethodsStr=" + u.mLastEnabledInputMethodsStr);
+ };
synchronized (ImfLock.class) {
mUserDataRepository.forAllUserData(userDataDump);
}
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java b/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java
index b5ee06863f2b..248fa60f4374 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java
@@ -287,10 +287,10 @@ final class InputMethodMenuController {
void dump(@NonNull Printer pw, @NonNull String prefix) {
final boolean showing = isisInputMethodPickerShownForTestLocked();
- pw.println(prefix + " isShowing: " + showing);
+ pw.println(prefix + "isShowing: " + showing);
if (showing) {
- pw.println(prefix + " imList: " + mImList);
+ pw.println(prefix + "imList: " + mImList);
}
}
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodMenuControllerNew.java b/services/core/java/com/android/server/inputmethod/InputMethodMenuControllerNew.java
index 1d0e3c639c3f..6abd5aabfabf 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodMenuControllerNew.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodMenuControllerNew.java
@@ -187,10 +187,10 @@ final class InputMethodMenuControllerNew {
void dump(@NonNull Printer pw, @NonNull String prefix) {
final boolean showing = isShowing();
- pw.println(prefix + " isShowing: " + showing);
+ pw.println(prefix + "isShowing: " + showing);
if (showing) {
- pw.println(prefix + " menuItems: " + mMenuItems);
+ pw.println(prefix + "menuItems: " + mMenuItems);
}
}