Add @IntDef for backup transport flags

This addresses the feedback from API council in b/183938013.

Fixes: 183938013
Test: m -j
Change-Id: I3ebf24053ce1ec6cdda60e4dc25ed92641f087fa
This commit is contained in:
Ruslan Tkhakokhov
2021-04-20 19:14:50 +01:00
parent a13c9782b8
commit bc6a7d8e2d
2 changed files with 15 additions and 1 deletions

View File

@@ -16,6 +16,7 @@
package android.app.backup;
import android.annotation.IntDef;
import android.annotation.Nullable;
import android.app.IBackupAgent;
import android.app.QueuedWork;
@@ -48,6 +49,8 @@ import org.xmlpull.v1.XmlPullParserException;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedList;
@@ -188,6 +191,15 @@ public abstract class BackupAgent extends ContextWrapper {
*/
public static final int FLAG_FAKE_CLIENT_SIDE_ENCRYPTION_ENABLED = 1 << 31;
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(flag = true, value = {
FLAG_CLIENT_SIDE_ENCRYPTION_ENABLED,
FLAG_DEVICE_TO_DEVICE_TRANSFER,
FLAG_FAKE_CLIENT_SIDE_ENCRYPTION_ENABLED
})
public @interface BackupTransportFlags {}
Handler mHandler = null;
@Nullable private UserHandle mUser;

View File

@@ -18,6 +18,7 @@ package android.app.backup;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.app.backup.BackupAgent.BackupTransportFlags;
import android.os.Parcel;
import android.os.Parcelable;
@@ -54,6 +55,7 @@ public class RestoreSet implements Parcelable {
* Properties of the {@link BackupTransport} transport that was used to obtain the data in
* this restore set.
*/
@BackupTransportFlags
public final int backupTransportFlags;
/**
@@ -87,7 +89,7 @@ public class RestoreSet implements Parcelable {
* flag values.
*/
public RestoreSet(@Nullable String name, @Nullable String device, long token,
int backupTransportFlags) {
@BackupTransportFlags int backupTransportFlags) {
this.name = name;
this.device = device;
this.token = token;