Merge "Add details to Download progress callback" am: b440b572d7

am: 5f047a68d9

Change-Id: I5b26730aacb9209f08b33204fb88be02c324609a
This commit is contained in:
Robert Greenwalt
2017-07-20 00:36:53 +00:00
committed by android-build-merger
6 changed files with 28 additions and 23 deletions

View File

@@ -487,7 +487,7 @@ LOCAL_SRC_FILES += \
telecomm/java/com/android/internal/telecom/RemoteServiceCallback.aidl \ telecomm/java/com/android/internal/telecom/RemoteServiceCallback.aidl \
telephony/java/android/telephony/mbms/IMbmsDownloadManagerCallback.aidl \ telephony/java/android/telephony/mbms/IMbmsDownloadManagerCallback.aidl \
telephony/java/android/telephony/mbms/IMbmsStreamingManagerCallback.aidl \ telephony/java/android/telephony/mbms/IMbmsStreamingManagerCallback.aidl \
telephony/java/android/telephony/mbms/IDownloadCallback.aidl \ telephony/java/android/telephony/mbms/IDownloadProgressListener.aidl \
telephony/java/android/telephony/mbms/IStreamingServiceCallback.aidl \ telephony/java/android/telephony/mbms/IStreamingServiceCallback.aidl \
telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl \ telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl \
telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl \ telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl \

View File

@@ -28,8 +28,8 @@ import android.net.Uri;
import android.os.IBinder; import android.os.IBinder;
import android.os.RemoteException; import android.os.RemoteException;
import android.telephony.mbms.FileInfo; import android.telephony.mbms.FileInfo;
import android.telephony.mbms.IDownloadCallback;
import android.telephony.mbms.DownloadRequest; import android.telephony.mbms.DownloadRequest;
import android.telephony.mbms.IDownloadProgressListener;
import android.telephony.mbms.IMbmsDownloadManagerCallback; import android.telephony.mbms.IMbmsDownloadManagerCallback;
import android.telephony.mbms.MbmsDownloadManagerCallback; import android.telephony.mbms.MbmsDownloadManagerCallback;
import android.telephony.mbms.MbmsDownloadReceiver; import android.telephony.mbms.MbmsDownloadReceiver;
@@ -390,9 +390,10 @@ public class MbmsDownloadManager {
* Asynchronous errors through the listener include any of the errors * Asynchronous errors through the listener include any of the errors
* *
* @param request The request that specifies what should be downloaded * @param request The request that specifies what should be downloaded
* @param callback Optional callback that will provide progress updates if the app is running. * @param progressListener Optional listener that will be provided progress updates
* if the app is running.
*/ */
public void download(DownloadRequest request, IDownloadCallback callback) public void download(DownloadRequest request, IDownloadProgressListener progressListener)
throws MbmsException { throws MbmsException {
IMbmsDownloadService downloadService = mService.get(); IMbmsDownloadService downloadService = mService.get();
if (downloadService == null) { if (downloadService == null) {
@@ -412,7 +413,7 @@ public class MbmsDownloadManager {
checkValidDownloadDestination(request); checkValidDownloadDestination(request);
writeDownloadRequestToken(request); writeDownloadRequestToken(request);
try { try {
downloadService.download(request, callback); downloadService.download(request, progressListener);
} catch (RemoteException e) { } catch (RemoteException e) {
mService.set(null); mService.set(null);
throw new MbmsException(MbmsException.ERROR_MIDDLEWARE_LOST); throw new MbmsException(MbmsException.ERROR_MIDDLEWARE_LOST);

View File

@@ -20,22 +20,26 @@ package android.telephony.mbms;
* A optional listener class used by download clients to track progress. * A optional listener class used by download clients to track progress.
* @hide * @hide
*/ */
public class DownloadCallback extends IDownloadCallback.Stub { public class DownloadProgressListener extends IDownloadProgressListener.Stub {
/** /**
* Gives process callbacks for a given DownloadRequest. * Gives process callbacks for a given DownloadRequest.
* request indicates which download is being referenced. * This is optionally specified when requesting a download and
* fileInfo gives information about the file being downloaded. Note that * only lives while the app is running - it's unlikely to be useful for
* downloads far in the future.
*
* @param request a {@link DownloadRequest}, indicating which download is being referenced.
* @param fileInfo a {@link FileInfo} specifying the file to report progress on. Note that
* the request may result in many files being downloaded and the client * the request may result in many files being downloaded and the client
* may not have been able to get a list of them in advance. * may not have been able to get a list of them in advance.
* downloadSize is the final amount to be downloaded. This may be different * @param currentDownloadSize is the current amount downloaded.
* from the decoded final size, but is useful in gauging download progress. * @param fullDownloadSize is the total number of bytes that make up the downloaded content.
* currentSize is the amount currently downloaded. * This may be different from the decoded final size, but is useful in gauging download
* decodedPercent is the percent from 0 to 100 of the file decoded. After the * progress.
* download completes the contents needs to be processed. It is perhaps * @param currentDecodedSize is the number of bytes that have been decoded.
* uncompressed, transcoded and/or decrypted. Generally the download completes * @param fullDecodedSize is the total number of bytes that make up the final decoded content.
* before the decode is started, but that's not required.
*/ */
public void progress(DownloadRequest request, FileInfo fileInfo, public void progress(DownloadRequest request, FileInfo fileInfo,
int downloadSize, int currentSize, int decodedPercent) { int currentDownloadSize, int fullDownloadSize,
int currentDecodedSize, int fullDecodedSize) {
} }
} }

View File

@@ -23,12 +23,12 @@ import android.telephony.mbms.FileInfo;
* The optional interface used by download clients to track progress. * The optional interface used by download clients to track progress.
* @hide * @hide
*/ */
interface IDownloadCallback interface IDownloadProgressListener
{ {
/** /**
* Gives progress callbacks for a given DownloadRequest. Includes a FileInfo * Gives progress callbacks for a given DownloadRequest. Includes a FileInfo
* as the list of files may not have been known at request-time. * as the list of files may not have been known at request-time.
*/ */
void progress(in DownloadRequest request, in FileInfo fileInfo, int downloadSize, void progress(in DownloadRequest request, in FileInfo fileInfo, int currentDownloadSize,
int currentSize, int decodedPercent); int fullDownloadSize, int currentDecodedSize, int fullDecodedSize);
} }

View File

@@ -21,7 +21,7 @@ import android.net.Uri;
import android.telephony.mbms.DownloadRequest; import android.telephony.mbms.DownloadRequest;
import android.telephony.mbms.FileInfo; import android.telephony.mbms.FileInfo;
import android.telephony.mbms.IMbmsDownloadManagerCallback; import android.telephony.mbms.IMbmsDownloadManagerCallback;
import android.telephony.mbms.IDownloadCallback; import android.telephony.mbms.IDownloadProgressListener;
/** /**
* @hide * @hide
@@ -34,7 +34,7 @@ interface IMbmsDownloadService
int setTempFileRootDirectory(int subId, String rootDirectoryPath); int setTempFileRootDirectory(int subId, String rootDirectoryPath);
int download(in DownloadRequest downloadRequest, IDownloadCallback listener); int download(in DownloadRequest downloadRequest, IDownloadProgressListener listener);
List<DownloadRequest> listPendingDownloads(int subscriptionId); List<DownloadRequest> listPendingDownloads(int subscriptionId);

View File

@@ -20,7 +20,7 @@ import android.annotation.NonNull;
import android.os.RemoteException; import android.os.RemoteException;
import android.telephony.mbms.DownloadRequest; import android.telephony.mbms.DownloadRequest;
import android.telephony.mbms.FileInfo; import android.telephony.mbms.FileInfo;
import android.telephony.mbms.IDownloadCallback; import android.telephony.mbms.IDownloadProgressListener;
import android.telephony.mbms.IMbmsDownloadManagerCallback; import android.telephony.mbms.IMbmsDownloadManagerCallback;
import android.telephony.mbms.MbmsException; import android.telephony.mbms.MbmsException;
@@ -105,7 +105,7 @@ public class MbmsDownloadServiceBase extends IMbmsDownloadService.Stub {
* @return TODO: enumerate possible return values * @return TODO: enumerate possible return values
*/ */
@Override @Override
public int download(DownloadRequest downloadRequest, IDownloadCallback listener) public int download(DownloadRequest downloadRequest, IDownloadProgressListener listener)
throws RemoteException { throws RemoteException {
return 0; return 0;
} }