Java Code Examples for android.content.Intent.getSelector()

The following are Jave code examples for showing how to use getSelector() of the android.content.Intent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: atlas   File: AdditionalPackageManager.java   View Source Code Vote up 6 votes
public List<ResolveInfo> queryIntentReceivers(Intent intent){
    if(intent==null){
        return null;
    }
    if(mExternalReceivers!=null) {
        ComponentName comp = intent.getComponent();
        if (comp == null) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
                if (intent.getSelector() != null) {
                    intent = intent.getSelector();
                    comp = intent.getComponent();
                }
            }
        }
        if (comp != null) {
            Object obj = mExternalReceivers.mComponents.get(comp);
            if (obj!=null){
                try {
                    List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
                    ResolveInfo info = new ResolveInfo();
                    info.activityInfo = (ActivityInfo) obj.getClass().getField("info").get(obj);
                    return list;
                }catch(Exception e){
                    return null;
                }
            }else{
                return null;
            }
        }else{
            // 先检测包名
            if (!TextUtils.isEmpty(intent.getPackage()) && !TextUtils.equals(intent.getPackage(), RuntimeVariables.androidApplication.getPackageName())) {
                return null;
            }
            return mExternalReceivers.queryIntent(intent,
                    intent.resolveTypeIfNeeded(RuntimeVariables.androidApplication.getContentResolver()), false);
        }
    }else{
        return null;
    }
}
 
Example 2
Project: VirtualAPK   File: LoadedPlugin.java   View Source Code Vote up 6 votes
@Override
public List<ResolveInfo> queryIntentActivities(Intent intent, int flags) {
    ComponentName component = intent.getComponent();
    if (null == component) {
        if (intent.getSelector() != null) {
            intent = intent.getSelector();
            component = intent.getComponent();
        }
    }

    if (null != component) {
        LoadedPlugin plugin = mPluginManager.getLoadedPlugin(component);
        if (null != plugin) {
            ActivityInfo activityInfo = plugin.getActivityInfo(component);
            if (activityInfo != null) {
                ResolveInfo resolveInfo = new ResolveInfo();
                resolveInfo.activityInfo = activityInfo;
                return Arrays.asList(resolveInfo);
            }
        }
    }

    List<ResolveInfo> all = new ArrayList<ResolveInfo>();

    List<ResolveInfo> pluginResolveInfos = mPluginManager.queryIntentActivities(intent, flags);
    if (null != pluginResolveInfos && pluginResolveInfos.size() > 0) {
        all.addAll(pluginResolveInfos);
    }

    List<ResolveInfo> hostResolveInfos = this.mHostPackageManager.queryIntentActivities(intent, flags);
    if (null != hostResolveInfos && hostResolveInfos.size() > 0) {
        all.addAll(hostResolveInfos);
    }

    return all;
}
 
Example 3
Project: VirtualAPK   File: LoadedPlugin.java   View Source Code Vote up 6 votes
@Override
public List<ResolveInfo> queryBroadcastReceivers(Intent intent, int flags) {
    ComponentName component = intent.getComponent();
    if (null == component) {
        if (intent.getSelector() != null) {
            intent = intent.getSelector();
            component = intent.getComponent();
        }
    }

    if (null != component) {
        LoadedPlugin plugin = mPluginManager.getLoadedPlugin(component);
        if (null != plugin) {
            ActivityInfo activityInfo = plugin.getReceiverInfo(component);
            if (activityInfo != null) {
                ResolveInfo resolveInfo = new ResolveInfo();
                resolveInfo.activityInfo = activityInfo;
                return Arrays.asList(resolveInfo);
            }
        }
    }

    List<ResolveInfo> all = new ArrayList<ResolveInfo>();

    List<ResolveInfo> pluginResolveInfos = mPluginManager.queryBroadcastReceivers(intent, flags);
    if (null != pluginResolveInfos && pluginResolveInfos.size() > 0) {
        all.addAll(pluginResolveInfos);
    }

    List<ResolveInfo> hostResolveInfos = this.mHostPackageManager.queryBroadcastReceivers(intent, flags);
    if (null != hostResolveInfos && hostResolveInfos.size() > 0) {
        all.addAll(hostResolveInfos);
    }

    return all;
}
 
Example 4
Project: VirtualAPK   File: LoadedPlugin.java   View Source Code Vote up 6 votes
@Override
public List<ResolveInfo> queryIntentServices(Intent intent, int flags) {
    ComponentName component = intent.getComponent();
    if (null == component) {
        if (intent.getSelector() != null) {
            intent = intent.getSelector();
            component = intent.getComponent();
        }
    }

    if (null != component) {
        LoadedPlugin plugin = mPluginManager.getLoadedPlugin(component);
        if (null != plugin) {
            ServiceInfo serviceInfo = plugin.getServiceInfo(component);
            if (serviceInfo != null) {
                ResolveInfo resolveInfo = new ResolveInfo();
                resolveInfo.serviceInfo = serviceInfo;
                return Arrays.asList(resolveInfo);
            }
        }
    }

    List<ResolveInfo> all = new ArrayList<ResolveInfo>();

    List<ResolveInfo> pluginResolveInfos = mPluginManager.queryIntentServices(intent, flags);
    if (null != pluginResolveInfos && pluginResolveInfos.size() > 0) {
        all.addAll(pluginResolveInfos);
    }

    List<ResolveInfo> hostResolveInfos = this.mHostPackageManager.queryIntentServices(intent, flags);
    if (null != hostResolveInfos && hostResolveInfos.size() > 0) {
        all.addAll(hostResolveInfos);
    }

    return all;
}
 
Example 5
Project: VirtualHook   File: VPackageManagerService.java   View Source Code Vote up 6 votes
@Override
public List<ResolveInfo> queryIntentActivities(Intent intent, String resolvedType, int flags, int userId) {
    checkUserId(userId);
    flags = updateFlagsNought(flags);
    ComponentName comp = intent.getComponent();
    if (comp == null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
            if (intent.getSelector() != null) {
                intent = intent.getSelector();
                comp = intent.getComponent();
            }
        }
    }
    if (comp != null) {
        final List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
        final ActivityInfo ai = getActivityInfo(comp, flags, userId);
        if (ai != null) {
            final ResolveInfo ri = new ResolveInfo();
            ri.activityInfo = ai;
            list.add(ri);
        }
        return list;
    }

    // reader
    synchronized (mPackages) {
        final String pkgName = intent.getPackage();
        if (pkgName == null) {
            return mActivities.queryIntent(intent, resolvedType, flags, userId);
        }
        final VPackage pkg = mPackages.get(pkgName);
        if (pkg != null) {
            return mActivities.queryIntentForPackage(intent, resolvedType, flags, pkg.activities, userId);
        }
        return Collections.emptyList();
    }
}
 
Example 6
Project: VirtualHook   File: VPackageManagerService.java   View Source Code Vote up 6 votes
@Override
public List<ResolveInfo> queryIntentReceivers(Intent intent, String resolvedType, int flags, int userId) {
    checkUserId(userId);
    flags = updateFlagsNought(flags);
    ComponentName comp = intent.getComponent();
    if (comp == null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
            if (intent.getSelector() != null) {
                intent = intent.getSelector();
                comp = intent.getComponent();
            }
        }
    }
    if (comp != null) {
        List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
        ActivityInfo ai = getReceiverInfo(comp, flags, userId);
        if (ai != null) {
            ResolveInfo ri = new ResolveInfo();
            ri.activityInfo = ai;
            list.add(ri);
        }
        return list;
    }

    // reader
    synchronized (mPackages) {
        String pkgName = intent.getPackage();
        if (pkgName == null) {
            return mReceivers.queryIntent(intent, resolvedType, flags, userId);
        }
        final VPackage pkg = mPackages.get(pkgName);
        if (pkg != null) {
            return mReceivers.queryIntentForPackage(intent, resolvedType, flags, pkg.receivers, userId);
        }
        return Collections.emptyList();
    }
}
 
Example 7
Project: VirtualHook   File: VPackageManagerService.java   View Source Code Vote up 6 votes
@Override
public List<ResolveInfo> queryIntentServices(Intent intent, String resolvedType, int flags, int userId) {
    checkUserId(userId);
    flags = updateFlagsNought(flags);
    ComponentName comp = intent.getComponent();
    if (comp == null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
            if (intent.getSelector() != null) {
                intent = intent.getSelector();
                comp = intent.getComponent();
            }
        }
    }
    if (comp != null) {
        final List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
        final ServiceInfo si = getServiceInfo(comp, flags, userId);
        if (si != null) {
            final ResolveInfo ri = new ResolveInfo();
            ri.serviceInfo = si;
            list.add(ri);
        }
        return list;
    }

    // reader
    synchronized (mPackages) {
        String pkgName = intent.getPackage();
        if (pkgName == null) {
            return mServices.queryIntent(intent, resolvedType, flags, userId);
        }
        final VPackage pkg = mPackages.get(pkgName);
        if (pkg != null) {
            return mServices.queryIntentForPackage(intent, resolvedType, flags, pkg.services, userId);
        }
        return Collections.emptyList();
    }
}
 
Example 8
Project: VirtualHook   File: VPackageManagerService.java   View Source Code Vote up 6 votes
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public List<ResolveInfo> queryIntentContentProviders(Intent intent, String resolvedType, int flags, int userId) {
    checkUserId(userId);
    flags = updateFlagsNought(flags);
    ComponentName comp = intent.getComponent();
    if (comp == null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
            if (intent.getSelector() != null) {
                intent = intent.getSelector();
                comp = intent.getComponent();
            }
        }
    }
    if (comp != null) {
        final List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
        final ProviderInfo pi = getProviderInfo(comp, flags, userId);
        if (pi != null) {
            final ResolveInfo ri = new ResolveInfo();
            ri.providerInfo = pi;
            list.add(ri);
        }
        return list;
    }
    // reader
    synchronized (mPackages) {
        String pkgName = intent.getPackage();
        if (pkgName == null) {
            return mProviders.queryIntent(intent, resolvedType, flags, userId);
        }
        final VPackage pkg = mPackages.get(pkgName);
        if (pkg != null) {
            return mProviders.queryIntentForPackage(intent, resolvedType, flags, pkg.providers, userId);
        }
        return Collections.emptyList();
    }
}
 
Example 9
Project: TPlayer   File: VPackageManagerService.java   View Source Code Vote up 6 votes
@Override
public List<ResolveInfo> queryIntentActivities(Intent intent, String resolvedType, int flags, int userId) {
    checkUserId(userId);
    flags = updateFlagsNought(flags);
    ComponentName comp = intent.getComponent();
    if (comp == null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
            if (intent.getSelector() != null) {
                intent = intent.getSelector();
                comp = intent.getComponent();
            }
        }
    }
    if (comp != null) {
        final List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
        final ActivityInfo ai = getActivityInfo(comp, flags, userId);
        if (ai != null) {
            final ResolveInfo ri = new ResolveInfo();
            ri.activityInfo = ai;
            list.add(ri);
        }
        return list;
    }

    // reader
    synchronized (mPackages) {
        final String pkgName = intent.getPackage();
        if (pkgName == null) {
            return mActivities.queryIntent(intent, resolvedType, flags, userId);
        }
        final VPackage pkg = mPackages.get(pkgName);
        if (pkg != null) {
            return mActivities.queryIntentForPackage(intent, resolvedType, flags, pkg.activities, userId);
        }
        return Collections.emptyList();
    }
}
 
Example 10
Project: TPlayer   File: VPackageManagerService.java   View Source Code Vote up 6 votes
@Override
public List<ResolveInfo> queryIntentReceivers(Intent intent, String resolvedType, int flags, int userId) {
    checkUserId(userId);
    flags = updateFlagsNought(flags);
    ComponentName comp = intent.getComponent();
    if (comp == null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
            if (intent.getSelector() != null) {
                intent = intent.getSelector();
                comp = intent.getComponent();
            }
        }
    }
    if (comp != null) {
        List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
        ActivityInfo ai = getReceiverInfo(comp, flags, userId);
        if (ai != null) {
            ResolveInfo ri = new ResolveInfo();
            ri.activityInfo = ai;
            list.add(ri);
        }
        return list;
    }

    // reader
    synchronized (mPackages) {
        String pkgName = intent.getPackage();
        if (pkgName == null) {
            return mReceivers.queryIntent(intent, resolvedType, flags, userId);
        }
        final VPackage pkg = mPackages.get(pkgName);
        if (pkg != null) {
            return mReceivers.queryIntentForPackage(intent, resolvedType, flags, pkg.receivers, userId);
        }
        return Collections.emptyList();
    }
}
 
Example 11
Project: TPlayer   File: VPackageManagerService.java   View Source Code Vote up 6 votes
@Override
public List<ResolveInfo> queryIntentServices(Intent intent, String resolvedType, int flags, int userId) {
    checkUserId(userId);
    flags = updateFlagsNought(flags);
    ComponentName comp = intent.getComponent();
    if (comp == null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
            if (intent.getSelector() != null) {
                intent = intent.getSelector();
                comp = intent.getComponent();
            }
        }
    }
    if (comp != null) {
        final List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
        final ServiceInfo si = getServiceInfo(comp, flags, userId);
        if (si != null) {
            final ResolveInfo ri = new ResolveInfo();
            ri.serviceInfo = si;
            list.add(ri);
        }
        return list;
    }

    // reader
    synchronized (mPackages) {
        String pkgName = intent.getPackage();
        if (pkgName == null) {
            return mServices.queryIntent(intent, resolvedType, flags, userId);
        }
        final VPackage pkg = mPackages.get(pkgName);
        if (pkg != null) {
            return mServices.queryIntentForPackage(intent, resolvedType, flags, pkg.services, userId);
        }
        return Collections.emptyList();
    }
}
 
Example 12
Project: TPlayer   File: VPackageManagerService.java   View Source Code Vote up 6 votes
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public List<ResolveInfo> queryIntentContentProviders(Intent intent, String resolvedType, int flags, int userId) {
    checkUserId(userId);
    flags = updateFlagsNought(flags);
    ComponentName comp = intent.getComponent();
    if (comp == null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
            if (intent.getSelector() != null) {
                intent = intent.getSelector();
                comp = intent.getComponent();
            }
        }
    }
    if (comp != null) {
        final List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
        final ProviderInfo pi = getProviderInfo(comp, flags, userId);
        if (pi != null) {
            final ResolveInfo ri = new ResolveInfo();
            ri.providerInfo = pi;
            list.add(ri);
        }
        return list;
    }
    // reader
    synchronized (mPackages) {
        String pkgName = intent.getPackage();
        if (pkgName == null) {
            return mProviders.queryIntent(intent, resolvedType, flags, userId);
        }
        final VPackage pkg = mPackages.get(pkgName);
        if (pkg != null) {
            return mProviders.queryIntentForPackage(intent, resolvedType, flags, pkg.providers, userId);
        }
        return Collections.emptyList();
    }
}
 
Example 13
Project: container   File: VPackageManagerService.java   View Source Code Vote up 6 votes
@Override
public List<ResolveInfo> queryIntentActivities(Intent intent, String resolvedType, int flags, int userId) {
	checkUserId(userId);
	ComponentName comp = intent.getComponent();
	if (comp == null) {
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
			if (intent.getSelector() != null) {
				intent = intent.getSelector();
				comp = intent.getComponent();
			}
		}
	}
	if (comp != null) {
		final List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
		final ActivityInfo ai = getActivityInfo(comp, flags, userId);
		if (ai != null) {
			final ResolveInfo ri = new ResolveInfo();
			ri.activityInfo = ai;
			list.add(ri);
		}
		return list;
	}

	// reader
	synchronized (mPackages) {
		final String pkgName = intent.getPackage();
		if (pkgName == null) {
			return mActivities.queryIntent(intent, resolvedType, flags);
		}
		final PackageParser.Package pkg = mPackages.get(pkgName);
		if (pkg != null) {
			return mActivities.queryIntentForPackage(intent, resolvedType, flags, pkg.activities);
		}
		return new ArrayList<ResolveInfo>();
	}
}
 
Example 14
Project: container   File: VPackageManagerService.java   View Source Code Vote up 6 votes
@Override
public List<ResolveInfo> queryIntentReceivers(Intent intent, String resolvedType, int flags, int userId) {
	ComponentName comp = intent.getComponent();
	if (comp == null) {
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
			if (intent.getSelector() != null) {
				intent = intent.getSelector();
				comp = intent.getComponent();
			}
		}
	}
	if (comp != null) {
		List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
		ActivityInfo ai = getReceiverInfo(comp, flags, userId);
		if (ai != null) {
			ResolveInfo ri = new ResolveInfo();
			ri.activityInfo = ai;
			list.add(ri);
		}
		return list;
	}

	// reader
	synchronized (mPackages) {
		String pkgName = intent.getPackage();
		if (pkgName == null) {
			return mReceivers.queryIntent(intent, resolvedType, flags);
		}
		final PackageParser.Package pkg = mPackages.get(pkgName);
		if (pkg != null) {
			return mReceivers.queryIntentForPackage(intent, resolvedType, flags, pkg.receivers);
		}
		return null;
	}
}
 
Example 15
Project: container   File: VPackageManagerService.java   View Source Code Vote up 6 votes
@Override
public List<ResolveInfo> queryIntentServices(Intent intent, String resolvedType, int flags, int userId) {
	checkUserId(userId);
	ComponentName comp = intent.getComponent();
	if (comp == null) {
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
			if (intent.getSelector() != null) {
				intent = intent.getSelector();
				comp = intent.getComponent();
			}
		}
	}
	if (comp != null) {
		final List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
		final ServiceInfo si = getServiceInfo(comp, flags, userId);
		if (si != null) {
			final ResolveInfo ri = new ResolveInfo();
			ri.serviceInfo = si;
			list.add(ri);
		}
		return list;
	}

	// reader
	synchronized (mPackages) {
		String pkgName = intent.getPackage();
		if (pkgName == null) {
			return mServices.queryIntent(intent, resolvedType, flags);
		}
		final PackageParser.Package pkg = mPackages.get(pkgName);
		if (pkg != null) {
			return mServices.queryIntentForPackage(intent, resolvedType, flags, pkg.services);
		}
		return null;
	}
}
 
Example 16
Project: container   File: VPackageManagerService.java   View Source Code Vote up 6 votes
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public List<ResolveInfo> queryIntentContentProviders(Intent intent, String resolvedType, int flags, int userId) {
	checkUserId(userId);
	ComponentName comp = intent.getComponent();
	if (comp == null) {
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
			if (intent.getSelector() != null) {
				intent = intent.getSelector();
				comp = intent.getComponent();
			}
		}
	}
	if (comp != null) {
		final List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
		final ProviderInfo pi = getProviderInfo(comp, flags, userId);
		if (pi != null) {
			final ResolveInfo ri = new ResolveInfo();
			ri.providerInfo = pi;
			list.add(ri);
		}
		return list;
	}
	// reader
	synchronized (mPackages) {
		String pkgName = intent.getPackage();
		if (pkgName == null) {
			return mProviders.queryIntent(intent, resolvedType, flags);
		}
		final PackageParser.Package pkg = mPackages.get(pkgName);
		if (pkg != null) {
			return mProviders.queryIntentForPackage(intent, resolvedType, flags, pkg.providers);
		}
		return null;
	}
}
 
Example 17
Project: atlas   File: AdditionalPackageManager.java   View Source Code Vote up 5 votes
private <T extends ComponentInfo> ResolveInfo queryIntentResolveInfo(Intent intent,Class<T> infoClass ){
    if(intent==null){
        return null;
    }
    AdditionalComponentIntentResolver resolver = null;
    if(infoClass == ActivityInfo.class){
        resolver = mExternalActivity;
    }else{
        resolver = mExternalServices;
    }
    if(resolver!=null) {
        ComponentName comp = intent.getComponent();
        if (comp == null) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
                if (intent.getSelector() != null) {
                    intent = intent.getSelector();
                    comp = intent.getComponent();
                }
            }
        }
        if (comp != null) {
            Object obj = resolver.mComponents.get(comp);
            if (obj!=null){
                try {
                    final ResolveInfo ri = new ExternalResolverInfo();
                    if(resolver == mExternalActivity) {
                        ri.activityInfo = (ActivityInfo) obj.getClass().getField("info").get(obj);
                    }else{
                        ri.serviceInfo = (ServiceInfo) obj.getClass().getField("info").get(obj);
                    }
                    return ri;
                }catch(Exception e){
                    return null;
                }
            }else{
                return null;
            }
        }else{
            // 先检测包名
            if (!TextUtils.isEmpty(intent.getPackage()) && !TextUtils.equals(intent.getPackage(), RuntimeVariables.androidApplication.getPackageName())) {
                return null;
            }
            List<ResolveInfo> list = resolver.queryIntent(intent,
                    intent.resolveTypeIfNeeded(RuntimeVariables.androidApplication.getContentResolver()), false);
            if(list!=null && list.size()>0){
                return new ExternalResolverInfo(list.get(0));
            }else{
                return null;
            }
        }
    }else{
        return null;
    }
}
 
Example 18
Project: chromium-for-android-56-debug-video   File: InstantAppsHandler.java   View Source Code Vote up 5 votes
private boolean handleIncomingIntentInternal(
        Context context, Intent intent, boolean isCustomTabsIntent, long startTime) {
    boolean isEnabled = isEnabled(context);
    if (!isEnabled || (isCustomTabsIntent && !IntentUtils.safeGetBooleanExtra(
            intent, CUSTOM_APPS_INSTANT_APP_EXTRA, false))) {
        Log.i(TAG, "Not handling with Instant Apps. Enabled? " + isEnabled);
        return false;
    }

    if (IntentUtils.safeGetBooleanExtra(intent, DO_NOT_LAUNCH_EXTRA, false)) {
        maybeRecordFallbackStats(intent);
        Log.i(TAG, "Not handling with Instant Apps (DO_NOT_LAUNCH_EXTRA)");
        return false;
    }

    if (IntentUtils.safeGetBooleanExtra(
            intent, IntentHandler.EXTRA_OPEN_NEW_INCOGNITO_TAB, false)
            || IntentUtils.safeHasExtra(intent, ShortcutHelper.EXTRA_SOURCE)
            || isIntentFromChrome(context, intent)
            || (IntentHandler.getUrlFromIntent(intent) == null)) {
        Log.i(TAG, "Not handling with Instant Apps (other)");
        return false;
    }

    // Used to search for the intent handlers. Needs null component to return correct results.
    Intent intentCopy = new Intent(intent);
    intentCopy.setComponent(null);
    Intent selector = intentCopy.getSelector();
    if (selector != null) selector.setComponent(null);

    if (!(isCustomTabsIntent || isChromeDefaultHandler(context))
            || ExternalNavigationDelegateImpl.isPackageSpecializedHandler(
                    context, null, intentCopy)) {
        // Chrome is not the default browser or a specialized handler exists.
        Log.i(TAG, "Not handling with Instant Apps because Chrome is not default or "
                + "there's a specialized handler");
        return false;
    }

    Intent callbackIntent = new Intent(intent);
    callbackIntent.putExtra(DO_NOT_LAUNCH_EXTRA, true);
    callbackIntent.putExtra(INSTANT_APP_START_TIME_EXTRA, startTime);

    return tryLaunchingInstantApp(context, intent, isCustomTabsIntent, callbackIntent);
}