Loading packages/SystemUI/src/com/android/systemui/navigationbar/gestural/BackPanelController.kt +34 −22 Original line number Diff line number Diff line Loading @@ -231,7 +231,6 @@ internal constructor( animation.removeEndListener(this) if (!canceled) { // The delay between finishing this animation and starting the runnable val delay = max(0, runnableDelay - elapsedTimeSinceEntry) Loading Loading @@ -461,7 +460,6 @@ internal constructor( } private fun handleMoveEvent(event: MotionEvent) { val x = event.x val y = event.y Loading Loading @@ -927,17 +925,7 @@ internal constructor( GestureState.ACTIVE -> { previousXTranslationOnActiveOffset = previousXTranslation updateRestingArrowDimens() if (featureFlags.isEnabled(ONE_WAY_HAPTICS_API_MIGRATION)) { vibratorHelper.performHapticFeedback( mView, HapticFeedbackConstants.GESTURE_THRESHOLD_ACTIVATE ) } else { vibratorHelper.cancel() mainHandler.postDelayed(10L) { vibratorHelper.vibrate(VIBRATE_ACTIVATED_EFFECT) } } performActivatedHapticFeedback() val popVelocity = if (previousState == GestureState.INACTIVE) { POP_ON_INACTIVE_TO_ACTIVE_VELOCITY Loading @@ -958,25 +946,24 @@ internal constructor( mView.popOffEdge(POP_ON_INACTIVE_VELOCITY) if (featureFlags.isEnabled(ONE_WAY_HAPTICS_API_MIGRATION)) { vibratorHelper.performHapticFeedback( mView, HapticFeedbackConstants.GESTURE_THRESHOLD_DEACTIVATE ) } else { vibratorHelper.vibrate(VIBRATE_DEACTIVATED_EFFECT) } performDeactivatedHapticFeedback() updateRestingArrowDimens() } GestureState.FLUNG -> { // Typically a vibration is only played while transitioning to ACTIVE. However there // are instances where a fling to trigger back occurs while not in that state. // (e.g. A fling is detected before crossing the trigger threshold.) if (previousState != GestureState.ACTIVE) { performActivatedHapticFeedback() } mainHandler.postDelayed(POP_ON_FLING_DELAY) { mView.popScale(POP_ON_FLING_VELOCITY) } updateRestingArrowDimens() mainHandler.postDelayed( onEndSetCommittedStateListener.runnable, MIN_DURATION_FLING_ANIMATION ) updateRestingArrowDimens() } GestureState.COMMITTED -> { // In most cases, animating between states is handled via `updateRestingArrowDimens` Loading Loading @@ -1011,6 +998,31 @@ internal constructor( } } private fun performDeactivatedHapticFeedback() { if (featureFlags.isEnabled(ONE_WAY_HAPTICS_API_MIGRATION)) { vibratorHelper.performHapticFeedback( mView, HapticFeedbackConstants.GESTURE_THRESHOLD_DEACTIVATE ) } else { vibratorHelper.vibrate(VIBRATE_DEACTIVATED_EFFECT) } } private fun performActivatedHapticFeedback() { if (featureFlags.isEnabled(ONE_WAY_HAPTICS_API_MIGRATION)) { vibratorHelper.performHapticFeedback( mView, HapticFeedbackConstants.GESTURE_THRESHOLD_ACTIVATE ) } else { vibratorHelper.cancel() mainHandler.postDelayed(10L) { vibratorHelper.vibrate(VIBRATE_ACTIVATED_EFFECT) } } } private fun convertVelocityToAnimationFactor( valueOnFastVelocity: Float, valueOnSlowVelocity: Float, Loading Loading
packages/SystemUI/src/com/android/systemui/navigationbar/gestural/BackPanelController.kt +34 −22 Original line number Diff line number Diff line Loading @@ -231,7 +231,6 @@ internal constructor( animation.removeEndListener(this) if (!canceled) { // The delay between finishing this animation and starting the runnable val delay = max(0, runnableDelay - elapsedTimeSinceEntry) Loading Loading @@ -461,7 +460,6 @@ internal constructor( } private fun handleMoveEvent(event: MotionEvent) { val x = event.x val y = event.y Loading Loading @@ -927,17 +925,7 @@ internal constructor( GestureState.ACTIVE -> { previousXTranslationOnActiveOffset = previousXTranslation updateRestingArrowDimens() if (featureFlags.isEnabled(ONE_WAY_HAPTICS_API_MIGRATION)) { vibratorHelper.performHapticFeedback( mView, HapticFeedbackConstants.GESTURE_THRESHOLD_ACTIVATE ) } else { vibratorHelper.cancel() mainHandler.postDelayed(10L) { vibratorHelper.vibrate(VIBRATE_ACTIVATED_EFFECT) } } performActivatedHapticFeedback() val popVelocity = if (previousState == GestureState.INACTIVE) { POP_ON_INACTIVE_TO_ACTIVE_VELOCITY Loading @@ -958,25 +946,24 @@ internal constructor( mView.popOffEdge(POP_ON_INACTIVE_VELOCITY) if (featureFlags.isEnabled(ONE_WAY_HAPTICS_API_MIGRATION)) { vibratorHelper.performHapticFeedback( mView, HapticFeedbackConstants.GESTURE_THRESHOLD_DEACTIVATE ) } else { vibratorHelper.vibrate(VIBRATE_DEACTIVATED_EFFECT) } performDeactivatedHapticFeedback() updateRestingArrowDimens() } GestureState.FLUNG -> { // Typically a vibration is only played while transitioning to ACTIVE. However there // are instances where a fling to trigger back occurs while not in that state. // (e.g. A fling is detected before crossing the trigger threshold.) if (previousState != GestureState.ACTIVE) { performActivatedHapticFeedback() } mainHandler.postDelayed(POP_ON_FLING_DELAY) { mView.popScale(POP_ON_FLING_VELOCITY) } updateRestingArrowDimens() mainHandler.postDelayed( onEndSetCommittedStateListener.runnable, MIN_DURATION_FLING_ANIMATION ) updateRestingArrowDimens() } GestureState.COMMITTED -> { // In most cases, animating between states is handled via `updateRestingArrowDimens` Loading Loading @@ -1011,6 +998,31 @@ internal constructor( } } private fun performDeactivatedHapticFeedback() { if (featureFlags.isEnabled(ONE_WAY_HAPTICS_API_MIGRATION)) { vibratorHelper.performHapticFeedback( mView, HapticFeedbackConstants.GESTURE_THRESHOLD_DEACTIVATE ) } else { vibratorHelper.vibrate(VIBRATE_DEACTIVATED_EFFECT) } } private fun performActivatedHapticFeedback() { if (featureFlags.isEnabled(ONE_WAY_HAPTICS_API_MIGRATION)) { vibratorHelper.performHapticFeedback( mView, HapticFeedbackConstants.GESTURE_THRESHOLD_ACTIVATE ) } else { vibratorHelper.cancel() mainHandler.postDelayed(10L) { vibratorHelper.vibrate(VIBRATE_ACTIVATED_EFFECT) } } } private fun convertVelocityToAnimationFactor( valueOnFastVelocity: Float, valueOnSlowVelocity: Float, Loading