New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 718965 link

Starred by 3 users

Issue metadata

Status: Assigned
Owner:
Last visit > 30 days ago
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

ArcCustomNotificationView::SlideHelper needs refactor

Project Member Reported by est...@chromium.org, May 5 2017

Issue description

ArcCustomNotificationView::SlideHelper makes a lot of assumptions about how notification slide-out works (i.e. the inner logic of former SlideOutView, currently SlideOutController). This is very fragile. It also lacks test coverage. This means the fix for  issue 716429  caused arc notifications to start crashing without causing any test to fail.

crash:

https://crash.corp.google.com/browse?q=product.name%3D%27Chrome_ChromeOS%27%20AND%20product.version%20%3E%3D%20%2760.0%27%20AND%20product.Version%3D%2760.0.3089.0%27&ignore_case=false&enable_rewrite=true&omit_field_name=&omit_field_value=&omit_field_opt=%3D&stbtiq=&reportid=&index=0
 
Cc: xiy...@chromium.org
Project Member

Comment 2 by bugdroid1@chromium.org, May 5 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/99c145d628465ca7c71f46ae39fe875466e3fb5e

commit 99c145d628465ca7c71f46ae39fe875466e3fb5e
Author: estade <estade@chromium.org>
Date: Fri May 05 22:53:04 2017

Fix ARC notification crash.

Make ArcCustomNotificationView::SlideHelper operate on the correct
layer, i.e. that which is sliding out.

This is meant as a temporary hack to address the crash, but the code
still needs to be restructured to reduce fragility and improve test
coverage.

BUG=718965

Review-Url: https://codereview.chromium.org/2863163002
Cr-Commit-Position: refs/heads/master@{#469787}

[modify] https://crrev.com/99c145d628465ca7c71f46ae39fe875466e3fb5e/ui/arc/notification/arc_custom_notification_view.cc

Issue 719612 has been merged into this issue.
Cc: edcourtney@chromium.org

Comment 5 by est...@chromium.org, May 19 2017

Labels: ReleaseBlock-Beta Merge-Request-59 M-59
bug 718956 has been approved for a merge but it needs this to be merged first.

Comment 6 by est...@chromium.org, May 19 2017

Cc: gkihumba@chromium.org
+Grace, see #5.
Project Member

Comment 7 by sheriffbot@chromium.org, May 19 2017

Labels: -Merge-Request-59 Hotlist-Merge-Approved Merge-Approved-59
Your change meets the bar and is auto-approved for M59. Please go ahead and merge the CL to branch 3071 manually. Please contact milestone owner if you have questions.
Owners: amineer@(Android), cmasso@(iOS), gkihumba@(ChromeOS), Abdul Syed@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Project Member

Comment 8 by bugdroid1@chromium.org, May 19 2017

Labels: -merge-approved-59 merge-merged-3071
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/8f75642cf2ecc597f87a8a66aa227ec79e947db1

commit 8f75642cf2ecc597f87a8a66aa227ec79e947db1
Author: Evan Stade <estade@chromium.org>
Date: Fri May 19 15:22:15 2017

Fix ARC notification crash.

Make ArcCustomNotificationView::SlideHelper operate on the correct
layer, i.e. that which is sliding out.

This is meant as a temporary hack to address the crash, but the code
still needs to be restructured to reduce fragility and improve test
coverage.

BUG=718965

Review-Url: https://codereview.chromium.org/2863163002
Cr-Original-Commit-Position: refs/heads/master@{#469787}
Review-Url: https://codereview.chromium.org/2886283006 .
Cr-Commit-Position: refs/branch-heads/3071@{#632}
Cr-Branched-From: a106f0abbf69dad349d4aaf4bcc4f5d376dd2377-refs/heads/master@{#464641}

[modify] https://crrev.com/8f75642cf2ecc597f87a8a66aa227ec79e947db1/ui/arc/notification/arc_custom_notification_view.cc

Comment 9 by est...@chromium.org, May 19 2017

Cc: yoshiki@chromium.org
Labels: -Pri-1 -ReleaseBlock-Beta -M-59 M-60 Pri-2
Owner: edcourtney@chromium.org
the crash fix is merged, but the original idea of this bug (refactoring SlideOutHelper) still needs addressing, and I believe Eliot mentioned he was going to look into that.
Cc: est...@chromium.org
I've had a look into this - it seems like there are a few options. If anyone has any comments that would be useful:

1. Use NotificationSurface's Window's layer in SlideOutController
 - Shadows are still drawn on CustomNotificationView's layer
 - Need to draw both and apply the transform to both (2), or move shadow drawing to ArcCustomNotificationView (3)

2. Animate multiple layers in SlideOutController, leaving the shadow drawing in CustomNotificationView.
 - If the notification is updated while sliding, then NativeViewHost::Layout() changes the position of the aura window based on CustomNotificationView's layer transform. This means that we can't animate NotificationSurface's window's layer - it will also take on its parent window's transform, but only sometimes. If we only animated CustomNotificationView's layer, we would need to call ArcCustomNotificationView::Layout every time the layer transform changed.

3. Draw the shadow in ArcCustomNotificationView
 - Oshima-san suggested using wm::SetShadowElevation, but the shadow ends up being clipped by ClippingWindow. 
 - I haven't been able to find a good way to get ClippingWindow to be a different size to what it contains.
 - Still need to animate ArcCustomNotificationView's layer (as well as NotificationSurface's window's layer)

4. Use BoundsAnimator in SlideOutController, which directly calls SetBounds
 - Still need to animate opacity on the layers, and SlideOutController will need a BoundsAnimator.

5. Temporarily reparent the NotificationSurface layer to ArcCustomNotificationView
 - Aura expects the layer hierarchy to match the window hierarchy, so it's a bit dodgy
 
6. Make ArcCustomNotificationView not a child view of CustomNotificationView, and merge them
 - Would fix the underlying issue (will still have to animate multiple layers though), but seems like a big refactor, assuming we don't use virtual multiple inheritance with NativeViewHost and MessageView.

All these options seem like a lot of work, more hacky than SlideHelper, or both.
> more hacky than SlideHelper

Anything that doesn't make assumptions about the hierarchy of views/layers in a different file and fail silently when that other file changes is less hacky than SlideHelper.

For #1, isn't the CustomNotificationView a child of the NotificationSurface window's layer? I would have thought that sliding the parent layer would also move the child.
Sorry for going silent on this.

In the mean time there were a few changes: CustomNotificationView moved to ui/arc/notification and is now called ArcNotificationView. ArcCustomNotificationView is now called ArcNotificationContentView. 

My understanding is that:
In the View hierarchy, ArcNotificationContentView is a child of ArcNotificationView. ArcNotificationView is a child of MessageListView.

The parent window of NotificationSurface's window is ClippingWindow, which is parented to the Aura window for the message center, and the layer hierarchy follows this.

So we have three layers: ArcNotificationView's (where the shadow is drawn), ArcNotificationContentView's (where the snapshot is drawn), and NotficationSurface's (with the notification content). NotificationSurface's layer is like a sibling to the others, so it's hard to get it to move in step with them. In the options I listed above I tried temporarily re-parenting the layer to be a child of ArcNotificationContentView, which worked. However, I heard from Oshima-san that it's a bit dodgy to change the layer hierarchy to be different to the window hierarchy.
Owner: yoshiki@chromium.org
Reassigning to Yoshiki-san for now since I haven't had cycles to work on notifications code recently.
Cc: -yoshiki@chromium.org
Labels: -M-60 M-62
Components: UI>Notifications

Sign in to add a comment