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
This commit is contained in:
Tianjie Xu
2019-10-31 17:36:18 -07:00
parent 0d7a5dc2ea
commit 69301416c8
2 changed files with 7 additions and 5 deletions

View File

@@ -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();

View File

@@ -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.
*
* <p>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();
}