public static Intent redirectBroadcastIntent(Intent intent, int userId) { Intent newIntent = intent.cloneFilter(); newIntent.setComponent(null); newIntent.setPackage(null); ComponentName component = intent.getComponent(); String pkg = intent.getPackage(); if (component != null) { newIntent.putExtra("_VA_|_user_id_", userId); newIntent.setAction(String.format("_VA_%s_%s", component.getPackageName(), component.getClassName())); newIntent.putExtra("_VA_|_component_", component); newIntent.putExtra("_VA_|_intent_", new Intent(intent)); } else if (pkg != null) { newIntent.putExtra("_VA_|_user_id_", userId); newIntent.putExtra("_VA_|_creator_", pkg); newIntent.putExtra("_VA_|_intent_", new Intent(intent)); String protectedAction = SpecialComponentList.protectAction(intent.getAction()); if (protectedAction != null) { newIntent.setAction(protectedAction); } } else { newIntent.putExtra("_VA_|_user_id_", userId); newIntent.putExtra("_VA_|_intent_", new Intent(intent)); String protectedAction = SpecialComponentList.protectAction(intent.getAction()); if (protectedAction != null) { newIntent.setAction(protectedAction); } } return newIntent; }
@Test public void cloneFilter_shouldIncludeAction() { Intent intent = new Intent("FOO"); intent.cloneFilter(); assertThat(intent.getAction()).isEqualTo("FOO"); }
private Intent redirectIntentSender(int type, String creator, Intent intent) { Intent newIntent = intent.cloneFilter(); switch (type) { case ActivityManagerCompat.INTENT_SENDER_ACTIVITY: {
public static Intent redirectIntentSender(int type, String creator, Intent intent, IBinder iBinder) { Intent cloneFilter = intent.cloneFilter(); switch (type) { case 1:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent baseIntent = getIntent().getParcelableExtra("intent"); Bundle bundle = baseIntent.getExtras(); Intent intent = baseIntent.cloneFilter(); for (String key : bundle.keySet()) { intent.putExtra(key, bundle.get(key).toString()); } shareExceptCurrentApp(intent); finish(); }
public static Intent redirectBroadcastIntent(Intent intent, int userId) { Intent newIntent = intent.cloneFilter(); newIntent.setComponent(null); newIntent.setPackage(null); ComponentName component = intent.getComponent(); String pkg = intent.getPackage(); if (component != null) { newIntent.putExtra("_VA_|_user_id_", userId); newIntent.setAction(String.format("_VA_%s_%s", component.getPackageName(), component.getClassName())); newIntent.putExtra("_VA_|_component_", component); newIntent.putExtra("_VA_|_intent_", new Intent(intent)); } else if (pkg != null) { newIntent.putExtra("_VA_|_user_id_", userId); newIntent.putExtra("_VA_|_creator_", pkg); newIntent.putExtra("_VA_|_intent_", new Intent(intent)); String protectedAction = SpecialComponentList.protectAction(intent.getAction()); if (protectedAction != null) { newIntent.setAction(protectedAction); } } else { newIntent.putExtra("_VA_|_user_id_", userId); newIntent.putExtra("_VA_|_intent_", new Intent(intent)); String protectedAction = SpecialComponentList.protectAction(intent.getAction()); if (protectedAction != null) { newIntent.setAction(protectedAction); } } return newIntent; } }
public static Intent redirectBroadcastIntent(Intent intent, int userId) { Intent newIntent = intent.cloneFilter(); newIntent.setComponent(null); newIntent.setPackage(null); ComponentName component = intent.getComponent(); String pkg = intent.getPackage(); if (component != null) { newIntent.putExtra("_VA_|_user_id_", userId); newIntent.setAction(String.format("_VA_%s_%s", component.getPackageName(), component.getClassName())); newIntent.putExtra("_VA_|_component_", component); newIntent.putExtra("_VA_|_intent_", new Intent(intent)); } else if (pkg != null) { newIntent.putExtra("_VA_|_user_id_", userId); newIntent.putExtra("_VA_|_creator_", pkg); newIntent.putExtra("_VA_|_intent_", new Intent(intent)); String protectedAction = SpecialComponentList.protectAction(intent.getAction()); if (protectedAction != null) { newIntent.setAction(protectedAction); } } else { newIntent.putExtra("_VA_|_user_id_", userId); newIntent.putExtra("_VA_|_intent_", new Intent(intent)); String protectedAction = SpecialComponentList.protectAction(intent.getAction()); if (protectedAction != null) { newIntent.setAction(protectedAction); } } return newIntent; } }
private Intent redirectIntentSender(int type, String creator, Intent intent) { Intent newIntent = intent.cloneFilter(); switch (type) { case ActivityManagerCompat.INTENT_SENDER_ACTIVITY: {
private Intent redirectIntentSender(int type, String creator, Intent intent) { Intent newIntent = intent.cloneFilter(); switch (type) { case ActivityManagerCompat.INTENT_SENDER_ACTIVITY: {
/** * Common code to test invalid intent code path that will also test work around for restart. */ private void invalidIntent(Intent intent) { /* Test old browser restart workaround. */ when(intent.cloneFilter()).thenReturn(intent); when(intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)).thenReturn(intent); DeepLinkActivity activity = spy(new DeepLinkActivity()); when(activity.getIntent()).thenReturn(intent); activity.onCreate(null); /* Check interactions. */ verify(activity).startActivity(intent); verify(activity).finish(); verifyStatic(never()); Distribute.getInstance(); }
if (!((getIntent().getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK) == Intent.FLAG_ACTIVITY_NEW_TASK)) { AppCenterLog.debug(LOG_TAG, "Using restart work around to correctly resume app."); startActivity(intent.cloneFilter().addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); } else if (isTaskRoot()) { Intent launchIntentForPackage = getPackageManager().getLaunchIntentForPackage(getPackageName());