Merge "Unhide EMBMS download API" am: 0285ee851d am: e9b31e8eaf

am: c55378fad4

Change-Id: Ib2a05680a219c45705db30420787d1b8ed827cca
This commit is contained in:
Hall Liu
2017-09-14 10:30:06 +00:00
committed by android-build-merger
16 changed files with 626 additions and 109 deletions

View File

@@ -39910,6 +39910,35 @@ package android.telephony {
field public static final int STATUS_UNKNOWN_ERROR = 4; // 0x4
}
public class MbmsDownloadManager {
method public void cancelDownload(android.telephony.mbms.DownloadRequest) throws android.telephony.mbms.MbmsException;
method public static android.telephony.MbmsDownloadManager create(android.content.Context, android.telephony.mbms.MbmsDownloadManagerCallback) throws android.telephony.mbms.MbmsException;
method public static android.telephony.MbmsDownloadManager create(android.content.Context, android.telephony.mbms.MbmsDownloadManagerCallback, android.os.Handler) throws android.telephony.mbms.MbmsException;
method public static android.telephony.MbmsDownloadManager create(android.content.Context, android.telephony.mbms.MbmsDownloadManagerCallback, int) throws android.telephony.mbms.MbmsException;
method public static android.telephony.MbmsDownloadManager create(android.content.Context, android.telephony.mbms.MbmsDownloadManagerCallback, int, android.os.Handler) throws android.telephony.mbms.MbmsException;
method public void dispose();
method public void download(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStateCallback, android.os.Handler) throws android.telephony.mbms.MbmsException;
method public int getDownloadStatus(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo) throws android.telephony.mbms.MbmsException;
method public void getFileServices(java.util.List<java.lang.String>) throws android.telephony.mbms.MbmsException;
method public java.io.File getTempFileRootDirectory();
method public java.util.List<android.telephony.mbms.DownloadRequest> listPendingDownloads() throws android.telephony.mbms.MbmsException;
method public void resetDownloadKnowledge(android.telephony.mbms.DownloadRequest) throws android.telephony.mbms.MbmsException;
method public void setTempFileRootDirectory(java.io.File) throws android.telephony.mbms.MbmsException;
field public static final java.lang.String DEFAULT_TOP_LEVEL_TEMP_DIRECTORY = "androidMbmsTempFileRoot";
field public static final java.lang.String EXTRA_MBMS_COMPLETED_FILE_URI = "android.telephony.extra.MBMS_COMPLETED_FILE_URI";
field public static final java.lang.String EXTRA_MBMS_DOWNLOAD_RESULT = "android.telephony.extra.MBMS_DOWNLOAD_RESULT";
field public static final java.lang.String EXTRA_MBMS_FILE_INFO = "android.telephony.extra.MBMS_FILE_INFO";
field public static final int RESULT_CANCELLED = 2; // 0x2
field public static final int RESULT_EXPIRED = 3; // 0x3
field public static final int RESULT_IO_ERROR = 4; // 0x4
field public static final int RESULT_SUCCESSFUL = 1; // 0x1
field public static final int STATUS_ACTIVELY_DOWNLOADING = 1; // 0x1
field public static final int STATUS_PENDING_DOWNLOAD = 2; // 0x2
field public static final int STATUS_PENDING_DOWNLOAD_WINDOW = 4; // 0x4
field public static final int STATUS_PENDING_REPAIR = 3; // 0x3
field public static final int STATUS_UNKNOWN = 0; // 0x0
}
public class MbmsStreamingManager {
method public static android.telephony.MbmsStreamingManager create(android.content.Context, android.telephony.mbms.MbmsStreamingManagerCallback, int, android.os.Handler) throws android.telephony.mbms.MbmsException;
method public static android.telephony.MbmsStreamingManager create(android.content.Context, android.telephony.mbms.MbmsStreamingManagerCallback, android.os.Handler) throws android.telephony.mbms.MbmsException;
@@ -40551,6 +40580,62 @@ package android.telephony.gsm {
package android.telephony.mbms {
public final class DownloadRequest implements android.os.Parcelable {
method public static android.telephony.mbms.DownloadRequest copy(android.telephony.mbms.DownloadRequest);
method public int describeContents();
method public android.net.Uri getDestinationUri();
method public java.lang.String getFileServiceId();
method public static int getMaxAppIntentSize();
method public static int getMaxDestinationUriSize();
method public android.net.Uri getSourceUri();
method public int getSubscriptionId();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.telephony.mbms.DownloadRequest> CREATOR;
}
public static class DownloadRequest.Builder {
ctor public DownloadRequest.Builder();
method public android.telephony.mbms.DownloadRequest build();
method public android.telephony.mbms.DownloadRequest.Builder setAppIntent(android.content.Intent);
method public android.telephony.mbms.DownloadRequest.Builder setDest(android.net.Uri);
method public android.telephony.mbms.DownloadRequest.Builder setServiceInfo(android.telephony.mbms.FileServiceInfo);
method public android.telephony.mbms.DownloadRequest.Builder setSource(android.net.Uri);
method public android.telephony.mbms.DownloadRequest.Builder setSubscriptionId(int);
}
public class DownloadStateCallback {
ctor public DownloadStateCallback();
method public void onProgressUpdated(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo, int, int, int, int);
method public void onStateChanged(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo, int);
}
public final class FileInfo implements android.os.Parcelable {
method public int describeContents();
method public java.lang.String getMimeType();
method public android.net.Uri getUri();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.telephony.mbms.FileInfo> CREATOR;
}
public final class FileServiceInfo extends android.telephony.mbms.ServiceInfo implements android.os.Parcelable {
method public int describeContents();
method public java.util.List<android.telephony.mbms.FileInfo> getFiles();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.telephony.mbms.FileServiceInfo> CREATOR;
}
public class MbmsDownloadManagerCallback {
ctor public MbmsDownloadManagerCallback();
method public void onError(int, java.lang.String);
method public void onFileServicesUpdated(java.util.List<android.telephony.mbms.FileServiceInfo>);
method public void onMiddlewareReady();
}
public class MbmsDownloadReceiver extends android.content.BroadcastReceiver {
ctor public MbmsDownloadReceiver();
method public void onReceive(android.content.Context, android.content.Intent);
}
public class MbmsException extends java.lang.Exception {
method public int getErrorCode();
field public static final int ERROR_MIDDLEWARE_LOST = 3; // 0x3
@@ -40559,6 +40644,11 @@ package android.telephony.mbms {
field public static final int SUCCESS = 0; // 0x0
}
public static class MbmsException.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
}
public static class MbmsException.GeneralErrors {
field public static final int ERROR_CARRIER_CHANGE_NOT_ALLOWED = 207; // 0xcf
field public static final int ERROR_IN_E911 = 204; // 0xcc

View File

@@ -43349,6 +43349,36 @@ package android.telephony {
field public static final int STATUS_UNKNOWN_ERROR = 4; // 0x4
}
public class MbmsDownloadManager {
method public void cancelDownload(android.telephony.mbms.DownloadRequest) throws android.telephony.mbms.MbmsException;
method public static android.telephony.MbmsDownloadManager create(android.content.Context, android.telephony.mbms.MbmsDownloadManagerCallback) throws android.telephony.mbms.MbmsException;
method public static android.telephony.MbmsDownloadManager create(android.content.Context, android.telephony.mbms.MbmsDownloadManagerCallback, android.os.Handler) throws android.telephony.mbms.MbmsException;
method public static android.telephony.MbmsDownloadManager create(android.content.Context, android.telephony.mbms.MbmsDownloadManagerCallback, int) throws android.telephony.mbms.MbmsException;
method public static android.telephony.MbmsDownloadManager create(android.content.Context, android.telephony.mbms.MbmsDownloadManagerCallback, int, android.os.Handler) throws android.telephony.mbms.MbmsException;
method public void dispose();
method public void download(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStateCallback, android.os.Handler) throws android.telephony.mbms.MbmsException;
method public int getDownloadStatus(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo) throws android.telephony.mbms.MbmsException;
method public void getFileServices(java.util.List<java.lang.String>) throws android.telephony.mbms.MbmsException;
method public java.io.File getTempFileRootDirectory();
method public java.util.List<android.telephony.mbms.DownloadRequest> listPendingDownloads() throws android.telephony.mbms.MbmsException;
method public void resetDownloadKnowledge(android.telephony.mbms.DownloadRequest) throws android.telephony.mbms.MbmsException;
method public void setTempFileRootDirectory(java.io.File) throws android.telephony.mbms.MbmsException;
field public static final java.lang.String DEFAULT_TOP_LEVEL_TEMP_DIRECTORY = "androidMbmsTempFileRoot";
field public static final java.lang.String EXTRA_MBMS_COMPLETED_FILE_URI = "android.telephony.extra.MBMS_COMPLETED_FILE_URI";
field public static final java.lang.String EXTRA_MBMS_DOWNLOAD_RESULT = "android.telephony.extra.MBMS_DOWNLOAD_RESULT";
field public static final java.lang.String EXTRA_MBMS_FILE_INFO = "android.telephony.extra.MBMS_FILE_INFO";
field public static final java.lang.String MBMS_DOWNLOAD_SERVICE_ACTION = "android.telephony.action.EmbmsDownload";
field public static final int RESULT_CANCELLED = 2; // 0x2
field public static final int RESULT_EXPIRED = 3; // 0x3
field public static final int RESULT_IO_ERROR = 4; // 0x4
field public static final int RESULT_SUCCESSFUL = 1; // 0x1
field public static final int STATUS_ACTIVELY_DOWNLOADING = 1; // 0x1
field public static final int STATUS_PENDING_DOWNLOAD = 2; // 0x2
field public static final int STATUS_PENDING_DOWNLOAD_WINDOW = 4; // 0x4
field public static final int STATUS_PENDING_REPAIR = 3; // 0x3
field public static final int STATUS_UNKNOWN = 0; // 0x0
}
public class MbmsStreamingManager {
method public static android.telephony.MbmsStreamingManager create(android.content.Context, android.telephony.mbms.MbmsStreamingManagerCallback, int, android.os.Handler) throws android.telephony.mbms.MbmsException;
method public static android.telephony.MbmsStreamingManager create(android.content.Context, android.telephony.mbms.MbmsStreamingManagerCallback, android.os.Handler) throws android.telephony.mbms.MbmsException;
@@ -44108,6 +44138,73 @@ package android.telephony.ims {
package android.telephony.mbms {
public final class DownloadRequest implements android.os.Parcelable {
method public static android.telephony.mbms.DownloadRequest copy(android.telephony.mbms.DownloadRequest);
method public int describeContents();
method public android.net.Uri getDestinationUri();
method public java.lang.String getFileServiceId();
method public static int getMaxAppIntentSize();
method public static int getMaxDestinationUriSize();
method public byte[] getOpaqueData();
method public android.net.Uri getSourceUri();
method public int getSubscriptionId();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.telephony.mbms.DownloadRequest> CREATOR;
}
public static class DownloadRequest.Builder {
ctor public DownloadRequest.Builder();
method public android.telephony.mbms.DownloadRequest build();
method public android.telephony.mbms.DownloadRequest.Builder setAppIntent(android.content.Intent);
method public android.telephony.mbms.DownloadRequest.Builder setDest(android.net.Uri);
method public android.telephony.mbms.DownloadRequest.Builder setOpaqueData(byte[]);
method public android.telephony.mbms.DownloadRequest.Builder setServiceId(java.lang.String);
method public android.telephony.mbms.DownloadRequest.Builder setServiceInfo(android.telephony.mbms.FileServiceInfo);
method public android.telephony.mbms.DownloadRequest.Builder setSource(android.net.Uri);
method public android.telephony.mbms.DownloadRequest.Builder setSubscriptionId(int);
}
public class DownloadStateCallback {
ctor public DownloadStateCallback();
method public void onProgressUpdated(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo, int, int, int, int);
method public void onStateChanged(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo, int);
}
public final class FileInfo implements android.os.Parcelable {
ctor public FileInfo(android.net.Uri, java.lang.String);
method public int describeContents();
method public java.lang.String getMimeType();
method public android.net.Uri getUri();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.telephony.mbms.FileInfo> CREATOR;
}
public final class FileServiceInfo extends android.telephony.mbms.ServiceInfo implements android.os.Parcelable {
ctor public FileServiceInfo(java.util.Map<java.util.Locale, java.lang.String>, java.lang.String, java.util.List<java.util.Locale>, java.lang.String, java.util.Date, java.util.Date, java.util.List<android.telephony.mbms.FileInfo>);
method public int describeContents();
method public java.util.List<android.telephony.mbms.FileInfo> getFiles();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.telephony.mbms.FileServiceInfo> CREATOR;
}
public class MbmsDownloadManagerCallback {
ctor public MbmsDownloadManagerCallback();
method public void onError(int, java.lang.String);
method public void onFileServicesUpdated(java.util.List<android.telephony.mbms.FileServiceInfo>);
method public void onMiddlewareReady();
}
public class MbmsDownloadReceiver extends android.content.BroadcastReceiver {
ctor public MbmsDownloadReceiver();
method public void onReceive(android.content.Context, android.content.Intent);
field public static final int RESULT_BAD_TEMP_FILE_ROOT = 3; // 0x3
field public static final int RESULT_DOWNLOAD_FINALIZATION_ERROR = 4; // 0x4
field public static final int RESULT_INVALID_ACTION = 1; // 0x1
field public static final int RESULT_MALFORMED_INTENT = 2; // 0x2
field public static final int RESULT_OK = 0; // 0x0
field public static final int RESULT_TEMP_FILE_GENERATION_ERROR = 5; // 0x5
}
public class MbmsException extends java.lang.Exception {
method public int getErrorCode();
field public static final int ERROR_MIDDLEWARE_LOST = 3; // 0x3
@@ -44116,6 +44213,11 @@ package android.telephony.mbms {
field public static final int SUCCESS = 0; // 0x0
}
public static class MbmsException.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
}
public static class MbmsException.GeneralErrors {
field public static final int ERROR_CARRIER_CHANGE_NOT_ALLOWED = 207; // 0xcf
field public static final int ERROR_IN_E911 = 204; // 0xcc
@@ -44190,10 +44292,32 @@ package android.telephony.mbms {
field public static final android.os.Parcelable.Creator<android.telephony.mbms.StreamingServiceInfo> CREATOR;
}
public final class UriPathPair implements android.os.Parcelable {
method public int describeContents();
method public android.net.Uri getContentUri();
method public android.net.Uri getFilePathUri();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.telephony.mbms.UriPathPair> CREATOR;
}
}
package android.telephony.mbms.vendor {
public class MbmsDownloadServiceBase extends android.os.Binder {
ctor public MbmsDownloadServiceBase();
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, android.telephony.mbms.DownloadStateCallback);
method public int getDownloadStatus(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo) throws android.os.RemoteException;
method public int getFileServices(int, java.util.List<java.lang.String>) throws android.os.RemoteException;
method public int initialize(int, android.telephony.mbms.MbmsDownloadManagerCallback) 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 resetDownloadKnowledge(android.telephony.mbms.DownloadRequest) throws android.os.RemoteException;
method public int setTempFileRootDirectory(int, java.lang.String) throws android.os.RemoteException;
}
public class MbmsStreamingServiceBase extends android.os.Binder {
ctor public MbmsStreamingServiceBase();
method public void dispose(int) throws android.os.RemoteException;
@@ -44206,6 +44330,24 @@ package android.telephony.mbms.vendor {
method public void stopStreaming(int, java.lang.String) throws android.os.RemoteException;
}
public class VendorUtils {
ctor public VendorUtils();
method public static android.content.ComponentName getAppReceiverFromPackageName(android.content.Context, java.lang.String);
field public static final java.lang.String ACTION_CLEANUP = "android.telephony.mbms.action.CLEANUP";
field public static final java.lang.String ACTION_DOWNLOAD_RESULT_INTERNAL = "android.telephony.mbms.action.DOWNLOAD_RESULT_INTERNAL";
field public static final java.lang.String ACTION_FILE_DESCRIPTOR_REQUEST = "android.telephony.mbms.action.FILE_DESCRIPTOR_REQUEST";
field public static final java.lang.String EXTRA_FD_COUNT = "android.telephony.mbms.extra.FD_COUNT";
field public static final java.lang.String EXTRA_FINAL_URI = "android.telephony.mbms.extra.FINAL_URI";
field public static final java.lang.String EXTRA_FREE_URI_LIST = "android.telephony.mbms.extra.FREE_URI_LIST";
field public static final java.lang.String EXTRA_PAUSED_LIST = "android.telephony.mbms.extra.PAUSED_LIST";
field public static final java.lang.String EXTRA_PAUSED_URI_LIST = "android.telephony.mbms.extra.PAUSED_URI_LIST";
field public static final java.lang.String EXTRA_REQUEST = "android.telephony.mbms.extra.REQUEST";
field public static final java.lang.String EXTRA_SERVICE_ID = "android.telephony.mbms.extra.SERVICE_ID";
field public static final java.lang.String EXTRA_TEMP_FILES_IN_USE = "android.telephony.mbms.extra.TEMP_FILES_IN_USE";
field public static final java.lang.String EXTRA_TEMP_FILE_ROOT = "android.telephony.mbms.extra.TEMP_FILE_ROOT";
field public static final java.lang.String EXTRA_TEMP_LIST = "android.telephony.mbms.extra.TEMP_LIST";
}
}
package android.test {

View File

@@ -40181,6 +40181,35 @@ package android.telephony {
field public static final int STATUS_UNKNOWN_ERROR = 4; // 0x4
}
public class MbmsDownloadManager {
method public void cancelDownload(android.telephony.mbms.DownloadRequest) throws android.telephony.mbms.MbmsException;
method public static android.telephony.MbmsDownloadManager create(android.content.Context, android.telephony.mbms.MbmsDownloadManagerCallback) throws android.telephony.mbms.MbmsException;
method public static android.telephony.MbmsDownloadManager create(android.content.Context, android.telephony.mbms.MbmsDownloadManagerCallback, android.os.Handler) throws android.telephony.mbms.MbmsException;
method public static android.telephony.MbmsDownloadManager create(android.content.Context, android.telephony.mbms.MbmsDownloadManagerCallback, int) throws android.telephony.mbms.MbmsException;
method public static android.telephony.MbmsDownloadManager create(android.content.Context, android.telephony.mbms.MbmsDownloadManagerCallback, int, android.os.Handler) throws android.telephony.mbms.MbmsException;
method public void dispose();
method public void download(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStateCallback, android.os.Handler) throws android.telephony.mbms.MbmsException;
method public int getDownloadStatus(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo) throws android.telephony.mbms.MbmsException;
method public void getFileServices(java.util.List<java.lang.String>) throws android.telephony.mbms.MbmsException;
method public java.io.File getTempFileRootDirectory();
method public java.util.List<android.telephony.mbms.DownloadRequest> listPendingDownloads() throws android.telephony.mbms.MbmsException;
method public void resetDownloadKnowledge(android.telephony.mbms.DownloadRequest) throws android.telephony.mbms.MbmsException;
method public void setTempFileRootDirectory(java.io.File) throws android.telephony.mbms.MbmsException;
field public static final java.lang.String DEFAULT_TOP_LEVEL_TEMP_DIRECTORY = "androidMbmsTempFileRoot";
field public static final java.lang.String EXTRA_MBMS_COMPLETED_FILE_URI = "android.telephony.extra.MBMS_COMPLETED_FILE_URI";
field public static final java.lang.String EXTRA_MBMS_DOWNLOAD_RESULT = "android.telephony.extra.MBMS_DOWNLOAD_RESULT";
field public static final java.lang.String EXTRA_MBMS_FILE_INFO = "android.telephony.extra.MBMS_FILE_INFO";
field public static final int RESULT_CANCELLED = 2; // 0x2
field public static final int RESULT_EXPIRED = 3; // 0x3
field public static final int RESULT_IO_ERROR = 4; // 0x4
field public static final int RESULT_SUCCESSFUL = 1; // 0x1
field public static final int STATUS_ACTIVELY_DOWNLOADING = 1; // 0x1
field public static final int STATUS_PENDING_DOWNLOAD = 2; // 0x2
field public static final int STATUS_PENDING_DOWNLOAD_WINDOW = 4; // 0x4
field public static final int STATUS_PENDING_REPAIR = 3; // 0x3
field public static final int STATUS_UNKNOWN = 0; // 0x0
}
public class MbmsStreamingManager {
method public static android.telephony.MbmsStreamingManager create(android.content.Context, android.telephony.mbms.MbmsStreamingManagerCallback, int, android.os.Handler) throws android.telephony.mbms.MbmsException;
method public static android.telephony.MbmsStreamingManager create(android.content.Context, android.telephony.mbms.MbmsStreamingManagerCallback, android.os.Handler) throws android.telephony.mbms.MbmsException;
@@ -40822,6 +40851,62 @@ package android.telephony.gsm {
package android.telephony.mbms {
public final class DownloadRequest implements android.os.Parcelable {
method public static android.telephony.mbms.DownloadRequest copy(android.telephony.mbms.DownloadRequest);
method public int describeContents();
method public android.net.Uri getDestinationUri();
method public java.lang.String getFileServiceId();
method public static int getMaxAppIntentSize();
method public static int getMaxDestinationUriSize();
method public android.net.Uri getSourceUri();
method public int getSubscriptionId();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.telephony.mbms.DownloadRequest> CREATOR;
}
public static class DownloadRequest.Builder {
ctor public DownloadRequest.Builder();
method public android.telephony.mbms.DownloadRequest build();
method public android.telephony.mbms.DownloadRequest.Builder setAppIntent(android.content.Intent);
method public android.telephony.mbms.DownloadRequest.Builder setDest(android.net.Uri);
method public android.telephony.mbms.DownloadRequest.Builder setServiceInfo(android.telephony.mbms.FileServiceInfo);
method public android.telephony.mbms.DownloadRequest.Builder setSource(android.net.Uri);
method public android.telephony.mbms.DownloadRequest.Builder setSubscriptionId(int);
}
public class DownloadStateCallback {
ctor public DownloadStateCallback();
method public void onProgressUpdated(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo, int, int, int, int);
method public void onStateChanged(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo, int);
}
public final class FileInfo implements android.os.Parcelable {
method public int describeContents();
method public java.lang.String getMimeType();
method public android.net.Uri getUri();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.telephony.mbms.FileInfo> CREATOR;
}
public final class FileServiceInfo extends android.telephony.mbms.ServiceInfo implements android.os.Parcelable {
method public int describeContents();
method public java.util.List<android.telephony.mbms.FileInfo> getFiles();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.telephony.mbms.FileServiceInfo> CREATOR;
}
public class MbmsDownloadManagerCallback {
ctor public MbmsDownloadManagerCallback();
method public void onError(int, java.lang.String);
method public void onFileServicesUpdated(java.util.List<android.telephony.mbms.FileServiceInfo>);
method public void onMiddlewareReady();
}
public class MbmsDownloadReceiver extends android.content.BroadcastReceiver {
ctor public MbmsDownloadReceiver();
method public void onReceive(android.content.Context, android.content.Intent);
}
public class MbmsException extends java.lang.Exception {
method public int getErrorCode();
field public static final int ERROR_MIDDLEWARE_LOST = 3; // 0x3
@@ -40830,6 +40915,11 @@ package android.telephony.mbms {
field public static final int SUCCESS = 0; // 0x0
}
public static class MbmsException.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
}
public static class MbmsException.GeneralErrors {
field public static final int ERROR_CARRIER_CHANGE_NOT_ALLOWED = 207; // 0xcf
field public static final int ERROR_IN_E911 = 204; // 0xcc

View File

@@ -27,11 +27,15 @@ import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
import android.telephony.mbms.DownloadStateCallback;
import android.telephony.mbms.FileInfo;
import android.telephony.mbms.DownloadRequest;
import android.telephony.mbms.InternalDownloadManagerCallback;
import android.telephony.mbms.InternalDownloadStateCallback;
import android.telephony.mbms.MbmsDownloadManagerCallback;
import android.telephony.mbms.MbmsDownloadReceiver;
import android.telephony.mbms.MbmsException;
@@ -52,7 +56,6 @@ import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
/**
* This class provides functionality for file download over MBMS.
* @hide
*/
public class MbmsDownloadManager {
private static final String LOG_TAG = MbmsDownloadManager.class.getSimpleName();
@@ -76,7 +79,8 @@ public class MbmsDownloadManager {
*
* This extra may also be used by the middleware when it is sending intents to the app.
*/
public static final String EXTRA_RESULT = "android.telephony.mbms.extra.RESULT";
public static final String EXTRA_MBMS_DOWNLOAD_RESULT =
"android.telephony.extra.MBMS_DOWNLOAD_RESULT";
/**
* {@link FileInfo} extra that Android will attach to the intent supplied via
@@ -85,21 +89,21 @@ public class MbmsDownloadManager {
*
* This extra may also be used by the middleware when it is sending intents to the app.
*/
public static final String EXTRA_FILE_INFO = "android.telephony.mbms.extra.FILE_INFO";
public static final String EXTRA_MBMS_FILE_INFO = "android.telephony.extra.MBMS_FILE_INFO";
/**
* {@link Uri} extra that Android will attach to the intent supplied via
* {@link android.telephony.mbms.DownloadRequest.Builder#setAppIntent(Intent)}
* Indicates the location of the successfully
* downloaded file. Will always be set to a non-null value if {@link #EXTRA_RESULT} is set to
* {@link #RESULT_SUCCESSFUL}.
* downloaded file. Will always be set to a non-null value if
* {@link #EXTRA_MBMS_DOWNLOAD_RESULT} is set to {@link #RESULT_SUCCESSFUL}.
*/
public static final String EXTRA_COMPLETED_FILE_URI =
"android.telephony.mbms.extra.COMPLETED_FILE_URI";
public static final String EXTRA_MBMS_COMPLETED_FILE_URI =
"android.telephony.extra.MBMS_COMPLETED_FILE_URI";
/**
* The default directory name for all MBMS temp files. If you call
* {@link #download(DownloadRequest, DownloadStateCallback)} without first calling
* {@link #download(DownloadRequest, DownloadStateCallback, Handler)} without first calling
* {@link #setTempFileRootDirectory(File)}, this directory will be created for you under the
* path returned by {@link Context#getFilesDir()}.
*/
@@ -173,24 +177,47 @@ public class MbmsDownloadManager {
};
private AtomicReference<IMbmsDownloadService> mService = new AtomicReference<>(null);
private final MbmsDownloadManagerCallback mCallback;
private final InternalDownloadManagerCallback mInternalCallback;
private MbmsDownloadManager(Context context, MbmsDownloadManagerCallback callback, int subId) {
private MbmsDownloadManager(Context context, MbmsDownloadManagerCallback callback,
int subscriptionId, Handler handler) {
mContext = context;
mCallback = callback;
mSubscriptionId = subId;
mSubscriptionId = subscriptionId;
if (handler == null) {
handler = new Handler(Looper.myLooper());
}
mInternalCallback = new InternalDownloadManagerCallback(callback, handler);
}
/**
* Create a new MbmsDownloadManager using the system default data subscription ID and default
* {@link Handler}
* See {@link #create(Context, MbmsDownloadManagerCallback, int, Handler)}
*/
public static MbmsDownloadManager create(Context context,
MbmsDownloadManagerCallback callback)
throws MbmsException {
return create(context, callback, SubscriptionManager.getDefaultSubscriptionId(), null);
}
/**
* Create a new MbmsDownloadManager using the system default data subscription ID.
* See {@link #create(Context, MbmsDownloadManagerCallback, int)}
*
* @hide
* See {@link #create(Context, MbmsDownloadManagerCallback, int, Handler)}
*/
public static MbmsDownloadManager create(Context context,
MbmsDownloadManagerCallback listener)
MbmsDownloadManagerCallback callback, Handler handler)
throws MbmsException {
return create(context, listener, SubscriptionManager.getDefaultSubscriptionId());
return create(context, callback, SubscriptionManager.getDefaultSubscriptionId(), handler);
}
/**
* Create a new MbmsDownloadManager using the default {@link Handler}
* See {@link #create(Context, MbmsDownloadManagerCallback, int, Handler)}
*/
public static MbmsDownloadManager create(Context context,
MbmsDownloadManagerCallback callback, int subscriptionId)
throws MbmsException {
return create(context, callback, subscriptionId, null);
}
/**
@@ -198,7 +225,7 @@ public class MbmsDownloadManager {
*
* Note that this call will bind a remote service and that may take a bit. The instance of
* {@link MbmsDownloadManager} that is returned will not be ready for use until
* {@link MbmsDownloadManagerCallback#middlewareReady()} is called on the provided callback.
* {@link MbmsDownloadManagerCallback#onMiddlewareReady()} is called on the provided callback.
* If you attempt to use the manager before it is ready, a {@link MbmsException} will be thrown.
*
* This also may throw an {@link IllegalArgumentException} or an {@link IllegalStateException}.
@@ -208,7 +235,7 @@ public class MbmsDownloadManager {
* (in other words, one that has not had {@link #dispose()} called on it), this method will
* throw an {@link MbmsException}. If you call this method in a different process
* running under the same UID, an error will be indicated via
* {@link MbmsDownloadManagerCallback#error(int, String)}.
* {@link MbmsDownloadManagerCallback#onError(int, String)}.
*
* Note that initialization may fail asynchronously. If you wish to try again after you
* receive such an asynchronous error, you must call dispose() on the instance of
@@ -217,15 +244,15 @@ public class MbmsDownloadManager {
* @param context The instance of {@link Context} to use
* @param listener A callback to get asynchronous error messages and file service updates.
* @param subscriptionId The data subscription ID to use
* @hide
*/
public static MbmsDownloadManager create(Context context,
MbmsDownloadManagerCallback listener, int subscriptionId)
MbmsDownloadManagerCallback listener, int subscriptionId, Handler handler)
throws MbmsException {
if (!sIsInitialized.compareAndSet(false, true)) {
throw new MbmsException(MbmsException.InitializationErrors.ERROR_DUPLICATE_INITIALIZE);
}
MbmsDownloadManager mdm = new MbmsDownloadManager(context, listener, subscriptionId);
MbmsDownloadManager mdm =
new MbmsDownloadManager(context, listener, subscriptionId, handler);
try {
mdm.bindAndInitialize();
} catch (MbmsException e) {
@@ -244,7 +271,7 @@ public class MbmsDownloadManager {
IMbmsDownloadService.Stub.asInterface(service);
int result;
try {
result = downloadService.initialize(mSubscriptionId, mCallback);
result = downloadService.initialize(mSubscriptionId, mInternalCallback);
} catch (RemoteException e) {
Log.e(LOG_TAG, "Service died before initialization");
sIsInitialized.set(false);
@@ -285,7 +312,7 @@ public class MbmsDownloadManager {
* An inspection API to retrieve the list of available
* {@link android.telephony.mbms.FileServiceInfo}s currently being advertised.
* The results are returned asynchronously via a call to
* {@link MbmsDownloadManagerCallback#fileServicesUpdated(List)}
* {@link MbmsDownloadManagerCallback#onFileServicesUpdated(List)}
*
* The serviceClasses argument lets the app filter on types of programming and is opaque data
* negotiated beforehand between the app and the carrier.
@@ -294,12 +321,12 @@ public class MbmsDownloadManager {
* {@link MbmsException#ERROR_MIDDLEWARE_NOT_BOUND}
* {@link MbmsException#ERROR_MIDDLEWARE_LOST}
*
* Asynchronous error codes via the {@link MbmsDownloadManagerCallback#error(int, String)}
* Asynchronous error codes via the {@link MbmsDownloadManagerCallback#onError(int, String)}
* callback can include any of the errors except:
* {@link MbmsException.StreamingErrors#ERROR_UNABLE_TO_START_SERVICE}
*
* @param classList A list of service classes which the app wishes to receive
* {@link MbmsDownloadManagerCallback#fileServicesUpdated(List)} callbacks
* {@link MbmsDownloadManagerCallback#onFileServicesUpdated(List)} callbacks
* about. Subsequent calls to this method will replace this list of service
* classes (i.e. the middleware will no longer send updates for services
* matching classes only in the old list).
@@ -329,7 +356,7 @@ public class MbmsDownloadManager {
* 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, DownloadStateCallback)}, the framework
* {@link #download(DownloadRequest, DownloadStateCallback, Handler)}, 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}.
*
@@ -380,9 +407,9 @@ public class MbmsDownloadManager {
/**
* 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, 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.
* {@link #download(DownloadRequest, DownloadStateCallback, Handler)} 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 {@code null}.
*
* @return A {@link File} pointing to the configured temp file directory, or null if not yet
* configured.
@@ -410,11 +437,15 @@ public class MbmsDownloadManager {
* Asynchronous errors through the listener include any of the errors
*
* @param request The request that specifies what should be downloaded
* @param progressListener Optional listener that will be provided progress updates
* @param stateCallback Optional listener that will be provided progress updates
* if the app is running. If {@code null}, no callbacks will be
* provided.
* @param handler A handler that calls to {@code stateCallback} should be called on. If
* null, defaults to the handler provided via
* {@link #create(Context, MbmsDownloadManagerCallback, int, Handler)}
*/
public void download(DownloadRequest request, @Nullable DownloadStateCallback progressListener)
public void download(DownloadRequest request, @Nullable DownloadStateCallback stateCallback,
Handler handler)
throws MbmsException {
IMbmsDownloadService downloadService = mService.get();
if (downloadService == null) {
@@ -430,11 +461,16 @@ public class MbmsDownloadManager {
tempRootDirectory.mkdirs();
setTempFileRootDirectory(tempRootDirectory);
}
InternalDownloadStateCallback internalCallback = null;
if (stateCallback != null) {
internalCallback = new InternalDownloadStateCallback(stateCallback,
handler == null ? mInternalCallback.getHandler() : handler);
}
checkValidDownloadDestination(request);
writeDownloadRequestToken(request);
try {
downloadService.download(request, progressListener);
downloadService.download(request, internalCallback);
} catch (RemoteException e) {
mService.set(null);
throw new MbmsException(MbmsException.ERROR_MIDDLEWARE_LOST);
@@ -444,7 +480,7 @@ public class MbmsDownloadManager {
/**
* 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, DownloadStateCallback)} but not cancelled through
* {@link #download(DownloadRequest, DownloadStateCallback, Handler)} but not cancelled through
* {@link #cancelDownload(DownloadRequest)}.
* @return A list, possibly empty, of {@link DownloadRequest}s
*/
@@ -636,7 +672,7 @@ public class MbmsDownloadManager {
private void sendErrorToApp(int errorCode, String message) {
try {
mCallback.error(errorCode, message);
mInternalCallback.error(errorCode, message);
} catch (RemoteException e) {
// Ignore, should not happen locally.
}

View File

@@ -41,23 +41,16 @@ import java.util.Objects;
* Describes a request to download files over cell-broadcast. Instances of this class should be
* created by the app when requesting a download, and instances of this class will be passed back
* to the app when the middleware updates the status of the download.
* @hide
*/
public class DownloadRequest implements Parcelable {
public final class DownloadRequest implements Parcelable {
// Version code used to keep token calculation consistent.
private static final int CURRENT_VERSION = 1;
private static final String LOG_TAG = "MbmsDownloadRequest";
/**
* Maximum permissible length for the app's download-completion intent, when serialized via
* {@link Intent#toUri(int)}.
*/
/** @hide */
public static final int MAX_APP_INTENT_SIZE = 50000;
/**
* Maximum permissible length for the app's destination path, when serialized via
* {@link Uri#toString()}.
*/
/** @hide */
public static final int MAX_DESTINATION_URI_SIZE = 50000;
/** @hide */
@@ -95,7 +88,7 @@ public class DownloadRequest implements Parcelable {
* Set the service ID for the download request. For use by the middleware only.
* @hide
*/
//@SystemApi
@SystemApi
public Builder setServiceId(String serviceId) {
fileServiceId = serviceId;
return this;
@@ -104,7 +97,6 @@ public class DownloadRequest implements Parcelable {
/**
* Sets the source URI for the download request to be built.
* @param source
* @return
*/
public Builder setSource(Uri source) {
this.source = source;
@@ -116,7 +108,6 @@ public class DownloadRequest implements Parcelable {
* not set this directly.
* @param dest A URI obtained from {@link Uri#fromFile(File)}, denoting the requested
* final destination of the download.
* @return
*/
public Builder setDest(Uri dest) {
if (dest.toString().length() > MAX_DESTINATION_URI_SIZE) {
@@ -130,7 +121,6 @@ public class DownloadRequest implements Parcelable {
/**
* Set the subscription ID on which the file(s) should be downloaded.
* @param subscriptionId
* @return
*/
public Builder setSubscriptionId(int subscriptionId) {
this.subscriptionId = subscriptionId;
@@ -144,7 +134,6 @@ public class DownloadRequest implements Parcelable {
*
* The middleware should not use this method.
* @param intent
* @return
*/
public Builder setAppIntent(Intent intent) {
this.appIntent = intent.toUri(0);
@@ -161,10 +150,9 @@ public class DownloadRequest implements Parcelable {
* manager code, but is irrelevant to the middleware.
* @param data A byte array, the contents of which should have been originally obtained
* from {@link DownloadRequest#getOpaqueData()}.
* @return
* @hide
*/
//@SystemApi
@SystemApi
public Builder setOpaqueData(byte[] data) {
try {
ObjectInputStream stream = new ObjectInputStream(new ByteArrayInputStream(data));
@@ -291,7 +279,7 @@ public class DownloadRequest implements Parcelable {
* @return A byte array of opaque data to persist.
* @hide
*/
//@SystemApi
@SystemApi
public byte[] getOpaqueData() {
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
@@ -323,6 +311,22 @@ public class DownloadRequest implements Parcelable {
}
};
/**
* Maximum permissible length for the app's destination path, when serialized via
* {@link Uri#toString()}.
*/
public static int getMaxAppIntentSize() {
return MAX_APP_INTENT_SIZE;
}
/**
* Maximum permissible length for the app's download-completion intent, when serialized via
* {@link Intent#toUri(int)}.
*/
public static int getMaxDestinationUriSize() {
return MAX_DESTINATION_URI_SIZE;
}
/**
* @hide
*/

View File

@@ -16,19 +16,19 @@
package android.telephony.mbms;
import android.os.RemoteException;
import android.os.Handler;
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, DownloadStateCallback)}
* {@link android.telephony.MbmsDownloadManager#download(
* DownloadRequest, DownloadStateCallback, Handler)}
*
* This is optionally specified when requesting a download and will only be called while the app
* is running.
* @hide
*/
public class DownloadStateCallback extends IDownloadStateCallback.Stub {
public class DownloadStateCallback {
/**
* Called when the middleware wants to report progress for a file in a {@link DownloadRequest}.
@@ -44,10 +44,9 @@ public class DownloadStateCallback extends IDownloadStateCallback.Stub {
* @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.
*/
@Override
public void progress(DownloadRequest request, FileInfo fileInfo,
public void onProgressUpdated(DownloadRequest request, FileInfo fileInfo,
int currentDownloadSize, int fullDownloadSize,
int currentDecodedSize, int fullDecodedSize) throws RemoteException {
int currentDecodedSize, int fullDecodedSize) {
}
/**
@@ -59,8 +58,7 @@ public class DownloadStateCallback extends IDownloadStateCallback.Stub {
* 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,
public void onStateChanged(DownloadRequest request, FileInfo fileInfo,
@MbmsDownloadManager.DownloadStatus int state) {
}
}

View File

@@ -23,9 +23,8 @@ import android.os.Parcelable;
/**
* Describes a single file that is available over MBMS.
* @hide
*/
public class FileInfo implements Parcelable {
public final class FileInfo implements Parcelable {
private final Uri uri;
@@ -47,7 +46,7 @@ public class FileInfo implements Parcelable {
/**
* @hide
*/
//@SystemApi
@SystemApi
public FileInfo(Uri uri, String mimeType) {
this.uri = uri;
this.mimeType = mimeType;

View File

@@ -29,9 +29,8 @@ import java.util.Map;
/**
* Describes a file service available from the carrier from which files can be downloaded via
* cell-broadcast.
* @hide
*/
public class FileServiceInfo extends ServiceInfo implements Parcelable {
public final class FileServiceInfo extends ServiceInfo implements Parcelable {
private final List<FileInfo> files;
/** @hide */

View File

@@ -0,0 +1,69 @@
/*
* Copyright (C) 2017 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;
import android.os.Handler;
import android.os.RemoteException;
import java.util.List;
/** @hide */
public class InternalDownloadManagerCallback extends IMbmsDownloadManagerCallback.Stub {
private final Handler mHandler;
private final MbmsDownloadManagerCallback mAppCallback;
public InternalDownloadManagerCallback(MbmsDownloadManagerCallback appCallback,
Handler handler) {
mAppCallback = appCallback;
mHandler = handler;
}
@Override
public void error(final int errorCode, final String message) throws RemoteException {
mHandler.post(new Runnable() {
@Override
public void run() {
mAppCallback.onError(errorCode, message);
}
});
}
@Override
public void fileServicesUpdated(final List<FileServiceInfo> services) throws RemoteException {
mHandler.post(new Runnable() {
@Override
public void run() {
mAppCallback.onFileServicesUpdated(services);
}
});
}
@Override
public void middlewareReady() throws RemoteException {
mHandler.post(new Runnable() {
@Override
public void run() {
mAppCallback.onMiddlewareReady();
}
});
}
public Handler getHandler() {
return mHandler;
}
}

View File

@@ -0,0 +1,57 @@
/*
* Copyright (C) 2017 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;
import android.os.Handler;
import android.os.RemoteException;
/**
* @hide
*/
public class InternalDownloadStateCallback extends IDownloadStateCallback.Stub {
private final Handler mHandler;
private final DownloadStateCallback mAppCallback;
public InternalDownloadStateCallback(DownloadStateCallback appCallback, Handler handler) {
mAppCallback = appCallback;
mHandler = handler;
}
@Override
public void progress(final DownloadRequest request, final FileInfo fileInfo,
final int currentDownloadSize, final int fullDownloadSize, final int currentDecodedSize,
final int fullDecodedSize) throws RemoteException {
mHandler.post(new Runnable() {
@Override
public void run() {
mAppCallback.onProgressUpdated(request, fileInfo, currentDownloadSize,
fullDownloadSize, currentDecodedSize, fullDecodedSize);
}
});
}
@Override
public void state(final DownloadRequest request, final FileInfo fileInfo, final int state)
throws RemoteException {
mHandler.post(new Runnable() {
@Override
public void run() {
mAppCallback.onStateChanged(request, fileInfo, state);
}
});
}
}

View File

@@ -16,7 +16,6 @@
package android.telephony.mbms;
import android.os.RemoteException;
import android.telephony.MbmsDownloadManager;
import java.util.List;
@@ -24,19 +23,16 @@ import java.util.List;
/**
* A callback class that apps should use to receive information on file downloads over
* cell-broadcast.
* @hide
*/
public class MbmsDownloadManagerCallback extends IMbmsDownloadManagerCallback.Stub {
public class MbmsDownloadManagerCallback {
/**
* Indicates that the middleware has encountered an asynchronous error.
* @param errorCode Any error code listed in {@link MbmsException}
* @param message A message, intended for debugging purposes, describing the error in further
* detail.
* @throws RemoteException
*/
@Override
public void error(int errorCode, String message) throws RemoteException {
public void onError(int errorCode, String message) {
// default implementation empty
}
@@ -51,8 +47,7 @@ public class MbmsDownloadManagerCallback extends IMbmsDownloadManagerCallback.St
*
* @param services The most recently updated list of available file services.
*/
@Override
public void fileServicesUpdated(List<FileServiceInfo> services) throws RemoteException {
public void onFileServicesUpdated(List<FileServiceInfo> services) {
// default implementation empty
}
@@ -64,8 +59,7 @@ public class MbmsDownloadManagerCallback extends IMbmsDownloadManagerCallback.St
* being thrown with error code {@link MbmsException#ERROR_MIDDLEWARE_NOT_BOUND}
* or {@link MbmsException.GeneralErrors#ERROR_MIDDLEWARE_NOT_YET_READY}
*/
@Override
public void middlewareReady() throws RemoteException {
public void onMiddlewareReady() {
// default implementation empty
}
}

View File

@@ -53,7 +53,6 @@ import java.util.UUID;
android:enabled="true"
android:exported="true">
</receiver>}</pre>
* @hide
*/
public class MbmsDownloadReceiver extends BroadcastReceiver {
/** @hide */
@@ -65,7 +64,7 @@ public class MbmsDownloadReceiver extends BroadcastReceiver {
* Indicates that the requested operation completed without error.
* @hide
*/
//@SystemApi
@SystemApi
public static final int RESULT_OK = 0;
/**
@@ -77,7 +76,7 @@ public class MbmsDownloadReceiver extends BroadcastReceiver {
* This is a fatal result code and no result extras should be expected.
* @hide
*/
//@SystemApi
@SystemApi
public static final int RESULT_INVALID_ACTION = 1;
/**
@@ -85,7 +84,7 @@ public class MbmsDownloadReceiver extends BroadcastReceiver {
* This is a fatal result code and no result extras should be expected.
* @hide
*/
//@SystemApi
@SystemApi
public static final int RESULT_MALFORMED_INTENT = 2;
/**
@@ -94,7 +93,7 @@ public class MbmsDownloadReceiver extends BroadcastReceiver {
* This is a fatal result code and no result extras should be expected.
* @hide
*/
//@SystemApi
@SystemApi
public static final int RESULT_BAD_TEMP_FILE_ROOT = 3;
/**
@@ -102,7 +101,7 @@ public class MbmsDownloadReceiver extends BroadcastReceiver {
* This is a fatal result code and no result extras should be expected.
* @hide
*/
//@SystemApi
@SystemApi
public static final int RESULT_DOWNLOAD_FINALIZATION_ERROR = 4;
/**
@@ -112,7 +111,7 @@ public class MbmsDownloadReceiver extends BroadcastReceiver {
* is no guarantee that they will be the same number as requested.
* @hide
*/
//@SystemApi
@SystemApi
public static final int RESULT_TEMP_FILE_GENERATION_ERROR = 5;
private static final String LOG_TAG = "MbmsDownloadReceiver";
@@ -149,7 +148,7 @@ public class MbmsDownloadReceiver extends BroadcastReceiver {
private boolean verifyIntentContents(Context context, Intent intent) {
if (VendorUtils.ACTION_DOWNLOAD_RESULT_INTERNAL.equals(intent.getAction())) {
if (!intent.hasExtra(MbmsDownloadManager.EXTRA_RESULT)) {
if (!intent.hasExtra(MbmsDownloadManager.EXTRA_MBMS_DOWNLOAD_RESULT)) {
Log.w(LOG_TAG, "Download result did not include a result code. Ignoring.");
return false;
}
@@ -161,7 +160,7 @@ public class MbmsDownloadReceiver extends BroadcastReceiver {
Log.w(LOG_TAG, "Download result did not include the temp file root. Ignoring.");
return false;
}
if (!intent.hasExtra(MbmsDownloadManager.EXTRA_FILE_INFO)) {
if (!intent.hasExtra(MbmsDownloadManager.EXTRA_MBMS_FILE_INFO)) {
Log.w(LOG_TAG, "Download result did not include the associated file info. " +
"Ignoring.");
return false;
@@ -214,9 +213,9 @@ public class MbmsDownloadReceiver extends BroadcastReceiver {
DownloadRequest request = intent.getParcelableExtra(VendorUtils.EXTRA_REQUEST);
Intent intentForApp = request.getIntentForApp();
int result = intent.getIntExtra(MbmsDownloadManager.EXTRA_RESULT,
int result = intent.getIntExtra(MbmsDownloadManager.EXTRA_MBMS_DOWNLOAD_RESULT,
MbmsDownloadManager.RESULT_CANCELLED);
intentForApp.putExtra(MbmsDownloadManager.EXTRA_RESULT, result);
intentForApp.putExtra(MbmsDownloadManager.EXTRA_MBMS_DOWNLOAD_RESULT, result);
if (result != MbmsDownloadManager.RESULT_SUCCESSFUL) {
Log.i(LOG_TAG, "Download request indicated a failed download. Aborting.");
@@ -233,7 +232,7 @@ public class MbmsDownloadReceiver extends BroadcastReceiver {
}
FileInfo completedFileInfo =
(FileInfo) intent.getParcelableExtra(MbmsDownloadManager.EXTRA_FILE_INFO);
(FileInfo) intent.getParcelableExtra(MbmsDownloadManager.EXTRA_MBMS_FILE_INFO);
String relativePath = calculateDestinationFileRelativePath(request, completedFileInfo);
Uri finalFileLocation = moveTempFile(finalTempFile, destinationUri, relativePath);
@@ -242,8 +241,8 @@ public class MbmsDownloadReceiver extends BroadcastReceiver {
setResultCode(RESULT_DOWNLOAD_FINALIZATION_ERROR);
return;
}
intentForApp.putExtra(MbmsDownloadManager.EXTRA_COMPLETED_FILE_URI, finalFileLocation);
intentForApp.putExtra(MbmsDownloadManager.EXTRA_FILE_INFO, completedFileInfo);
intentForApp.putExtra(MbmsDownloadManager.EXTRA_MBMS_COMPLETED_FILE_URI, finalFileLocation);
intentForApp.putExtra(MbmsDownloadManager.EXTRA_MBMS_FILE_INFO, completedFileInfo);
context.sendBroadcast(intentForApp);
setResultCode(RESULT_OK);

View File

@@ -116,7 +116,6 @@ public class MbmsException extends Exception {
/**
* Indicates the errors that are applicable only to the file-download use-case
* @hide
*/
public static class DownloadErrors {
private DownloadErrors() { }

View File

@@ -28,8 +28,8 @@ import android.telephony.mbms.vendor.VendorUtils;
* download files via cell-broadcast.
* @hide
*/
//@SystemApi
public class UriPathPair implements Parcelable {
@SystemApi
public final class UriPathPair implements Parcelable {
private final Uri mFilePathUri;
private final Uri mContentUri;

View File

@@ -19,6 +19,7 @@ package android.telephony.mbms.vendor;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.content.Intent;
import android.os.Binder;
import android.os.RemoteException;
import android.telephony.mbms.DownloadStateCallback;
import android.telephony.mbms.DownloadRequest;
@@ -36,7 +37,7 @@ import java.util.List;
* its {@link android.app.Service#onBind(Intent)} method.
* @hide
*/
//@SystemApi
@SystemApi
public class MbmsDownloadServiceBase extends IMbmsDownloadService.Stub {
/**
* Initialize the download service for this app and subId, registering the listener.
@@ -62,22 +63,42 @@ public class MbmsDownloadServiceBase extends IMbmsDownloadService.Stub {
* @hide
*/
@Override
public final int initialize(int subscriptionId,
public final int initialize(final int subscriptionId,
final IMbmsDownloadManagerCallback callback) throws RemoteException {
final int uid = Binder.getCallingUid();
callback.asBinder().linkToDeath(new DeathRecipient() {
@Override
public void binderDied() {
onAppCallbackDied(uid, subscriptionId);
}
}, 0);
return initialize(subscriptionId, new MbmsDownloadManagerCallback() {
@Override
public void error(int errorCode, String message) throws RemoteException {
callback.error(errorCode, message);
public void onError(int errorCode, String message) {
try {
callback.error(errorCode, message);
} catch (RemoteException e) {
onAppCallbackDied(uid, subscriptionId);
}
}
@Override
public void fileServicesUpdated(List<FileServiceInfo> services) throws RemoteException {
callback.fileServicesUpdated(services);
public void onFileServicesUpdated(List<FileServiceInfo> services) {
try {
callback.fileServicesUpdated(services);
} catch (RemoteException e) {
onAppCallbackDied(uid, subscriptionId);
}
}
@Override
public void middlewareReady() throws RemoteException {
callback.middlewareReady();
public void onMiddlewareReady() {
try {
callback.middlewareReady();
} catch (RemoteException e) {
onAppCallbackDied(uid, subscriptionId);
}
}
});
}
@@ -150,13 +171,25 @@ public class MbmsDownloadServiceBase extends IMbmsDownloadService.Stub {
@Override
public final int download(DownloadRequest downloadRequest, IDownloadStateCallback callback)
throws RemoteException {
final int uid = Binder.getCallingUid();
callback.asBinder().linkToDeath(new DeathRecipient() {
@Override
public void binderDied() {
onAppCallbackDied(uid, downloadRequest.getSubscriptionId());
}
}, 0);
return download(downloadRequest, new DownloadStateCallback() {
@Override
public void progress(DownloadRequest request, FileInfo fileInfo, int
public void onProgressUpdated(DownloadRequest request, FileInfo fileInfo, int
currentDownloadSize, int fullDownloadSize, int currentDecodedSize, int
fullDecodedSize) throws RemoteException {
callback.progress(request, fileInfo, currentDownloadSize, fullDownloadSize,
currentDecodedSize, fullDecodedSize);
fullDecodedSize) {
try {
callback.progress(request, fileInfo, currentDownloadSize, fullDownloadSize,
currentDecodedSize, fullDecodedSize);
} catch (RemoteException e) {
onAppCallbackDied(uid, downloadRequest.getSubscriptionId());
}
}
});
}
@@ -246,4 +279,12 @@ public class MbmsDownloadServiceBase extends IMbmsDownloadService.Stub {
@Override
public void dispose(int subscriptionId) throws RemoteException {
}
/**
* Indicates that the app identified by the given UID and subscription ID has died.
* @param uid the UID of the app, as returned by {@link Binder#getCallingUid()}.
* @param subscriptionId The subscription ID the app is using.
*/
public void onAppCallbackDied(int uid, int subscriptionId) {
}
}

View File

@@ -33,14 +33,14 @@ import java.util.List;
* frontend apps.
* @hide
*/
//@SystemApi
@SystemApi
public class VendorUtils {
/**
* The MBMS middleware should send this when a download of single file has completed or
* failed. Mandatory extras are
* {@link android.telephony.MbmsDownloadManager#EXTRA_RESULT}
* {@link android.telephony.MbmsDownloadManager#EXTRA_FILE_INFO}
* {@link android.telephony.MbmsDownloadManager#EXTRA_MBMS_DOWNLOAD_RESULT}
* {@link android.telephony.MbmsDownloadManager#EXTRA_MBMS_FILE_INFO}
* {@link #EXTRA_REQUEST}
* {@link #EXTRA_TEMP_LIST}
* {@link #EXTRA_FINAL_URI}