Merge "Add a debug utility for InputMethodUtils"
This commit is contained in:
committed by
Android (Google) Code Review
commit
fd5d153af8
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user