Don't use ActivityManagerTestBase
Test: atest NotificationManagerTest
Bug: 145602966
Change-Id: I4785cf9b66fd480c7c7df65e0f4f7b205689ac73
diff --git a/tests/app/src/android/app/cts/NotificationManagerTest.java b/tests/app/src/android/app/cts/NotificationManagerTest.java
index fcd6a0a..ad455b6 100644
--- a/tests/app/src/android/app/cts/NotificationManagerTest.java
+++ b/tests/app/src/android/app/cts/NotificationManagerTest.java
@@ -100,7 +100,6 @@
import android.provider.ContactsContract.Data;
import android.provider.Settings;
import android.provider.Telephony.Threads;
-import android.server.wm.ActivityManagerTestBase;
import android.service.notification.Condition;
import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
@@ -689,19 +688,12 @@
mContext.unregisterReceiver(mBubbleBroadcastReceiver);
}
- private class HomeHelper extends ActivityManagerTestBase implements AutoCloseable {
-
- HomeHelper() throws Exception {
- setUp();
- }
-
- void goHome() {
- launchHomeActivity();
- }
-
- @Override
- public void close() throws Exception {
- tearDown();
+ private static String goHome() {
+ try {
+ return SystemUtil.runShellCommand(InstrumentationRegistry.getInstrumentation(),
+ "am start -a android.intent.action.MAIN -c android.intent.category.HOME");
+ } catch (IOException e) {
+ throw new RuntimeException(e);
}
}
@@ -2977,8 +2969,7 @@
}
// Make ourselves not foreground
- HomeHelper homeHelper = new HomeHelper();
- homeHelper.goHome();
+ goHome();
// The notif should be allowed to update as a bubble
a.sendBubble(4001, false /* autoExpand */);
@@ -3000,7 +2991,6 @@
}
cleanupSendBubbleActivity();
- homeHelper.close();
} finally {
// turn off bubbles globally
toggleBubbleSetting(false);