1 /*
2  * Copyright (C) 2015 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.webkit;
18 
19 import android.annotation.SystemApi;
20 import android.os.Parcel;
21 import android.os.Parcelable;
22 
23 import java.util.Arrays;
24 
25 /**
26  * @hide
27  */
28 @SystemApi
29 public final class WebViewProviderInfo implements Parcelable {
30 
WebViewProviderInfo(String packageName, String description, boolean availableByDefault, boolean isFallback, String[] signatures)31     public WebViewProviderInfo(String packageName, String description,
32             boolean availableByDefault, boolean isFallback, String[] signatures) {
33         this.packageName = packageName;
34         this.description = description;
35         this.availableByDefault = availableByDefault;
36         this.isFallback = isFallback;
37         this.signatures = signatures;
38     }
39 
40     // aidl stuff
41     public static final Parcelable.Creator<WebViewProviderInfo> CREATOR =
42         new Parcelable.Creator<WebViewProviderInfo>() {
43             public WebViewProviderInfo createFromParcel(Parcel in) {
44                 return new WebViewProviderInfo(in);
45             }
46 
47             public WebViewProviderInfo[] newArray(int size) {
48                 return new WebViewProviderInfo[size];
49             }
50         };
51 
WebViewProviderInfo(Parcel in)52     private WebViewProviderInfo(Parcel in) {
53         packageName = in.readString();
54         description = in.readString();
55         availableByDefault = (in.readInt() > 0);
56         isFallback = (in.readInt() > 0);
57         signatures = in.createStringArray();
58     }
59 
60     @Override
describeContents()61     public int describeContents() {
62         return 0;
63     }
64 
65     @Override
writeToParcel(Parcel out, int flags)66     public void writeToParcel(Parcel out, int flags) {
67         out.writeString(packageName);
68         out.writeString(description);
69         out.writeInt(availableByDefault ? 1 : 0);
70         out.writeInt(isFallback ? 1 : 0);
71         out.writeStringArray(signatures);
72     }
73 
74     // fields read from framework resource
75     public final String packageName;
76     public final String description;
77     public final boolean availableByDefault;
78     public final boolean isFallback;
79     public final String[] signatures;
80 }
81