From 69301416c88ea063bf5433dcb9352f45f19d1489 Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Thu, 31 Oct 2019 17:36:18 -0700 Subject: [PATCH] Update system api for applyPayload As requested, the system API needs to use AssetFileDescriptor instead of ParcelFileDescriptor. No need to change the AIDL. This API was added by sony, and we are not using it right now. Bug: 142426712 Test: build Change-Id: I95c347f01fe50cc0973c2a90497a6f05ce38204b --- api/system-current.txt | 2 +- core/java/android/os/UpdateEngine.java | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/api/system-current.txt b/api/system-current.txt index 7a379d5669e66..31d7c21d5b41d 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -6071,7 +6071,7 @@ package android.os { public class UpdateEngine { ctor public UpdateEngine(); method public void applyPayload(String, long, long, String[]); - method public void applyPayload(@NonNull android.os.ParcelFileDescriptor, long, long, @NonNull String[]); + method public void applyPayload(@NonNull android.content.res.AssetFileDescriptor, @NonNull String[]); method public boolean bind(android.os.UpdateEngineCallback, android.os.Handler); method public boolean bind(android.os.UpdateEngineCallback); method public void cancel(); diff --git a/core/java/android/os/UpdateEngine.java b/core/java/android/os/UpdateEngine.java index a9ddffe7d55c0..d24f6dda56d2b 100644 --- a/core/java/android/os/UpdateEngine.java +++ b/core/java/android/os/UpdateEngine.java @@ -18,6 +18,7 @@ package android.os; import android.annotation.NonNull; import android.annotation.SystemApi; +import android.content.res.AssetFileDescriptor; import android.os.IUpdateEngine; import android.os.IUpdateEngineCallback; import android.os.RemoteException; @@ -313,16 +314,17 @@ public class UpdateEngine { } /** - * Applies the payload passed as ParcelFileDescriptor {@code pfd} instead of - * using the {@code file://} scheme. + * Applies the payload passed as AssetFileDescriptor {@code assetFd} + * instead of using the {@code file://} scheme. * *

See {@link #applyPayload(String)} for {@code offset}, {@code size} and * {@code headerKeyValuePairs} parameters. */ - public void applyPayload(@NonNull ParcelFileDescriptor pfd, long offset, long size, + public void applyPayload(@NonNull AssetFileDescriptor assetFd, @NonNull String[] headerKeyValuePairs) { try { - mUpdateEngine.applyPayloadFd(pfd, offset, size, headerKeyValuePairs); + mUpdateEngine.applyPayloadFd(assetFd.getParcelFileDescriptor(), + assetFd.getStartOffset(), assetFd.getLength(), headerKeyValuePairs); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); }