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

Commit e1b637d2 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Make IMM#peekInstance() thread-safe"

parents bd243f59 3b3a2ade
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ import android.view.ViewRootImpl;
import android.view.WindowManager.LayoutParams.SoftInputModeFlags;
import android.view.autofill.AutofillManager;

import com.android.internal.annotations.GuardedBy;
import com.android.internal.inputmethod.InputMethodPrivilegedOperationsRegistry;
import com.android.internal.os.SomeArgs;
import com.android.internal.view.IInputConnectionWrapper;
@@ -263,6 +264,9 @@ public final class InputMethodManager {
     */
    public static final boolean ENABLE_LEGACY_EAGER_INITIALIZATION = true;

    private static final Object sLock = new Object();

    @GuardedBy("sLock")
    @UnsupportedAppUsage
    static InputMethodManager sInstance;

@@ -686,7 +690,7 @@ public final class InputMethodManager {
     */
    @UnsupportedAppUsage
    public static InputMethodManager getInstance() {
        synchronized (InputMethodManager.class) {
        synchronized (sLock) {
            if (sInstance == null) {
                try {
                    final InputMethodManager imm = new InputMethodManager(Looper.getMainLooper());
@@ -709,8 +713,10 @@ public final class InputMethodManager {
    @Deprecated
    @UnsupportedAppUsage
    public static InputMethodManager peekInstance() {
        synchronized (sLock) {
            return sInstance;
        }
    }

    /** @hide */
    @UnsupportedAppUsage