distance = mTranslationOnDown + distance;
distance = Math.max(0, distance);
}
- setTranslation(distance, false /* isReset */, false /* animateReset */);
+ setTranslation(distance, false /* isReset */, false /* animateReset */,
+ false /* force */);
}
break;
targetView.finishAnimation(velocity, mAnimationEndRunnable);
}
- private void setTranslation(float translation, boolean isReset, boolean animateReset) {
+ private void setTranslation(float translation, boolean isReset, boolean animateReset,
+ boolean force) {
translation = rightSwipePossible() ? translation : Math.max(0, translation);
translation = leftSwipePossible() ? translation : Math.min(0, translation);
float absTranslation = Math.abs(translation);
- if (translation != mTranslation || isReset) {
+ if (translation != mTranslation || isReset || force) {
KeyguardAffordanceView targetView = translation > 0 ? mLeftIcon : mRightIcon;
KeyguardAffordanceView otherView = translation > 0 ? mRightIcon : mLeftIcon;
float alpha = absTranslation / getMinTranslationAmount();
boolean slowAnimation = isReset && isBelowFalsingThreshold();
if (!isReset) {
updateIcon(targetView, radius, alpha + fadeOutAlpha * targetView.getRestingAlpha(),
- false, false, false, false);
+ false, false, force, false);
} else {
updateIcon(targetView, 0.0f, fadeOutAlpha * targetView.getRestingAlpha(),
- animateIcons, slowAnimation, false, forceNoCircleAnimation);
+ animateIcons, slowAnimation, force, forceNoCircleAnimation);
}
updateIcon(otherView, 0.0f, fadeOutAlpha * otherView.getRestingAlpha(),
- animateIcons, slowAnimation, false, forceNoCircleAnimation);
+ animateIcons, slowAnimation, force, forceNoCircleAnimation);
updateIcon(mCenterIcon, 0.0f, fadeOutAlpha * mCenterIcon.getRestingAlpha(),
- animateIcons, slowAnimation, false, forceNoCircleAnimation);
+ animateIcons, slowAnimation, force, forceNoCircleAnimation);
mTranslation = translation;
}
}
public void reset(boolean animate) {
+ reset(animate, false /* force */);
+ }
+
+ public void reset(boolean animate, boolean force) {
cancelAnimation();
- setTranslation(0.0f, true, animate);
+ setTranslation(0.0f, true, animate, force);
mMotionCancelled = true;
if (mSwipingInProgress) {
mCallback.onSwipingAborted();
}
}
+ public void resetImmediately() {
+ reset(false /* animate */, true /* force */);
+ }
+
public boolean isSwipingInProgress() {
return mSwipingInProgress;
}
setBarState(StatusBarState.KEYGUARD);
}
updateKeyguardState(false /* goingToFullShade */, false /* fromShadeLocked */);
- if (!mDeviceInteractive) {
-
- // If the screen is off already, we need to disable touch events because these might
- // collapse the panel after we expanded it, and thus we would end up with a blank
- // Keyguard.
- mNotificationPanel.setTouchDisabled(true);
- }
updatePanelExpansionForKeyguard();
mLeaveOpenOnKeyguardHide = false;
if (mDraggedDownRow != null) {
mStackScroller.setAnimationsEnabled(false);
mVisualStabilityManager.setScreenOn(false);
updateVisibleToUser();
+
+ // We need to disable touch events because these might
+ // collapse the panel after we expanded it, and thus we would end up with a blank
+ // Keyguard.
+ mNotificationPanel.setTouchDisabled(true);
+ mStatusBarWindow.cancelCurrentTouch();
if (mLaunchCameraOnFinishedGoingToSleep) {
mLaunchCameraOnFinishedGoingToSleep = false;
import android.os.SystemClock;
import android.util.AttributeSet;
import android.view.ActionMode;
+import android.view.InputDevice;
import android.view.InputQueue;
import android.view.KeyEvent;
import android.view.LayoutInflater;
private ActionMode mFloatingActionMode;
private FloatingToolbar mFloatingToolbar;
private ViewTreeObserver.OnPreDrawListener mFloatingToolbarPreDrawListener;
+ private boolean mTouchCancelled;
+ private boolean mTouchActive;
public StatusBarWindowView(Context context, AttributeSet attrs) {
super(context, attrs);
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
- if (ev.getActionMasked() == MotionEvent.ACTION_DOWN
- && mNotificationPanel.isFullyCollapsed()) {
+ boolean isDown = ev.getActionMasked() == MotionEvent.ACTION_DOWN;
+ if (isDown && mNotificationPanel.isFullyCollapsed()) {
mNotificationPanel.startExpandLatencyTracking();
}
+ if (isDown) {
+ mTouchActive = true;
+ mTouchCancelled = false;
+ } else if (ev.getActionMasked() == MotionEvent.ACTION_UP
+ || ev.getActionMasked() == MotionEvent.ACTION_CANCEL) {
+ mTouchActive = false;
+ }
+ if (mTouchCancelled) {
+ return false;
+ }
mFalsingManager.onTouchEvent(ev, getWidth(), getHeight());
if (mBrightnessMirror != null && mBrightnessMirror.getVisibility() == VISIBLE) {
// Disallow new pointers while the brightness mirror is visible. This is so that you
return false;
}
}
- if (ev.getActionMasked() == MotionEvent.ACTION_DOWN) {
+ if (isDown) {
mStackScrollLayout.closeControlsIfOutsideTouch(ev);
}
if (mService.isDozing()) {
}
}
+ public void cancelCurrentTouch() {
+ if (mTouchActive) {
+ final long now = SystemClock.uptimeMillis();
+ MotionEvent event = MotionEvent.obtain(now, now,
+ MotionEvent.ACTION_CANCEL, 0.0f, 0.0f, 0);
+ event.setSource(InputDevice.SOURCE_TOUCHSCREEN);
+ dispatchTouchEvent(event);
+ event.recycle();
+ mTouchCancelled = true;
+ }
+ }
+
public class LayoutParams extends FrameLayout.LayoutParams {
public boolean ignoreRightInset;