本文整理了Java中android.content.Intent.cloneFilter()
方法的一些代码示例,展示了Intent.cloneFilter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Intent.cloneFilter()
方法的具体详情如下:
包路径:android.content.Intent
类名称:Intent
方法名:cloneFilter
暂无
代码示例来源:origin: android-hacker/VirtualXposed
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;
}
代码示例来源:origin: robolectric/robolectric
@Test
public void cloneFilter_shouldIncludeAction() {
Intent intent = new Intent("FOO");
intent.cloneFilter();
assertThat(intent.getAction()).isEqualTo("FOO");
}
代码示例来源:origin: android-hacker/VirtualXposed
private Intent redirectIntentSender(int type, String creator, Intent intent) {
Intent newIntent = intent.cloneFilter();
switch (type) {
case ActivityManagerCompat.INTENT_SENDER_ACTIVITY: {
代码示例来源:origin: android-hacker/VirtualXposed
public static Intent redirectIntentSender(int type, String creator, Intent intent, IBinder iBinder) {
Intent cloneFilter = intent.cloneFilter();
switch (type) {
case 1:
代码示例来源:origin: tengusw/share_to_clipboard
@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();
}
代码示例来源:origin: darkskygit/VirtualApp
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;
}
}
代码示例来源:origin: bzsome/VirtualApp-x326
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;
}
}
代码示例来源:origin: darkskygit/VirtualApp
private Intent redirectIntentSender(int type, String creator, Intent intent) {
Intent newIntent = intent.cloneFilter();
switch (type) {
case ActivityManagerCompat.INTENT_SENDER_ACTIVITY: {
代码示例来源:origin: bzsome/VirtualApp-x326
private Intent redirectIntentSender(int type, String creator, Intent intent) {
Intent newIntent = intent.cloneFilter();
switch (type) {
case ActivityManagerCompat.INTENT_SENDER_ACTIVITY: {
代码示例来源:origin: Microsoft/AppCenter-SDK-Android
/**
* 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();
}
代码示例来源:origin: Microsoft/AppCenter-SDK-Android
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());
内容来源于网络,如有侵权,请联系作者删除!