Skip to content

Commit

Permalink
cros: Fix rounded corners on shelf on first tablet mode startup
Browse files Browse the repository at this point in the history
Since CL 1737730, AppList visibility is now correct in tablet mode.

After this change, bugs have surfaced with the shelf background.
To fix this, modify HomeLauncherGestureHandler so we no longer notify
observers that the animation has completed before clearing state.

The specific issue was that
HomeLauncherGestureHandler::IsDragInProgress returns true when
observers are notified of home launcher animation completion.

So, fix this, then check HomeLauncherGestureHandler::IsDragInProgress
to more accurately determine the proper shelf background.

Also check for widget visibility, not activation, because the widget
is not activated in tablet mode when shown.

Bug: 990995

Change-Id: I560a6db4c045dbbc802f18b43266e2c1f2f19e1a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1746915
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: Sammie Quon <sammiequon@chromium.org>
Commit-Queue: Alex Newcomer <newcomer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#687306}
  • Loading branch information
Alex Newcomer authored and Commit Bot committed Aug 15, 2019
1 parent fa7c3b0 commit 45822db
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
6 changes: 5 additions & 1 deletion ash/app_list/presenter/app_list_presenter_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ void AppListPresenterImpl::Show(int64_t display_id,
SetView(view);
}
delegate_->ShowForDisplay(display_id);
if (delegate_->IsTabletMode())
home_launcher_shown_ = true;

NotifyTargetVisibilityChanged(GetTargetVisibility());
NotifyVisibilityChanged(GetTargetVisibility(), display_id);
Expand Down Expand Up @@ -299,7 +301,9 @@ void AppListPresenterImpl::OnTabletModeChanged(bool started) {
DCHECK(IsVisible());
view_->OnTabletModeChanged(true);
}
home_launcher_shown_ = GetWindow() && GetWindow()->HasFocus();
// The AppList widget is shown without being focused in tablet mode, so
// check for visibility, not focus.
home_launcher_shown_ = GetWindow() && GetWindow()->IsVisible();
} else {
if (IsVisible())
view_->OnTabletModeChanged(false);
Expand Down
7 changes: 4 additions & 3 deletions ash/home_screen/home_launcher_gesture_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,11 @@ void HomeLauncherGestureHandler::OnTabletModeEnded() {
}

void HomeLauncherGestureHandler::OnImplicitAnimationsCompleted() {
float home_launcher_opacity = 1.f;
const bool is_final_state_show = IsFinalStateShow();
NotifyHomeLauncherAnimationComplete(is_final_state_show /*shown*/,
display_.id());
base::ScopedClosureRunner notification_runner(base::BindOnce(
&HomeLauncherGestureHandler::NotifyHomeLauncherAnimationComplete,
base::Unretained(this), is_final_state_show, display_.id()));
float home_launcher_opacity = 1.f;
if (Shell::Get()->overview_controller()->InOverviewSession()) {
if (overview_active_on_gesture_start_ && is_final_state_show) {
// Exit overview if event is released on the top half. This will also
Expand Down
14 changes: 6 additions & 8 deletions ash/shelf/shelf_layout_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ bool IsTabletModeEnabled() {
bool IsHomeScreenAvailable() {
// Shell could be destroying. Shell destroys HomeScreenController before
// closing all windows.
if (!Shell::Get()->home_screen_controller())
if (!Shell::Get() || !Shell::Get()->home_screen_controller())
return false;

return Shell::Get()->home_screen_controller()->IsHomeScreenAvailable();
Expand Down Expand Up @@ -529,15 +529,13 @@ ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const {
return SHELF_BACKGROUND_LOGIN;
}

if (is_app_list_visible_) {
if (!IsHomeScreenAvailable())
return SHELF_BACKGROUND_APP_LIST;

// When the home screen is available, it is always visible. If the home
// screen is either fullscreen or being animated or dragged, show the
// transparent background.
if (IsHomeScreenAvailable()) {
// If the home launcher is shown, being animated, or dragged, show the
// default background.
if (is_home_launcher_shown_ || is_home_launcher_target_position_shown_)
return SHELF_BACKGROUND_DEFAULT;
} else if (is_app_list_visible_) {
return SHELF_BACKGROUND_APP_LIST;
}

const bool in_split_view_mode =
Expand Down
9 changes: 6 additions & 3 deletions ash/shelf/shelf_layout_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -418,15 +418,18 @@ class ASH_EXPORT ShelfLayoutManager : public AppListControllerObserver,
Shelf* shelf_;

// Whether the app list is visible. This is maintained by
// OnAppListVisibilityChanged.
// OnAppListVisibilityChanged. Used to determine AppList visibility in
// clamshell mode.
bool is_app_list_visible_ = false;

// Whether the HomeLauncher is being dragged to, or animating to fullscreen.
// This is maintained by OnHomeLauncherTargetPositionChanged.
// This is maintained by OnHomeLauncherTargetPositionChanged. Used to
// determine AppList visibility in tablet mode.
bool is_home_launcher_target_position_shown_ = false;

// Whether the HomeLauncher is shown. This is maintained by
// OnHomeLauncherAnimationComplete.
// OnHomeLauncherAnimationComplete. Used to determine AppList visibility in
// tablet mode.
bool is_home_launcher_shown_ = false;

// True to skip updating shelf visibility state.
Expand Down

0 comments on commit 45822db

Please sign in to comment.