1 /*
2  * Copyright (C) 2021 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.graphics.fonts;
18 
19 import android.annotation.NonNull;
20 import android.annotation.SystemApi;
21 import android.os.ParcelFileDescriptor;
22 
23 import java.util.Objects;
24 
25 /**
26  * Request for updating a font file on the system.
27  *
28  * @hide
29  */
30 @SystemApi
31 public final class FontFileUpdateRequest {
32 
33     private final ParcelFileDescriptor mParcelFileDescriptor;
34     private final byte[] mSignature;
35 
36     /**
37      * Creates a FontFileUpdateRequest with the given file and signature.
38      *
39      * @param parcelFileDescriptor A file descriptor of the font file.
40      * @param signature            A PKCS#7 detached signature for verifying the font file.
41      */
FontFileUpdateRequest(@onNull ParcelFileDescriptor parcelFileDescriptor, @NonNull byte[] signature)42     public FontFileUpdateRequest(@NonNull ParcelFileDescriptor parcelFileDescriptor,
43             @NonNull byte[] signature) {
44         Objects.requireNonNull(parcelFileDescriptor);
45         Objects.requireNonNull(signature);
46         mParcelFileDescriptor = parcelFileDescriptor;
47         mSignature = signature;
48     }
49 
50     /**
51      * Returns the file descriptor of the font file.
52      */
53     @NonNull
getParcelFileDescriptor()54     public ParcelFileDescriptor getParcelFileDescriptor() {
55         return mParcelFileDescriptor;
56     }
57 
58     /**
59      * Returns the PKCS#7 detached signature for verifying the font file.
60      */
61     @NonNull
getSignature()62     public byte[] getSignature() {
63         return mSignature;
64     }
65 }
66