Forward wallpaper activity results to the caller.
- Added Activity.FLAG_ACTIVITY_FORWARD_RESULT to the intent that
launches the wallpaper activities.
- WallpaperSuggestionActivity also finishes itself after launching
intent.
Bug: 65691577
Test: Added robolectric test. Also verified manually that result code is
being forwarded
Change-Id: I2f8b0fac7a35c38e14c4a733b7552fd2e58dd0db
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index b108c62..d7064e6 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -504,6 +504,26 @@
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
@@ -544,8 +564,17 @@
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, 0);
+ }
+
+
+ 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);
if (resultTo == null) {
context.startActivity(intent);
} else {