Merge "eMBMS API update" am: 99b21ccb34 am: 6b4841d116

am: cfb792830c

Change-Id: I4d227eeae02910f4be020b3e9abf3ec5decc168d
This commit is contained in:
Hall Liu
2017-04-28 22:38:27 +00:00
committed by android-build-merger
20 changed files with 649 additions and 97 deletions

View File

@@ -483,10 +483,10 @@ LOCAL_SRC_FILES += \
telecomm/java/com/android/internal/telecom/IInCallService.aidl \
telecomm/java/com/android/internal/telecom/ITelecomService.aidl \
telecomm/java/com/android/internal/telecom/RemoteServiceCallback.aidl \
telephony/java/android/telephony/mbms/IMbmsDownloadManagerListener.aidl \
telephony/java/android/telephony/mbms/IMbmsStreamingManagerListener.aidl \
telephony/java/android/telephony/mbms/IDownloadListener.aidl \
telephony/java/android/telephony/mbms/IStreamingServiceListener.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/IStreamingServiceCallback.aidl \
telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl \
telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl \
telephony/java/com/android/ims/internal/IImsCallSession.aidl \

View File

@@ -16,14 +16,16 @@
package android.telephony;
import android.app.PendingIntent;
import android.content.Context;
import android.net.Uri;
import android.telephony.mbms.DownloadListener;
import android.os.RemoteException;
import android.telephony.mbms.DownloadCallback;
import android.telephony.mbms.DownloadRequest;
import android.telephony.mbms.DownloadStatus;
import android.telephony.mbms.FileServiceInfo;
import android.telephony.mbms.IMbmsDownloadManagerListener;
import android.telephony.mbms.IMbmsDownloadManagerCallback;
import android.telephony.mbms.MbmsInitializationException;
import android.telephony.mbms.vendor.IMbmsDownloadService;
import android.util.Log;
import java.util.List;
@@ -31,9 +33,135 @@ import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
/** @hide */
public class MbmsDownloadManager {
private static final String LOG_TAG = MbmsDownloadManager.class.getSimpleName();
/**
* The MBMS middleware should send this when a download of single file has completed or
* failed. Mandatory extras are
* {@link #EXTRA_RESULT}
* {@link #EXTRA_INFO}
* {@link #EXTRA_REQUEST}
* {@link #EXTRA_TEMP_LIST}
* {@link #EXTRA_FINAL_URI}
*
* TODO: future systemapi
*/
public static final String ACTION_DOWNLOAD_RESULT_INTERNAL =
"android.telephony.mbms.action.DOWNLOAD_RESULT_INTERNAL";
/**
* 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}
*
* Optional extras are
* {@link #EXTRA_FD_COUNT} (0 if not present)
* {@link #EXTRA_PAUSED_LIST} (empty if not present)
*
* TODO: future systemapi
*/
public static final String ACTION_FILE_DESCRIPTOR_REQUEST =
"android.telephony.mbms.action.FILE_DESCRIPTOR_REQUEST";
/**
* The MBMS middleware should send this when it wishes to clean up temp files in the app's
* filesystem. Mandatory extras are:
* {@link #EXTRA_TEMP_FILES_IN_USE}
*
* TODO: future systemapi
*/
public static final String ACTION_CLEANUP =
"android.telephony.mbms.action.CLEANUP";
/**
* Integer extra indicating the result code of the download.
* TODO: put in link to error list
* TODO: future systemapi (here and and all extras)
*/
public static final String EXTRA_RESULT = "android.telephony.mbms.extra.RESULT";
/**
* Extra containing the {@link android.telephony.mbms.FileInfo} for which the download result
* is for. Must not be null.
*/
public static final String EXTRA_INFO = "android.telephony.mbms.extra.INFO";
/**
* Extra containing the {@link DownloadRequest} for which the download result or file
* descriptor request is for. Must not be null.
*/
public static final String EXTRA_REQUEST = "android.telephony.mbms.extra.REQUEST";
/**
* Extra containing a {@link List} of {@link Uri}s that were used as temp files for this
* completed file. These {@link Uri}s should have scheme {@code file://}, and the temp
* files will be deleted upon receipt of the intent.
* May be null.
*/
public static final String EXTRA_TEMP_LIST = "android.telephony.mbms.extra.TEMP_LIST";
/**
* Extra containing a single {@link Uri} indicating the path to the temp file in which the
* decoded downloaded file resides. Must not be null.
*/
public static final String EXTRA_FINAL_URI = "android.telephony.mbms.extra.FINAL_URI";
/**
* Extra containing an integer indicating the number of temp files requested.
*/
public static final String EXTRA_FD_COUNT = "android.telephony.mbms.extra.FD_COUNT";
/**
* Extra containing a list of {@link Uri}s that the middleware is requesting access to via
* {@link #ACTION_FILE_DESCRIPTOR_REQUEST} in order to resume downloading. These {@link Uri}s
* should have scheme {@code file://}.
*/
public static final String EXTRA_PAUSED_LIST = "android.telephony.mbms.extra.PAUSED_LIST";
/**
* Extra containing a list of {@link android.telephony.mbms.UriPathPair}s, used in the
* response to {@link #ACTION_FILE_DESCRIPTOR_REQUEST}. These are temp files that are meant
* to be used for new file downloads.
*/
public static final String EXTRA_FREE_URI_LIST = "android.telephony.mbms.extra.FREE_URI_LIST";
/**
* Extra containing a list of {@link android.telephony.mbms.UriPathPair}s, used in the
* response to {@link #ACTION_FILE_DESCRIPTOR_REQUEST}. These
* {@link android.telephony.mbms.UriPathPair}s contain {@code content://} URIs that provide
* access to previously paused downloads.
*/
public static final String EXTRA_PAUSED_URI_LIST =
"android.telephony.mbms.extra.PAUSED_URI_LIST";
/**
* Extra containing a list of {@link Uri}s indicating temp files which the middleware is
* still using.
*/
public static final String EXTRA_TEMP_FILES_IN_USE =
"android.telephony.mbms.extra.TEMP_FILES_IN_USE";
public static final int RESULT_SUCCESSFUL = 1;
public static final int RESULT_CANCELLED = 2;
public static final int RESULT_EXPIRED = 3;
// TODO - more results!
private final Context mContext;
private int mSubId = INVALID_SUBSCRIPTION_ID;
private IMbmsDownloadService mService;
private final IMbmsDownloadManagerCallback mCallback;
private final String mDownloadAppName;
private MbmsDownloadManager(Context context, IMbmsDownloadManagerCallback callback,
String downloadAppName, int subId) {
mContext = context;
mCallback = callback;
mDownloadAppName = downloadAppName;
mSubId = subId;
}
/**
* Create a new MbmsDownloadManager using the system default data subscription ID.
*
@@ -42,9 +170,13 @@ public class MbmsDownloadManager {
*
* @hide
*/
public MbmsDownloadManager(Context context, IMbmsDownloadManagerListener listener,
String downloadAppName) {
mContext = context;
public static MbmsDownloadManager createManager(Context context,
IMbmsDownloadManagerCallback listener, String downloadAppName)
throws MbmsInitializationException{
MbmsDownloadManager mdm = new MbmsDownloadManager(context, listener, downloadAppName,
SubscriptionManager.getDefaultSubscriptionId());
mdm.bindAndInitialize();
return mdm;
}
/**
@@ -55,9 +187,23 @@ public class MbmsDownloadManager {
*
* @hide
*/
public MbmsDownloadManager(Context context, IMbmsDownloadManagerListener listener,
String downloadAppName, int subId) {
mContext = context;
public static MbmsDownloadManager createManager(Context context,
IMbmsDownloadManagerCallback listener, String downloadAppName, int subId)
throws MbmsInitializationException {
MbmsDownloadManager mdm = new MbmsDownloadManager(context, listener, downloadAppName,
subId);
mdm.bindAndInitialize();
return mdm;
}
private void bindAndInitialize() throws MbmsInitializationException {
// TODO: bind
try {
mService.initialize(mDownloadAppName, mSubId, mCallback);
} catch (RemoteException e) {
throw new MbmsInitializationException(0); // TODO: proper error code
}
}
/**
@@ -84,31 +230,9 @@ public class MbmsDownloadManager {
}
public static final String EXTRA_REQUEST = "extraRequest";
public static final int RESULT_SUCCESSFUL = 1;
public static final int RESULT_CANCELLED = 2;
public static final int RESULT_EXPIRED = 3;
// TODO - more results!
public static final String EXTRA_RESULT = "extraResult";
public static final String EXTRA_URI = "extraDownloadedUri";
/**
* Requests a future download.
* returns a token which may be used to cancel a download.
* fileServiceInfo indicates what FileService to download from
* source indicates which file to download from the given FileService. This is
* an optional field - it may be null or empty to indicate download everything from
* the FileService.
* destination is a file URI for where in the apps accessible storage locations to write
* the content. This URI may be used to store temporary data and should not be
* accessed until the PendingIntent is called indicating success.
* resultIntent is sent when each file is completed and when the request is concluded
* either via TTL expiration, cancel or error.
* This intent is sent with three extras: a {@link DownloadRequest} typed extra called
* {@link #EXTRA_REQUEST}, an Integer called {@link #EXTRA_RESULT} for the result code
* and a {@link Uri} called {@link #EXTRA_URI} to the resulting file (if successful).
* 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
@@ -118,7 +242,7 @@ public class MbmsDownloadManager {
*
* Asynchronous errors through the listener include any of the errors
*/
public DownloadRequest download(DownloadRequest downloadRequest, DownloadListener listener) {
public DownloadRequest download(DownloadRequest downloadRequest, DownloadCallback listener) {
return null;
}
@@ -168,7 +292,7 @@ public class MbmsDownloadManager {
}
/**
* Resets middleware knowldge regarding this download request.
* Resets middleware knowledge regarding this download request.
*
* This state consists of knowledge of what files have already been downloaded.
* Normally the middleware won't download files who's hash matches previously downloaded
@@ -187,5 +311,15 @@ public class MbmsDownloadManager {
}
public void dispose() {
try {
if (mService != null) {
mService.dispose(mDownloadAppName, mSubId);
} else {
Log.i(LOG_TAG, "Service already dead");
}
} catch (RemoteException e) {
// Ignore
Log.i(LOG_TAG, "Remote exception while disposing of service");
}
}
}

View File

@@ -17,10 +17,13 @@
package android.telephony;
import android.content.Context;
import android.telephony.mbms.IMbmsStreamingManagerListener;
import android.telephony.mbms.IStreamingServiceListener;
import android.os.RemoteException;
import android.telephony.mbms.IMbmsStreamingManagerCallback;
import android.telephony.mbms.IStreamingServiceCallback;
import android.telephony.mbms.MbmsInitializationException;
import android.telephony.mbms.StreamingService;
import android.telephony.mbms.StreamingServiceInfo;
import android.telephony.mbms.vendor.IMbmsStreamingService;
import android.util.Log;
import java.util.List;
@@ -31,19 +34,20 @@ import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
public class MbmsStreamingManager {
private static final String LOG_TAG = "MbmsStreamingManager";
private static final boolean DEBUG = true;
private IMbmsStreamingService mService;
private IMbmsStreamingManagerCallback mCallbackToApp;
private final String mAppName;
private final Context mContext;
private int mSubId = INVALID_SUBSCRIPTION_ID;
private int mSubscriptionId = INVALID_SUBSCRIPTION_ID;
/**
* Create a new MbmsStreamingManager using the system default data subscription ID.
*
* Note that this call will bind a remote service and that may take a bit. This
* may throw an IllegalArgumentException or RemoteException.
*/
public MbmsStreamingManager(Context context, IMbmsStreamingManagerListener listener,
String streamingAppName) {
/** @hide */
private MbmsStreamingManager(Context context, IMbmsStreamingManagerCallback listener,
String streamingAppName, int subscriptionId) {
mContext = context;
mAppName = streamingAppName;
mCallbackToApp = listener;
mSubscriptionId = subscriptionId;
}
/**
@@ -51,10 +55,39 @@ public class MbmsStreamingManager {
*
* Note that this call will bind a remote service and that may take a bit. This
* may throw an IllegalArgumentException or RemoteException.
* TODO: document this and add exceptions that can be thrown for synchronous
* initialization/bind errors
*
* @param context
* @param listener
* @param streamingAppName
* @param subscriptionId
* @return
*/
public MbmsStreamingManager(Context context, IMbmsStreamingManagerListener listener,
String streamingAppName, int subId) {
mContext = context;
public static MbmsStreamingManager create(Context context,
IMbmsStreamingManagerCallback listener, String streamingAppName, int subscriptionId)
throws MbmsInitializationException {
MbmsStreamingManager manager = new MbmsStreamingManager(context, listener,
streamingAppName, subscriptionId);
manager.bindAndInitialize();
return manager;
}
/**
* Create a new MbmsStreamingManager using the system default data subscription ID.
*
* Note that this call will bind a remote service and that may take a bit. This
* may throw an IllegalArgumentException or RemoteException.
*/
public static MbmsStreamingManager create(Context context,
IMbmsStreamingManagerCallback listener, String streamingAppName)
throws MbmsInitializationException {
// TODO: get default sub id
int subId = INVALID_SUBSCRIPTION_ID;
MbmsStreamingManager manager = new MbmsStreamingManager(context, listener,
streamingAppName, subId);
manager.bindAndInitialize();
return manager;
}
/**
@@ -97,7 +130,7 @@ public class MbmsStreamingManager {
* Asynchronous errors through the listener include any of the errors
*/
public StreamingService startStreaming(StreamingServiceInfo serviceInfo,
IStreamingServiceListener listener) {
IStreamingServiceCallback listener) {
return null;
}
@@ -125,4 +158,20 @@ public class MbmsStreamingManager {
private void logd(String str) {
Log.d(LOG_TAG, str);
}
private boolean isServiceConnected() {
return mService != null;
}
private void bindAndInitialize() throws MbmsInitializationException {
// TODO: bind to the service
try {
int returnCode = mService.initialize(mCallbackToApp, mAppName, mSubscriptionId);
if (returnCode != 0) {
throw new MbmsInitializationException(returnCode);
}
} catch (RemoteException e) {
throw new MbmsInitializationException(/* some error */ 0);
}
}
}

View File

@@ -20,7 +20,7 @@ package android.telephony.mbms;
* A optional listener class used by download clients to track progress.
* @hide
*/
public class DownloadListener extends IDownloadListener.Stub {
public class DownloadCallback extends IDownloadCallback.Stub {
/**
* Gives process callbacks for a given DownloadRequest.
* request indicates which download is being referenced.

View File

@@ -16,44 +16,101 @@
package android.telephony.mbms;
import android.app.PendingIntent;
import android.content.Intent;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import java.net.URISyntaxException;
/**
* A Parcelable class describing a pending Cell-Broadcast download request
* @hide
*/
public class DownloadRequest implements Parcelable {
public DownloadRequest(int id, FileServiceInfo serviceInfo, Uri source, Uri dest,
PendingIntent resultPI, int sub) {
/** @hide */
public static class Builder {
private int id;
private FileServiceInfo serviceInfo;
private Uri source;
private Uri dest;
private int sub;
private String appIntent;
public Builder setId(int id) {
this.id = id;
return this;
}
public Builder setServiceInfo(FileServiceInfo serviceInfo) {
this.serviceInfo = serviceInfo;
return this;
}
public Builder setSource(Uri source) {
this.source = source;
return this;
}
public Builder setDest(Uri dest) {
this.dest = dest;
return this;
}
public Builder setSub(int sub) {
this.sub = sub;
return this;
}
public Builder setAppIntent(Intent intent) {
this.appIntent = intent.toUri(0);
return this;
}
public DownloadRequest build() {
return new DownloadRequest(id, serviceInfo, source, dest, sub, appIntent);
}
}
private final int downloadId;
private final FileServiceInfo fileServiceInfo;
private final Uri sourceUri;
private final Uri destinationUri;
private final int subId;
private final String serializedResultIntentForApp;
private DownloadRequest(int id, FileServiceInfo serviceInfo,
Uri source, Uri dest,
int sub, String appIntent) {
downloadId = id;
fileServiceInfo = serviceInfo;
sourceUri = source;
destinationUri = dest;
subId = sub;
serializedResultIntentForApp = appIntent;
}
/** @hide */
public DownloadRequest(DownloadRequest dr, PendingIntent fdRequestPI, PendingIntent cleanupPI) {
public static DownloadRequest copy(DownloadRequest other) {
return new DownloadRequest(other);
}
private DownloadRequest(DownloadRequest dr) {
downloadId = dr.downloadId;
fileServiceInfo = dr.fileServiceInfo;
sourceUri = dr.sourceUri;
destinationUri = dr.destinationUri;
subId = dr.subId;
/*
* resultPI = new PI
* fileDescriptorRequstPI = fdRequestPI;
* this.cleanupPI = cleanupPI;
*/
serializedResultIntentForApp = dr.serializedResultIntentForApp;
}
public final int downloadId;
public final FileServiceInfo fileServiceInfo;
public final Uri sourceUri;
public final Uri destinationUri;
public final int subId;
private DownloadRequest(Parcel in) {
downloadId = in.readInt();
fileServiceInfo = in.readParcelable(getClass().getClassLoader());
sourceUri = in.readParcelable(getClass().getClassLoader());
destinationUri = in.readParcelable(getClass().getClassLoader());
subId = in.readInt();
serializedResultIntentForApp = in.readString();
}
public int describeContents() {
return 0;
@@ -65,14 +122,35 @@ public class DownloadRequest implements Parcelable {
out.writeParcelable(sourceUri, flags);
out.writeParcelable(destinationUri, flags);
out.writeInt(subId);
out.writeString(serializedResultIntentForApp);
}
private DownloadRequest(Parcel in) {
downloadId = in.readInt();
fileServiceInfo = in.readParcelable(null);
sourceUri = in.readParcelable(null);
destinationUri = in.readParcelable(null);
subId = in.readInt();
public int getDownloadId() {
return downloadId;
}
public FileServiceInfo getFileServiceInfo() {
return fileServiceInfo;
}
public Uri getSourceUri() {
return sourceUri;
}
public Uri getDestinationUri() {
return destinationUri;
}
public int getSubId() {
return subId;
}
public Intent getIntentForApp() {
try {
return Intent.parseUri(serializedResultIntentForApp, 0);
} catch (URISyntaxException e) {
return null;
}
}
public static final Parcelable.Creator<DownloadRequest> CREATOR =

View File

@@ -23,7 +23,7 @@ import android.telephony.mbms.FileInfo;
* The optional interface used by download clients to track progress.
* @hide
*/
interface IDownloadListener
interface IDownloadCallback
{
/**
* Gives progress callbacks for a given DownloadRequest. Includes a FileInfo

View File

@@ -24,7 +24,7 @@ import java.util.List;
* The interface the clients top-level file download listener will satisfy.
* @hide
*/
interface IMbmsDownloadManagerListener
interface IMbmsDownloadManagerCallback
{
void error(int errorCode, String message);

View File

@@ -24,7 +24,7 @@ import java.util.List;
* The interface the clients top-level streaming listener will satisfy.
* @hide
*/
interface IMbmsStreamingManagerListener
interface IMbmsStreamingManagerCallback
{
void error(int errorCode, String message);

View File

@@ -18,13 +18,14 @@ package android.telephony.mbms;
import android.net.Uri;
import android.telephony.SignalStrength;
import android.telephony.mbms.StreamingService;
/**
* @hide
*/
oneway interface IStreamingServiceListener {
oneway interface IStreamingServiceCallback {
void error(int errorCode, String message);
void stateUpdated(int state);
void streamStateChanged(in StreamingService service, int state);
void uriUpdated(in Uri uri);
void signalStrengthUpdated(in SignalStrength signalStrength);
}

View File

@@ -22,7 +22,7 @@ import java.util.List;
* A Parcelable class with Cell-Broadcast service information.
* @hide
*/
public class MbmsDownloadManagerListener extends IMbmsDownloadManagerListener.Stub {
public class MbmsDownloadManagerCallback extends IMbmsDownloadManagerCallback.Stub {
public final static int ERROR_CARRIER_NOT_SUPPORTED = 1;
public final static int ERROR_UNABLE_TO_INITIALIZE = 2;

View File

@@ -0,0 +1,32 @@
/*
* 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;
/** @hide */
public class MbmsInitializationException extends Exception {
private final int mErrorCode;
/** @hide */
public MbmsInitializationException(int errorCode) {
super();
mErrorCode = errorCode;
}
public int getErrorCode() {
return mErrorCode;
}
}

View File

@@ -22,7 +22,7 @@ import java.util.List;
* A Parcelable class with Cell-Broadcast service information.
* @hide
*/
public class MbmsStreamingManagerListener extends IMbmsStreamingManagerListener.Stub {
public class MbmsStreamingManagerCallback extends IMbmsStreamingManagerCallback.Stub {
public final static int ERROR_CARRIER_NOT_SUPPORTED = 1;
public final static int ERROR_UNABLE_TO_INITIALIZE = 2;

View File

@@ -33,7 +33,7 @@ public class StreamingService {
/**
*/
StreamingService(StreamingServiceInfo streamingServiceInfo,
IStreamingServiceListener listener) {
IStreamingServiceCallback listener) {
}
/**

View File

@@ -23,7 +23,7 @@ import android.telephony.SignalStrength;
* A Callback class for use when the applicaiton is actively streaming content.
* @hide
*/
public class StreamingServiceListener extends IStreamingServiceListener.Stub {
public class StreamingServiceCallback extends IStreamingServiceCallback.Stub {
public void error(int errorCode, String message) {
@@ -36,7 +36,7 @@ public class StreamingServiceListener extends IStreamingServiceListener.Stub {
* See {@link StreamingService#STATE_STOPPED}, {@link StreamingService#STATE_STARTED}
* and {@link StreamingService#STATE_STALLED}.
*/
public void stateUpdated(int state) {
public void streamStateChanged(StreamingService service, int state) {
// default implementation empty
}

View File

@@ -0,0 +1,20 @@
/*
**
** Copyright 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;
parcelable UriPathPair;

View File

@@ -0,0 +1,80 @@
/*
* 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.content.ContentResolver;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
/** @hide */
public class UriPathPair implements Parcelable {
private final Uri mFilePathUri;
private final Uri mContentUri;
/** @hide */
public UriPathPair(Uri fileUri, Uri contentUri) {
if (fileUri == null || !ContentResolver.SCHEME_FILE.equals(fileUri.getScheme())) {
throw new IllegalArgumentException("File URI must have file scheme");
}
if (contentUri == null || !ContentResolver.SCHEME_CONTENT.equals(contentUri.getScheme())) {
throw new IllegalArgumentException("Content URI must have content scheme");
}
mFilePathUri = fileUri;
mContentUri = contentUri;
}
/** @hide */
protected UriPathPair(Parcel in) {
mFilePathUri = in.readParcelable(Uri.class.getClassLoader());
mContentUri = in.readParcelable(Uri.class.getClassLoader());
}
public static final Creator<UriPathPair> CREATOR = new Creator<UriPathPair>() {
@Override
public UriPathPair createFromParcel(Parcel in) {
return new UriPathPair(in);
}
@Override
public UriPathPair[] newArray(int size) {
return new UriPathPair[size];
}
};
/** future systemapi */
public Uri getFilePathUri() {
return mFilePathUri;
}
/** future systemapi */
public Uri getContentUri() {
return mContentUri;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeParcelable(mFilePathUri, flags);
dest.writeParcelable(mContentUri, flags);
}
}

View File

@@ -20,8 +20,8 @@ import android.app.PendingIntent;
import android.net.Uri;
import android.telephony.mbms.DownloadRequest;
import android.telephony.mbms.DownloadStatus;
import android.telephony.mbms.IMbmsDownloadManagerListener;
import android.telephony.mbms.IDownloadListener;
import android.telephony.mbms.IMbmsDownloadManagerCallback;
import android.telephony.mbms.IDownloadCallback;
/**
* The interface the opaque MbmsStreamingService will satisfy.
@@ -35,7 +35,7 @@ interface IMbmsDownloadService
*
* No return value. Async errors may be reported, but none expected (not doing anything yet).
*/
void initialize(String appName, int subId, IMbmsDownloadManagerListener listener);
void initialize(String appName, int subId, IMbmsDownloadManagerCallback listener);
/**
* - Registers serviceClasses of interest with the uid/appName/subId key.
@@ -50,20 +50,20 @@ interface IMbmsDownloadService
/**
* should move the params into a DownloadRequest parcelable
*/
int download(in DownloadRequest downloadRequest, IDownloadListener listener);
int download(String appName, in DownloadRequest downloadRequest, IDownloadCallback listener);
List<DownloadRequest> listPendingDownloads();
List<DownloadRequest> listPendingDownloads(String appName);
int cancelDownload(in DownloadRequest downloadRequest);
int cancelDownload(String appName, in DownloadRequest downloadRequest);
DownloadStatus getDownloadStatus(in DownloadRequest downloadRequest);
DownloadStatus getDownloadStatus(String appName, 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(in DownloadRequest downloadRequest);
void resetDownloadKnowledge(String appName, in DownloadRequest downloadRequest);
/**
* End of life for this MbmsDownloadManager.

View File

@@ -17,8 +17,8 @@
package android.telephony.mbms.vendor;
import android.net.Uri;
import android.telephony.mbms.IMbmsStreamingManagerListener;
import android.telephony.mbms.IStreamingServiceListener;
import android.telephony.mbms.IMbmsStreamingManagerCallback;
import android.telephony.mbms.IStreamingServiceCallback;
import android.telephony.mbms.StreamingService;
import android.telephony.mbms.StreamingServiceInfo;
import android.telephony.SignalStrength;
@@ -34,7 +34,7 @@ interface IMbmsStreamingService
* Registers this listener, subId with this appName
*
*/
int initialize(IMbmsStreamingManagerListener listener, String appName, int subId);
int initialize(IMbmsStreamingManagerCallback listener, String appName, int subId);
/**
@@ -55,7 +55,7 @@ interface IMbmsStreamingService
* URL-change and State-change pair.
*/
StreamingService startStreaming(String appName, int subId, String serviceId,
IStreamingServiceListener listener);
IStreamingServiceCallback listener);
/**
* Asynchronously fetches all Services being streamed by this uid/appName/subId.

View File

@@ -0,0 +1,76 @@
/*
* 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.vendor;
import android.os.RemoteException;
import android.telephony.mbms.DownloadRequest;
import android.telephony.mbms.DownloadStatus;
import android.telephony.mbms.IDownloadCallback;
import android.telephony.mbms.IMbmsDownloadManagerCallback;
import java.util.List;
/**
* Base class for MbmsDownloadService. The middleware should extend this base class rather than
* the aidl stub for compatibility
* @hide
* TODO: future systemapi
*/
public class MbmsDownloadServiceBase extends IMbmsDownloadService.Stub {
@Override
public void initialize(String appName, int subId, IMbmsDownloadManagerCallback listener)
throws RemoteException {
}
@Override
public int getFileServices(String appName, int subId, List<String> serviceClasses) throws
RemoteException {
return 0;
}
@Override
public int download(String appName, DownloadRequest downloadRequest, IDownloadCallback listener)
throws RemoteException {
return 0;
}
@Override
public List<DownloadRequest> listPendingDownloads(String appName) throws RemoteException {
return null;
}
@Override
public int cancelDownload(String appName, DownloadRequest downloadRequest)
throws RemoteException {
return 0;
}
@Override
public DownloadStatus getDownloadStatus(String appName, DownloadRequest downloadRequest)
throws RemoteException {
return null;
}
@Override
public void resetDownloadKnowledge(String appName, DownloadRequest downloadRequest)
throws RemoteException {
}
@Override
public void dispose(String appName, int subId) throws RemoteException {
}
}

View File

@@ -0,0 +1,82 @@
/*
* 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.vendor;
import android.net.Uri;
import android.os.RemoteException;
import android.telephony.mbms.IMbmsStreamingManagerCallback;
import android.telephony.mbms.IStreamingServiceCallback;
import android.telephony.mbms.StreamingService;
import java.util.List;
/**
* @hide
* TODO: future systemapi
*/
public class MbmsStreamingServiceBase extends IMbmsStreamingService.Stub {
@Override
public int initialize(IMbmsStreamingManagerCallback listener, String appName, int subId)
throws RemoteException {
return 0;
}
@Override
public int getStreamingServices(String appName, int subId, List<String> serviceClasses)
throws RemoteException {
return 0;
}
@Override
public StreamingService startStreaming(String appName, int subId,
String serviceId, IStreamingServiceCallback listener) throws RemoteException {
return null;
}
@Override
public int getActiveStreamingServices(String appName, int subId) throws RemoteException {
return 0;
}
@Override
public Uri getPlaybackUri(String appName, int subId, String serviceId) throws RemoteException {
return null;
}
@Override
public void switchStreams(String appName, int subId, String oldServiceId, String newServiceId)
throws RemoteException {
}
@Override
public int getState(String appName, int subId, String serviceId) throws RemoteException {
return 0;
}
@Override
public void stopStreaming(String appName, int subId, String serviceId) throws RemoteException {
}
@Override
public void disposeStream(String appName, int subId, String serviceId) throws RemoteException {
}
@Override
public void dispose(String appName, int subId) throws RemoteException {
}
}