FileDocCategorySizeDatePackage
UriPermission.javaAPI DocAndroid 5.1 API3434Thu Mar 12 22:22:10 GMT 2015android.content

UriPermission

public final class UriPermission extends Object implements android.os.Parcelable
Description of a single Uri permission grant. This grants may have been created via {@link Intent#FLAG_GRANT_READ_URI_PERMISSION}, etc when sending an {@link Intent}, or explicitly through {@link Context#grantUriPermission(String, android.net.Uri, int)}.
see
ContentResolver#getPersistedUriPermissions()

Fields Summary
private final android.net.Uri
mUri
private final int
mModeFlags
private final long
mPersistedTime
public static final long
INVALID_TIME
Value returned when a permission has not been persisted.
public static final Creator
CREATOR
Constructors Summary
public UriPermission(android.net.Uri uri, int modeFlags, long persistedTime)
{@hide}


      
           
        mUri = uri;
        mModeFlags = modeFlags;
        mPersistedTime = persistedTime;
    
public UriPermission(android.os.Parcel in)
{@hide}

        mUri = in.readParcelable(null);
        mModeFlags = in.readInt();
        mPersistedTime = in.readLong();
    
Methods Summary
public intdescribeContents()

        return 0;
    
public longgetPersistedTime()
Return the time when this permission was first persisted, in milliseconds since January 1, 1970 00:00:00.0 UTC. Returns {@link #INVALID_TIME} if not persisted.

see
ContentResolver#takePersistableUriPermission(Uri, int)
see
System#currentTimeMillis()

        return mPersistedTime;
    
public android.net.UrigetUri()
Return the Uri this permission pertains to.

        return mUri;
    
public booleanisReadPermission()
Returns if this permission offers read access.

        return (mModeFlags & Intent.FLAG_GRANT_READ_URI_PERMISSION) != 0;
    
public booleanisWritePermission()
Returns if this permission offers write access.

        return (mModeFlags & Intent.FLAG_GRANT_WRITE_URI_PERMISSION) != 0;
    
public java.lang.StringtoString()

        return "UriPermission {uri=" + mUri + ", modeFlags=" + mModeFlags + ", persistedTime="
                + mPersistedTime + "}";
    
public voidwriteToParcel(android.os.Parcel dest, int flags)

        dest.writeParcelable(mUri, flags);
        dest.writeInt(mModeFlags);
        dest.writeLong(mPersistedTime);