Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13dc12f8 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Simplify IMMS#startInputOrWindowGainedFocusInternal() part 3/5

This is a series of CLs to reduce the average indentation level of
InputMethodManagerService#startInputOrWindowGainedFocusInternal().

With this CL, Binder.{clear,restore}CallingIdentity() are also handled
by the caller side, which reduces the indentation level of
startInputOrWindowGainedFocus() by one level.

This is a mechanical refactoring.  There should be no behavior change.

Bug: 34886274
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Change-Id: I807608d52bd5240c235b8270132c9cc622092f9a
parent 7cc3356c
Loading
Loading
Loading
Loading
+185 −185
Original line number Diff line number Diff line
@@ -2774,9 +2774,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        }
        final InputBindResult result;
        synchronized (mMethodMap) {
            final long ident = Binder.clearCallingIdentity();
            try {
                result = startInputOrWindowGainedFocusInternalLocked(startInputReason, client,
                        windowToken, startInputFlags, softInputMode, windowFlags, attribute,
                        inputContext, missingMethods, unverifiedTargetSdkVersion, userId);
            } finally {
                Binder.restoreCallingIdentity(ident);
            }
        }
        if (result == null) {
            // This must never happen, but just in case.
@@ -2799,8 +2804,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        InputBindResult res = null;
        final int windowDisplayId =
                mWindowManagerInternal.getDisplayIdForWindow(windowToken);
        final long ident = Binder.clearCallingIdentity();
        try {
        if (DEBUG) Slog.v(TAG, "startInputOrWindowGainedFocusInternalLocked: reason="
                + InputMethodDebug.startInputReasonToString(startInputReason)
                + " client=" + client.asBinder()
@@ -3003,9 +3006,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                res = InputBindResult.NULL_EDITOR_INFO;
            }
        }
        } finally {
            Binder.restoreCallingIdentity(ident);
        }
        return res;
    }