Add @IntDef for status of committed rollback.

Per API council request.

Bug: 127282563
Test: atest RollbackTest
Change-Id: I72e979ce3978c72a0783b44a044ad536b35ee09d
This commit is contained in:
Richard Uhler
2019-03-11 14:34:33 +00:00
parent 8a9774550d
commit a4b70300e4
2 changed files with 19 additions and 1 deletions

View File

@@ -16,6 +16,7 @@
package android.content.rollback;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
@@ -27,6 +28,8 @@ import android.content.pm.ParceledListSlice;
import android.content.pm.VersionedPackage;
import android.os.RemoteException;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.List;
/**
@@ -112,6 +115,20 @@ public final class RollbackManager {
public static final String EXTRA_STATUS_MESSAGE =
"android.content.rollback.extra.STATUS_MESSAGE";
/**
* Status result of committing a rollback.
*
* @hide
*/
@IntDef(prefix = "STATUS_", value = {
STATUS_SUCCESS,
STATUS_FAILURE,
STATUS_FAILURE_ROLLBACK_UNAVAILABLE,
STATUS_FAILURE_INSTALL,
})
@Retention(RetentionPolicy.SOURCE)
public @interface Status {};
/**
* The rollback was successfully committed.
*/

View File

@@ -684,7 +684,8 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub {
* @param status the RollbackManager.STATUS_* code with the failure.
* @param message the failure message.
*/
private void sendFailure(IntentSender statusReceiver, int status, String message) {
private void sendFailure(IntentSender statusReceiver, @RollbackManager.Status int status,
String message) {
Log.e(TAG, message);
try {
final Intent fillIn = new Intent();