Merge "Move appName inside Downloadrequest."
This commit is contained in:
@@ -17,9 +17,10 @@
|
||||
package android.telephony;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.RemoteException;
|
||||
import android.telephony.mbms.DownloadCallback;
|
||||
import android.telephony.mbms.IDownloadCallback;
|
||||
import android.telephony.mbms.DownloadRequest;
|
||||
import android.telephony.mbms.DownloadStatus;
|
||||
import android.telephony.mbms.IMbmsDownloadManagerCallback;
|
||||
@@ -242,8 +243,9 @@ public class MbmsDownloadManager {
|
||||
*
|
||||
* Asynchronous errors through the listener include any of the errors
|
||||
*/
|
||||
public DownloadRequest download(DownloadRequest downloadRequest, DownloadCallback listener) {
|
||||
return null;
|
||||
public DownloadRequest download(DownloadRequest request, IDownloadCallback listener) {
|
||||
request.setAppName(mDownloadAppName);
|
||||
return request;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,6 +21,7 @@ import android.net.Uri;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.lang.IllegalStateException;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
/**
|
||||
@@ -36,6 +37,7 @@ public class DownloadRequest implements Parcelable {
|
||||
private Uri dest;
|
||||
private int sub;
|
||||
private String appIntent;
|
||||
private String appName; // not the Android app Name, the embms app Name
|
||||
|
||||
public Builder setId(int id) {
|
||||
this.id = id;
|
||||
@@ -68,7 +70,7 @@ public class DownloadRequest implements Parcelable {
|
||||
}
|
||||
|
||||
public DownloadRequest build() {
|
||||
return new DownloadRequest(id, serviceInfo, source, dest, sub, appIntent);
|
||||
return new DownloadRequest(id, serviceInfo, source, dest, sub, appIntent, appName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,16 +80,18 @@ public class DownloadRequest implements Parcelable {
|
||||
private final Uri destinationUri;
|
||||
private final int subId;
|
||||
private final String serializedResultIntentForApp;
|
||||
private String appName; // not the Android app Name, the embms app name
|
||||
|
||||
private DownloadRequest(int id, FileServiceInfo serviceInfo,
|
||||
Uri source, Uri dest,
|
||||
int sub, String appIntent) {
|
||||
int sub, String appIntent, String name) {
|
||||
downloadId = id;
|
||||
fileServiceInfo = serviceInfo;
|
||||
sourceUri = source;
|
||||
destinationUri = dest;
|
||||
subId = sub;
|
||||
serializedResultIntentForApp = appIntent;
|
||||
appName = name;
|
||||
}
|
||||
|
||||
public static DownloadRequest copy(DownloadRequest other) {
|
||||
@@ -101,6 +105,7 @@ public class DownloadRequest implements Parcelable {
|
||||
destinationUri = dr.destinationUri;
|
||||
subId = dr.subId;
|
||||
serializedResultIntentForApp = dr.serializedResultIntentForApp;
|
||||
appName = dr.appName;
|
||||
}
|
||||
|
||||
private DownloadRequest(Parcel in) {
|
||||
@@ -110,6 +115,7 @@ public class DownloadRequest implements Parcelable {
|
||||
destinationUri = in.readParcelable(getClass().getClassLoader());
|
||||
subId = in.readInt();
|
||||
serializedResultIntentForApp = in.readString();
|
||||
appName = in.readString();
|
||||
}
|
||||
|
||||
public int describeContents() {
|
||||
@@ -123,6 +129,7 @@ public class DownloadRequest implements Parcelable {
|
||||
out.writeParcelable(destinationUri, flags);
|
||||
out.writeInt(subId);
|
||||
out.writeString(serializedResultIntentForApp);
|
||||
out.writeString(appName);
|
||||
}
|
||||
|
||||
public int getDownloadId() {
|
||||
@@ -153,6 +160,18 @@ public class DownloadRequest implements Parcelable {
|
||||
}
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public synchronized void setAppName(String newAppName) {
|
||||
if (appName != null) {
|
||||
throw new IllegalStateException("Attempting to reset appName");
|
||||
}
|
||||
appName = newAppName;
|
||||
}
|
||||
|
||||
public String getAppName() {
|
||||
return appName;
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<DownloadRequest> CREATOR =
|
||||
new Parcelable.Creator<DownloadRequest>() {
|
||||
public DownloadRequest createFromParcel(Parcel in) {
|
||||
@@ -162,5 +181,4 @@ public class DownloadRequest implements Parcelable {
|
||||
return new DownloadRequest[size];
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -50,20 +50,20 @@ interface IMbmsDownloadService
|
||||
/**
|
||||
* should move the params into a DownloadRequest parcelable
|
||||
*/
|
||||
int download(String appName, in DownloadRequest downloadRequest, IDownloadCallback listener);
|
||||
int download(in DownloadRequest downloadRequest, IDownloadCallback listener);
|
||||
|
||||
List<DownloadRequest> listPendingDownloads(String appName);
|
||||
List<DownloadRequest> listPendingDownloads(String appName, int subscriptionId);
|
||||
|
||||
int cancelDownload(String appName, in DownloadRequest downloadRequest);
|
||||
int cancelDownload(in DownloadRequest downloadRequest);
|
||||
|
||||
DownloadStatus getDownloadStatus(String appName, in DownloadRequest downloadRequest);
|
||||
DownloadStatus getDownloadStatus(in DownloadRequest downloadRequest);
|
||||
|
||||
/*
|
||||
* named this for 2 reasons:
|
||||
* 1 don't want 'State' here as it conflicts with 'Status' of the previous function
|
||||
* 2 want to perfect typing 'Knowledge'
|
||||
*/
|
||||
void resetDownloadKnowledge(String appName, in DownloadRequest downloadRequest);
|
||||
void resetDownloadKnowledge(in DownloadRequest downloadRequest);
|
||||
|
||||
/**
|
||||
* End of life for this MbmsDownloadManager.
|
||||
|
||||
@@ -43,34 +43,34 @@ public class MbmsDownloadServiceBase extends IMbmsDownloadService.Stub {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int download(String appName, DownloadRequest downloadRequest, IDownloadCallback listener)
|
||||
public int download(DownloadRequest downloadRequest, IDownloadCallback listener)
|
||||
throws RemoteException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DownloadRequest> listPendingDownloads(String appName) throws RemoteException {
|
||||
public List<DownloadRequest> listPendingDownloads(String appName, int subscriptionId)
|
||||
throws RemoteException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int cancelDownload(String appName, DownloadRequest downloadRequest)
|
||||
throws RemoteException {
|
||||
public int cancelDownload(DownloadRequest downloadRequest) throws RemoteException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DownloadStatus getDownloadStatus(String appName, DownloadRequest downloadRequest)
|
||||
public DownloadStatus getDownloadStatus(DownloadRequest downloadRequest)
|
||||
throws RemoteException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetDownloadKnowledge(String appName, DownloadRequest downloadRequest)
|
||||
public void resetDownloadKnowledge(DownloadRequest downloadRequest)
|
||||
throws RemoteException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose(String appName, int subId) throws RemoteException {
|
||||
public void dispose(String appName, int subscriptionId) throws RemoteException {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user