Clean up user activity handling

- Only call userActivity in down touch event
- Use normal timeout when QS is open
- Clean up old code regarding user activity in Keyguard

Change-Id: I968eeed33fef44def37b68eb1ddc63f1a531ab35
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java
index fe57cef..6cb0f95 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java
@@ -139,7 +139,8 @@
 
     private void applyUserActivityTimeout(State state) {
         if (state.isKeyguardShowingAndNotOccluded()
-                && state.statusBarState == StatusBarState.KEYGUARD) {
+                && state.statusBarState == StatusBarState.KEYGUARD
+                && !state.qsExpanded) {
             mLp.userActivityTimeout = state.keyguardUserActivityTimeout;
         } else {
             mLp.userActivityTimeout = -1;
@@ -148,7 +149,8 @@
 
     private void applyInputFeatures(State state) {
         if (state.isKeyguardShowingAndNotOccluded()
-                && state.statusBarState == StatusBarState.KEYGUARD) {
+                && state.statusBarState == StatusBarState.KEYGUARD
+                && !state.qsExpanded) {
             mLp.inputFeatures |= WindowManager.LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
         } else {
             mLp.inputFeatures &= ~WindowManager.LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
@@ -207,6 +209,11 @@
         apply(mCurrentState);
     }
 
+    public void setQsExpanded(boolean expanded) {
+        mCurrentState.qsExpanded = expanded;
+        apply(mCurrentState);
+    }
+
     /**
      * @param state The {@link StatusBarState} of the status bar.
      */
@@ -224,6 +231,7 @@
         long keyguardUserActivityTimeout;
         boolean bouncerShowing;
         boolean keyguardFadingAway;
+        boolean qsExpanded;
 
         /**
          * The {@link BaseStatusBar} state from the status bar.