Commit 20236661 authored by Weidong Guo's avatar Weidong Guo Committed by Commit Bot

Fix home launcher freeze issue after two finger drag

Enable auto-hide shelf. Drag from bottom bezel to show home launcher
and, meanwhile, use second finger to drag on home launcher, the launcher
freezes.

It happens because shelf is hidden when dragging with second finger
which prevents the drag end event reaching home gesture handler.

Changes:
1. Remove shelf visibility check for drag end event.
2. Avoid processing drag event when animation is running.

Bug: 899554
Change-Id: I18262f813ab4acaab9266b7fba1c7790275d8fbc
Reviewed-on: https://chromium-review.googlesource.com/c/1311840Reviewed-by: default avatarSammie Quon <sammiequon@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Weidong Guo <weidongg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604608}
parent 24c885e6
......@@ -190,6 +190,9 @@ bool HomeLauncherGestureHandler::OnPressEvent(Mode mode,
bool HomeLauncherGestureHandler::OnScrollEvent(const gfx::Point& location,
float scroll_y) {
if (IsAnimating())
return false;
if (!IsDragInProgress())
return false;
......@@ -209,11 +212,15 @@ bool HomeLauncherGestureHandler::OnScrollEvent(const gfx::Point& location,
bool HomeLauncherGestureHandler::OnReleaseEvent(const gfx::Point& location,
bool* out_dragged_down) {
if (IsAnimating())
return false;
if (!IsDragInProgress()) {
if (window_) {
// |window_| may not be nullptr when this release event is triggered by
// opening |window_| with modal dialog in OnPressEvent(). In that case,
// just leave the |window_| in show state and stop tracking.
AnimateToFinalState();
RemoveObserversAndStopTracking();
return true;
}
......@@ -551,26 +558,27 @@ void HomeLauncherGestureHandler::RemoveObserversAndStopTracking() {
}
bool HomeLauncherGestureHandler::IsIdle() {
if (IsDragInProgress())
return false;
return !IsDragInProgress() && !IsAnimating();
}
bool HomeLauncherGestureHandler::IsAnimating() {
if (window_ && window_->layer()->GetAnimator()->is_animating())
return false;
return true;
if (window2_ && window2_->layer()->GetAnimator()->is_animating())
return false;
return true;
for (const auto& descendant : transient_descendants_values_) {
if (descendant.first->layer()->GetAnimator()->is_animating())
return false;
return true;
}
for (const auto& descendant : transient_descendants_values2_) {
if (descendant.first->layer()->GetAnimator()->is_animating())
return false;
return true;
}
return true;
return false;
}
bool HomeLauncherGestureHandler::IsFinalStateShow() {
......
......@@ -115,6 +115,9 @@ class ASH_EXPORT HomeLauncherGestureHandler : aura::WindowObserver,
// Returns true if there's no gesture dragging and animation.
bool IsIdle();
// Returns true if animation is running.
bool IsAnimating();
// Returns true if home launcher should run animation to show. Otherwise,
// returns false.
bool IsFinalStateShow();
......
......@@ -1316,7 +1316,7 @@ void ShelfLayoutManager::CompleteAppListDrag(
HomeLauncherGestureHandler* home_launcher_handler =
Shell::Get()->app_list_controller()->home_launcher_gesture_handler();
bool dragged_down;
if (home_launcher_handler && IsVisible() &&
if (home_launcher_handler &&
home_launcher_handler->OnReleaseEvent(gesture_in_screen.location(),
&dragged_down)) {
if (dragged_down && visibility_state() == SHELF_AUTO_HIDE) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment