return;
}
final InputMethodInfo defIm = suitableImes.get(0);
- Slog.i(TAG, "Default found, using " + defIm.getId());
+ if (DEBUG) {
+ Slog.i(TAG, "Default found, using " + defIm.getId());
+ }
setSelectedInputMethodAndSubtypeLocked(defIm, NOT_A_SUBTYPE_ID, false);
}
}
return true;
}
+ // TODO(b/34886274): The semantics of this verification is actually not well-defined.
Slog.w(TAG, "--- IPC called from background users. Ignore. callers="
+ Debug.getCallers(10));
return false;
* @param token The window token given to the input method when it was started.
* @return true if and only if non-null valid token is specified.
*/
- private boolean calledWithValidToken(IBinder token) {
- if (token == null || mCurToken != token) {
+ private boolean calledWithValidToken(@Nullable IBinder token) {
+ if (token == null && Binder.getCallingPid() == Process.myPid()) {
+ if (DEBUG) {
+ // TODO(b/34851776): Basically it's the caller's fault if we reach here.
+ Slog.d(TAG, "Bug 34851776 is detected callers=" + Debug.getCallers(10));
+ }
+ return false;
+ }
+ if (token == null || token != mCurToken) {
+ // TODO(b/34886274): The semantics of this verification is actually not well-defined.
+ Slog.e(TAG, "Ignoring " + Debug.getCaller() + " due to an invalid token."
+ + " uid:" + Binder.getCallingUid() + " token:" + token);
return false;
}
return true;
// because if the focus changes some time before or after, the
// next client receiving focus that has any interest in input will
// be calling through here after that change happens.
- Slog.w(TAG, "Starting input on non-focused client " + cs.client
- + " (uid=" + cs.uid + " pid=" + cs.pid + ")");
+ if (DEBUG) {
+ Slog.w(TAG, "Starting input on non-focused client " + cs.client
+ + " (uid=" + cs.uid + " pid=" + cs.pid + ")");
+ }
return null;
}
} catch (RemoteException e) {
mCurId = info.getId();
mCurToken = new Binder();
try {
- if (true || DEBUG) Slog.v(TAG, "Adding window token: " + mCurToken);
+ if (DEBUG) Slog.v(TAG, "Adding window token: " + mCurToken);
mIWindowManager.addWindowToken(mCurToken, TYPE_INPUT_METHOD, DEFAULT_DISPLAY);
} catch (RemoteException e) {
}
public void updateStatusIcon(IBinder token, String packageName, int iconId) {
synchronized (mMethodMap) {
if (!calledWithValidToken(token)) {
- final int uid = Binder.getCallingUid();
- Slog.e(TAG, "Ignoring updateStatusIcon due to an invalid token. uid:" + uid
- + " token:" + token);
return;
}
final long ident = Binder.clearCallingIdentity();
@Override
public void setImeWindowStatus(IBinder token, int vis, int backDisposition) {
if (!calledWithValidToken(token)) {
- final int uid = Binder.getCallingUid();
- Slog.e(TAG, "Ignoring setImeWindowStatus due to an invalid token. uid:" + uid
- + " token:" + token);
return;
}
// Caution! This method is called in this class. Handle multi-user carefully
private void updateSystemUiLocked(IBinder token, int vis, int backDisposition) {
if (!calledWithValidToken(token)) {
- final int uid = Binder.getCallingUid();
- Slog.e(TAG, "Ignoring updateSystemUiLocked due to an invalid token. uid:" + uid
- + " token:" + token);
return;
}
// because if the focus changes some time before or after, the
// next client receiving focus that has any interest in input will
// be calling through here after that change happens.
- Slog.w(TAG, "Focus gain on non-focused client " + cs.client
- + " (uid=" + cs.uid + " pid=" + cs.pid + ")");
+ if (DEBUG) {
+ Slog.w(TAG, "Focus gain on non-focused client " + cs.client
+ + " (uid=" + cs.uid + " pid=" + cs.pid + ")");
+ }
return null;
}
} catch (RemoteException e) {
}
if (mCurFocusedWindow == windowToken) {
- Slog.w(TAG, "Window already focused, ignoring focus gain of: " + client
- + " attribute=" + attribute + ", token = " + windowToken);
+ if (DEBUG) {
+ Slog.w(TAG, "Window already focused, ignoring focus gain of: " + client
+ + " attribute=" + attribute + ", token = " + windowToken);
+ }
if (attribute != null) {
return startInputUncheckedLocked(cs, inputContext, missingMethods,
attribute, controlFlags);
}
synchronized (mMethodMap) {
if (!calledWithValidToken(token)) {
- final int uid = Binder.getCallingUid();
- Slog.e(TAG, "Ignoring switchToNextInputMethod due to an invalid token. uid:" + uid
- + " token:" + token);
return false;
}
final ImeSubtypeListItem nextSubtype = mSwitchingController.getNextInputMethodLocked(
}
synchronized (mMethodMap) {
if (!calledWithValidToken(token)) {
- final int uid = Binder.getCallingUid();
- Slog.e(TAG, "Ignoring shouldOfferSwitchingToNextInputMethod due to an invalid "
- + "token. uid:" + uid + " token:" + token);
return false;
}
final ImeSubtypeListItem nextSubtype = mSwitchingController.getNextInputMethodLocked(
}
synchronized (mMethodMap) {
if (!calledWithValidToken(token)) {
- final int uid = Binder.getCallingUid();
- Slog.e(TAG, "Ignoring clearLastInputMethodWindowForTransition due to an "
- + "invalid token. uid:" + uid + " token:" + token);
return;
}
}
}
synchronized (mMethodMap) {
if (!calledWithValidToken(token)) {
- final int uid = Binder.getCallingUid();
- Slog.e(TAG, "Ignoring hideInputMethod due to an invalid token. uid:"
- + uid + " token:" + token);
return;
}
long ident = Binder.clearCallingIdentity();
}
synchronized (mMethodMap) {
if (!calledWithValidToken(token)) {
- final int uid = Binder.getCallingUid();
- Slog.e(TAG, "Ignoring showMySoftInput due to an invalid token. uid:"
- + uid + " token:" + token);
return;
}
long ident = Binder.clearCallingIdentity();
}
}
if (!enabledImeFound) {
- Slog.i(TAG, "All the enabled IMEs are gone. Reset default enabled IMEs.");
+ if (DEBUG) {
+ Slog.i(TAG, "All the enabled IMEs are gone. Reset default enabled IMEs.");
+ }
resetDefaultEnabledIme = true;
resetSelectedInputMethodAndSubtypeLocked("");
}