Gustav Sennton | 6258dcd | 2015-10-30 19:25:37 +0000 | [diff] [blame] | 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 | |
Gustav Sennton | 1c177d8 | 2016-03-29 20:43:11 +0100 | [diff] [blame] | 19 | import android.annotation.SystemApi; |
Gustav Sennton | 6258dcd | 2015-10-30 19:25:37 +0000 | [diff] [blame] | 20 | import android.os.Parcel; |
| 21 | import android.os.Parcelable; |
Gustav Sennton | 6258dcd | 2015-10-30 19:25:37 +0000 | [diff] [blame] | 22 | |
| 23 | import java.util.Arrays; |
| 24 | |
Gustav Sennton | 1c177d8 | 2016-03-29 20:43:11 +0100 | [diff] [blame] | 25 | /** |
| 26 | * @hide |
| 27 | */ |
| 28 | @SystemApi |
Gustav Sennton | dbf5eb0 | 2016-03-30 14:53:03 +0100 | [diff] [blame] | 29 | public final class WebViewProviderInfo implements Parcelable { |
Gustav Sennton | 6258dcd | 2015-10-30 19:25:37 +0000 | [diff] [blame] | 30 | |
Gustav Sennton | dbf5eb0 | 2016-03-30 14:53:03 +0100 | [diff] [blame] | 31 | public WebViewProviderInfo(String packageName, String description, |
| 32 | boolean availableByDefault, boolean isFallback, String[] signatures) { |
Gustav Sennton | 6258dcd | 2015-10-30 19:25:37 +0000 | [diff] [blame] | 33 | this.packageName = packageName; |
| 34 | this.description = description; |
Gustav Sennton | c83e3fa | 2016-02-18 12:19:13 +0000 | [diff] [blame] | 35 | this.availableByDefault = availableByDefault; |
| 36 | this.isFallback = isFallback; |
Gustav Sennton | 5c2454c | 2015-12-17 15:49:33 +0000 | [diff] [blame] | 37 | this.signatures = signatures; |
Gustav Sennton | 6258dcd | 2015-10-30 19:25:37 +0000 | [diff] [blame] | 38 | } |
| 39 | |
Gustav Sennton | 6258dcd | 2015-10-30 19:25:37 +0000 | [diff] [blame] | 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 | |
| 52 | private WebViewProviderInfo(Parcel in) { |
| 53 | packageName = in.readString(); |
| 54 | description = in.readString(); |
Gustav Sennton | 8b17926 | 2016-03-14 11:31:14 +0000 | [diff] [blame] | 55 | availableByDefault = (in.readInt() > 0); |
| 56 | isFallback = (in.readInt() > 0); |
Gustav Sennton | 5c2454c | 2015-12-17 15:49:33 +0000 | [diff] [blame] | 57 | signatures = in.createStringArray(); |
Gustav Sennton | 6258dcd | 2015-10-30 19:25:37 +0000 | [diff] [blame] | 58 | } |
| 59 | |
| 60 | @Override |
| 61 | public int describeContents() { |
| 62 | return 0; |
| 63 | } |
| 64 | |
| 65 | @Override |
| 66 | public void writeToParcel(Parcel out, int flags) { |
| 67 | out.writeString(packageName); |
| 68 | out.writeString(description); |
Gustav Sennton | 8b17926 | 2016-03-14 11:31:14 +0000 | [diff] [blame] | 69 | out.writeInt(availableByDefault ? 1 : 0); |
| 70 | out.writeInt(isFallback ? 1 : 0); |
Gustav Sennton | 5c2454c | 2015-12-17 15:49:33 +0000 | [diff] [blame] | 71 | out.writeStringArray(signatures); |
Gustav Sennton | 6258dcd | 2015-10-30 19:25:37 +0000 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | // fields read from framework resource |
Gustav Sennton | dbf5eb0 | 2016-03-30 14:53:03 +0100 | [diff] [blame] | 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; |
Jeff Sharkey | c5967e9 | 2016-01-07 18:50:29 -0700 | [diff] [blame] | 80 | } |