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

Commit a2cc28d7 authored by Jeff Brown's avatar Jeff Brown
Browse files

Fix focused application handle.

Fix a bug where we were always setting the focused application
handle to NULL.  This broke ANR processing while starting
applications and caused input events to be dropped while
starting applications.

Bug: 4174573
Change-Id: Icd7b8c4c49ed73c41978f3ff076c2e5cd839a802
parent c33d8d49
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1239,7 +1239,7 @@ int32_t InputDispatcher::findTouchedWindowTargetsLocked(nsecs_t currentTime,
        mTempTouchState.copyFrom(mTouchState);
    }
    if (wrongDevice) {
#if DEBUG_INPUT_DISPATCHER_POLICY
#if DEBUG_FOCUS
        LOGD("Dropping event because a pointer for a different device is already down.");
#endif
        injectionResult = INPUT_EVENT_INJECTION_FAILED;
@@ -1380,7 +1380,7 @@ int32_t InputDispatcher::findTouchedWindowTargetsLocked(nsecs_t currentTime,

        // If the pointer is not currently down, then ignore the event.
        if (! mTempTouchState.down) {
#if DEBUG_INPUT_DISPATCHER_POLICY
#if DEBUG_FOCUS
            LOGD("Dropping event because the pointer is not down or we previously "
                    "dropped the pointer down event.");
#endif
@@ -1428,7 +1428,7 @@ int32_t InputDispatcher::findTouchedWindowTargetsLocked(nsecs_t currentTime,
            }
        }
        if (! haveForegroundWindow) {
#if DEBUG_INPUT_DISPATCHER_POLICY
#if DEBUG_FOCUS
            LOGD("Dropping event because there is no touched foreground window to receive it.");
#endif
            injectionResult = INPUT_EVENT_INJECTION_FAILED;
@@ -1445,7 +1445,7 @@ int32_t InputDispatcher::findTouchedWindowTargetsLocked(nsecs_t currentTime,
        if (touchedWindow.targetFlags & InputTarget::FLAG_FOREGROUND) {
            // If the touched window is paused then keep waiting.
            if (touchedWindow.window->paused) {
#if DEBUG_INPUT_DISPATCHER_POLICY
#if DEBUG_FOCUS
                LOGD("Waiting because touched window is paused.");
#endif
                injectionResult = handleTargetsNotReadyLocked(currentTime, entry,
+1 −0
Original line number Diff line number Diff line
@@ -600,6 +600,7 @@ void NativeInputManager::setFocusedApplication(JNIEnv* env, jobject applicationO
        android_server_InputApplication_toNative(env, applicationObj, &application);
        if (application.inputApplicationHandle != NULL) {
            mInputManager->getDispatcher()->setFocusedApplication(&application);
            return;
        }
    }
    mInputManager->getDispatcher()->setFocusedApplication(NULL);