Avoid warning log from InteractionJankMonitor in VolumeDialogImpl

the two intents ACTION_CLOSE_SYSTEM_DIALOGS, ACTION_SCREEN_OFF
have a race in VolumeDialogImpl, so the JankLinster may begin
a tracing on a DialogView which has detachted from window.

Test: Manually press VolumeKey and Press power key to screen off
      InteractionJankMonitor warning log should not showing.
Bug: 232066671
Change-Id: Ic8f973372bbe1bda0f8dbab58d99269a2d766e46
This commit is contained in:
Bill Lin
2022-05-17 16:13:12 +08:00
parent a9cdc4a888
commit 7bba64785a

View File

@@ -1271,6 +1271,10 @@ public class VolumeDialogImpl implements VolumeDialog,
return new Animator.AnimatorListener() {
@Override
public void onAnimationStart(@NonNull Animator animation) {
if (!v.isAttachedToWindow()) {
if (D.BUG) Log.d(TAG, "onAnimationStart view do not attached to window:" + v);
return;
}
mInteractionJankMonitor.begin(Builder.withView(CUJ_VOLUME_CONTROL, v).setTag(type)
.setTimeout(timeout));
}