Merge "Add details to Download progress callback"
diff --git a/Android.mk b/Android.mk
index 700cdc1..8179748 100644
--- a/Android.mk
+++ b/Android.mk
@@ -437,7 +437,7 @@
telecomm/java/com/android/internal/telecom/RemoteServiceCallback.aidl \
telephony/java/android/telephony/mbms/IMbmsDownloadManagerCallback.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/vendor/IMbmsDownloadService.aidl \
telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl \
diff --git a/telephony/java/android/telephony/MbmsDownloadManager.java b/telephony/java/android/telephony/MbmsDownloadManager.java
index 4eeabb0..c747b84 100644
--- a/telephony/java/android/telephony/MbmsDownloadManager.java
+++ b/telephony/java/android/telephony/MbmsDownloadManager.java
@@ -28,8 +28,8 @@
import android.os.IBinder;
import android.os.RemoteException;
import android.telephony.mbms.FileInfo;
-import android.telephony.mbms.IDownloadCallback;
import android.telephony.mbms.DownloadRequest;
+import android.telephony.mbms.IDownloadProgressListener;
import android.telephony.mbms.IMbmsDownloadManagerCallback;
import android.telephony.mbms.MbmsDownloadManagerCallback;
import android.telephony.mbms.MbmsDownloadReceiver;
@@ -390,9 +390,10 @@
* Asynchronous errors through the listener include any of the errors
*
* @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 {
IMbmsDownloadService downloadService = mService.get();
if (downloadService == null) {
@@ -412,7 +413,7 @@
checkValidDownloadDestination(request);
writeDownloadRequestToken(request);
try {
- downloadService.download(request, callback);
+ downloadService.download(request, progressListener);
} catch (RemoteException e) {
mService.set(null);
throw new MbmsException(MbmsException.ERROR_MIDDLEWARE_LOST);
diff --git a/telephony/java/android/telephony/mbms/DownloadCallback.java b/telephony/java/android/telephony/mbms/DownloadCallback.java
deleted file mode 100644
index 0c6fec4..0000000
--- a/telephony/java/android/telephony/mbms/DownloadCallback.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.telephony.mbms;
-
-/**
- * A optional listener class used by download clients to track progress.
- * @hide
- */
-public class DownloadCallback extends IDownloadCallback.Stub {
- /**
- * Gives process callbacks for a given DownloadRequest.
- * request indicates which download is being referenced.
- * fileInfo gives information about the file being downloaded. Note that
- * 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.
- * downloadSize is the final amount to be downloaded. This may be different
- * from the decoded final size, but is useful in gauging download progress.
- * currentSize is the amount currently downloaded.
- * decodedPercent is the percent from 0 to 100 of the file decoded. After the
- * download completes the contents needs to be processed. It is perhaps
- * uncompressed, transcoded and/or decrypted. Generally the download completes
- * before the decode is started, but that's not required.
- */
- public void progress(DownloadRequest request, FileInfo fileInfo,
- int downloadSize, int currentSize, int decodedPercent) {
- }
-}
diff --git a/telephony/java/android/telephony/mbms/DownloadProgressListener.java b/telephony/java/android/telephony/mbms/DownloadProgressListener.java
new file mode 100644
index 0000000..d6bd5dc
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/DownloadProgressListener.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony.mbms;
+
+/**
+ * A optional listener class used by download clients to track progress.
+ * @hide
+ */
+public class DownloadProgressListener extends IDownloadProgressListener.Stub {
+ /**
+ * Gives process callbacks for a given DownloadRequest.
+ * This is optionally specified when requesting a download and
+ * 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
+ * may not have been able to get a list of them in advance.
+ * @param currentDownloadSize is the current amount downloaded.
+ * @param fullDownloadSize is the total number of bytes that make up the downloaded content.
+ * This may be different from the decoded final size, but is useful in gauging download
+ * progress.
+ * @param currentDecodedSize is the number of bytes that have been decoded.
+ * @param fullDecodedSize is the total number of bytes that make up the final decoded content.
+ */
+ public void progress(DownloadRequest request, FileInfo fileInfo,
+ int currentDownloadSize, int fullDownloadSize,
+ int currentDecodedSize, int fullDecodedSize) {
+ }
+}
diff --git a/telephony/java/android/telephony/mbms/IDownloadCallback.aidl b/telephony/java/android/telephony/mbms/IDownloadProgressListener.aidl
similarity index 87%
rename from telephony/java/android/telephony/mbms/IDownloadCallback.aidl
rename to telephony/java/android/telephony/mbms/IDownloadProgressListener.aidl
index a6bd7e5..bb9dc6c 100755
--- a/telephony/java/android/telephony/mbms/IDownloadCallback.aidl
+++ b/telephony/java/android/telephony/mbms/IDownloadProgressListener.aidl
@@ -23,12 +23,12 @@
* The optional interface used by download clients to track progress.
* @hide
*/
-interface IDownloadCallback
+interface IDownloadProgressListener
{
/**
* Gives progress callbacks for a given DownloadRequest. Includes a FileInfo
* as the list of files may not have been known at request-time.
*/
- void progress(in DownloadRequest request, in FileInfo fileInfo, int downloadSize,
- int currentSize, int decodedPercent);
+ void progress(in DownloadRequest request, in FileInfo fileInfo, int currentDownloadSize,
+ int fullDownloadSize, int currentDecodedSize, int fullDecodedSize);
}
diff --git a/telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl b/telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl
index 725d11c..0a76f32 100755
--- a/telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl
+++ b/telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl
@@ -21,7 +21,7 @@
import android.telephony.mbms.DownloadRequest;
import android.telephony.mbms.FileInfo;
import android.telephony.mbms.IMbmsDownloadManagerCallback;
-import android.telephony.mbms.IDownloadCallback;
+import android.telephony.mbms.IDownloadProgressListener;
/**
* @hide
@@ -34,7 +34,7 @@
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);
diff --git a/telephony/java/android/telephony/mbms/vendor/MbmsDownloadServiceBase.java b/telephony/java/android/telephony/mbms/vendor/MbmsDownloadServiceBase.java
index 8fbd448..d725d9f 100644
--- a/telephony/java/android/telephony/mbms/vendor/MbmsDownloadServiceBase.java
+++ b/telephony/java/android/telephony/mbms/vendor/MbmsDownloadServiceBase.java
@@ -20,7 +20,7 @@
import android.os.RemoteException;
import android.telephony.mbms.DownloadRequest;
import android.telephony.mbms.FileInfo;
-import android.telephony.mbms.IDownloadCallback;
+import android.telephony.mbms.IDownloadProgressListener;
import android.telephony.mbms.IMbmsDownloadManagerCallback;
import android.telephony.mbms.MbmsException;
@@ -105,7 +105,7 @@
* @return TODO: enumerate possible return values
*/
@Override
- public int download(DownloadRequest downloadRequest, IDownloadCallback listener)
+ public int download(DownloadRequest downloadRequest, IDownloadProgressListener listener)
throws RemoteException {
return 0;
}