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

Commit b0e40f36 authored by Ming-Shin Lu's avatar Ming-Shin Lu Committed by Android (Google) Code Review
Browse files

Merge "Fix IME crash on SoftInputWindow.show by TOKEN_PENDING"

parents 2417a8a4 8bd8b278
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -590,10 +590,6 @@ public class InputMethodService extends AbstractInputMethodService {
        @Override
        public final void initializeInternal(@NonNull IBinder token,
                IInputMethodPrivilegedOperations privilegedOperations, int configChanges) {
            if (InputMethodPrivilegedOperationsRegistry.isRegistered(token)) {
                Log.w(TAG, "The token has already registered, ignore this initialization.");
                return;
            }
            Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMS.initializeInternal");
            mConfigTracker.onInitialize(configChanges);
            mPrivOps.set(privilegedOperations);
+1 −23
Original line number Diff line number Diff line
@@ -74,12 +74,7 @@ public final class InputMethodPrivilegedOperationsRegistry {
            if (sRegistry == null) {
                sRegistry = new WeakHashMap<>();
            }
            final WeakReference<InputMethodPrivilegedOperations> previousOps =
            sRegistry.put(token, new WeakReference<>(ops));
            if (previousOps != null) {
                throw new IllegalStateException(previousOps.get() + " is already registered for "
                        + " this token=" + token + " newOps=" + ops);
            }
        }
    }

@@ -132,21 +127,4 @@ public final class InputMethodPrivilegedOperationsRegistry {
            }
        }
    }

    /**
     * Check the given IME token registration status.
     *
     * @param token IME token
     * @return {@code true} when the IME token has already registered
     *         {@link InputMethodPrivilegedOperations}, {@code false} otherwise.
     */
    @AnyThread
    public static boolean isRegistered(IBinder token) {
        synchronized (sLock) {
            if (sRegistry == null) {
                return false;
            }
            return sRegistry.containsKey(token);
        }
    }
}