From 63ef8cf1e73da2f957ffeebd36b0cf5bca5b2f75 Mon Sep 17 00:00:00 2001 From: Liran Binyamin Date: Sun, 18 Aug 2024 06:27:30 -0400 Subject: [PATCH] Deflake BubbleViewScreenshotTest Hiding the dot runs an animation which is flaky. Instead the bubble is created with the suppress notification flag. Flake: https://android-build.corp.google.com/abtd/run/L87700030005824088 ABTD 50x: https://android-build.corp.google.com/abtd/run/L03700030005851578 Flag: EXEMPT test only Bug: 355454021 Test: atest BubbleViewScreenshotTest Change-Id: I635eafb44a3e0ffb9b38fd83c8cc7b36822cce75 --- .../taskbar/bubbles/BubbleViewScreenshotTest.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/BubbleViewScreenshotTest.kt b/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/BubbleViewScreenshotTest.kt index 3e0d6b5424..d77ac5cff1 100644 --- a/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/BubbleViewScreenshotTest.kt +++ b/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/BubbleViewScreenshotTest.kt @@ -15,6 +15,7 @@ */ package com.android.launcher3.taskbar.bubbles +import android.app.Notification import android.content.Context import android.graphics.Bitmap import android.graphics.Canvas @@ -72,7 +73,7 @@ class BubbleViewScreenshotTest(emulationSpec: DeviceEmulationSpec) { fun bubbleView_seen() { screenshotRule.screenshotTest("bubbleView_seen") { activity -> activity.actionBar?.hide() - setupBubbleView().apply { markSeen() } + setupBubbleView(suppressNotification = true) } } @@ -84,7 +85,7 @@ class BubbleViewScreenshotTest(emulationSpec: DeviceEmulationSpec) { } } - private fun setupBubbleView(): BubbleView { + private fun setupBubbleView(suppressNotification: Boolean = false): BubbleView { val inflater = LayoutInflater.from(context) val iconSize = 100 @@ -95,7 +96,10 @@ class BubbleViewScreenshotTest(emulationSpec: DeviceEmulationSpec) { val icon = createCircleBitmap(radius = iconSize / 2, color = Color.LTGRAY) val badge = createCircleBitmap(radius = badgeRadius.toInt(), color = Color.RED) - val bubbleInfo = BubbleInfo("key", 0, null, null, 0, context.packageName, null, null, false) + val flags = + if (suppressNotification) Notification.BubbleMetadata.FLAG_SUPPRESS_NOTIFICATION else 0 + val bubbleInfo = + BubbleInfo("key", flags, null, null, 0, context.packageName, null, null, false) val bubbleView = inflater.inflate(R.layout.bubblebar_item_view, null) as BubbleView val dotPath = PathParser.createPathFromPathData(