Not use NEW_TASKS for Wallpaper & style's 2-pane UX

Refine launch mode to support 2-pane UX for Settings.

Bug: 197609643
Test: make RunSettingsRoboTests
Change-Id: I5212bbcf8c512fac571284379a29cf487f387c5a
This commit is contained in:
Kunhung Li
2021-09-30 14:19:18 +08:00
parent 0a942ab338
commit c692af2a76
3 changed files with 66 additions and 8 deletions

View File

@@ -31,6 +31,7 @@ import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.activityembedding.ActivityEmbeddingUtils;
import com.android.settings.core.BasePreferenceController;
import com.android.settingslib.RestrictedLockUtilsInternal;
import com.android.settingslib.RestrictedTopLevelPreference;
@@ -97,7 +98,8 @@ public class TopLevelWallpaperPreferenceController extends BasePreferenceControl
if (getPreferenceKey().equals(preference.getKey())) {
final Intent intent = new Intent().setComponent(
getComponentName()).putExtra(mWallpaperLaunchExtra, LAUNCHED_SETTINGS);
if (areStylesAvailable()) {
if (areStylesAvailable() && !ActivityEmbeddingUtils.isEmbeddingActivityEnabled(
mContext)) {
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
}
preference.getContext().startActivity(intent);