use of android.content.UriPermission in project android_frameworks_base by ResurrectionRemix.
the class ActivityManagerProxy method getPersistedUriPermissions.
@Override
public ParceledListSlice<UriPermission> getPersistedUriPermissions(String packageName, boolean incoming) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
data.writeString(packageName);
data.writeInt(incoming ? 1 : 0);
mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
reply.readException();
@SuppressWarnings("unchecked") final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(reply);
data.recycle();
reply.recycle();
return perms;
}
use of android.content.UriPermission in project android_frameworks_base by crdroidandroid.
the class OpenExternalDirectoryActivity method getIntentForExistingPermission.
private static Intent getIntentForExistingPermission(OpenExternalDirectoryActivity activity, boolean isRoot, File root, File file) {
final String packageName = activity.getCallingPackage();
final ContentProviderClient storageClient = activity.getExternalStorageClient();
final Uri grantedUri = getGrantedUriPermission(activity, storageClient, file);
final Uri rootUri = root.equals(file) ? grantedUri : getGrantedUriPermission(activity, storageClient, root);
if (DEBUG)
Log.d(TAG, "checking if " + packageName + " already has permission for " + grantedUri + " or its root (" + rootUri + ")");
final ActivityManager am = (ActivityManager) activity.getSystemService(Context.ACTIVITY_SERVICE);
for (UriPermission uriPermission : am.getGrantedUriPermissions(packageName).getList()) {
final Uri uri = uriPermission.getUri();
if (uri == null) {
Log.w(TAG, "null URI for " + uriPermission);
continue;
}
if (uri.equals(grantedUri) || uri.equals(rootUri)) {
if (DEBUG)
Log.d(TAG, packageName + " already has permission: " + uriPermission);
return createGrantedUriPermissionsIntent(grantedUri);
}
}
if (DEBUG)
Log.d(TAG, packageName + " does not have permission for " + grantedUri);
return null;
}
use of android.content.UriPermission in project android_frameworks_base by crdroidandroid.
the class ActivityManagerProxy method getPersistedUriPermissions.
@Override
public ParceledListSlice<UriPermission> getPersistedUriPermissions(String packageName, boolean incoming) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
data.writeString(packageName);
data.writeInt(incoming ? 1 : 0);
mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
reply.readException();
@SuppressWarnings("unchecked") final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(reply);
data.recycle();
reply.recycle();
return perms;
}
Aggregations