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);
}
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();
}
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);
}
}
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;
}
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);
}
Aggregations