blob: 11c9a7d19cda287bf3b45625fb420353539f7fc9 [file] [log] [blame]
Dianne Hackborn2af632f2009-07-08 14:56:37 -07001/*
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
17package android.content.pm;
18
19import android.os.Parcel;
20import android.os.Parcelable;
21import android.os.PatternMatcher;
22
23/**
24 * Description of permissions needed to access a particular path
25 * in a {@link ProviderInfo}.
26 */
27public class PathPermission extends PatternMatcher {
28 private final String mReadPermission;
29 private final String mWritePermission;
30
31 public PathPermission(String pattern, int type, String readPermission,
32 String writePermission) {
33 super(pattern, type);
34 mReadPermission = readPermission;
35 mWritePermission = writePermission;
36 }
37
38 public String getReadPermission() {
39 return mReadPermission;
40 }
41
42 public String getWritePermission() {
43 return mWritePermission;
44 }
45
46 public void writeToParcel(Parcel dest, int flags) {
47 super.writeToParcel(dest, flags);
48 dest.writeString(mReadPermission);
49 dest.writeString(mWritePermission);
50 }
51
52 public PathPermission(Parcel src) {
53 super(src);
54 mReadPermission = src.readString();
55 mWritePermission = src.readString();
56 }
57
Jeff Sharkey9e8f83d2019-02-28 12:06:45 -070058 public static final @android.annotation.NonNull Parcelable.Creator<PathPermission> CREATOR
Dianne Hackborn2af632f2009-07-08 14:56:37 -070059 = 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}