Update TestLauncherActivity to send TAPL launcher stopped message

This removes the need for a workaround in LauncherInstrumentation.executeAndWaitForLauncherStop for FallbackRecentsTests with recents window enabled

Flag: com.android.launcher3.enable_fallback_overview_in_window
Bug: 377678992
Test: FallbackRecentsTest
Change-Id: I1b974cb2bfff4c14e99abb96c35dcdff04ed0be7
This commit is contained in:
Schneider Victor-Tulias
2025-05-13 17:06:51 -04:00
committed by Schneider Victor-tulias
parent 66923a912c
commit 9705f8fefa
11 changed files with 72 additions and 31 deletions
@@ -20,8 +20,12 @@ import static android.content.Intent.CATEGORY_LAUNCHER;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static android.content.Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED;
import static com.android.launcher3.testing.shared.TestProtocol.LAUNCHER_ACTIVITY_STOPPED_MESSAGE;
import android.app.LauncherActivity;
import android.content.Intent;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
public class TestLauncherActivity extends LauncherActivity {
@@ -31,4 +35,18 @@ public class TestLauncherActivity extends LauncherActivity {
.addCategory(CATEGORY_LAUNCHER)
.addFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
}
@Override
protected void onStop() {
super.onStop();
final AccessibilityManager accessibilityManager =
getSystemService(AccessibilityManager.class);
if (accessibilityManager == null || !accessibilityManager.isEnabled()) return;
final AccessibilityEvent e = AccessibilityEvent.obtain(
AccessibilityEvent.TYPE_ANNOUNCEMENT);
e.setClassName(LAUNCHER_ACTIVITY_STOPPED_MESSAGE);
e.setPackageName(getApplicationContext().getPackageName());
accessibilityManager.sendAccessibilityEvent(e);
}
}