FileDocCategorySizeDatePackage
UriPermissionOwner.javaAPI DocAndroid 5.1 API4491Thu Mar 12 22:22:42 GMT 2015com.android.server.am

UriPermissionOwner

public final class UriPermissionOwner extends Object

Fields Summary
final ActivityManagerService
service
final Object
owner
android.os.Binder
externalToken
private android.util.ArraySet
mReadPerms
private android.util.ArraySet
mWritePerms
Constructors Summary
UriPermissionOwner(ActivityManagerService service, Object owner)

        this.service = service;
        this.owner = owner;
    
Methods Summary
public voidaddReadPermission(UriPermission perm)

        if (mReadPerms == null) {
            mReadPerms = Sets.newArraySet();
        }
        mReadPerms.add(perm);
    
public voidaddWritePermission(UriPermission perm)

        if (mWritePerms == null) {
            mWritePerms = Sets.newArraySet();
        }
        mWritePerms.add(perm);
    
public voiddump(java.io.PrintWriter pw, java.lang.String prefix)

        if (mReadPerms != null) {
            pw.print(prefix); pw.print("readUriPermissions="); pw.println(mReadPerms);
        }
        if (mWritePerms != null) {
            pw.print(prefix); pw.print("writeUriPermissions="); pw.println(mWritePerms);
        }
    
static com.android.server.am.UriPermissionOwnerfromExternalToken(android.os.IBinder token)

        if (token instanceof ExternalToken) {
            return ((ExternalToken)token).getOwner();
        }
        return null;
    
android.os.BindergetExternalTokenLocked()

        if (externalToken == null) {
            externalToken = new ExternalToken();
        }
        return externalToken;
    
public voidremoveReadPermission(UriPermission perm)

        mReadPerms.remove(perm);
        if (mReadPerms.isEmpty()) {
            mReadPerms = null;
        }
    
voidremoveUriPermissionLocked(ActivityManagerService.GrantUri grantUri, int mode)

        if ((mode & Intent.FLAG_GRANT_READ_URI_PERMISSION) != 0
                && mReadPerms != null) {
            Iterator<UriPermission> it = mReadPerms.iterator();
            while (it.hasNext()) {
                UriPermission perm = it.next();
                if (grantUri == null || grantUri.equals(perm.uri)) {
                    perm.removeReadOwner(this);
                    service.removeUriPermissionIfNeededLocked(perm);
                    it.remove();
                }
            }
            if (mReadPerms.isEmpty()) {
                mReadPerms = null;
            }
        }
        if ((mode & Intent.FLAG_GRANT_WRITE_URI_PERMISSION) != 0
                && mWritePerms != null) {
            Iterator<UriPermission> it = mWritePerms.iterator();
            while (it.hasNext()) {
                UriPermission perm = it.next();
                if (grantUri == null || grantUri.equals(perm.uri)) {
                    perm.removeWriteOwner(this);
                    service.removeUriPermissionIfNeededLocked(perm);
                    it.remove();
                }
            }
            if (mWritePerms.isEmpty()) {
                mWritePerms = null;
            }
        }
    
voidremoveUriPermissionsLocked()

        removeUriPermissionsLocked(Intent.FLAG_GRANT_READ_URI_PERMISSION
                | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
    
voidremoveUriPermissionsLocked(int mode)

        removeUriPermissionLocked(null, mode);
    
public voidremoveWritePermission(UriPermission perm)

        mWritePerms.remove(perm);
        if (mWritePerms.isEmpty()) {
            mWritePerms = null;
        }
    
public java.lang.StringtoString()

        return owner.toString();