Move some subsetting launch to SubSettingLauncher

Bug: 73250851
Test: robotests
Change-Id: I1c3620d335eaf99bb110bcbb3e33ff3b2a05f84e
This commit is contained in:
Fan Zhang
2018-02-15 16:34:40 -08:00
parent 615563db0c
commit 3fff7bc35f
2 changed files with 8 additions and 33 deletions

View File

@@ -412,26 +412,6 @@ public final class Utils extends com.android.settingslib.Utils {
metricsCategory); 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. * 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 * When launched in this mode, the given preference fragment will be instantiated and fill the
@@ -463,17 +443,9 @@ public final class Utils extends com.android.settingslib.Utils {
public static void startWithFragment(Context context, String fragmentName, Bundle args, public static void startWithFragment(Context context, String fragmentName, Bundle args,
Fragment resultTo, int resultRequestCode, String titleResPackageName, int titleResId, Fragment resultTo, int resultRequestCode, String titleResPackageName, int titleResId,
CharSequence title, boolean isShortcut, int metricsCategory) { 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, Intent intent = onBuildStartFragmentIntent(context, fragmentName, args, titleResPackageName,
titleResId, title, isShortcut, metricsCategory); titleResId, title, isShortcut, metricsCategory);
intent.addFlags(flags); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (resultTo == null) { if (resultTo == null) {
context.startActivity(intent); context.startActivity(intent);
} else { } else {

View File

@@ -26,7 +26,7 @@ import android.support.annotation.VisibleForTesting;
import com.android.internal.logging.nano.MetricsProto; import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.Utils; import com.android.settings.core.SubSettingLauncher;
import com.android.settings.wrapper.WallpaperManagerWrapper; import com.android.settings.wrapper.WallpaperManagerWrapper;
public class WallpaperSuggestionActivity extends Activity { public class WallpaperSuggestionActivity extends Activity {
@@ -51,9 +51,12 @@ public class WallpaperSuggestionActivity extends Activity {
@VisibleForTesting @VisibleForTesting
void startFallbackSuggestion() { void startFallbackSuggestion() {
// fall back to default wallpaper picker // fall back to default wallpaper picker
Utils.startWithFragment(this, WallpaperTypeSettings.class.getName(), new SubSettingLauncher(this)
R.string.wallpaper_suggestion_title, MetricsProto.MetricsEvent.DASHBOARD_SUMMARY, .setDestination(WallpaperTypeSettings.class.getName())
Intent.FLAG_ACTIVITY_FORWARD_RESULT); .setTitle(R.string.wallpaper_suggestion_title)
.setSourceMetricsCategory(MetricsProto.MetricsEvent.DASHBOARD_SUMMARY)
.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT)
.launch();
} }
@VisibleForTesting @VisibleForTesting