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 @android.ravenwood.annotation.RavenwoodKeepWholeClass
28 public class PathPermission extends PatternMatcher {
29     private final String mReadPermission;
30     private final String mWritePermission;
31 
PathPermission(String pattern, int type, String readPermission, String writePermission)32     public PathPermission(String pattern, int type, String readPermission,
33             String writePermission) {
34         super(pattern, type);
35         mReadPermission = readPermission;
36         mWritePermission = writePermission;
37     }
38 
getReadPermission()39     public String getReadPermission() {
40         return mReadPermission;
41     }
42 
getWritePermission()43     public String getWritePermission() {
44         return mWritePermission;
45     }
46 
writeToParcel(Parcel dest, int flags)47     public void writeToParcel(Parcel dest, int flags) {
48         super.writeToParcel(dest, flags);
49         dest.writeString(mReadPermission);
50         dest.writeString(mWritePermission);
51     }
52 
PathPermission(Parcel src)53     public PathPermission(Parcel src) {
54         super(src);
55         mReadPermission = src.readString();
56         mWritePermission = src.readString();
57     }
58 
59     public static final @android.annotation.NonNull Parcelable.Creator<PathPermission> CREATOR
60             = new Parcelable.Creator<PathPermission>() {
61         public PathPermission createFromParcel(Parcel source) {
62             return new PathPermission(source);
63         }
64 
65         public PathPermission[] newArray(int size) {
66             return new PathPermission[size];
67         }
68     };
69 }