Fix race condition in dumpDebug
The dumpDebug method was calling isImeSessionAvailableLocked to ensure that mCurBindState was not null, but this was happening before acquiring the lock. When acquiring the lock and reading the value, this was now null due to an intermediary unbind operation which already had the lock. Test: none Bug: 282815830 Change-Id: I0fddfb12c14eda109cc985eedadc9d3237dff8b0
This commit is contained in:
@@ -4361,15 +4361,14 @@ public final class InputMethodManager {
|
||||
* @param icProto {@link InputConnection} call data in proto format.
|
||||
* @hide
|
||||
*/
|
||||
@GuardedBy("mH")
|
||||
public void dumpDebug(ProtoOutputStream proto, @Nullable byte[] icProto) {
|
||||
if (!isImeSessionAvailableLocked()) {
|
||||
return;
|
||||
}
|
||||
|
||||
proto.write(DISPLAY_ID, mDisplayId);
|
||||
final long token = proto.start(INPUT_METHOD_MANAGER);
|
||||
synchronized (mH) {
|
||||
if (!isImeSessionAvailableLocked()) {
|
||||
return;
|
||||
}
|
||||
|
||||
proto.write(DISPLAY_ID, mDisplayId);
|
||||
final long token = proto.start(INPUT_METHOD_MANAGER);
|
||||
proto.write(CUR_ID, mCurBindState.mImeId);
|
||||
proto.write(FULLSCREEN_MODE, mFullscreenMode);
|
||||
proto.write(ACTIVE, mActive);
|
||||
|
||||
Reference in New Issue
Block a user