Make sure to obtain the IC before requesting CursorAnchorInfo

RichInputConnection#requestUpdateCursorAnchorInfo must make
sure to obtain the input connection before calling methods
of it.

BUG: 17299587
Change-Id: I8e0cd473a4cc32583cd47634c227d702f7c69c6c
main
Yohei Yukawa 2014-08-27 12:37:22 -07:00
parent 37beaf1529
commit acce1aa59e
1 changed files with 8 additions and 2 deletions

View File

@ -924,8 +924,14 @@ public final class RichInputConnection {
*/ */
public boolean requestUpdateCursorAnchorInfo(final boolean enableMonitor, public boolean requestUpdateCursorAnchorInfo(final boolean enableMonitor,
final boolean requestImmediateCallback) { final boolean requestImmediateCallback) {
final boolean scheduled = InputConnectionCompatUtils.requestUpdateCursorAnchorInfo(mIC, mIC = mParent.getCurrentInputConnection();
final boolean scheduled;
if (null != mIC) {
scheduled = InputConnectionCompatUtils.requestUpdateCursorAnchorInfo(mIC,
enableMonitor, requestImmediateCallback); enableMonitor, requestImmediateCallback);
} else {
scheduled = false;
}
mCursorAnchorInfoMonitorEnabled = (scheduled && enableMonitor); mCursorAnchorInfoMonitorEnabled = (scheduled && enableMonitor);
return scheduled; return scheduled;
} }