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

Commit 7ffc8e93 authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

Use InputChannel::create

InputChannel no longer allows direct creation, because it may be
invalid, depending on the data provided. Force the users to check the
result of the creation by only allowing the use of static creators
::read and ::create.

Bug: none
Test: atest libinput_tests inputflinger_tests
Change-Id: Ieb746036798cf673ceb63cbc1d59a9be7e5cc05a
parent f1a14f9a
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -210,8 +210,7 @@ static void android_view_InputChannel_nativeReadFromParcel(JNIEnv* env, jobject
    if (parcel) {
        bool isInitialized = parcel->readInt32();
        if (isInitialized) {
            InputChannel* inputChannel = new InputChannel();
            inputChannel->read(*parcel);
            sp<InputChannel> inputChannel = InputChannel::read(*parcel);

            NativeInputChannel* nativeInputChannel = new NativeInputChannel(inputChannel);

+2 −3
Original line number Diff line number Diff line
@@ -7767,8 +7767,7 @@ public class WindowManagerService extends IWindowManager.Stub
        clientChannel.transferTo(outInputChannel);
        clientChannel.dispose();

        IBinder token = new Binder();
        mInputManager.registerInputChannel(inputChannel, token);
        mInputManager.registerInputChannel(inputChannel, null /* generate new token */);

        // Prevent the java finalizer from breaking the input channel. But we won't
        // do any further management so we just release the java ref and let the
@@ -7776,7 +7775,7 @@ public class WindowManagerService extends IWindowManager.Stub
        inputChannel.release();

        InputWindowHandle h = new InputWindowHandle(null, null, displayId);
        h.token = token;
        h.token = inputChannel.getToken();
        h.name = name;
        h.layoutParamsFlags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
        h.layoutParamsType = 0;