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

Commit b7480c2b authored by Yohei Yukawa's avatar Yohei Yukawa Committed by Android (Google) Code Review
Browse files

Merge "Revert "InputConnectionWrapper never supports null target."" into nyc-dev

parents def048e5 abc4b8f0
Loading
Loading
Loading
Loading
+4 −18
Original line number Diff line number Diff line
@@ -16,41 +16,27 @@

package android.view.inputmethod;

import android.annotation.NonNull;
import android.os.Bundle;
import android.os.Handler;
import android.view.KeyEvent;

import static com.android.internal.util.Preconditions.checkNotNull;

/**
 * <p>Wrapper class for proxying calls to another InputConnection.  Subclass
 * and have fun!
 */
public class InputConnectionWrapper implements InputConnection {
    @NonNull
    private InputConnection mTarget;
    final boolean mMutable;
    
    /**
     * Initializes the wrapper for the given {@link InputConnection}.
     * @param target the {@link InputConnection} to be wrapped.
     * @param mutable {@code true} if the wrapper is to be mutable.
     * @throws NullPointerException if {@code target} is {@code null}.
     */
    public InputConnectionWrapper(@NonNull InputConnection target, boolean mutable) {
        checkNotNull(target);
    public InputConnectionWrapper(InputConnection target, boolean mutable) {
        mMutable = mutable;
        mTarget = target;
    }

    /**
     * Change the target of the input connection.
     * @param target the {@link InputConnection} to be wrapped.
     * @throws NullPointerException if {@code target} is {@code null}.
     */
    public void setTarget(@NonNull InputConnection target) {
        checkNotNull(target);
    public void setTarget(InputConnection target) {
        if (mTarget != null && !mMutable) {
            throw new SecurityException("not mutable");
        }