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

Commit 349703ef authored by Jeff Brown's avatar Jeff Brown
Browse files

Native input event dispatching.

Target identification is now fully native.
Fixed a couple of minor issues related to input injection.
Native input enabled by default, can be disabled by setting
WindowManagerPolicy.ENABLE_NATIVE_INPUT_DISPATCH to false.

Change-Id: I7edf66ed3e987cc9306ad4743ac57a116af452ff
parent f2b544f5
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -773,8 +773,6 @@ public abstract class WallpaperService extends Service {
                    if (WindowManagerPolicy.ENABLE_NATIVE_INPUT_DISPATCH) {
                        if (mInputChannel != null) {
                            InputQueue.unregisterInputChannel(mInputChannel);
                            mInputChannel.dispose();
                            mInputChannel = null;
                        }
                    }
                    
@@ -783,6 +781,15 @@ public abstract class WallpaperService extends Service {
                }
                mSurfaceHolder.mSurface.release();
                mCreated = false;
                
                if (WindowManagerPolicy.ENABLE_NATIVE_INPUT_DISPATCH) {
                    // Dispose the input channel after removing the window so the Window Manager
                    // doesn't interpret the input channel being closed as an abnormal termination.
                    if (mInputChannel != null) {
                        mInputChannel.dispose();
                        mInputChannel = null;
                    }
                }
            }
        }
    }
+9 −0
Original line number Diff line number Diff line
@@ -1762,6 +1762,15 @@ public final class ViewRoot extends Handler implements ViewParent,
            sWindowSession.remove(mWindow);
        } catch (RemoteException e) {
        }
        
        if (WindowManagerPolicy.ENABLE_NATIVE_INPUT_DISPATCH) {
            // Dispose the input channel after removing the window so the Window Manager
            // doesn't interpret the input channel being closed as an abnormal termination.
            if (mInputChannel != null) {
                mInputChannel.dispose();
                mInputChannel = null;
            }
        }
    }

    void updateConfiguration(Configuration config, boolean force) {
+1 −1
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ public interface WindowManagerPolicy {
     * Temporary flag added during the transition to the new native input dispatcher.
     * This will be removed when the old input dispatch code is deleted.
     */
    public final static boolean ENABLE_NATIVE_INPUT_DISPATCH = false;
    public final static boolean ENABLE_NATIVE_INPUT_DISPATCH = true;

    // flags for interceptKeyTq
    /**
+0 −1
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ LOCAL_SRC_FILES:= \
	android_view_ViewRoot.cpp \
	android_view_InputChannel.cpp \
	android_view_InputQueue.cpp \
	android_view_InputTarget.cpp \
	android_view_KeyEvent.cpp \
	android_view_MotionEvent.cpp \
	android_text_AndroidCharacter.cpp \
+0 −2
Original line number Diff line number Diff line
@@ -164,7 +164,6 @@ extern int register_android_backup_BackupHelperDispatcher(JNIEnv *env);
extern int register_android_app_NativeActivity(JNIEnv *env);
extern int register_android_view_InputChannel(JNIEnv* env);
extern int register_android_view_InputQueue(JNIEnv* env);
extern int register_android_view_InputTarget(JNIEnv* env);
extern int register_android_view_KeyEvent(JNIEnv* env);
extern int register_android_view_MotionEvent(JNIEnv* env);

@@ -1297,7 +1296,6 @@ static const RegJNIRec gRegJNI[] = {
    REG_JNI(register_android_app_NativeActivity),
    REG_JNI(register_android_view_InputChannel),
    REG_JNI(register_android_view_InputQueue),
    REG_JNI(register_android_view_InputTarget),
    REG_JNI(register_android_view_KeyEvent),
    REG_JNI(register_android_view_MotionEvent),
};
Loading