Merge "Move appName inside Downloadrequest." am: 142a392b75

am: 196cb3dff6

Change-Id: I79e1beb5c211a8ff0f90a2f473f85b0068abe61a
This commit is contained in:
Robert Greenwalt
2017-06-01 17:11:56 +00:00
committed by android-build-merger
4 changed files with 38 additions and 18 deletions

View File

@@ -17,9 +17,10 @@
package android.telephony; package android.telephony;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.RemoteException; import android.os.RemoteException;
import android.telephony.mbms.DownloadCallback; import android.telephony.mbms.IDownloadCallback;
import android.telephony.mbms.DownloadRequest; import android.telephony.mbms.DownloadRequest;
import android.telephony.mbms.DownloadStatus; import android.telephony.mbms.DownloadStatus;
import android.telephony.mbms.IMbmsDownloadManagerCallback; import android.telephony.mbms.IMbmsDownloadManagerCallback;
@@ -242,8 +243,9 @@ public class MbmsDownloadManager {
* *
* Asynchronous errors through the listener include any of the errors * Asynchronous errors through the listener include any of the errors
*/ */
public DownloadRequest download(DownloadRequest downloadRequest, DownloadCallback listener) { public DownloadRequest download(DownloadRequest request, IDownloadCallback listener) {
return null; request.setAppName(mDownloadAppName);
return request;
} }
/** /**

View File

@@ -21,6 +21,7 @@ import android.net.Uri;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import java.lang.IllegalStateException;
import java.net.URISyntaxException; import java.net.URISyntaxException;
/** /**
@@ -36,6 +37,7 @@ public class DownloadRequest implements Parcelable {
private Uri dest; private Uri dest;
private int sub; private int sub;
private String appIntent; private String appIntent;
private String appName; // not the Android app Name, the embms app Name
public Builder setId(int id) { public Builder setId(int id) {
this.id = id; this.id = id;
@@ -68,7 +70,7 @@ public class DownloadRequest implements Parcelable {
} }
public DownloadRequest build() { 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 Uri destinationUri;
private final int subId; private final int subId;
private final String serializedResultIntentForApp; private final String serializedResultIntentForApp;
private String appName; // not the Android app Name, the embms app name
private DownloadRequest(int id, FileServiceInfo serviceInfo, private DownloadRequest(int id, FileServiceInfo serviceInfo,
Uri source, Uri dest, Uri source, Uri dest,
int sub, String appIntent) { int sub, String appIntent, String name) {
downloadId = id; downloadId = id;
fileServiceInfo = serviceInfo; fileServiceInfo = serviceInfo;
sourceUri = source; sourceUri = source;
destinationUri = dest; destinationUri = dest;
subId = sub; subId = sub;
serializedResultIntentForApp = appIntent; serializedResultIntentForApp = appIntent;
appName = name;
} }
public static DownloadRequest copy(DownloadRequest other) { public static DownloadRequest copy(DownloadRequest other) {
@@ -101,6 +105,7 @@ public class DownloadRequest implements Parcelable {
destinationUri = dr.destinationUri; destinationUri = dr.destinationUri;
subId = dr.subId; subId = dr.subId;
serializedResultIntentForApp = dr.serializedResultIntentForApp; serializedResultIntentForApp = dr.serializedResultIntentForApp;
appName = dr.appName;
} }
private DownloadRequest(Parcel in) { private DownloadRequest(Parcel in) {
@@ -110,6 +115,7 @@ public class DownloadRequest implements Parcelable {
destinationUri = in.readParcelable(getClass().getClassLoader()); destinationUri = in.readParcelable(getClass().getClassLoader());
subId = in.readInt(); subId = in.readInt();
serializedResultIntentForApp = in.readString(); serializedResultIntentForApp = in.readString();
appName = in.readString();
} }
public int describeContents() { public int describeContents() {
@@ -123,6 +129,7 @@ public class DownloadRequest implements Parcelable {
out.writeParcelable(destinationUri, flags); out.writeParcelable(destinationUri, flags);
out.writeInt(subId); out.writeInt(subId);
out.writeString(serializedResultIntentForApp); out.writeString(serializedResultIntentForApp);
out.writeString(appName);
} }
public int getDownloadId() { 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 = public static final Parcelable.Creator<DownloadRequest> CREATOR =
new Parcelable.Creator<DownloadRequest>() { new Parcelable.Creator<DownloadRequest>() {
public DownloadRequest createFromParcel(Parcel in) { public DownloadRequest createFromParcel(Parcel in) {
@@ -162,5 +181,4 @@ public class DownloadRequest implements Parcelable {
return new DownloadRequest[size]; return new DownloadRequest[size];
} }
}; };
} }

View File

@@ -50,20 +50,20 @@ interface IMbmsDownloadService
/** /**
* should move the params into a DownloadRequest parcelable * 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: * named this for 2 reasons:
* 1 don't want 'State' here as it conflicts with 'Status' of the previous function * 1 don't want 'State' here as it conflicts with 'Status' of the previous function
* 2 want to perfect typing 'Knowledge' * 2 want to perfect typing 'Knowledge'
*/ */
void resetDownloadKnowledge(String appName, in DownloadRequest downloadRequest); void resetDownloadKnowledge(in DownloadRequest downloadRequest);
/** /**
* End of life for this MbmsDownloadManager. * End of life for this MbmsDownloadManager.

View File

@@ -43,34 +43,34 @@ public class MbmsDownloadServiceBase extends IMbmsDownloadService.Stub {
} }
@Override @Override
public int download(String appName, DownloadRequest downloadRequest, IDownloadCallback listener) public int download(DownloadRequest downloadRequest, IDownloadCallback listener)
throws RemoteException { throws RemoteException {
return 0; return 0;
} }
@Override @Override
public List<DownloadRequest> listPendingDownloads(String appName) throws RemoteException { public List<DownloadRequest> listPendingDownloads(String appName, int subscriptionId)
throws RemoteException {
return null; return null;
} }
@Override @Override
public int cancelDownload(String appName, DownloadRequest downloadRequest) public int cancelDownload(DownloadRequest downloadRequest) throws RemoteException {
throws RemoteException {
return 0; return 0;
} }
@Override @Override
public DownloadStatus getDownloadStatus(String appName, DownloadRequest downloadRequest) public DownloadStatus getDownloadStatus(DownloadRequest downloadRequest)
throws RemoteException { throws RemoteException {
return null; return null;
} }
@Override @Override
public void resetDownloadKnowledge(String appName, DownloadRequest downloadRequest) public void resetDownloadKnowledge(DownloadRequest downloadRequest)
throws RemoteException { throws RemoteException {
} }
@Override @Override
public void dispose(String appName, int subId) throws RemoteException { public void dispose(String appName, int subscriptionId) throws RemoteException {
} }
} }