Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3fff7bc3 authored by Fan Zhang's avatar Fan Zhang
Browse files

Move some subsetting launch to SubSettingLauncher

Bug: 73250851
Test: robotests
Change-Id: I1c3620d335eaf99bb110bcbb3e33ff3b2a05f84e
parent 615563db
Loading
Loading
Loading
Loading
+1 −29
Original line number Diff line number Diff line
@@ -412,26 +412,6 @@ public final class Utils extends com.android.settingslib.Utils {
                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 final class Utils extends com.android.settingslib.Utils {
    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 {
+7 −4
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ import android.support.annotation.VisibleForTesting;

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 @@ public class WallpaperSuggestionActivity extends Activity {
    @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