当前位置: 首页>>代码示例>>Java>>正文


Java Intent.getSelector方法代码示例

本文整理汇总了Java中android.content.Intent.getSelector方法的典型用法代码示例。如果您正苦于以下问题:Java Intent.getSelector方法的具体用法?Java Intent.getSelector怎么用?Java Intent.getSelector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.Intent的用法示例。


在下文中一共展示了Intent.getSelector方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: queryIntentReceivers

import android.content.Intent; //导入方法依赖的package包/类
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;
    }
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:41,代码来源:AdditionalPackageManager.java

示例2: queryIntentActivities

import android.content.Intent; //导入方法依赖的package包/类
@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;
}
 
开发者ID:didi,项目名称:VirtualAPK,代码行数:37,代码来源:LoadedPlugin.java

示例3: queryBroadcastReceivers

import android.content.Intent; //导入方法依赖的package包/类
@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;
}
 
开发者ID:didi,项目名称:VirtualAPK,代码行数:37,代码来源:LoadedPlugin.java

示例4: queryIntentServices

import android.content.Intent; //导入方法依赖的package包/类
@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;
}
 
开发者ID:didi,项目名称:VirtualAPK,代码行数:37,代码来源:LoadedPlugin.java

示例5: queryIntentActivities

import android.content.Intent; //导入方法依赖的package包/类
@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();
    }
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:38,代码来源:VPackageManagerService.java

示例6: queryIntentReceivers

import android.content.Intent; //导入方法依赖的package包/类
@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();
    }
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:38,代码来源:VPackageManagerService.java

示例7: queryIntentServices

import android.content.Intent; //导入方法依赖的package包/类
@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();
    }
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:38,代码来源:VPackageManagerService.java

示例8: queryIntentContentProviders

import android.content.Intent; //导入方法依赖的package包/类
@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();
    }
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:38,代码来源:VPackageManagerService.java

示例9: queryIntentActivities

import android.content.Intent; //导入方法依赖的package包/类
@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>();
	}
}
 
开发者ID:codehz,项目名称:container,代码行数:37,代码来源:VPackageManagerService.java

示例10: queryIntentReceivers

import android.content.Intent; //导入方法依赖的package包/类
@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;
	}
}
 
开发者ID:codehz,项目名称:container,代码行数:36,代码来源:VPackageManagerService.java

示例11: queryIntentServices

import android.content.Intent; //导入方法依赖的package包/类
@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;
	}
}
 
开发者ID:codehz,项目名称:container,代码行数:37,代码来源:VPackageManagerService.java

示例12: queryIntentContentProviders

import android.content.Intent; //导入方法依赖的package包/类
@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;
	}
}
 
开发者ID:codehz,项目名称:container,代码行数:37,代码来源:VPackageManagerService.java

示例13: queryIntentResolveInfo

import android.content.Intent; //导入方法依赖的package包/类
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;
    }
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:55,代码来源:AdditionalPackageManager.java

示例14: handleIncomingIntentInternal

import android.content.Intent; //导入方法依赖的package包/类
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);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:46,代码来源:InstantAppsHandler.java


注:本文中的android.content.Intent.getSelector方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。