Merge "Fix IME crash on SoftInputWindow.show by TOKEN_PENDING"
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
sRegistry.put(token, new WeakReference<>(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user