1 /* 2 * Copyright (C) 2009 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.content.pm; 18 19 import android.os.Parcel; 20 import android.os.Parcelable; 21 import android.os.PatternMatcher; 22 23 /** 24 * Description of permissions needed to access a particular path 25 * in a {@link ProviderInfo}. 26 */ 27 public class PathPermission extends PatternMatcher { 28 private final String mReadPermission; 29 private final String mWritePermission; 30 PathPermission(String pattern, int type, String readPermission, String writePermission)31 public PathPermission(String pattern, int type, String readPermission, 32 String writePermission) { 33 super(pattern, type); 34 mReadPermission = readPermission; 35 mWritePermission = writePermission; 36 } 37 getReadPermission()38 public String getReadPermission() { 39 return mReadPermission; 40 } 41 getWritePermission()42 public String getWritePermission() { 43 return mWritePermission; 44 } 45 writeToParcel(Parcel dest, int flags)46 public void writeToParcel(Parcel dest, int flags) { 47 super.writeToParcel(dest, flags); 48 dest.writeString(mReadPermission); 49 dest.writeString(mWritePermission); 50 } 51 PathPermission(Parcel src)52 public PathPermission(Parcel src) { 53 super(src); 54 mReadPermission = src.readString(); 55 mWritePermission = src.readString(); 56 } 57 58 public static final @android.annotation.NonNull Parcelable.Creator<PathPermission> CREATOR 59 = new Parcelable.Creator<PathPermission>() { 60 public PathPermission createFromParcel(Parcel source) { 61 return new PathPermission(source); 62 } 63 64 public PathPermission[] newArray(int size) { 65 return new PathPermission[size]; 66 } 67 }; 68 }