Added @IntDef for DATA_SHARE_ERROR_ constants

Bug: 150844071
Fix: 150844071
Test: NA
Change-Id: I853f10addf5b2f104ce04503aa033e7a8609d4b3
This commit is contained in:
Yara Hassan
2020-03-09 18:35:59 +00:00
parent 592397e97a
commit e41b29ec57
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 */
}
}