Search in sources :

Example 26 with ProviderInfo

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;
    }
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) VPackage(com.lody.virtual.server.pm.parser.VPackage) ProviderInfo(android.content.pm.ProviderInfo) ArrayList(java.util.ArrayList) ComponentName(android.content.ComponentName) TargetApi(android.annotation.TargetApi)

Example 27 with ProviderInfo

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;
}
Also used : VPackage(com.lody.virtual.server.pm.parser.VPackage) ProviderInfo(android.content.pm.ProviderInfo)

Example 28 with ProviderInfo

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;
}
Also used : ProviderInfo(android.content.pm.ProviderInfo)

Example 29 with ProviderInfo

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) {
    }
}
Also used : ProviderInfo(android.content.pm.ProviderInfo) IContentProvider(android.content.IContentProvider) ArrayList(java.util.ArrayList) RemoteException(android.os.RemoteException)

Example 30 with ProviderInfo

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();
    }
}
Also used : ProviderInfo(android.content.pm.ProviderInfo) ArrayList(java.util.ArrayList) RemoteException(android.os.RemoteException)

Aggregations

ProviderInfo (android.content.pm.ProviderInfo)114 RemoteException (android.os.RemoteException)36 ComponentName (android.content.ComponentName)27 PackageManager (android.content.pm.PackageManager)17 Point (android.graphics.Point)16 ArrayList (java.util.ArrayList)16 IPackageManager (android.content.pm.IPackageManager)12 ApplicationInfo (android.content.pm.ApplicationInfo)11 PackageInfo (android.content.pm.PackageInfo)10 Uri (android.net.Uri)9 PackageParser (android.content.pm.PackageParser)8 ResolveInfo (android.content.pm.ResolveInfo)8 IOException (java.io.IOException)8 ActivityInfo (android.content.pm.ActivityInfo)6 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)6 ServiceInfo (android.content.pm.ServiceInfo)6 SmallTest (android.test.suitebuilder.annotation.SmallTest)6 Context (android.content.Context)5 VPackage (com.lody.virtual.server.pm.parser.VPackage)5 Map (java.util.Map)5