Move trace points to IMMS#onSessionCreated()

This is a follow up CL to our previous CL [1], which introduced
invocations of Trace.trace{Begin,End} into

  InputMethodManagerService.MethodCallback#sessionCreated()

with trace tag:

  "IMMS.sessionCreated".

In order to inline InputMethodManagerService.MethodCallback,

this CL moves these Trace.trace{Begin,End} to

  InputMethodManagerService#onSessionCreated(),

with renaming the tag to

  "IMMS.onSessionCreated".

Other than that, there is no observable behavior change in this CL.

 [1]: I586341426916f9b9e0f1efe988894621972da4ff
      d663b62186

Bug: 167947940
Bug: 192412909
Test: presubmit
Change-Id: I4135737825befff9e696f47c153a209de4adb0e3
This commit is contained in:
Yohei Yukawa
2022-01-17 14:59:59 -08:00
parent daeda6e736
commit 321550e784

View File

@@ -1478,14 +1478,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
@Override
public void sessionCreated(IInputMethodSession session) {
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMMS.sessionCreated");
final long ident = Binder.clearCallingIdentity();
try {
mParentIMMS.onSessionCreated(mMethod, session, mChannel);
} finally {
Binder.restoreCallingIdentity(ident);
}
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
}
}
@@ -2539,34 +2537,40 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
mCaller.obtainMessageI(MSG_NOTIFY_IME_UID_TO_AUDIO_SERVICE, uid).sendToTarget();
}
void onSessionCreated(IInputMethod method, IInputMethodSession session,
InputChannel channel) {
synchronized (ImfLock.class) {
if (mUserSwitchHandlerTask != null) {
// We have a pending user-switching task so it's better to just ignore this session.
channel.dispose();
return;
}
IInputMethod curMethod = getCurMethodLocked();
if (curMethod != null && method != null
&& curMethod.asBinder() == method.asBinder()) {
if (mCurClient != null) {
clearClientSessionLocked(mCurClient);
mCurClient.curSession = new SessionState(mCurClient,
method, session, channel);
InputBindResult res = attachNewInputLocked(
StartInputReason.SESSION_CREATED_BY_IME, true);
if (res.method != null) {
executeOrSendMessage(mCurClient.client, mCaller.obtainMessageOO(
MSG_BIND_CLIENT, mCurClient.client, res));
}
@BinderThread
void onSessionCreated(IInputMethod method, IInputMethodSession session, InputChannel channel) {
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMMS.onSessionCreated");
try {
synchronized (ImfLock.class) {
if (mUserSwitchHandlerTask != null) {
// We have a pending user-switching task so it's better to just ignore this
// session.
channel.dispose();
return;
}
IInputMethod curMethod = getCurMethodLocked();
if (curMethod != null && method != null
&& curMethod.asBinder() == method.asBinder()) {
if (mCurClient != null) {
clearClientSessionLocked(mCurClient);
mCurClient.curSession = new SessionState(mCurClient,
method, session, channel);
InputBindResult res = attachNewInputLocked(
StartInputReason.SESSION_CREATED_BY_IME, true);
if (res.method != null) {
executeOrSendMessage(mCurClient.client, mCaller.obtainMessageOO(
MSG_BIND_CLIENT, mCurClient.client, res));
}
return;
}
}
}
}
// Session abandoned. Close its associated input channel.
channel.dispose();
// Session abandoned. Close its associated input channel.
channel.dispose();
} finally {
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
}
}
@GuardedBy("ImfLock.class")