LineageParts: Make sure wakelock is held before releasing it

Change-Id: I5d98fa71f65334266459d0e4b07f8330a24d1a63
diff --git a/src/org/lineageos/lineageparts/gestures/KeyHandler.java b/src/org/lineageos/lineageparts/gestures/KeyHandler.java
index b670bf0..61b93c6 100644
--- a/src/org/lineageos/lineageparts/gestures/KeyHandler.java
+++ b/src/org/lineageos/lineageparts/gestures/KeyHandler.java
@@ -184,7 +184,9 @@
         mSensorManager.registerListener(new SensorEventListener() {
             @Override
             public void onSensorChanged(SensorEvent event) {
-                mProximityWakeLock.release();
+                if (mProximityWakeLock.isHeld()) {
+                    mProximityWakeLock.release();
+                }
                 mSensorManager.unregisterListener(this);
                 if (!mEventHandler.hasMessages(GESTURE_REQUEST)) {
                     // The sensor took too long; ignoring