diff --git a/tests/tapl/com/android/launcher3/tapl/Qsb.java b/tests/tapl/com/android/launcher3/tapl/Qsb.java index 5ca80a3fde..fe2a63dd57 100644 --- a/tests/tapl/com/android/launcher3/tapl/Qsb.java +++ b/tests/tapl/com/android/launcher3/tapl/Qsb.java @@ -22,6 +22,8 @@ import androidx.test.uiautomator.BySelector; import androidx.test.uiautomator.UiObject2; import androidx.test.uiautomator.Until; +import java.util.regex.Pattern; + /** * Operations on qsb from either Home screen or AllApp screen. */ @@ -30,7 +32,8 @@ public abstract class Qsb implements SearchInputSource { private static final String ASSISTANT_APP_PACKAGE = "com.google.android.googlequicksearchbox"; private static final String ASSISTANT_ICON_RES_ID = "mic_icon"; private static final String LENS_ICON_RES_ID = "lens_icon"; - private static final String LENS_APP_TEXT_RES_ID = "lens_camera_cutout_text"; + private static final Pattern LENS_APP_RES_PATTERN = Pattern.compile( + ASSISTANT_APP_PACKAGE + ":id/lens.*"); protected final LauncherInstrumentation mLauncher; private final UiObject2 mContainer; private final String mQsbResName; @@ -96,8 +99,8 @@ public abstract class Qsb implements SearchInputSource { try (LauncherInstrumentation.Closable c2 = mLauncher.addContextLayer("clicked")) { // Package name is not enough to check if the app is launched, because many // elements are having googlequicksearchbox as package name. So it checks if the - // corresponding text resource is displayed - BySelector selector = By.res(ASSISTANT_APP_PACKAGE, LENS_APP_TEXT_RES_ID); + // corresponding app resource is displayed + BySelector selector = By.res(LENS_APP_RES_PATTERN); mLauncher.assertTrue( "Lens app didn't start: (" + selector + ")", mLauncher.getDevice().wait(Until.hasObject(selector),