Clear WallpaperPicker task before launch am: 5f2cf8e695
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/13869868 Change-Id: I1aa28544148d1bfa2a1a249d6a919af9959a998d
This commit is contained in:
@@ -105,7 +105,7 @@ public class TopLevelWallpaperPreferenceController extends BasePreferenceControl
|
||||
final Intent intent = new Intent().setComponent(
|
||||
getComponentName()).putExtra(mWallpaperLaunchExtra, LAUNCHED_SETTINGS);
|
||||
if (areStylesAvailable()) {
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
}
|
||||
preference.getContext().startActivity(intent);
|
||||
return true;
|
||||
|
@@ -202,4 +202,20 @@ public class TopLevelWallpaperPreferenceControllerTest {
|
||||
assertThat(Shadows.shadowOf(mContext).getNextStartedActivityForResult()
|
||||
.intent.hasExtra("com.android.wallpaper.LAUNCH_SOURCE")).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handlePreferenceTreeClick_launchClearTask() {
|
||||
mShadowPackageManager.setResolveInfosForIntent(
|
||||
mWallpaperIntent, Lists.newArrayList());
|
||||
mShadowPackageManager.setResolveInfosForIntent(
|
||||
mStylesAndWallpaperIntent, Lists.newArrayList(mock(ResolveInfo.class)));
|
||||
|
||||
Preference preference = new Preference(mContext);
|
||||
preference.setKey(TEST_KEY);
|
||||
|
||||
mController.handlePreferenceTreeClick(preference);
|
||||
|
||||
assertThat((Shadows.shadowOf(mContext).getNextStartedActivityForResult()
|
||||
.intent.getFlags() & Intent.FLAG_ACTIVITY_CLEAR_TASK) != 0).isTrue();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user