use of android.content.pm.ProviderInfo in project VirtualApp by asLody.
the class VPackageManagerService method queryIntentContentProviders.
@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 null;
}
}
use of android.content.pm.ProviderInfo in project VirtualApp by asLody.
the class VPackageManagerService method getProviderInfo.
@Override
public ProviderInfo getProviderInfo(ComponentName component, int flags, int userId) {
checkUserId(userId);
flags = updateFlagsNought(flags);
synchronized (mPackages) {
VPackage p = mPackages.get(component.getPackageName());
if (p != null) {
PackageSetting ps = (PackageSetting) p.mExtras;
VPackage.ProviderComponent provider = mProvidersByComponent.get(component);
if (provider != null) {
ProviderInfo providerInfo = PackageParserEx.generateProviderInfo(provider, flags, ps.readUserState(userId), userId);
ComponentFixer.fixComponentInfo(ps, providerInfo, userId);
return providerInfo;
}
}
}
return null;
}
use of android.content.pm.ProviderInfo in project tray by grandcentrix.
the class TrayProviderTest method startupProvider.
public TrayContentProvider startupProvider() {
final TrayContentProvider provider = new TrayContentProvider();
provider.attachInfo(getProviderMockContext(), new ProviderInfo());
assertTrue(provider.onCreate());
assertTrue(provider.mUserDbHelper.getWritableDatabase().isOpen());
return provider;
}
use of android.content.pm.ProviderInfo in project XobotOS by xamarin.
the class ActivityThread method installContentProviders.
private void installContentProviders(Context context, List<ProviderInfo> providers) {
final ArrayList<IActivityManager.ContentProviderHolder> results = new ArrayList<IActivityManager.ContentProviderHolder>();
Iterator<ProviderInfo> i = providers.iterator();
while (i.hasNext()) {
ProviderInfo cpi = i.next();
StringBuilder buf = new StringBuilder(128);
buf.append("Pub ");
buf.append(cpi.authority);
buf.append(": ");
buf.append(cpi.name);
Log.i(TAG, buf.toString());
IContentProvider cp = installProvider(context, null, cpi, false);
if (cp != null) {
IActivityManager.ContentProviderHolder cph = new IActivityManager.ContentProviderHolder(cpi);
cph.provider = cp;
results.add(cph);
// Don't ever unload this provider from the process.
synchronized (mProviderMap) {
mProviderRefCountMap.put(cp.asBinder(), new ProviderRefCount(10000));
}
}
}
try {
ActivityManagerNative.getDefault().publishContentProviders(getApplicationThread(), results);
} catch (RemoteException ex) {
}
}
use of android.content.pm.ProviderInfo in project android_frameworks_base by DirtyUnicorns.
the class ActivityThread method installContentProviders.
private void installContentProviders(Context context, List<ProviderInfo> providers) {
final ArrayList<IActivityManager.ContentProviderHolder> results = new ArrayList<IActivityManager.ContentProviderHolder>();
for (ProviderInfo cpi : providers) {
if (DEBUG_PROVIDER) {
StringBuilder buf = new StringBuilder(128);
buf.append("Pub ");
buf.append(cpi.authority);
buf.append(": ");
buf.append(cpi.name);
Log.i(TAG, buf.toString());
}
IActivityManager.ContentProviderHolder cph = installProvider(context, null, cpi, false, /*noisy*/
true, /*noReleaseNeeded*/
true);
if (cph != null) {
cph.noReleaseNeeded = true;
results.add(cph);
}
}
try {
ActivityManagerNative.getDefault().publishContentProviders(getApplicationThread(), results);
} catch (RemoteException ex) {
throw ex.rethrowFromSystemServer();
}
}
Aggregations