diff options
author | Jorim Jaggi <jjaggi@google.com> | 2014-07-03 23:25:44 +0200 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2014-07-04 03:00:29 +0200 |
commit | b690f0d5023fcf144f2701058d5a6f88d66cc97a (patch) | |
tree | 7bf8c478f0171edfd7836433b757ad65ba4b83ed /packages/SystemUI/src/com/android | |
parent | e05a56bf9386e2e0c6a862c3080698da8367a22e (diff) | |
download | frameworks_base-b690f0d5023fcf144f2701058d5a6f88d66cc97a.zip frameworks_base-b690f0d5023fcf144f2701058d5a6f88d66cc97a.tar.gz frameworks_base-b690f0d5023fcf144f2701058d5a6f88d66cc97a.tar.bz2 |
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
Diffstat (limited to 'packages/SystemUI/src/com/android')
7 files changed, 22 insertions, 47 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 85f5888..0681ff4 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -29,7 +29,6 @@ import android.content.Intent; import android.content.IntentFilter; import android.media.AudioManager; import android.media.SoundPool; -import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.Looper; @@ -45,8 +44,8 @@ import android.telephony.TelephonyManager; import android.util.EventLog; import android.util.Log; import android.util.Slog; -import android.view.ViewGroup; import android.view.IWindowManager; +import android.view.ViewGroup; import android.view.WindowManagerGlobal; import android.view.WindowManagerPolicy; @@ -65,8 +64,6 @@ import com.android.systemui.statusbar.phone.ScrimController; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; import com.android.systemui.statusbar.phone.StatusBarWindowManager; -import java.io.File; - import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT; @@ -406,10 +403,6 @@ public class KeyguardViewMediator extends SystemUI { KeyguardViewMediator.this.userActivity(); } - public void userActivity(long holdMs) { - KeyguardViewMediator.this.userActivity(holdMs); - } - public void keyguardDone(boolean authenticated) { KeyguardViewMediator.this.keyguardDone(authenticated, true); } @@ -439,13 +432,7 @@ public class KeyguardViewMediator extends SystemUI { } }; - private void userActivity() { - userActivity(AWAKE_INTERVAL_DEFAULT_MS); - } - - public void userActivity(long holdMs) { - // We ignore the hold time. Eventually we should remove it. - // Instead, the keyguard window has an explicit user activity timeout set on it. + public void userActivity() { mPM.userActivity(SystemClock.uptimeMillis(), false); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardPageSwipeHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardPageSwipeHelper.java index e312d58..d5f9619 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardPageSwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardPageSwipeHelper.java @@ -59,7 +59,6 @@ public class KeyguardPageSwipeHelper { private int mMinTranslationAmount; private int mMinFlingVelocity; private int mHintDistance; - private PowerManager mPowerManager; private final View mLeftIcon; private final View mCenterIcon; private final View mRightIcon; @@ -77,7 +76,6 @@ public class KeyguardPageSwipeHelper { updateIcon(mLeftIcon, 1.0f, SWIPE_RESTING_ALPHA_AMOUNT, false); updateIcon(mCenterIcon, 1.0f, SWIPE_RESTING_ALPHA_AMOUNT, false); updateIcon(mRightIcon, 1.0f, SWIPE_RESTING_ALPHA_AMOUNT, false); - mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); initDimens(); } @@ -145,7 +143,6 @@ public class KeyguardPageSwipeHelper { } if (mSwipingInProgress) { setTranslation(mTranslationOnDown + x - mInitialTouchX, false); - onUserActivity(event.getEventTime()); } break; @@ -254,10 +251,6 @@ public class KeyguardPageSwipeHelper { } } - private void onUserActivity(long when) { - mPowerManager.userActivity(when, false); - } - private void cancelAnimations() { ArrayList<View> targetViews = mCallback.getTranslationViews(); for (View target : targetViews) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index 0c6ea50..82e082b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -618,6 +618,7 @@ public class NotificationPanelView extends PanelView implements updateQsState(); requestPanelHeightUpdate(); mNotificationStackScroller.setInterceptDelegateEnabled(expanded); + mStatusBar.setQsExpanded(expanded); } } @@ -657,7 +658,6 @@ public class NotificationPanelView extends PanelView implements setQsTranslation(height); requestScrollerTopPaddingUpdate(false /* animate */); updateNotificationScrim(height); - mStatusBar.userActivity(); } private void updateNotificationScrim(float height) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java index 2c5ece6..c962dde 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java @@ -368,6 +368,7 @@ public abstract class PanelView extends FrameLayout { switch (event.getActionMasked()) { case MotionEvent.ACTION_DOWN: + mStatusBar.userActivity(); if (mHeightAnimator != null && !mHintAnimationRunning || mPeekPending || mPeekAnimator != null) { if (mHeightAnimator != null) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 62e2734..4c34eb1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -61,6 +61,7 @@ import android.os.Message; import android.os.PowerManager; import android.os.RemoteException; import android.os.SystemClock; +import android.os.Trace; import android.os.UserHandle; import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; @@ -377,14 +378,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, private Interpolator mAlphaIn = new PathInterpolator(0f, 0.2f, 1f, 1f); private Interpolator mAlphaOut = new PathInterpolator(0f, 0f, 0.8f, 1f); - private final OnChildLocationsChangedListener mOnChildLocationsChangedListener = - new OnChildLocationsChangedListener() { - @Override - public void onChildLocationsChanged(NotificationStackScrollLayout stackScrollLayout) { - userActivity(); - } - }; - private int mDisabledUnmodified; /** Keys of notifications currently visible to the user. */ @@ -608,7 +601,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mStackScroller = (NotificationStackScrollLayout) mStatusBarWindow.findViewById( R.id.notification_stack_scroller); mStackScroller.setLongPressListener(getNotificationLongClicker()); - mStackScroller.setChildLocationsChangedListener(mOnChildLocationsChangedListener); mKeyguardIconOverflowContainer = (NotificationOverflowContainer) LayoutInflater.from(mContext).inflate( @@ -1553,6 +1545,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, return mScrimController; } + public void setQsExpanded(boolean expanded) { + mStatusBarWindowManager.setQsExpanded(expanded); + } + /** * All changes to the status bar and notifications funnel through here and are batched. */ @@ -2886,8 +2882,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } public void userActivity() { - mHandler.removeCallbacks(mUserActivity); - mHandler.post(mUserActivity); + if (mState == StatusBarState.KEYGUARD) { + mKeyguardViewMediatorCallback.userActivity(); + } } public boolean interceptMediaKey(KeyEvent event) { @@ -2928,7 +2925,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, @Override public void onActivated(ActivatableNotificationView view) { - userActivity(); mKeyguardIndicationController.showTransientIndication(R.string.notification_tap_again); ActivatableNotificationView previousView = mStackScroller.getActivatedChild(); if (previousView != null) { @@ -3094,15 +3090,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } } - private final Runnable mUserActivity = new Runnable() { - @Override - public void run() { - if (mState == StatusBarState.KEYGUARD) { - mKeyguardViewMediatorCallback.userActivity(); - } - } - }; - // Recents @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java index 103a582..6411fb8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java @@ -173,6 +173,5 @@ public class PhoneStatusBarView extends PanelBar { super.panelExpansionChanged(panel, frac, expanded); mScrimController.setPanelExpansion(frac); mBar.updateCarrierLabelVisibility(false); - mBar.userActivity(); } } 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 @@ public class StatusBarWindowManager { 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 @@ public class StatusBarWindowManager { 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 @@ public class StatusBarWindowManager { 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 @@ public class StatusBarWindowManager { long keyguardUserActivityTimeout; boolean bouncerShowing; boolean keyguardFadingAway; + boolean qsExpanded; /** * The {@link BaseStatusBar} state from the status bar. |