Merge "Add a debug utility for InputMethodUtils"

This commit is contained in:
Satoshi Kataoka
2013-08-01 03:12:35 +00:00
committed by Android (Google) Code Review
2 changed files with 24 additions and 1 deletions

View File

@@ -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) {

View File

@@ -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;