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


Java PackageParser.Provider方法代码示例

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


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

示例1: queryContentProviders

import android.content.pm.PackageParser; //导入方法依赖的package包/类
@Override
public VParceledListSlice<ProviderInfo> queryContentProviders(String processName, int vuid, int flags) {
	int userId = VUserHandle.getUserId(vuid);
	checkUserId(userId);
	ArrayList<ProviderInfo> finalList = new ArrayList<>(3);
	// reader
	synchronized (mPackages) {
		for (PackageParser.Provider p : mProvidersByComponent.values()) {
			AppSetting setting = (AppSetting) p.owner.mExtras;
			if (processName == null || setting.appId == VUserHandle.getAppId(vuid) && p.info.processName.equals(processName)) {
				ProviderInfo providerInfo = PackageParserCompat.generateProviderInfo(p, flags);
				ComponentFixer.fixApplicationInfo(setting, providerInfo.applicationInfo, userId);
				finalList.add(providerInfo);
			}
		}
	}
	if (!finalList.isEmpty()) {
		Collections.sort(finalList, mProviderInitOrderSorter);
	}
	return new VParceledListSlice<>(finalList);
}
 
开发者ID:codehz,项目名称:container,代码行数:22,代码来源:VPackageManagerService.java

示例2: queryIntentForPackage

import android.content.pm.PackageParser; //导入方法依赖的package包/类
public List<ResolveInfo> queryIntentForPackage(Intent intent, String resolvedType, int flags,
		ArrayList<PackageParser.Provider> packageProviders) {
	if (packageProviders == null) {
		return null;
	}
	mFlags = flags;
	final boolean defaultOnly = (flags & PackageManager.MATCH_DEFAULT_ONLY) != 0;
	final int N = packageProviders.size();
	ArrayList<PackageParser.ProviderIntentInfo[]> listCut = new ArrayList<>(N);

	ArrayList<PackageParser.ProviderIntentInfo> intentFilters;
	for (int i = 0; i < N; ++i) {
		intentFilters = packageProviders.get(i).intents;
		if (intentFilters != null && intentFilters.size() > 0) {
			PackageParser.ProviderIntentInfo[] array = new PackageParser.ProviderIntentInfo[intentFilters
					.size()];
			intentFilters.toArray(array);
			listCut.add(array);
		}
	}
	return super.queryIntentFromList(intent, resolvedType, defaultOnly, listCut);
}
 
开发者ID:codehz,项目名称:container,代码行数:23,代码来源:ProviderIntentResolver.java

示例3: newResult

import android.content.pm.PackageParser; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
protected ResolveInfo newResult(PackageParser.ProviderIntentInfo filter, int match) {
	final PackageParser.Provider provider = filter.provider;
	ProviderInfo pi = PackageParserCompat.generateProviderInfo(provider, mFlags);
	if (pi == null) {
		return null;
	}
	final ResolveInfo res = new ResolveInfo();
	res.providerInfo = pi;
	if ((mFlags & PackageManager.GET_RESOLVED_FILTER) != 0) {
		res.filter = filter;
	}
	res.priority = filter.getPriority();
	res.preferredOrder = provider.owner.mPreferredOrder;
	res.match = match;
	res.isDefault = filter.hasDefault;
	res.labelRes = filter.labelRes;
	res.nonLocalizedLabel = filter.nonLocalizedLabel;
	res.icon = filter.icon;
	return res;
}
 
开发者ID:codehz,项目名称:container,代码行数:23,代码来源:ProviderIntentResolver.java

示例4: ProviderComponent

import android.content.pm.PackageParser; //导入方法依赖的package包/类
public ProviderComponent(PackageParser.Provider provider) {
    super(provider);
    if (provider.intents != null) {
        this.intents = new ArrayList<>(provider.intents.size());
        for (Object o : provider.intents) {
            intents.add(new ProviderIntentInfo((PackageParser.IntentInfo) o));
        }
    }
    this.info = provider.info;
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:11,代码来源:VPackage.java

示例5: getProviderInfo

import android.content.pm.PackageParser; //导入方法依赖的package包/类
@Override
public ProviderInfo getProviderInfo(ComponentName component, int flags, int userId) {
	checkUserId(userId);
	synchronized (mPackages) {
		PackageParser.Provider p = mProvidersByComponent.get(component);
		if (p != null) {
			ProviderInfo providerInfo = PackageParserCompat.generateProviderInfo(p, flags);
			PackageParser.Package pkg = mPackages.get(providerInfo.packageName);
			AppSetting settings = (AppSetting) pkg.mExtras;
			ComponentFixer.fixComponentInfo(settings, providerInfo, userId);
			return providerInfo;
		}
	}
	return null;
}
 
开发者ID:codehz,项目名称:container,代码行数:16,代码来源:VPackageManagerService.java

示例6: resolveContentProvider

import android.content.pm.PackageParser; //导入方法依赖的package包/类
@Override
public ProviderInfo resolveContentProvider(String name, int flags, int userId) {
	checkUserId(userId);
	synchronized (mPackages) {
		final PackageParser.Provider provider = mProvidersByAuthority.get(name);
		if (provider != null) {
			ProviderInfo providerInfo = PackageParserCompat.generateProviderInfo(provider, flags);
			PackageParser.Package p = mPackages.get(providerInfo.packageName);
			AppSetting settings = (AppSetting) p.mExtras;
			ComponentFixer.fixComponentInfo(settings, providerInfo, userId);
			return providerInfo;
		}
	}
	return null;
}
 
开发者ID:codehz,项目名称:container,代码行数:16,代码来源:VPackageManagerService.java

示例7: addProvider

import android.content.pm.PackageParser; //导入方法依赖的package包/类
public final void addProvider(PackageParser.Provider p) {
	if (mProviders.containsKey(p.getComponentName())) {
		VLog.w(TAG, "Provider " + p.getComponentName() + " already defined; ignoring");
		return;
	}

	mProviders.put(p.getComponentName(), p);
	final int NI = p.intents.size();
	int j;
	for (j = 0; j < NI; j++) {
		PackageParser.ProviderIntentInfo intent = p.intents.get(j);
		addFilter(intent);
	}
}
 
开发者ID:codehz,项目名称:container,代码行数:15,代码来源:ProviderIntentResolver.java

示例8: removeProvider

import android.content.pm.PackageParser; //导入方法依赖的package包/类
public final void removeProvider(PackageParser.Provider p) {
	mProviders.remove(p.getComponentName());
	final int NI = p.intents.size();
	int j;
	for (j = 0; j < NI; j++) {
		PackageParser.ProviderIntentInfo intent = p.intents.get(j);
		removeFilter(intent);
	}
}
 
开发者ID:codehz,项目名称:container,代码行数:10,代码来源:ProviderIntentResolver.java

示例9: LoadedPlugin

import android.content.pm.PackageParser; //导入方法依赖的package包/类
LoadedPlugin(PluginManager pluginManager, Context context, File apk) throws PackageParser.PackageParserException {
    this.mPluginManager = pluginManager;
    this.mHostContext = context;
    this.mLocation = apk.getAbsolutePath();
    this.mPackage = PackageParserCompat.parsePackage(context, apk, PackageParser.PARSE_MUST_BE_APK);
    this.mPackage.applicationInfo.metaData = this.mPackage.mAppMetaData;
    this.mPackageInfo = new PackageInfo();
    this.mPackageInfo.applicationInfo = this.mPackage.applicationInfo;
    this.mPackageInfo.applicationInfo.sourceDir = apk.getAbsolutePath();
    this.mPackageInfo.signatures = this.mPackage.mSignatures;
    this.mPackageInfo.packageName = this.mPackage.packageName;
    if (pluginManager.getLoadedPlugin(mPackageInfo.packageName) != null) {
        throw new RuntimeException("plugin has already been loaded : " + mPackageInfo.packageName);
    }
    this.mPackageInfo.versionCode = this.mPackage.mVersionCode;
    this.mPackageInfo.versionName = this.mPackage.mVersionName;
    this.mPackageInfo.permissions = new PermissionInfo[0];
    this.mPackageManager = new PluginPackageManager();
    this.mPluginContext = new PluginContext(this);
    this.mNativeLibDir = context.getDir(Constants.NATIVE_DIR, Context.MODE_PRIVATE);
    this.mResources = createResources(context, apk);
    this.mClassLoader = createClassLoader(context, apk, this.mNativeLibDir, context.getClassLoader());

    tryToCopyNativeLib(apk);

    // Cache instrumentations
    Map<ComponentName, InstrumentationInfo> instrumentations = new HashMap<ComponentName, InstrumentationInfo>();
    for (PackageParser.Instrumentation instrumentation : this.mPackage.instrumentation) {
        instrumentations.put(instrumentation.getComponentName(), instrumentation.info);
    }
    this.mInstrumentationInfos = Collections.unmodifiableMap(instrumentations);
    this.mPackageInfo.instrumentation = instrumentations.values().toArray(new InstrumentationInfo[instrumentations.size()]);

    // Cache activities
    Map<ComponentName, ActivityInfo> activityInfos = new HashMap<ComponentName, ActivityInfo>();
    for (PackageParser.Activity activity : this.mPackage.activities) {
        activityInfos.put(activity.getComponentName(), activity.info);
    }
    this.mActivityInfos = Collections.unmodifiableMap(activityInfos);
    this.mPackageInfo.activities = activityInfos.values().toArray(new ActivityInfo[activityInfos.size()]);

    // Cache services
    Map<ComponentName, ServiceInfo> serviceInfos = new HashMap<ComponentName, ServiceInfo>();
    for (PackageParser.Service service : this.mPackage.services) {
        serviceInfos.put(service.getComponentName(), service.info);
    }
    this.mServiceInfos = Collections.unmodifiableMap(serviceInfos);
    this.mPackageInfo.services = serviceInfos.values().toArray(new ServiceInfo[serviceInfos.size()]);

    // Cache providers
    Map<String, ProviderInfo> providers = new HashMap<String, ProviderInfo>();
    Map<ComponentName, ProviderInfo> providerInfos = new HashMap<ComponentName, ProviderInfo>();
    for (PackageParser.Provider provider : this.mPackage.providers) {
        providers.put(provider.info.authority, provider.info);
        providerInfos.put(provider.getComponentName(), provider.info);
    }
    this.mProviders = Collections.unmodifiableMap(providers);
    this.mProviderInfos = Collections.unmodifiableMap(providerInfos);
    this.mPackageInfo.providers = providerInfos.values().toArray(new ProviderInfo[providerInfos.size()]);

    // Register broadcast receivers dynamically
    Map<ComponentName, ActivityInfo> receivers = new HashMap<ComponentName, ActivityInfo>();
    for (PackageParser.Activity receiver : this.mPackage.receivers) {
        receivers.put(receiver.getComponentName(), receiver.info);

        try {
            BroadcastReceiver br = BroadcastReceiver.class.cast(getClassLoader().loadClass(receiver.getComponentName().getClassName()).newInstance());
            for (PackageParser.ActivityIntentInfo aii : receiver.intents) {
                this.mHostContext.registerReceiver(br, aii);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    this.mReceiverInfos = Collections.unmodifiableMap(receivers);
    this.mPackageInfo.receivers = receivers.values().toArray(new ActivityInfo[receivers.size()]);
}
 
开发者ID:didi,项目名称:VirtualAPK,代码行数:78,代码来源:LoadedPlugin.java


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