Merge changes Ib7daba9c,Ib692bff0

* changes:
  UpdateEngine: add WorkerThread annotation.
  UpdateEngine.AllocateSpaceResult: rename functions
This commit is contained in:
Treehugger Robot
2020-02-03 19:55:48 +00:00
committed by Gerrit Code Review
2 changed files with 16 additions and 11 deletions

View File

@@ -6514,13 +6514,13 @@ package android.os {
public class UpdateEngine {
ctor public UpdateEngine();
method @NonNull public android.os.UpdateEngine.AllocateSpaceResult allocateSpace(@NonNull String, @NonNull String[]);
method @NonNull @WorkerThread public android.os.UpdateEngine.AllocateSpaceResult allocateSpace(@NonNull String, @NonNull String[]);
method public void applyPayload(String, long, long, 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();
method public int cleanupAppliedPayload();
method @WorkerThread public int cleanupAppliedPayload();
method public void resetStatus();
method public void resume();
method public void suspend();
@@ -6529,8 +6529,8 @@ package android.os {
}
public static final class UpdateEngine.AllocateSpaceResult {
method public int errorCode();
method public long freeSpaceRequired();
method public int getErrorCode();
method public long getFreeSpaceRequired();
}
public static final class UpdateEngine.ErrorCodeConstants {

View File

@@ -19,6 +19,7 @@ package android.os;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.annotation.WorkerThread;
import android.content.res.AssetFileDescriptor;
import android.os.IUpdateEngine;
import android.os.IUpdateEngineCallback;
@@ -478,7 +479,7 @@ public class UpdateEngine {
* </ul>
*/
@ErrorCode
public int errorCode() {
public int getErrorCode() {
return mErrorCode;
}
@@ -492,14 +493,15 @@ public class UpdateEngine {
*
* @return The following values:
* <ul>
* <li>zero if {@link #errorCode} returns {@link ErrorCodeConstants#SUCCESS}</li>
* <li>non-zero if {@link #errorCode} returns {@link ErrorCodeConstants#NOT_ENOUGH_SPACE}.
* <li>zero if {@link #getErrorCode} returns {@link ErrorCodeConstants#SUCCESS}</li>
* <li>non-zero if {@link #getErrorCode} returns
* {@link ErrorCodeConstants#NOT_ENOUGH_SPACE}.
* Value is the estimated total space required on userdata partition.</li>
* </ul>
* @throws IllegalStateException if {@link #errorCode} is not one of the above.
* @throws IllegalStateException if {@link #getErrorCode} is not one of the above.
*
*/
public long freeSpaceRequired() {
public long getFreeSpaceRequired() {
if (mErrorCode == ErrorCodeConstants.SUCCESS) {
return 0;
}
@@ -507,7 +509,7 @@ public class UpdateEngine {
return mFreeSpaceRequired;
}
throw new IllegalStateException(String.format(
"freeSpaceRequired() is not available when error code is %d", mErrorCode));
"getFreeSpaceRequired() is not available when error code is %d", mErrorCode));
}
}
@@ -531,8 +533,10 @@ public class UpdateEngine {
*
* @param payloadMetadataFilename See {@link #verifyPayloadMetadata}.
* @param headerKeyValuePairs See {@link #applyPayload}.
* @return See {@link AllocateSpaceResult}.
* @return See {@link AllocateSpaceResult#getErrorCode} and
* {@link AllocateSpaceResult#getFreeSpaceRequired}.
*/
@WorkerThread
@NonNull
public AllocateSpaceResult allocateSpace(
@NonNull String payloadMetadataFilename,
@@ -583,6 +587,7 @@ public class UpdateEngine {
* @throws ServiceSpecificException if other transient errors has occurred.
* A reboot may or may not help resolving the issue.
*/
@WorkerThread
@ErrorCode
public int cleanupAppliedPayload() {
try {