charger: ignore key event if value didn't change

Change-Id: Idcb481550eca53209be217361cac38e48368a04f
Signed-off-by: Dima Zavin <dima@android.com>
diff --git a/charger/charger.c b/charger/charger.c
index b63312c..aface7e 100644
--- a/charger/charger.c
+++ b/charger/charger.c
@@ -754,6 +754,10 @@
     if (code > KEY_MAX)
         return -1;
 
+    /* ignore events that don't modify our state */
+    if (charger->keys[code].down == down)
+        return -1;
+
     /* only record the down even timestamp, as the amount
      * of time the key spent not being pressed is not useful */
     if (down)