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

Commit ba217ef2 authored by Jeff Brown's avatar Jeff Brown Committed by Android (Google) Code Review
Browse files

Merge "Ignore broken input channel when finishing input event."

parents 580d0791 9806a230
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -264,7 +264,7 @@ static void nativeFinishInputEvent(JNIEnv* env, jclass clazz, jint receiverPtr,
    sp<NativeInputEventReceiver> receiver =
            reinterpret_cast<NativeInputEventReceiver*>(receiverPtr);
    status_t status = receiver->finishInputEvent(seq, handled);
    if (status) {
    if (status && status != DEAD_OBJECT) {
        String8 message;
        message.appendFormat("Failed to finish input event.  status=%d", status);
        jniThrowRuntimeException(env, message.string());
+8 −9
Original line number Diff line number Diff line
@@ -6377,7 +6377,7 @@ public class WindowManagerService extends IWindowManager.Stub
                INJECTION_TIMEOUT_MILLIS);
        
        Binder.restoreCallingIdentity(ident);
        return reportInjectionResult(result);
        return reportInjectionResult(result, pid);
    }

    /**
@@ -6407,7 +6407,7 @@ public class WindowManagerService extends IWindowManager.Stub
                INJECTION_TIMEOUT_MILLIS);
        
        Binder.restoreCallingIdentity(ident);
        return reportInjectionResult(result);
        return reportInjectionResult(result, pid);
    }

    /**
@@ -6437,7 +6437,7 @@ public class WindowManagerService extends IWindowManager.Stub
                INJECTION_TIMEOUT_MILLIS);
        
        Binder.restoreCallingIdentity(ident);
        return reportInjectionResult(result);
        return reportInjectionResult(result, pid);
    }
    
    /**
@@ -6458,24 +6458,23 @@ public class WindowManagerService extends IWindowManager.Stub
                INJECTION_TIMEOUT_MILLIS);
        
        Binder.restoreCallingIdentity(ident);
        return reportInjectionResult(result);
        return reportInjectionResult(result, pid);
    }
    
    private boolean reportInjectionResult(int result) {
    private boolean reportInjectionResult(int result, int pid) {
        switch (result) {
            case InputManager.INPUT_EVENT_INJECTION_PERMISSION_DENIED:
                Slog.w(TAG, "Input event injection permission denied.");
                Slog.w(TAG, "Input event injection from pid " + pid + " permission denied.");
                throw new SecurityException(
                        "Injecting to another application requires INJECT_EVENTS permission");
            case InputManager.INPUT_EVENT_INJECTION_SUCCEEDED:
                //Slog.v(TAG, "Input event injection succeeded.");
                return true;
            case InputManager.INPUT_EVENT_INJECTION_TIMED_OUT:
                Slog.w(TAG, "Input event injection timed out.");
                Slog.w(TAG, "Input event injection from pid " + pid + " timed out.");
                return false;
            case InputManager.INPUT_EVENT_INJECTION_FAILED:
            default:
                Slog.w(TAG, "Input event injection failed.");
                Slog.w(TAG, "Input event injection from pid " + pid + " failed.");
                return false;
        }
    }