summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/graphics/fonts/FontManager.java2
-rw-r--r--core/java/android/graphics/fonts/FontUpdateRequest.aidl (renamed from core/java/android/graphics/fonts/SystemFontState.aidl)2
-rw-r--r--core/java/android/graphics/fonts/FontUpdateRequest.java78
3 files changed, 80 insertions, 2 deletions
diff --git a/core/java/android/graphics/fonts/FontManager.java b/core/java/android/graphics/fonts/FontManager.java
index f0b218ce5343..abb4f9fa7eef 100644
--- a/core/java/android/graphics/fonts/FontManager.java
+++ b/core/java/android/graphics/fonts/FontManager.java
@@ -261,7 +261,7 @@ public class FontManager {
@IntRange(from = 0) int baseVersion
) {
try {
- return mIFontManager.updateFont(pfd, signature, baseVersion);
+ return mIFontManager.updateFont(baseVersion, new FontUpdateRequest(pfd, signature));
} catch (RemoteException e) {
Log.e(TAG, "Failed to call updateFont API", e);
return RESULT_ERROR_REMOTE_EXCEPTION;
diff --git a/core/java/android/graphics/fonts/SystemFontState.aidl b/core/java/android/graphics/fonts/FontUpdateRequest.aidl
index 19b20f268486..f6cb373b7ed2 100644
--- a/core/java/android/graphics/fonts/SystemFontState.aidl
+++ b/core/java/android/graphics/fonts/FontUpdateRequest.aidl
@@ -17,4 +17,4 @@
package android.graphics.fonts;
/** @hide */
-parcelable SystemFontState; \ No newline at end of file
+parcelable FontUpdateRequest; \ No newline at end of file
diff --git a/core/java/android/graphics/fonts/FontUpdateRequest.java b/core/java/android/graphics/fonts/FontUpdateRequest.java
new file mode 100644
index 000000000000..db047f8ba696
--- /dev/null
+++ b/core/java/android/graphics/fonts/FontUpdateRequest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.graphics.fonts;
+
+import android.annotation.NonNull;
+import android.os.Parcel;
+import android.os.ParcelFileDescriptor;
+import android.os.Parcelable;
+
+/**
+ * Represents a font update request. Currently only font install request is supported.
+ * @hide
+ */
+// TODO: Support font config update.
+public final class FontUpdateRequest implements Parcelable {
+
+ public static final Creator<FontUpdateRequest> CREATOR = new Creator<FontUpdateRequest>() {
+ @Override
+ public FontUpdateRequest createFromParcel(Parcel in) {
+ return new FontUpdateRequest(in);
+ }
+
+ @Override
+ public FontUpdateRequest[] newArray(int size) {
+ return new FontUpdateRequest[size];
+ }
+ };
+
+ @NonNull
+ private final ParcelFileDescriptor mFd;
+ @NonNull
+ private final byte[] mSignature;
+
+ public FontUpdateRequest(@NonNull ParcelFileDescriptor fd, @NonNull byte[] signature) {
+ mFd = fd;
+ mSignature = signature;
+ }
+
+ private FontUpdateRequest(Parcel in) {
+ mFd = in.readParcelable(ParcelFileDescriptor.class.getClassLoader());
+ mSignature = in.readBlob();
+ }
+
+ @NonNull
+ public ParcelFileDescriptor getFd() {
+ return mFd;
+ }
+
+ @NonNull
+ public byte[] getSignature() {
+ return mSignature;
+ }
+
+ @Override
+ public int describeContents() {
+ return Parcelable.CONTENTS_FILE_DESCRIPTOR;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeParcelable(mFd, flags);
+ dest.writeBlob(mSignature);
+ }
+}