Move some subsetting launch to SubSettingLauncher
Bug: 73250851
Test: robotests
Change-Id: I1c3620d335eaf99bb110bcbb3e33ff3b2a05f84e
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 7b3f73e..3923da5 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -412,26 +412,6 @@
metricsCategory);
}
-
- /**
- * Start a new instance of the activity, showing only the given fragment.
- * When launched in this mode, the given preference fragment will be instantiated and fill the
- * entire activity.
- *
- * @param context The context.
- * @param fragmentName The name of the fragment to display.
- * @param titleResId resource id for the String to display for the title of this set
- * of preferences.
- * @param metricsCategory The current metricsCategory for logging source when fragment starts
- * @param intentFlags flag that should be added to the intent.
- */
- public static void startWithFragment(Context context, String fragmentName, int titleResId,
- int metricsCategory, int intentFlags) {
- startWithFragment(context, fragmentName, null, null, 0,
- null /* titleResPackageName */, titleResId, null, false /* not a shortcut */,
- metricsCategory, intentFlags);
- }
-
/**
* Start a new instance of the activity, showing only the given fragment.
* When launched in this mode, the given preference fragment will be instantiated and fill the
@@ -463,17 +443,9 @@
public static void startWithFragment(Context context, String fragmentName, Bundle args,
Fragment resultTo, int resultRequestCode, String titleResPackageName, int titleResId,
CharSequence title, boolean isShortcut, int metricsCategory) {
- startWithFragment(context, fragmentName, args, resultTo, resultRequestCode,
- titleResPackageName, titleResId, title, isShortcut, metricsCategory,
- Intent.FLAG_ACTIVITY_NEW_TASK);
- }
-
- public static void startWithFragment(Context context, String fragmentName, Bundle args,
- Fragment resultTo, int resultRequestCode, String titleResPackageName, int titleResId,
- CharSequence title, boolean isShortcut, int metricsCategory, int flags) {
Intent intent = onBuildStartFragmentIntent(context, fragmentName, args, titleResPackageName,
titleResId, title, isShortcut, metricsCategory);
- intent.addFlags(flags);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (resultTo == null) {
context.startActivity(intent);
} else {
diff --git a/src/com/android/settings/wallpaper/WallpaperSuggestionActivity.java b/src/com/android/settings/wallpaper/WallpaperSuggestionActivity.java
index 8d798b1..0874cea 100644
--- a/src/com/android/settings/wallpaper/WallpaperSuggestionActivity.java
+++ b/src/com/android/settings/wallpaper/WallpaperSuggestionActivity.java
@@ -26,7 +26,7 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
-import com.android.settings.Utils;
+import com.android.settings.core.SubSettingLauncher;
import com.android.settings.wrapper.WallpaperManagerWrapper;
public class WallpaperSuggestionActivity extends Activity {
@@ -51,9 +51,12 @@
@VisibleForTesting
void startFallbackSuggestion() {
// fall back to default wallpaper picker
- Utils.startWithFragment(this, WallpaperTypeSettings.class.getName(),
- R.string.wallpaper_suggestion_title, MetricsProto.MetricsEvent.DASHBOARD_SUMMARY,
- Intent.FLAG_ACTIVITY_FORWARD_RESULT);
+ new SubSettingLauncher(this)
+ .setDestination(WallpaperTypeSettings.class.getName())
+ .setTitle(R.string.wallpaper_suggestion_title)
+ .setSourceMetricsCategory(MetricsProto.MetricsEvent.DASHBOARD_SUMMARY)
+ .addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT)
+ .launch();
}
@VisibleForTesting