From fd77ab618286de8dc764fb87e68d9ec8d1ec993f Mon Sep 17 00:00:00 2001 From: Wes Okuhara Date: Fri, 8 Nov 2024 12:12:16 -0800 Subject: [PATCH] Settings: Fix queryShortcuts_shouldOnlyIncludeSystemApp test Previously this test asserted that the ActivityInfo instances were the same address. While this can assert general equality, it is more robust to assert the ActivityInfo's properties- mainly that the associated application is a system app. Bug: b/314924127 Test: atest SettingsRoboTests:com.android.settings.shortcut.CreateShortcutPreferenceControllerTest Flag: TEST_ONLY Change-Id: I0d60fb848afdd40cecf3f3393421006ad1ff1086 --- .../shortcut/CreateShortcutPreferenceControllerTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/robotests/src/com/android/settings/shortcut/CreateShortcutPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/shortcut/CreateShortcutPreferenceControllerTest.java index 8442a37873b..522aa58a04e 100644 --- a/tests/robotests/src/com/android/settings/shortcut/CreateShortcutPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/shortcut/CreateShortcutPreferenceControllerTest.java @@ -116,7 +116,6 @@ public class CreateShortcutPreferenceControllerTest { .isEqualTo(SHORTCUT_ID_PREFIX + intent.getComponent().flattenToShortString()); } - @Ignore("b/314924127") @Test public void queryShortcuts_shouldOnlyIncludeSystemApp() { final ResolveInfo ri1 = new ResolveInfo(); @@ -137,7 +136,9 @@ public class CreateShortcutPreferenceControllerTest { doReturn(false).when(mController).canShowWifiHotspot(); final List info = mController.queryShortcuts(); assertThat(info).hasSize(1); - assertThat(info.get(0).activityInfo).isEqualTo(ri2.activityInfo); + final ActivityInfo resultActivityInfo = info.get(0).activityInfo; + assertThat(resultActivityInfo.name).isEqualTo(ri2.activityInfo.name); + assertThat(resultActivityInfo.applicationInfo.isSystemApp()).isTrue(); } @Ignore("b/314924127")