Search in sources :

Example 96 with ProviderInfo

use of android.content.pm.ProviderInfo in project storio by pushtorefresh.

the class IntegrationTest method setUp.

@Before
public void setUp() {
    contentResolver = RuntimeEnvironment.application.getContentResolver();
    storIOContentResolver = DefaultStorIOContentResolver.builder().contentResolver(contentResolver).addTypeMapping(TestItem.class, ContentResolverTypeMapping.<TestItem>builder().putResolver(TestItem.PUT_RESOLVER).getResolver(TestItem.GET_RESOLVER).deleteResolver(TestItem.DELETE_RESOLVER).build()).build();
    ContentProviderController<IntegrationContentProvider> controller = Robolectric.buildContentProvider(IntegrationContentProvider.class);
    ProviderInfo providerInfo = new ProviderInfo();
    providerInfo.authority = IntegrationContentProvider.AUTHORITY;
    controller.create(providerInfo);
}
Also used : ProviderInfo(android.content.pm.ProviderInfo) Before(org.junit.Before)

Example 97 with ProviderInfo

use of android.content.pm.ProviderInfo in project platform_frameworks_base by android.

the class ActivityManagerService method installSystemProviders.

public final void installSystemProviders() {
    List<ProviderInfo> providers;
    synchronized (this) {
        ProcessRecord app = mProcessNames.get("system", Process.SYSTEM_UID);
        providers = generateApplicationProvidersLocked(app);
        if (providers != null) {
            for (int i = providers.size() - 1; i >= 0; i--) {
                ProviderInfo pi = (ProviderInfo) providers.get(i);
                if ((pi.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
                    Slog.w(TAG, "Not installing system proc provider " + pi.name + ": not system .apk");
                    providers.remove(i);
                }
            }
        }
    }
    if (providers != null) {
        mSystemThread.installSystemProviders(providers);
    }
    mCoreSettingsObserver = new CoreSettingsObserver(this);
    mFontScaleSettingObserver = new FontScaleSettingObserver();
//mUsageStatsService.monitorPackages();
}
Also used : ProviderInfo(android.content.pm.ProviderInfo) Point(android.graphics.Point)

Example 98 with ProviderInfo

use of android.content.pm.ProviderInfo in project platform_frameworks_base by android.

the class ActivityManagerService method revokeUriPermission.

/**
     * @param uri This uri must NOT contain an embedded userId.
     * @param userId The userId in which the uri is to be resolved.
     */
@Override
public void revokeUriPermission(IApplicationThread caller, Uri uri, final int modeFlags, int userId) {
    enforceNotIsolatedCaller("revokeUriPermission");
    synchronized (this) {
        final ProcessRecord r = getRecordForAppLocked(caller);
        if (r == null) {
            throw new SecurityException("Unable to find app for caller " + caller + " when revoking permission to uri " + uri);
        }
        if (uri == null) {
            Slog.w(TAG, "revokeUriPermission: null uri");
            return;
        }
        if (!Intent.isAccessUriMode(modeFlags)) {
            return;
        }
        final String authority = uri.getAuthority();
        final ProviderInfo pi = getProviderInfoLocked(authority, userId, MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE);
        if (pi == null) {
            Slog.w(TAG, "No content provider found for permission revoke: " + uri.toSafeString());
            return;
        }
        revokeUriPermissionLocked(r.uid, new GrantUri(userId, uri, false), modeFlags);
    }
}
Also used : ProviderInfo(android.content.pm.ProviderInfo)

Example 99 with ProviderInfo

use of android.content.pm.ProviderInfo in project platform_frameworks_base by android.

the class ActivityManagerService method getProviderInfoLocked.

private ProviderInfo getProviderInfoLocked(String authority, int userHandle, int pmFlags) {
    ProviderInfo pi = null;
    ContentProviderRecord cpr = mProviderMap.getProviderByName(authority, userHandle);
    if (cpr != null) {
        pi = cpr.info;
    } else {
        try {
            pi = AppGlobals.getPackageManager().resolveContentProvider(authority, PackageManager.GET_URI_PERMISSION_PATTERNS | pmFlags, userHandle);
        } catch (RemoteException ex) {
        }
    }
    return pi;
}
Also used : ProviderInfo(android.content.pm.ProviderInfo) RemoteException(android.os.RemoteException)

Example 100 with ProviderInfo

use of android.content.pm.ProviderInfo in project platform_frameworks_base by android.

the class ActivityManagerService method grantUriPermissionUncheckedLocked.

void grantUriPermissionUncheckedLocked(int targetUid, String targetPkg, GrantUri grantUri, final int modeFlags, UriPermissionOwner owner) {
    if (!Intent.isAccessUriMode(modeFlags)) {
        return;
    }
    if (DEBUG_URI_PERMISSION)
        Slog.v(TAG_URI_PERMISSION, "Granting " + targetPkg + "/" + targetUid + " permission to " + grantUri);
    final String authority = grantUri.uri.getAuthority();
    final ProviderInfo pi = getProviderInfoLocked(authority, grantUri.sourceUserId, MATCH_DEBUG_TRIAGED_MISSING);
    if (pi == null) {
        Slog.w(TAG, "No content provider found for grant: " + grantUri.toSafeString());
        return;
    }
    if ((modeFlags & Intent.FLAG_GRANT_PREFIX_URI_PERMISSION) != 0) {
        grantUri.prefix = true;
    }
    final UriPermission perm = findOrCreateUriPermissionLocked(pi.packageName, targetPkg, targetUid, grantUri);
    perm.grantModes(modeFlags, owner);
}
Also used : ProviderInfo(android.content.pm.ProviderInfo)

Aggregations

ProviderInfo (android.content.pm.ProviderInfo)200 ComponentName (android.content.ComponentName)43 RemoteException (android.os.RemoteException)36 ArrayList (java.util.ArrayList)33 PackageManager (android.content.pm.PackageManager)27 ResolveInfo (android.content.pm.ResolveInfo)23 ApplicationInfo (android.content.pm.ApplicationInfo)22 ServiceInfo (android.content.pm.ServiceInfo)16 Point (android.graphics.Point)16 VPackage (com.lody.virtual.server.pm.parser.VPackage)15 PackageInfo (android.content.pm.PackageInfo)14 Map (java.util.Map)14 Test (org.junit.Test)14 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)13 Uri (android.net.Uri)13 File (java.io.File)13 IPackageManager (android.content.pm.IPackageManager)12 ActivityInfo (android.content.pm.ActivityInfo)10 Before (org.junit.Before)10 Intent (android.content.Intent)8