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/IDownloadProgressListener.aidl \
+ telephony/java/android/telephony/mbms/IDownloadStateCallback.aidl \
telephony/java/android/telephony/mbms/IStreamingServiceCallback.aidl \
telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl \
telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl \
import android.net.Uri;
import android.os.IBinder;
import android.os.RemoteException;
-import android.telephony.mbms.DownloadProgressListener;
+import android.telephony.mbms.DownloadStateCallback;
import android.telephony.mbms.FileInfo;
import android.telephony.mbms.DownloadRequest;
import android.telephony.mbms.MbmsDownloadManagerCallback;
/**
* The default directory name for all MBMS temp files. If you call
- * {@link #download(DownloadRequest, DownloadProgressListener)} without first calling
+ * {@link #download(DownloadRequest, DownloadStateCallback)} without first calling
* {@link #setTempFileRootDirectory(File)}, this directory will be created for you under the
* path returned by {@link Context#getFilesDir()}.
*/
* local instance of {@link android.content.SharedPreferences} and by the middleware.
*
* If this method is not called at least once before calling
- * {@link #download(DownloadRequest, DownloadProgressListener)}, the framework
+ * {@link #download(DownloadRequest, DownloadStateCallback)}, the framework
* will default to a directory formed by the concatenation of the app's files directory and
* {@link MbmsDownloadManager#DEFAULT_TOP_LEVEL_TEMP_DIRECTORY}.
*
/**
* Retrieves the currently configured temp file root directory. Returns the file that was
* configured via {@link #setTempFileRootDirectory(File)} or the default directory
- * {@link #download(DownloadRequest, DownloadProgressListener)} was called without ever setting
+ * {@link #download(DownloadRequest, DownloadStateCallback)} was called without ever setting
* the temp file root. If neither method has been called since the last time the app's shared
* preferences were reset, returns null.
*
/**
* Requests a download of a file that is available via multicast.
*
- * downloadListener is an optional callback object which can be used to get progress reports
- * of a currently occuring download. Note this can only run while the calling app
- * is running, so future downloads will simply result in resultIntents being sent
- * for completed or errored-out downloads. A NULL indicates no callbacks are needed.
- *
* May throw an {@link IllegalArgumentException}
*
* If {@link #setTempFileRootDirectory(File)} has not called after the app has been installed,
*
* @param request The request that specifies what should be downloaded
* @param progressListener Optional listener that will be provided progress updates
- * if the app is running.
+ * if the app is running. If {@code null}, no callbacks will be
+ * provided.
*/
- public void download(DownloadRequest request, DownloadProgressListener progressListener)
+ public void download(DownloadRequest request, @Nullable DownloadStateCallback progressListener)
throws MbmsException {
IMbmsDownloadService downloadService = mService.get();
if (downloadService == null) {
/**
* Returns a list of pending {@link DownloadRequest}s that originated from this application.
* A pending request is one that was issued via
- * {@link #download(DownloadRequest, DownloadProgressListener)} but not cancelled through
+ * {@link #download(DownloadRequest, DownloadStateCallback)} but not cancelled through
* {@link #cancelDownload(DownloadRequest)}.
* @return A list, possibly empty, of {@link DownloadRequest}s
*/
package android.telephony.mbms;
import android.os.RemoteException;
+import android.telephony.MbmsDownloadManager;
/**
* A optional listener class used by download clients to track progress. Apps should extend this
* class and pass an instance into
- * {@link android.telephony.MbmsDownloadManager#download(DownloadRequest, DownloadProgressListener)}
+ * {@link android.telephony.MbmsDownloadManager#download(DownloadRequest, DownloadStateCallback)}
+ *
+ * This is optionally specified when requesting a download and will only be called while the app
+ * is running.
* @hide
*/
-public class DownloadProgressListener extends IDownloadProgressListener.Stub {
+public class DownloadStateCallback extends IDownloadStateCallback.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.
+ * Called when the middleware wants to report progress for a file in a {@link DownloadRequest}.
*
* @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
int currentDownloadSize, int fullDownloadSize,
int currentDecodedSize, int fullDecodedSize) throws RemoteException {
}
+
+ /**
+ * Gives download state callbacks for a file in a {@link DownloadRequest}.
+ *
+ * @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 state The current state of the download.
+ */
+ @Override
+ public void state(DownloadRequest request, FileInfo fileInfo,
+ @MbmsDownloadManager.DownloadStatus int state) {
+ }
}
* The optional interface used by download clients to track progress.
* @hide
*/
-interface IDownloadProgressListener
+interface IDownloadStateCallback
{
/**
* Gives progress callbacks for a given DownloadRequest. Includes a FileInfo
*/
void progress(in DownloadRequest request, in FileInfo fileInfo, int currentDownloadSize,
int fullDownloadSize, int currentDecodedSize, int fullDecodedSize);
+
+ void state(in DownloadRequest request, in FileInfo fileInfo, int state);
}
return false;
}
} else if (VendorUtils.ACTION_FILE_DESCRIPTOR_REQUEST.equals(intent.getAction())) {
- if (!intent.hasExtra(VendorUtils.EXTRA_SERVICE_INFO)) {
- Log.w(LOG_TAG, "Temp file request did not include the associated service info." +
+ if (!intent.hasExtra(VendorUtils.EXTRA_SERVICE_ID)) {
+ Log.w(LOG_TAG, "Temp file request did not include the associated service id." +
" Ignoring.");
return false;
}
return false;
}
} else if (VendorUtils.ACTION_CLEANUP.equals(intent.getAction())) {
- if (!intent.hasExtra(VendorUtils.EXTRA_SERVICE_INFO)) {
- Log.w(LOG_TAG, "Cleanup request did not include the associated service info." +
+ if (!intent.hasExtra(VendorUtils.EXTRA_SERVICE_ID)) {
+ Log.w(LOG_TAG, "Cleanup request did not include the associated service id." +
" Ignoring.");
return false;
}
}
private void generateTempFiles(Context context, Intent intent) {
- FileServiceInfo serviceInfo =
- intent.getParcelableExtra(VendorUtils.EXTRA_SERVICE_INFO);
- if (serviceInfo == null) {
- Log.w(LOG_TAG, "Temp file request did not include the associated service info. " +
+ String serviceId = intent.getStringExtra(VendorUtils.EXTRA_SERVICE_ID);
+ if (serviceId == null) {
+ Log.w(LOG_TAG, "Temp file request did not include the associated service id. " +
"Ignoring.");
setResultCode(RESULT_MALFORMED_INTENT);
return;
}
ArrayList<UriPathPair> freshTempFiles =
- generateFreshTempFiles(context, serviceInfo, fdCount);
+ generateFreshTempFiles(context, serviceId, fdCount);
ArrayList<UriPathPair> pausedFiles =
- generateUrisForPausedFiles(context, serviceInfo, pausedList);
+ generateUrisForPausedFiles(context, serviceId, pausedList);
Bundle result = new Bundle();
result.putParcelableArrayList(VendorUtils.EXTRA_FREE_URI_LIST, freshTempFiles);
setResultExtras(result);
}
- private ArrayList<UriPathPair> generateFreshTempFiles(Context context,
- FileServiceInfo serviceInfo,
+ private ArrayList<UriPathPair> generateFreshTempFiles(Context context, String serviceId,
int freshFdCount) {
- File tempFileDir = MbmsUtils.getEmbmsTempFileDirForService(context,
- serviceInfo.getServiceId());
+ File tempFileDir = MbmsUtils.getEmbmsTempFileDirForService(context, serviceId);
if (!tempFileDir.exists()) {
tempFileDir.mkdirs();
}
}
private ArrayList<UriPathPair> generateUrisForPausedFiles(Context context,
- FileServiceInfo serviceInfo, List<Uri> pausedFiles) {
+ String serviceId, List<Uri> pausedFiles) {
if (pausedFiles == null) {
return new ArrayList<>(0);
}
ArrayList<UriPathPair> result = new ArrayList<>(pausedFiles.size());
for (Uri fileUri : pausedFiles) {
- if (!verifyTempFilePath(context, serviceInfo.getServiceId(), fileUri)) {
+ if (!verifyTempFilePath(context, serviceId, fileUri)) {
Log.w(LOG_TAG, "Supplied file " + fileUri + " is not a valid temp file to resume");
setResultCode(RESULT_TEMP_FILE_GENERATION_ERROR);
continue;
}
private void cleanupTempFiles(Context context, Intent intent) {
- FileServiceInfo serviceInfo =
- intent.getParcelableExtra(VendorUtils.EXTRA_SERVICE_INFO);
- File tempFileDir = MbmsUtils.getEmbmsTempFileDirForService(context,
- serviceInfo.getServiceId());
+ String serviceId = intent.getStringExtra(VendorUtils.EXTRA_SERVICE_ID);
+ File tempFileDir = MbmsUtils.getEmbmsTempFileDirForService(context, serviceId);
final List<Uri> filesInUse =
intent.getParcelableArrayListExtra(VendorUtils.EXTRA_TEMP_FILES_IN_USE);
File[] filesToDelete = tempFileDir.listFiles(new FileFilter() {
import android.telephony.mbms.DownloadRequest;
import android.telephony.mbms.FileInfo;
import android.telephony.mbms.IMbmsDownloadManagerCallback;
-import android.telephony.mbms.IDownloadProgressListener;
+import android.telephony.mbms.IDownloadStateCallback;
/**
* @hide
int setTempFileRootDirectory(int subId, String rootDirectoryPath);
- int download(in DownloadRequest downloadRequest, IDownloadProgressListener listener);
+ int download(in DownloadRequest downloadRequest, IDownloadStateCallback listener);
List<DownloadRequest> listPendingDownloads(int subscriptionId);
import android.annotation.SystemApi;
import android.content.Intent;
import android.os.RemoteException;
-import android.telephony.mbms.DownloadProgressListener;
+import android.telephony.mbms.DownloadStateCallback;
import android.telephony.mbms.DownloadRequest;
import android.telephony.mbms.FileInfo;
import android.telephony.mbms.FileServiceInfo;
-import android.telephony.mbms.IDownloadProgressListener;
+import android.telephony.mbms.IDownloadStateCallback;
import android.telephony.mbms.IMbmsDownloadManagerCallback;
import android.telephony.mbms.MbmsDownloadManagerCallback;
import android.telephony.mbms.MbmsException;
* this is not the case, an {@link IllegalStateException} may be thrown.
*
* @param downloadRequest An object describing the set of files to be downloaded.
- * @param listener A listener through which the middleware can provide progress updates to
+ * @param callback A callback through which the middleware can provide progress updates to
* the app while both are still running.
* @return Any error from {@link android.telephony.mbms.MbmsException.GeneralErrors}
* or {@link MbmsException#SUCCESS}
*/
- public int download(DownloadRequest downloadRequest, DownloadProgressListener listener) {
+ public int download(DownloadRequest downloadRequest, DownloadStateCallback callback) {
return 0;
}
* @hide
*/
@Override
- public final int download(DownloadRequest downloadRequest, IDownloadProgressListener listener)
+ public final int download(DownloadRequest downloadRequest, IDownloadStateCallback callback)
throws RemoteException {
- return download(downloadRequest, new DownloadProgressListener() {
+ return download(downloadRequest, new DownloadStateCallback() {
@Override
public void progress(DownloadRequest request, FileInfo fileInfo, int
currentDownloadSize, int fullDownloadSize, int currentDecodedSize, int
fullDecodedSize) throws RemoteException {
- listener.progress(request, fileInfo, currentDownloadSize, fullDownloadSize,
+ callback.progress(request, fileInfo, currentDownloadSize, fullDownloadSize,
currentDecodedSize, fullDecodedSize);
}
});
/**
* Returns a list of pending {@link DownloadRequest}s that originated from the calling
* application, identified by its uid. A pending request is one that was issued via
- * {@link #download(DownloadRequest, IDownloadProgressListener)} but not cancelled through
+ * {@link #download(DownloadRequest, DownloadStateCallback)} but not cancelled through
* {@link #cancelDownload(DownloadRequest)}.
* The middleware must return a non-null result synchronously or throw an exception
* inheriting from {@link RuntimeException}.
* The MBMS middleware should send this when it wishes to request {@code content://} URIs to
* serve as temp files for downloads or when it wishes to resume paused downloads. Mandatory
* extras are
- * {@link #EXTRA_REQUEST}
+ * {@link #EXTRA_SERVICE_ID}
*
* Optional extras are
* {@link #EXTRA_FD_COUNT} (0 if not present)
public static final String EXTRA_FINAL_URI = "android.telephony.mbms.extra.FINAL_URI";
/**
- * Extra containing an instance of {@link android.telephony.mbms.ServiceInfo}, used by
+ * Extra containing a String representing a service ID, used by
* file-descriptor requests and cleanup requests to specify which service they want to
* request temp files or clean up temp files for, respectively.
*/
- public static final String EXTRA_SERVICE_INFO =
- "android.telephony.mbms.extra.SERVICE_INFO";
+ public static final String EXTRA_SERVICE_ID =
+ "android.telephony.mbms.extra.SERVICE_ID";
/**
* Retrieves the {@link ComponentName} for the {@link android.content.BroadcastReceiver} that