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

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

Merge changes I2915cdc9,Ide6ba9d8

* changes:
  Remove name from InputMonitor
  Simplify creation of NativeInputChannel
parents 32be5c80 7480ae28
Loading
Loading
Loading
Loading
+27 −30
Original line number Diff line number Diff line
@@ -39,8 +39,6 @@ public final class InputMonitor implements Parcelable {

    private static final boolean DEBUG = false;

    @NonNull
    private final String mName;
    @NonNull
    private final InputChannel mInputChannel;
    @NonNull
@@ -81,23 +79,19 @@ public final class InputMonitor implements Parcelable {



    // Code below generated by codegen v1.0.1.
    // Code below generated by codegen v1.0.7.
    //
    // DO NOT MODIFY!
    // CHECKSTYLE:OFF Generated code
    //
    // To regenerate run:
    // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/view/InputMonitor.java
    //
    // CHECKSTYLE:OFF Generated code


    @DataClass.Generated.Member
    public InputMonitor(
            @NonNull String name,
            @NonNull InputChannel inputChannel,
            @NonNull IInputMonitorHost host) {
        this.mName = name;
        com.android.internal.util.AnnotationValidations.validate(
                NonNull.class, null, mName);
        this.mInputChannel = inputChannel;
        com.android.internal.util.AnnotationValidations.validate(
                NonNull.class, null, mInputChannel);
@@ -108,11 +102,6 @@ public final class InputMonitor implements Parcelable {
        // onConstructed(); // You can define this method to get a callback
    }

    @DataClass.Generated.Member
    public @NonNull String getName() {
        return mName;
    }

    @DataClass.Generated.Member
    public @NonNull InputChannel getInputChannel() {
        return mInputChannel;
@@ -130,7 +119,6 @@ public final class InputMonitor implements Parcelable {
        // String fieldNameToString() { ... }

        return "InputMonitor { " +
                "name = " + mName + ", " +
                "inputChannel = " + mInputChannel + ", " +
                "host = " + mHost +
        " }";
@@ -142,7 +130,6 @@ public final class InputMonitor implements Parcelable {
        // You can override field parcelling by defining methods like:
        // void parcelFieldName(Parcel dest, int flags) { ... }

        dest.writeString(mName);
        dest.writeTypedObject(mInputChannel, flags);
        dest.writeStrongInterface(mHost);
    }
@@ -151,6 +138,26 @@ public final class InputMonitor implements Parcelable {
    @DataClass.Generated.Member
    public int describeContents() { return 0; }

    /** @hide */
    @SuppressWarnings({"unchecked", "RedundantCast"})
    @DataClass.Generated.Member
    /* package-private */ InputMonitor(Parcel in) {
        // You can override field unparcelling by defining methods like:
        // static FieldType unparcelFieldName(Parcel in) { ... }

        InputChannel inputChannel = (InputChannel) in.readTypedObject(InputChannel.CREATOR);
        IInputMonitorHost host = IInputMonitorHost.Stub.asInterface(in.readStrongBinder());

        this.mInputChannel = inputChannel;
        com.android.internal.util.AnnotationValidations.validate(
                NonNull.class, null, mInputChannel);
        this.mHost = host;
        com.android.internal.util.AnnotationValidations.validate(
                NonNull.class, null, mHost);

        // onConstructed(); // You can define this method to get a callback
    }

    @DataClass.Generated.Member
    public static final @NonNull Parcelable.Creator<InputMonitor> CREATOR
            = new Parcelable.Creator<InputMonitor>() {
@@ -160,26 +167,16 @@ public final class InputMonitor implements Parcelable {
        }

        @Override
        @SuppressWarnings({"unchecked", "RedundantCast"})
        public InputMonitor createFromParcel(Parcel in) {
            // You can override field unparcelling by defining methods like:
            // static FieldType unparcelFieldName(Parcel in) { ... }

            String name = in.readString();
            InputChannel inputChannel = (InputChannel) in.readTypedObject(InputChannel.CREATOR);
            IInputMonitorHost host = IInputMonitorHost.Stub.asInterface(in.readStrongBinder());
            return new InputMonitor(
                    name,
                    inputChannel,
                    host);
            return new InputMonitor(in);
        }
    };

    @DataClass.Generated(
            time = 1569871940995L,
            codegenVersion = "1.0.1",
            time = 1571177265149L,
            codegenVersion = "1.0.7",
            sourceFile = "frameworks/base/core/java/android/view/InputMonitor.java",
            inputSignatures = "private static final  java.lang.String TAG\nprivate static final  boolean DEBUG\nprivate final @android.annotation.NonNull java.lang.String mName\nprivate final @android.annotation.NonNull android.view.InputChannel mInputChannel\nprivate final @android.annotation.NonNull android.view.IInputMonitorHost mHost\npublic  void pilferPointers()\npublic  void dispose()\nclass InputMonitor extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true)")
            inputSignatures = "private static final  java.lang.String TAG\nprivate static final  boolean DEBUG\nprivate final @android.annotation.NonNull android.view.InputChannel mInputChannel\nprivate final @android.annotation.NonNull android.view.IInputMonitorHost mHost\npublic  void pilferPointers()\npublic  void dispose()\nclass InputMonitor extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true)")
    @Deprecated
    private void __metadata() {}

+5 −5
Original line number Diff line number Diff line
@@ -112,7 +112,9 @@ void android_view_InputChannel_setDisposeCallback(JNIEnv* env, jobject inputChan
}

static jobject android_view_InputChannel_createInputChannel(JNIEnv* env,
        std::unique_ptr<NativeInputChannel> nativeInputChannel) {
        sp<InputChannel> inputChannel) {
    std::unique_ptr<NativeInputChannel> nativeInputChannel =
            std::make_unique<NativeInputChannel>(inputChannel);
    jobject inputChannelObj = env->NewObject(gInputChannelClassInfo.clazz,
            gInputChannelClassInfo.ctor);
    if (inputChannelObj) {
@@ -143,14 +145,12 @@ static jobjectArray android_view_InputChannel_nativeOpenInputChannelPair(JNIEnv*
        return nullptr;
    }

    jobject serverChannelObj = android_view_InputChannel_createInputChannel(env,
            std::make_unique<NativeInputChannel>(serverChannel));
    jobject serverChannelObj = android_view_InputChannel_createInputChannel(env, serverChannel);
    if (env->ExceptionCheck()) {
        return nullptr;
    }

    jobject clientChannelObj = android_view_InputChannel_createInputChannel(env,
            std::make_unique<NativeInputChannel>(clientChannel));
    jobject clientChannelObj = android_view_InputChannel_createInputChannel(env, clientChannel);
    if (env->ExceptionCheck()) {
        return nullptr;
    }
+1 −2
Original line number Diff line number Diff line
@@ -524,7 +524,6 @@ public class InputManagerService extends IInputManager.Stub
            throw new IllegalArgumentException("displayId must >= 0.");
        }


        final long ident = Binder.clearCallingIdentity();
        try {
            InputChannel[] inputChannels = InputChannel.openInputChannelPair(inputChannelName);
@@ -532,7 +531,7 @@ public class InputManagerService extends IInputManager.Stub
            inputChannels[0].setToken(host.asBinder());
            nativeRegisterInputMonitor(mPtr, inputChannels[0], displayId,
                    true /*isGestureMonitor*/);
            return new InputMonitor(inputChannelName, inputChannels[1], host);
            return new InputMonitor(inputChannels[1], host);
        } finally {
            Binder.restoreCallingIdentity(ident);
        }