FileOperationResult


public final class FileOperationResult
extends Object implements Parcelable

java.lang.Object
   ↳ android.os.storage.operations.FileOperationResult


Represents the result of a file operation.

Summary

Constants

int ERROR_BUSY

The system is too busy to handle the request.

int ERROR_DISK_FULL

The operation failed because the disk is full.

int ERROR_INVALID_REQUEST

The system cannot fulfill the request as configured.

int ERROR_NONE

Successful operation.

int ERROR_PERMISSION_DENIED

The operation failed due to missing permissions.

int ERROR_UNKNOWN

An unknown error.

int ERROR_UNSUPPORTED_SOURCE

The source of the operation is unsupported or invalid.

int ERROR_UNSUPPORTED_TARGET

The target of the operation is unsupported or invalid.

int STATUS_FAILED

The operation failed.

int STATUS_FINISHED

The operation finished successfully.

int STATUS_IN_PROGRESS

The operation is currently running.

int STATUS_QUEUED

The operation is queued and waiting to start.

int STATUS_UNKNOWN

Unknown status.

Inherited constants

Fields

public static final Creator<FileOperationResult> CREATOR

Public methods

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

int getErrorCode()

Returns the error code if the operation failed.

String getErrorMessage()

Returns the error message if the operation failed.

List<String> getFailedPaths()

Returns the list of failures.

String getRequestId()

Returns the unique ID of the request.

OperationSource getSource()

Returns the OperationSource that was configured in the original FileOperationRequest.

int getStatus()

Returns the current status of the operation.

OperationTarget getTarget()

Returns the target of the file operation.

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

Constants

ERROR_BUSY

Added in API level 37
public static final int ERROR_BUSY

The system is too busy to handle the request.

This error is transient. Applications should consider retrying the operation after a short delay, potentially using an exponential backoff strategy.

Constant Value: 1 (0x00000001)

ERROR_DISK_FULL

Added in API level 37
public static final int ERROR_DISK_FULL

The operation failed because the disk is full.

This error is potentially transient if the user clears enough space on the storage device.

Constant Value: 6 (0x00000006)

ERROR_INVALID_REQUEST

Added in API level 37
public static final int ERROR_INVALID_REQUEST

The system cannot fulfill the request as configured.

This error is permanent as it indicates a malformed or invalid request.

Constant Value: 2 (0x00000002)

ERROR_NONE

Added in API level 37
public static final int ERROR_NONE

Successful operation.

Constant Value: -1 (0xffffffff)

ERROR_PERMISSION_DENIED

Added in API level 37
public static final int ERROR_PERMISSION_DENIED

The operation failed due to missing permissions.

This error is permanent unless the user manually grants the required permissions.

Constant Value: 5 (0x00000005)

ERROR_UNKNOWN

Added in API level 37
public static final int ERROR_UNKNOWN

An unknown error.

Constant Value: 0 (0x00000000)

ERROR_UNSUPPORTED_SOURCE

Added in API level 37
public static final int ERROR_UNSUPPORTED_SOURCE

The source of the operation is unsupported or invalid.

This error is permanent as it indicates an issue with the request.

Constant Value: 3 (0x00000003)

ERROR_UNSUPPORTED_TARGET

Added in API level 37
public static final int ERROR_UNSUPPORTED_TARGET

The target of the operation is unsupported or invalid.

This error is permanent as it indicates an issue with the request.

Constant Value: 4 (0x00000004)

STATUS_FAILED

Added in API level 37
public static final int STATUS_FAILED

The operation failed.

Constant Value: 4 (0x00000004)

STATUS_FINISHED

Added in API level 37
public static final int STATUS_FINISHED

The operation finished successfully.

Constant Value: 3 (0x00000003)

STATUS_IN_PROGRESS

Added in API level 37
public static final int STATUS_IN_PROGRESS

The operation is currently running.

Constant Value: 2 (0x00000002)

STATUS_QUEUED

Added in API level 37
public static final int STATUS_QUEUED

The operation is queued and waiting to start.

Constant Value: 1 (0x00000001)

STATUS_UNKNOWN

Added in API level 37
public static final int STATUS_UNKNOWN

Unknown status.

Constant Value: 0 (0x00000000)

Fields

CREATOR

Added in API level 37
public static final Creator<FileOperationResult> CREATOR

Public methods

describeContents

Added in API level 37
public int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(Parcel,int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.
Value is either 0 or

getErrorCode

Added in API level 37
public int getErrorCode ()

Returns the error code if the operation failed.

Returns
int Value is one of the following:

getErrorMessage

Added in API level 37
public String getErrorMessage ()

Returns the error message if the operation failed.

Returns
String This value may be null.

getFailedPaths

Added in API level 37
public List<String> getFailedPaths ()

Returns the list of failures.

This list is only populated when the operation reaches a terminal state (STATUS_FINISHED or STATUS_FAILED).

Note: Due to binder transaction limits, this list can truncate the total number of reported failures. If failures occurred, only the first FileManager.getMaxReportedFailures() are reported.

Returns
List<String> This value cannot be null.

getRequestId

Added in API level 37
public String getRequestId ()

Returns the unique ID of the request.

Returns
String This value cannot be null.

getSource

Added in API level 37
public OperationSource getSource ()

Returns the OperationSource that was configured in the original FileOperationRequest.

For example, if an operation was created using a ERROR(/AppDataFileSource) that object would be returned here.

Returns
OperationSource This value cannot be null.

getStatus

Added in API level 37
public int getStatus ()

Returns the current status of the operation.

Returns
int Value is one of the following:

getTarget

Added in API level 37
public OperationTarget getTarget ()

Returns the target of the file operation.

Returns
OperationTarget This value may be null.

writeToParcel

Added in API level 37
public void writeToParcel (Parcel dest, 
                int flags)

Flatten this object in to a Parcel.

Parameters
dest Parcel: This value cannot be null.

flags int: Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE.
Value is either 0 or a combination of the following: