Merge "Rename MbmsDownloadSession#getDownloadStatus"
am: a07d895f09
Change-Id: I1b6b063920de4de085f583d05876e246f1f65686
This commit is contained in:
@@ -40394,10 +40394,10 @@ package android.telephony {
|
||||
method public static android.telephony.MbmsDownloadSession create(android.content.Context, android.telephony.mbms.MbmsDownloadSessionCallback, android.os.Handler);
|
||||
method public static android.telephony.MbmsDownloadSession create(android.content.Context, android.telephony.mbms.MbmsDownloadSessionCallback, int, android.os.Handler);
|
||||
method public int download(android.telephony.mbms.DownloadRequest);
|
||||
method public int getDownloadStatus(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo);
|
||||
method public java.io.File getTempFileRootDirectory();
|
||||
method public java.util.List<android.telephony.mbms.DownloadRequest> listPendingDownloads();
|
||||
method public int registerStateCallback(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStateCallback, android.os.Handler);
|
||||
method public void requestDownloadState(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo);
|
||||
method public void requestUpdateFileServices(java.util.List<java.lang.String>);
|
||||
method public void resetDownloadKnowledge(android.telephony.mbms.DownloadRequest);
|
||||
method public void setTempFileRootDirectory(java.io.File);
|
||||
@@ -41280,6 +41280,7 @@ package android.telephony.mbms {
|
||||
public static class MbmsErrors.DownloadErrors {
|
||||
field public static final int ERROR_CANNOT_CHANGE_TEMP_FILE_ROOT = 401; // 0x191
|
||||
field public static final int ERROR_UNKNOWN_DOWNLOAD_REQUEST = 402; // 0x192
|
||||
field public static final int ERROR_UNKNOWN_FILE_INFO = 403; // 0x193
|
||||
}
|
||||
|
||||
public static class MbmsErrors.GeneralErrors {
|
||||
|
||||
@@ -4379,11 +4379,11 @@ package android.telephony.mbms.vendor {
|
||||
method public int cancelDownload(android.telephony.mbms.DownloadRequest) throws android.os.RemoteException;
|
||||
method public void dispose(int) throws android.os.RemoteException;
|
||||
method public int download(android.telephony.mbms.DownloadRequest) throws android.os.RemoteException;
|
||||
method public int getDownloadStatus(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo) throws android.os.RemoteException;
|
||||
method public int initialize(int, android.telephony.mbms.MbmsDownloadSessionCallback) throws android.os.RemoteException;
|
||||
method public java.util.List<android.telephony.mbms.DownloadRequest> listPendingDownloads(int) throws android.os.RemoteException;
|
||||
method public void onAppCallbackDied(int, int);
|
||||
method public int registerStateCallback(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStateCallback) throws android.os.RemoteException;
|
||||
method public int requestDownloadState(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo) throws android.os.RemoteException;
|
||||
method public int requestUpdateFileServices(int, java.util.List<java.lang.String>) throws android.os.RemoteException;
|
||||
method public int resetDownloadKnowledge(android.telephony.mbms.DownloadRequest) throws android.os.RemoteException;
|
||||
method public int setTempFileRootDirectory(int, java.lang.String) throws android.os.RemoteException;
|
||||
|
||||
@@ -495,11 +495,11 @@ package android.telephony.mbms.vendor {
|
||||
method public int cancelDownload(android.telephony.mbms.DownloadRequest) throws android.os.RemoteException;
|
||||
method public void dispose(int) throws android.os.RemoteException;
|
||||
method public int download(android.telephony.mbms.DownloadRequest) throws android.os.RemoteException;
|
||||
method public int getDownloadStatus(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo) throws android.os.RemoteException;
|
||||
method public int initialize(int, android.telephony.mbms.MbmsDownloadSessionCallback) throws android.os.RemoteException;
|
||||
method public java.util.List<android.telephony.mbms.DownloadRequest> listPendingDownloads(int) throws android.os.RemoteException;
|
||||
method public void onAppCallbackDied(int, int);
|
||||
method public int registerStateCallback(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStateCallback) throws android.os.RemoteException;
|
||||
method public int requestDownloadState(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo) throws android.os.RemoteException;
|
||||
method public int requestUpdateFileServices(int, java.util.List<java.lang.String>) throws android.os.RemoteException;
|
||||
method public int resetDownloadKnowledge(android.telephony.mbms.DownloadRequest) throws android.os.RemoteException;
|
||||
method public int setTempFileRootDirectory(int, java.lang.String) throws android.os.RemoteException;
|
||||
|
||||
@@ -686,30 +686,42 @@ public class MbmsDownloadSession implements AutoCloseable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets information about the status of a file pending download.
|
||||
* Requests information about the state of a file pending download.
|
||||
*
|
||||
* If there was a problem communicating with the middleware or if it has no records of the
|
||||
* The state will be delivered as a callback via
|
||||
* {@link DownloadStateCallback#onStateUpdated(DownloadRequest, FileInfo, int)}. If no such
|
||||
* callback has been registered via
|
||||
* {@link #registerStateCallback(DownloadRequest, DownloadStateCallback, Handler)}, this
|
||||
* method will be a no-op.
|
||||
*
|
||||
* If the middleware has no record of the
|
||||
* file indicated by {@code fileInfo} being associated with {@code downloadRequest},
|
||||
* {@link #STATUS_UNKNOWN} will be returned.
|
||||
* an {@link IllegalArgumentException} will be thrown.
|
||||
*
|
||||
* @param downloadRequest The download request to query.
|
||||
* @param fileInfo The particular file within the request to get information on.
|
||||
* @return The status of the download.
|
||||
*/
|
||||
@DownloadStatus
|
||||
public int getDownloadStatus(DownloadRequest downloadRequest, FileInfo fileInfo) {
|
||||
public void requestDownloadState(DownloadRequest downloadRequest, FileInfo fileInfo) {
|
||||
IMbmsDownloadService downloadService = mService.get();
|
||||
if (downloadService == null) {
|
||||
throw new IllegalStateException("Middleware not yet bound");
|
||||
}
|
||||
|
||||
try {
|
||||
return downloadService.getDownloadStatus(downloadRequest, fileInfo);
|
||||
int result = downloadService.requestDownloadState(downloadRequest, fileInfo);
|
||||
if (result != MbmsErrors.SUCCESS) {
|
||||
if (result == MbmsErrors.DownloadErrors.ERROR_UNKNOWN_DOWNLOAD_REQUEST) {
|
||||
throw new IllegalArgumentException("Unknown download request.");
|
||||
}
|
||||
if (result == MbmsErrors.DownloadErrors.ERROR_UNKNOWN_FILE_INFO) {
|
||||
throw new IllegalArgumentException("Unknown file.");
|
||||
}
|
||||
sendErrorToApp(result, null);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
mService.set(null);
|
||||
sIsInitialized.set(false);
|
||||
sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null);
|
||||
return STATUS_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -128,6 +128,9 @@ public class MbmsErrors {
|
||||
|
||||
/** Indicates that the middleware has no record of the supplied {@link DownloadRequest}. */
|
||||
public static final int ERROR_UNKNOWN_DOWNLOAD_REQUEST = 402;
|
||||
|
||||
/** Indicates the the middleware has no record of the supplied {@link FileInfo} */
|
||||
public static final int ERROR_UNKNOWN_FILE_INFO = 403;
|
||||
}
|
||||
|
||||
private MbmsErrors() {}
|
||||
|
||||
@@ -46,7 +46,7 @@ interface IMbmsDownloadService
|
||||
|
||||
int cancelDownload(in DownloadRequest downloadRequest);
|
||||
|
||||
int getDownloadStatus(in DownloadRequest downloadRequest, in FileInfo fileInfo);
|
||||
int requestDownloadState(in DownloadRequest downloadRequest, in FileInfo fileInfo);
|
||||
|
||||
int resetDownloadKnowledge(in DownloadRequest downloadRequest);
|
||||
|
||||
|
||||
@@ -370,18 +370,18 @@ public class MbmsDownloadServiceBase extends IMbmsDownloadService.Stub {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets information about the status of a file pending download.
|
||||
* Requests information about the state of a file pending download.
|
||||
*
|
||||
* If the middleware has not yet been properly initialized or if it has no records of the
|
||||
* If the middleware has no records of the
|
||||
* file indicated by {@code fileInfo} being associated with {@code downloadRequest},
|
||||
* {@link MbmsDownloadSession#STATUS_UNKNOWN} must be returned.
|
||||
* {@link MbmsErrors.DownloadErrors#ERROR_UNKNOWN_FILE_INFO} must be returned.
|
||||
*
|
||||
* @param downloadRequest The download request to query.
|
||||
* @param fileInfo The particular file within the request to get information on.
|
||||
* @return The status of the download.
|
||||
* @return {@link MbmsErrors#SUCCESS} if the request was successful, an error code otherwise.
|
||||
*/
|
||||
@Override
|
||||
public int getDownloadStatus(DownloadRequest downloadRequest, FileInfo fileInfo)
|
||||
public int requestDownloadState(DownloadRequest downloadRequest, FileInfo fileInfo)
|
||||
throws RemoteException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user