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
This commit is contained in:
@@ -51,9 +51,9 @@ public class WallpaperSuggestionActivity extends Activity {
|
||||
@VisibleForTesting
|
||||
void startFallbackSuggestion() {
|
||||
// fall back to default wallpaper picker
|
||||
Utils.startWithFragment(this, WallpaperTypeSettings.class.getName(), null, null, 0,
|
||||
R.string.wallpaper_suggestion_title, null,
|
||||
MetricsProto.MetricsEvent.DASHBOARD_SUMMARY);
|
||||
Utils.startWithFragment(this, WallpaperTypeSettings.class.getName(),
|
||||
R.string.wallpaper_suggestion_title, MetricsProto.MetricsEvent.DASHBOARD_SUMMARY,
|
||||
Intent.FLAG_ACTIVITY_FORWARD_RESULT);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings.wallpaper;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -67,7 +68,7 @@ public class WallpaperTypeSettings extends SettingsPreferenceFragment implements
|
||||
// Add Preference items for each of the matching activities
|
||||
for (ResolveInfo info : rList) {
|
||||
Preference pref = new Preference(getPrefContext());
|
||||
Intent prefIntent = new Intent(intent);
|
||||
Intent prefIntent = new Intent(intent).addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
|
||||
prefIntent.setComponent(new ComponentName(
|
||||
info.activityInfo.packageName, info.activityInfo.name));
|
||||
pref.setIntent(prefIntent);
|
||||
@@ -79,6 +80,16 @@ public class WallpaperTypeSettings extends SettingsPreferenceFragment implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(Preference preference) {
|
||||
if (preference.getIntent() == null) {
|
||||
return super.onPreferenceTreeClick(preference);
|
||||
}
|
||||
startActivity(preference.getIntent());
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
|
||||
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider() {
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user