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, ...@@ -190,6 +190,9 @@ bool HomeLauncherGestureHandler::OnPressEvent(Mode mode,
bool HomeLauncherGestureHandler::OnScrollEvent(const gfx::Point& location, bool HomeLauncherGestureHandler::OnScrollEvent(const gfx::Point& location,
float scroll_y) { float scroll_y) {
if (IsAnimating())
return false;
if (!IsDragInProgress()) if (!IsDragInProgress())
return false; return false;
...@@ -209,11 +212,15 @@ bool HomeLauncherGestureHandler::OnScrollEvent(const gfx::Point& location, ...@@ -209,11 +212,15 @@ bool HomeLauncherGestureHandler::OnScrollEvent(const gfx::Point& location,
bool HomeLauncherGestureHandler::OnReleaseEvent(const gfx::Point& location, bool HomeLauncherGestureHandler::OnReleaseEvent(const gfx::Point& location,
bool* out_dragged_down) { bool* out_dragged_down) {
if (IsAnimating())
return false;
if (!IsDragInProgress()) { if (!IsDragInProgress()) {
if (window_) { if (window_) {
// |window_| may not be nullptr when this release event is triggered by // |window_| may not be nullptr when this release event is triggered by
// opening |window_| with modal dialog in OnPressEvent(). In that case, // opening |window_| with modal dialog in OnPressEvent(). In that case,
// just leave the |window_| in show state and stop tracking. // just leave the |window_| in show state and stop tracking.
AnimateToFinalState();
RemoveObserversAndStopTracking(); RemoveObserversAndStopTracking();
return true; return true;
} }
...@@ -551,26 +558,27 @@ void HomeLauncherGestureHandler::RemoveObserversAndStopTracking() { ...@@ -551,26 +558,27 @@ void HomeLauncherGestureHandler::RemoveObserversAndStopTracking() {
} }
bool HomeLauncherGestureHandler::IsIdle() { bool HomeLauncherGestureHandler::IsIdle() {
if (IsDragInProgress()) return !IsDragInProgress() && !IsAnimating();
return false; }
bool HomeLauncherGestureHandler::IsAnimating() {
if (window_ && window_->layer()->GetAnimator()->is_animating()) if (window_ && window_->layer()->GetAnimator()->is_animating())
return false; return true;
if (window2_ && window2_->layer()->GetAnimator()->is_animating()) if (window2_ && window2_->layer()->GetAnimator()->is_animating())
return false; return true;
for (const auto& descendant : transient_descendants_values_) { for (const auto& descendant : transient_descendants_values_) {
if (descendant.first->layer()->GetAnimator()->is_animating()) if (descendant.first->layer()->GetAnimator()->is_animating())
return false; return true;
} }
for (const auto& descendant : transient_descendants_values2_) { for (const auto& descendant : transient_descendants_values2_) {
if (descendant.first->layer()->GetAnimator()->is_animating()) if (descendant.first->layer()->GetAnimator()->is_animating())
return false; return true;
} }
return true; return false;
} }
bool HomeLauncherGestureHandler::IsFinalStateShow() { bool HomeLauncherGestureHandler::IsFinalStateShow() {
......
...@@ -115,6 +115,9 @@ class ASH_EXPORT HomeLauncherGestureHandler : aura::WindowObserver, ...@@ -115,6 +115,9 @@ class ASH_EXPORT HomeLauncherGestureHandler : aura::WindowObserver,
// Returns true if there's no gesture dragging and animation. // Returns true if there's no gesture dragging and animation.
bool IsIdle(); bool IsIdle();
// Returns true if animation is running.
bool IsAnimating();
// Returns true if home launcher should run animation to show. Otherwise, // Returns true if home launcher should run animation to show. Otherwise,
// returns false. // returns false.
bool IsFinalStateShow(); bool IsFinalStateShow();
......
...@@ -1316,7 +1316,7 @@ void ShelfLayoutManager::CompleteAppListDrag( ...@@ -1316,7 +1316,7 @@ void ShelfLayoutManager::CompleteAppListDrag(
HomeLauncherGestureHandler* home_launcher_handler = HomeLauncherGestureHandler* home_launcher_handler =
Shell::Get()->app_list_controller()->home_launcher_gesture_handler(); Shell::Get()->app_list_controller()->home_launcher_gesture_handler();
bool dragged_down; bool dragged_down;
if (home_launcher_handler && IsVisible() && if (home_launcher_handler &&
home_launcher_handler->OnReleaseEvent(gesture_in_screen.location(), home_launcher_handler->OnReleaseEvent(gesture_in_screen.location(),
&dragged_down)) { &dragged_down)) {
if (dragged_down && visibility_state() == SHELF_AUTO_HIDE) { 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