Merge "Added @IntDef for DATA_SHARE_ERROR_ constants" into rvc-dev am: 4a4e1e45d0 am: 279f3dcc8b am: fd59e23273

Change-Id: I292fe82bea86ba90662fd18a644b205759a933d9
This commit is contained in:
Automerger Merge Worker
2020-03-10 11:58:24 +00:00
3 changed files with 13 additions and 2 deletions

View File

@@ -20,6 +20,7 @@ import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.os.ParcelFileDescriptor;
import android.view.contentcapture.ContentCaptureManager.DataShareError;
/**
* Adapter class to be used for the Content Capture Service app to propagate the status of the
@@ -46,5 +47,5 @@ public interface DataShareReadAdapter {
* these 2 events is not defined, and it's important that the service treats end of stream
* correctly in this situation.
**/
void onError(int errorCode);
void onError(@DataShareError int errorCode);
}

View File

@@ -216,6 +216,15 @@ public final class ContentCaptureManager {
/** Request has been interrupted because of data share session timeout. */
public static final int DATA_SHARE_ERROR_TIMEOUT_INTERRUPTED = 3;
/** @hide */
@IntDef(flag = false, value = {
DATA_SHARE_ERROR_UNKNOWN,
DATA_SHARE_ERROR_CONCURRENT_REQUEST,
DATA_SHARE_ERROR_TIMEOUT_INTERRUPTED
})
@Retention(RetentionPolicy.SOURCE)
public @interface DataShareError {}
/** @hide */
public static final int RESULT_CODE_OK = 0;
/** @hide */

View File

@@ -18,6 +18,7 @@ package android.view.contentcapture;
import android.annotation.NonNull;
import android.os.ParcelFileDescriptor;
import android.view.contentcapture.ContentCaptureManager.DataShareError;
/** Adapter class used by apps to share data with the Content Capture service. */
public interface DataShareWriteAdapter {
@@ -42,7 +43,7 @@ public interface DataShareWriteAdapter {
*
* @param errorCode the error code corresponding to an ERROR_* value.
*/
default void onError(int errorCode) {
default void onError(@DataShareError int errorCode) {
/* do nothing - stub */
}
}