Avoid launching activity-based feature to force stop exist actiivty and

recreate it.

Root cause: FLAG_ACTIVITY_CLEAR_TASK would cause the exist activity are finished and new one items to be started. It causes Live Transcribe main activity goes onStart call of new activity is followed by onStop call of old activity, which cause the mic stopping.

Solution: Remmove the FLAG_ACTIVITY_CLEAR_TASK.

Bug: 156455425
Test: Manual test
Change-Id: I86778577ff37d7f14b28e5eca3087fa9cf5cb2c1
This commit is contained in:
menghanli
2020-05-14 09:29:04 +08:00
parent 60920beb86
commit efabdcc7d6

View File

@@ -148,7 +148,7 @@ public class LaunchAccessibilityActivityPreferenceFragment extends
final Bundle bundle = ActivityOptions.makeBasic().setLaunchDisplayId(displayId).toBundle(); final Bundle bundle = ActivityOptions.makeBasic().setLaunchDisplayId(displayId).toBundle();
intent.setComponent(name); intent.setComponent(name);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try { try {
final int userId = UserHandle.myUserId(); final int userId = UserHandle.myUserId();
getPrefContext().startActivityAsUser(intent, bundle, UserHandle.of(userId)); getPrefContext().startActivityAsUser(intent, bundle, UserHandle.of(userId));