diff options
| author | 2013-08-01 03:12:35 +0000 | |
|---|---|---|
| committer | 2013-08-01 03:12:35 +0000 | |
| commit | fd5d153af8e37ad88b8564408a7dc27fc20e95f0 (patch) | |
| tree | 13ee5211db2d1c6430776653ca2fca1777eb2dca | |
| parent | 53672be11093e56c47e037b8540d63221ccd2f7f (diff) | |
| parent | 87c291421544821fe9d10a08ee4e9f31b62d5052 (diff) | |
Merge "Add a debug utility for InputMethodUtils"
| -rw-r--r-- | core/java/com/android/internal/inputmethod/InputMethodUtils.java | 22 | ||||
| -rw-r--r-- | services/java/com/android/server/InputMethodManagerService.java | 3 |
2 files changed, 24 insertions, 1 deletions
diff --git a/core/java/com/android/internal/inputmethod/InputMethodUtils.java b/core/java/com/android/internal/inputmethod/InputMethodUtils.java index 7b4352e66f3f..c7b5697f55af 100644 --- a/core/java/com/android/internal/inputmethod/InputMethodUtils.java +++ b/core/java/com/android/internal/inputmethod/InputMethodUtils.java @@ -72,6 +72,28 @@ public class InputMethodUtils { } return sb.toString(); } + + public static String getApiCallStack() { + String apiCallStack = ""; + try { + throw new RuntimeException(); + } catch (RuntimeException e) { + final StackTraceElement[] frames = e.getStackTrace(); + for (int j = 1; j < frames.length; ++j) { + final String tempCallStack = frames[j].toString(); + if (TextUtils.isEmpty(apiCallStack)) { + // Overwrite apiCallStack if it's empty + apiCallStack = tempCallStack; + } else if (tempCallStack.indexOf("Transact(") < 0) { + // Overwrite apiCallStack if it's not a binder call + apiCallStack = tempCallStack; + } else { + break; + } + } + } + return apiCallStack; + } // ---------------------------------------------------------------------- public static boolean isSystemIme(InputMethodInfo inputMethod) { diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index 8200a690e0db..da584e2012b4 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -899,7 +899,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub Slog.d(TAG, "--- calledFromForegroundUserOrSystemProcess ? " + "calling uid = " + uid + " system uid = " + Process.SYSTEM_UID + " calling userId = " + userId + ", foreground user id = " - + mSettings.getCurrentUserId() + ", calling pid = " + Binder.getCallingPid()); + + mSettings.getCurrentUserId() + ", calling pid = " + Binder.getCallingPid() + + InputMethodUtils.getApiCallStack()); } if (uid == Process.SYSTEM_UID || userId == mSettings.getCurrentUserId()) { return true; |