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

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

Merge "Fix lid switch interpretation."

parents 3b0ea8db 27fd3420
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -4807,10 +4807,13 @@ public class WindowManagerService extends IWindowManager.Stub
        final int SW_LID = 0x00;
        int sw = mInputManager.getSwitchState(-1, InputDevice.SOURCE_ANY, SW_LID);
        if (sw > 0) {
            return LID_OPEN;
        } else if (sw == 0) {
            // Switch state: AKEY_STATE_DOWN or AKEY_STATE_VIRTUAL.
            return LID_CLOSED;
        } else if (sw == 0) {
            // Switch state: AKEY_STATE_UP.
            return LID_OPEN;
        } else {
            // Switch state: AKEY_STATE_UNKNOWN.
            return LID_ABSENT;
        }
    }
@@ -4818,10 +4821,6 @@ public class WindowManagerService extends IWindowManager.Stub
    // Called by window manager policy.  Not exposed externally.
    @Override
    public InputChannel monitorInput(String inputChannelName) {
        if (!checkCallingPermission(android.Manifest.permission.READ_INPUT_STATE,
                "monitorInput()")) {
            throw new SecurityException("Requires READ_INPUT_STATE permission");
        }
        return mInputManager.monitorInput(inputChannelName);
    }

+2 −1
Original line number Diff line number Diff line
@@ -510,8 +510,9 @@ void NativeInputManager::notifySwitch(nsecs_t when, int32_t switchCode,

    switch (switchCode) {
    case SW_LID:
        // When switch value is set indicates lid is closed.
        env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyLidSwitchChanged,
                when, switchValue == 0);
                when, switchValue == 0 /*lidOpen*/);
        checkAndClearExceptionFromCallback(env, "notifyLidSwitchChanged");
        break;
    }