Merge "Fix intent flags" into nyc-mr1-dev

This commit is contained in:
TreeHugger Robot
2016-07-22 20:34:43 +00:00
committed by Android (Google) Code Review
2 changed files with 32 additions and 13 deletions

View File

@@ -459,7 +459,7 @@ public class LauncherAppsService extends SystemService {
} }
// Note the target activity doesn't have to be exported. // Note the target activity doesn't have to be exported.
intents[0].setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intents[0].addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intents[0].setSourceBounds(sourceBounds); intents[0].setSourceBounds(sourceBounds);
return startShortcutIntentsAsPublisher( return startShortcutIntentsAsPublisher(

View File

@@ -2614,8 +2614,10 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
"Title 1", "Title 1",
makeComponent(ShortcutActivity.class), makeComponent(ShortcutActivity.class),
/* icon =*/ null, /* icon =*/ null,
makeIntent(Intent.ACTION_ASSIST, ShortcutActivity2.class, new Intent[] {makeIntent(Intent.ACTION_ASSIST, ShortcutActivity2.class,
"key1", "val1", "nest", makeBundle("key", 123)), "key1", "val1", "nest", makeBundle("key", 123))
.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK),
new Intent("act2").setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION)},
/* rank */ 10); /* rank */ 10);
final ShortcutInfo s1_2 = makeShortcut( final ShortcutInfo s1_2 = makeShortcut(
@@ -2658,10 +2660,19 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
}); });
runWithCaller(LAUNCHER_1, USER_0, () -> { runWithCaller(LAUNCHER_1, USER_0, () -> {
assertEquals( final Intent[] intents = launchShortcutAndGetIntents(CALLING_PACKAGE_1, "s1", USER_0);
ShortcutActivity2.class.getName(), assertEquals(ShortcutActivity2.class.getName(),
launchShortcutAndGetIntent(CALLING_PACKAGE_1, "s1", USER_0) intents[0].getComponent().getClassName());
.getComponent().getClassName()); assertEquals(Intent.ACTION_ASSIST,
intents[0].getAction());
assertEquals(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK,
intents[0].getFlags());
assertEquals("act2",
intents[1].getAction());
assertEquals(Intent.FLAG_ACTIVITY_NO_ANIMATION,
intents[1].getFlags());
assertEquals( assertEquals(
ShortcutActivity3.class.getName(), ShortcutActivity3.class.getName(),
launchShortcutAndGetIntent(CALLING_PACKAGE_1, "s2", USER_0) launchShortcutAndGetIntent(CALLING_PACKAGE_1, "s2", USER_0)
@@ -2682,10 +2693,18 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
runWithCaller(LAUNCHER_1, USER_0, () -> { runWithCaller(LAUNCHER_1, USER_0, () -> {
// Not the default launcher, but pinned shortcuts are still lauchable. // Not the default launcher, but pinned shortcuts are still lauchable.
assertEquals( final Intent[] intents = launchShortcutAndGetIntents(CALLING_PACKAGE_1, "s1", USER_0);
ShortcutActivity2.class.getName(), assertEquals(ShortcutActivity2.class.getName(),
launchShortcutAndGetIntent(CALLING_PACKAGE_1, "s1", USER_0) intents[0].getComponent().getClassName());
.getComponent().getClassName()); assertEquals(Intent.ACTION_ASSIST,
intents[0].getAction());
assertEquals(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK,
intents[0].getFlags());
assertEquals("act2",
intents[1].getAction());
assertEquals(Intent.FLAG_ACTIVITY_NO_ANIMATION,
intents[1].getFlags());
assertEquals( assertEquals(
ShortcutActivity3.class.getName(), ShortcutActivity3.class.getName(),
launchShortcutAndGetIntent(CALLING_PACKAGE_1, "s2", USER_0) launchShortcutAndGetIntent(CALLING_PACKAGE_1, "s2", USER_0)