Remove FLAG_ACTIVITY_NEW_TASk when there is transition

Making activities launch in a separate task breaks the page transition.
Reviewed the history of the addition of these flags, they seem stale and
are no longer needed, so remove these when the transition is applied.

Bug: 189412031
Test: Tap on any badged entry and see it being launched in the same
task.

Change-Id: I60b2ec0b2772cd3bdc8c4ebbc83cedd2a603492a
This commit is contained in:
Yi-Ling Chuang
2021-06-08 18:55:49 +08:00
parent 787685b2cc
commit 4d7da4a425

View File

@@ -28,6 +28,7 @@ import androidx.fragment.app.Fragment;
import com.android.settings.SettingsActivity;
import com.android.settings.SubSettings;
import com.android.settings.Utils;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import com.android.settingslib.transition.SettingsTransitionHelper.TransitionType;
@@ -181,8 +182,10 @@ public class SubSettingLauncher {
@VisibleForTesting
void launchAsUser(Intent intent, UserHandle userHandle) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
if (!Utils.isPageTransitionEnabled(mContext)) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
}
mContext.startActivityAsUser(intent, userHandle);
}