Second pass of eMBMS api.
Updating Streaming apis. Adding midwear aidl files.
Updating Download apis.
Making it Compile..
Test: none yet
Change-Id: I3f44ef3f6690274af1dc2002bc02e6668fe23248
diff --git a/Android.mk b/Android.mk
index 77ab10b..a2d70ce 100644
--- a/Android.mk
+++ b/Android.mk
@@ -433,6 +433,12 @@
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/vendor/IMbmsDownloadService.aidl \
+ telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl \
telephony/java/com/android/ims/internal/IImsCallSession.aidl \
telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl \
telephony/java/com/android/ims/internal/IImsConfig.aidl \
@@ -541,6 +547,13 @@
include $(CLEAR_VARS)
aidl_files := \
+ frameworks/base/telephony/java/android/telephony/mbms/DownloadRequest.aidl \
+ frameworks/base/telephony/java/android/telephony/mbms/DownloadStatus.aidl \
+ frameworks/base/telephony/java/android/telephony/mbms/FileInfo.aidl \
+ frameworks/base/telephony/java/android/telephony/mbms/FileServiceInfo.aidl \
+ frameworks/base/telephony/java/android/telephony/mbms/ServiceInfo.aidl \
+ frameworks/base/telephony/java/android/telephony/mbms/StreamingService.aidl \
+ frameworks/base/telephony/java/android/telephony/mbms/StreamingServiceInfo.aidl \
frameworks/base/telephony/java/android/telephony/ServiceState.aidl \
frameworks/base/telephony/java/android/telephony/SubscriptionInfo.aidl \
frameworks/base/telephony/java/android/telephony/CellInfo.aidl \
diff --git a/telephony/java/android/telephony/MbmsDownloadManager.java b/telephony/java/android/telephony/MbmsDownloadManager.java
new file mode 100644
index 0000000..ad61d02
--- /dev/null
+++ b/telephony/java/android/telephony/MbmsDownloadManager.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 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;
+
+import android.app.PendingIntent;
+import android.content.Context;
+import android.net.Uri;
+import android.telephony.mbms.DownloadListener;
+import android.telephony.mbms.DownloadRequest;
+import android.telephony.mbms.DownloadStatus;
+import android.telephony.mbms.FileServiceInfo;
+import android.telephony.mbms.IMbmsDownloadManagerListener;
+
+import java.util.List;
+
+import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+
+/** @hide */
+public class MbmsDownloadManager {
+ private final Context mContext;
+ private int mSubId = INVALID_SUBSCRIPTION_ID;
+
+ /**
+ * should use createManager to create/initialize a copy
+ * @hide
+ */
+ public MbmsDownloadManager(Context context) {
+ mContext = context;
+ }
+
+ public static MbmsDownloadManager createManager(Context context,
+ IMbmsDownloadManagerListener listener, String downloadAppName) {
+// MbmsDownloadManager mdm = context.getSystemService(Context.MBMS_DOWNLOAD_SERVICE);
+// if (mdm == null) return mdm;
+// mdm.initialize(listener, downloadAppName,
+// SubscriptionManager.getDefaultSubscriptionId());
+// return mdm;
+ return null;
+ }
+
+ public static MbmsDownloadManager createManager(Context context,
+ IMbmsDownloadManagerListener listener, String downloadAppName, int subId) {
+// MbmsDownloadManager mdm = context.getSystemService(Context.MBMS_DOWNLOAD_SERVICE);
+// if (mdm == null) return mdm;
+// mdm.initialize(listener, downloadAppName, subId);
+// return mdm;
+ return null;
+ }
+
+ private void initialize(IMbmsDownloadManagerListener listener, String downloadAppName,
+ int subId) {
+ // assert all empty and set
+ }
+
+ /**
+ * Gets the list of files published for download.
+ * They may occur at times far in the future.
+ * servicesClasses lets the app filter on types of files and is opaque data between
+ * the app and the carrier
+ */
+ public int getFileServices(List<String> serviceClasses) {
+ return 0;
+ }
+
+
+ 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
+ * for completed or errored-out downloads. A NULL indicates no callbacks are needed.
+ */
+ public DownloadRequest download(DownloadRequest downloadRequest, DownloadListener listener) {
+ return null;
+ }
+
+ public List<DownloadRequest> listPendingDownloads() {
+ return null;
+ }
+
+ public int cancelDownload(DownloadRequest downloadRequest) {
+ return 0;
+ }
+
+ /**
+ * Gets information about current and known upcoming downloads.
+ *
+ * Current is a straightforward count of the files being downloaded "now"
+ * for some definition of now (may be racey).
+ * Future downloads include counts of files with pending repair operations, counts of
+ * files with future downloads and indication of scheduled download times with unknown
+ * file details.
+ */
+ public DownloadStatus getDownloadStatus(DownloadRequest downloadRequest) {
+ return null;
+ }
+
+ /**
+ * Resets middleware knowldge 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
+ * content, even if that content has since been deleted. If this function is called
+ * repeated content will be downloaded again when available. This does not interrupt
+ * in-progress downloads.
+ */
+ public void resetDownloadKnowledge(DownloadRequest downloadRequest) {
+ }
+
+ public void dispose() {
+ }
+}
diff --git a/telephony/java/android/telephony/MbmsStreamingManager.java b/telephony/java/android/telephony/MbmsStreamingManager.java
new file mode 100644
index 0000000..0bcde2f
--- /dev/null
+++ b/telephony/java/android/telephony/MbmsStreamingManager.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 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;
+
+import android.content.Context;
+import android.telephony.mbms.IMbmsStreamingManagerListener;
+import android.telephony.mbms.IStreamingServiceListener;
+import android.telephony.mbms.StreamingService;
+import android.telephony.mbms.StreamingServiceInfo;
+import android.util.Log;
+
+import java.util.List;
+
+import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+
+/** @hide */
+public class MbmsStreamingManager {
+ private static final String LOG_TAG = "MbmsStreamingManager";
+ private static final boolean DEBUG = true;
+
+ private final Context mContext;
+ private int mSubId = 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.
+ */
+ public MbmsStreamingManager(Context context, IMbmsStreamingManagerListener listener,
+ String streamingAppName) {
+ mContext = context;
+ }
+
+ /**
+ * Create a new MbmsStreamingManager using the give subscription ID.
+ *
+ * Note that this call will bind a remote service and that may take a bit. This
+ * may throw an IllegalArgumentException.
+ */
+ public MbmsStreamingManager(Context context, IMbmsStreamingManagerListener listener,
+ String streamingAppName, int subId) {
+ mContext = context;
+ }
+
+ /**
+ * Terminates this instance, ending calls to the registered listener. Also terminates
+ * any streaming services spawned from this instance.
+ */
+ public void dispose() {
+ // service.dispose(streamingAppName);
+ }
+
+ /**
+ * An inspection API to retrieve the list of streaming media currently be advertised.
+ * The results are returned asynchronously through the previously registered callback.
+ * serviceClasses lets the app filter on types of programming and is opaque data between
+ * the app and the carrier.
+ *
+ * Multiple calls replace the list of serviceClasses of interest.
+ * The return value is a success/error-code with the following possible values:
+ * <li>SUCCESS</li>
+ * <li>NO_MIDDLEWARE</li>
+ * <li>QUEUE_LIMIT</li>
+ */
+ public int getStreamingServices(List<String> classList) {
+ return 0;
+ }
+
+ /**
+ * Starts streaming a requested service, reporting status to the indicated listener.
+ * Returns an object used to control that stream.
+ *
+ */
+ public StreamingService startStreaming(StreamingServiceInfo serviceInfo,
+ IStreamingServiceListener listener) {
+ return null;
+ }
+
+ /**
+ * Lists all the services currently being streamed to the device by this application
+ * on this given subId. Results are returned asynchronously through the previously
+ * registered callback.
+ *
+ * The return value is a success/error-code with the following possible values:
+ * <li>SUCCESS</li>
+ * <li>NO_MIDDLEWARE</li>
+ * <li>QUEU_LIMIT</li>
+ */
+ public int getActiveStreamingServices() {
+ return 0;
+ }
+
+ private void logd(String str) {
+ Log.d(LOG_TAG, str);
+ }
+}
diff --git a/telephony/java/android/telephony/mbms/DownloadListener.java b/telephony/java/android/telephony/mbms/DownloadListener.java
new file mode 100644
index 0000000..8d1bd02
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/DownloadListener.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 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;
+
+/**
+ * A optional listener class used by download clients to track progress.
+ * @hide
+ */
+public class DownloadListener extends IDownloadListener.Stub {
+ /**
+ * Gives process callbacks for a given DownloadRequest.
+ * request indicates which download is being referenced.
+ * fileInfo gives information about the file being downloaded. Note that
+ * the request may result in many files being downloaded and the client
+ * may not have been able to get a list of them in advance.
+ * downloadSize is the final amount to be downloaded. This may be different
+ * from the decoded final size, but is useful in gauging download progress.
+ * currentSize is the amount currently downloaded.
+ * decodedPercent is the percent from 0 to 100 of the file decoded. After the
+ * download completes the contents needs to be processed. It is perhaps
+ * uncompressed, transcoded and/or decrypted. Generally the download completes
+ * before the decode is started, but that's not required.
+ */
+ public void progress(DownloadRequest request, FileInfo fileInfo,
+ int downloadSize, int currentSize, int decodedPercent) {
+ }
+}
diff --git a/telephony/java/android/telephony/mbms/DownloadRequest.aidl b/telephony/java/android/telephony/mbms/DownloadRequest.aidl
new file mode 100755
index 0000000..ece577d
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/DownloadRequest.aidl
@@ -0,0 +1,19 @@
+/*
+** Copyright 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;
+
+parcelable DownloadRequest;
diff --git a/telephony/java/android/telephony/mbms/DownloadRequest.java b/telephony/java/android/telephony/mbms/DownloadRequest.java
new file mode 100644
index 0000000..42a82da
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/DownloadRequest.java
@@ -0,0 +1,88 @@
+/*
+ * 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.app.PendingIntent;
+import android.net.Uri;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * 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) {
+ downloadId = id;
+ fileServiceInfo = serviceInfo;
+ sourceUri = source;
+ destinationUri = dest;
+ subId = sub;
+ }
+
+ /** @hide */
+ public DownloadRequest(DownloadRequest dr, PendingIntent fdRequestPI, PendingIntent cleanupPI) {
+ downloadId = dr.downloadId;
+ fileServiceInfo = dr.fileServiceInfo;
+ sourceUri = dr.sourceUri;
+ destinationUri = dr.destinationUri;
+ subId = dr.subId;
+ /*
+ * resultPI = new PI
+ * fileDescriptorRequstPI = fdRequestPI;
+ * this.cleanupPI = cleanupPI;
+ */
+ }
+
+ public final int downloadId;
+ public final FileServiceInfo fileServiceInfo;
+ public final Uri sourceUri;
+ public final Uri destinationUri;
+ public final int subId;
+
+ public int describeContents() {
+ return 0;
+ }
+
+ public void writeToParcel(Parcel out, int flags) {
+ out.writeInt(downloadId);
+ out.writeParcelable(fileServiceInfo, flags);
+ out.writeParcelable(sourceUri, flags);
+ out.writeParcelable(destinationUri, flags);
+ out.writeInt(subId);
+ }
+
+ private DownloadRequest(Parcel in) {
+ downloadId = in.readInt();
+ fileServiceInfo = in.readParcelable(null);
+ sourceUri = in.readParcelable(null);
+ destinationUri = in.readParcelable(null);
+ subId = in.readInt();
+ }
+
+ public static final Parcelable.Creator<DownloadRequest> CREATOR =
+ new Parcelable.Creator<DownloadRequest>() {
+ public DownloadRequest createFromParcel(Parcel in) {
+ return new DownloadRequest(in);
+ }
+ public DownloadRequest[] newArray(int size) {
+ return new DownloadRequest[size];
+ }
+ };
+
+}
diff --git a/telephony/java/android/telephony/mbms/DownloadStatus.aidl b/telephony/java/android/telephony/mbms/DownloadStatus.aidl
new file mode 100755
index 0000000..e7cfd39
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/DownloadStatus.aidl
@@ -0,0 +1,19 @@
+/*
+** Copyright 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;
+
+parcelable DownloadStatus;
diff --git a/telephony/java/android/telephony/mbms/DownloadStatus.java b/telephony/java/android/telephony/mbms/DownloadStatus.java
new file mode 100644
index 0000000..90eb53f
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/DownloadStatus.java
@@ -0,0 +1,77 @@
+/*
+ * 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.Parcel;
+import android.os.Parcelable;
+
+/**
+ * A Parcelable class describing the status of a Cell-Broadcast download request
+ * @hide
+ */
+public class DownloadStatus implements Parcelable {
+ // includes downloads and active repair work
+ public final int activelyDownloading;
+
+ // files scheduled for future broadcast
+ public final int pendingDownloads;
+
+ // files scheduled for future repairs
+ public final int pendingRepairs;
+
+ // is a future download window scheduled with unknown
+ // number of files
+ public final boolean windowPending;
+
+ public DownloadStatus(int downloading, int downloads, int repairs, boolean window) {
+ activelyDownloading = downloading;
+ pendingDownloads = downloads;
+ pendingRepairs = repairs;
+ windowPending = window;
+ }
+
+ public static final Parcelable.Creator<DownloadStatus> CREATOR =
+ new Parcelable.Creator<DownloadStatus>() {
+ @Override
+ public DownloadStatus createFromParcel(Parcel in) {
+ return new DownloadStatus(in);
+ }
+
+ @Override
+ public DownloadStatus[] newArray(int size) {
+ return new DownloadStatus[size];
+ }
+ };
+
+ DownloadStatus(Parcel in) {
+ activelyDownloading = in.readInt();
+ pendingDownloads = in.readInt();
+ pendingRepairs = in.readInt();
+ windowPending = (in.readInt() == 1);
+ }
+
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(activelyDownloading);
+ dest.writeInt(pendingDownloads);
+ dest.writeInt(pendingRepairs);
+ dest.writeInt((windowPending ? 1 : 0));
+ }
+
+ public int describeContents() {
+ return 0;
+ }
+}
diff --git a/telephony/java/android/telephony/mbms/FileInfo.aidl b/telephony/java/android/telephony/mbms/FileInfo.aidl
new file mode 100755
index 0000000..62926e1
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/FileInfo.aidl
@@ -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 FileInfo;
diff --git a/telephony/java/android/telephony/mbms/FileInfo.java b/telephony/java/android/telephony/mbms/FileInfo.java
new file mode 100644
index 0000000..d3888bd
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/FileInfo.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 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;
+
+import android.net.Uri;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * A Parcelable class Cell-Broadcast downloadable file information.
+ * @hide
+ */
+public class FileInfo implements Parcelable {
+
+ /**
+ * The URI into the carriers infrastructure which points to this file.
+ * This is used internally but is also one of the few pieces of data about the content that is
+ * exposed and may be needed for disambiguation by the application.
+ */
+ final Uri uri;
+
+ /**
+ * The mime type of the content.
+ */
+ final String mimeType;
+
+ /**
+ * The size of the file in bytes.
+ */
+ final long size;
+
+ /**
+ * The MD5 hash of the file.
+ */
+ final byte md5Hash[];
+
+ /**
+ * Gets the parent service for this file.
+ */
+ public FileServiceInfo getFileServiceInfo() {
+ return null;
+ }
+
+ public static final Parcelable.Creator<FileInfo> CREATOR =
+ new Parcelable.Creator<FileInfo>() {
+ @Override
+ public FileInfo createFromParcel(Parcel source) {
+ return new FileInfo(source);
+ }
+
+ @Override
+ public FileInfo[] newArray(int size) {
+ return new FileInfo[size];
+ }
+ };
+
+ private FileInfo(Parcel in) {
+ uri = in.readParcelable(null);
+ mimeType = in.readString();
+ size = in.readLong();
+ int arraySize = in.readInt();
+ md5Hash = new byte[arraySize];
+ in.readByteArray(md5Hash);
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeParcelable(uri, flags);
+ dest.writeString(mimeType);
+ dest.writeLong(size);
+ dest.writeInt(md5Hash.length);
+ dest.writeByteArray(md5Hash);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+}
diff --git a/telephony/java/android/telephony/mbms/FileServiceInfo.aidl b/telephony/java/android/telephony/mbms/FileServiceInfo.aidl
new file mode 100755
index 0000000..4646bad
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/FileServiceInfo.aidl
@@ -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 FileServiceInfo;
diff --git a/telephony/java/android/telephony/mbms/FileServiceInfo.java b/telephony/java/android/telephony/mbms/FileServiceInfo.java
new file mode 100644
index 0000000..8bda370
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/FileServiceInfo.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 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;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * A Parcelable class Cell-Broadcast downloadable file information.
+ * @hide
+ */
+public class FileServiceInfo extends ServiceInfo implements Parcelable {
+ public List<FileInfo> files;
+
+ public FileServiceInfo(Map<Locale, String> newNames, String newClassName, Locale newLocale,
+ String newServiceId, Date start, Date end, List<FileInfo> newFiles) {
+ super(newNames, newClassName, newLocale, newServiceId, start, end);
+ files = new ArrayList(newFiles);
+ }
+
+ public static final Parcelable.Creator<FileServiceInfo> CREATOR =
+ new Parcelable.Creator<FileServiceInfo>() {
+ @Override
+ public FileServiceInfo createFromParcel(Parcel source) {
+ return new FileServiceInfo(source);
+ }
+
+ @Override
+ public FileServiceInfo[] newArray(int size) {
+ return new FileServiceInfo[size];
+ }
+ };
+
+ FileServiceInfo(Parcel in) {
+ super(in);
+ files = new ArrayList<FileInfo>();
+ in.readList(files, null);
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ super.writeToParcel(dest, flags);
+ dest.writeList(files);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+}
diff --git a/telephony/java/android/telephony/mbms/IDownloadListener.aidl b/telephony/java/android/telephony/mbms/IDownloadListener.aidl
new file mode 100755
index 0000000..9838682
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/IDownloadListener.aidl
@@ -0,0 +1,34 @@
+/*
+** Copyright 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.telephony.mbms.DownloadRequest;
+import android.telephony.mbms.FileInfo;
+
+/**
+ * The optional interface used by download clients to track progress.
+ * @hide
+ */
+interface IDownloadListener
+{
+ /**
+ * Gives progress callbacks for a given DownloadRequest. Includes a FileInfo
+ * as the list of files may not have been known at request-time.
+ */
+ void progress(in DownloadRequest request, in FileInfo fileInfo, int downloadSize,
+ int currentSize, int decodedPercent);
+}
diff --git a/telephony/java/android/telephony/mbms/IMbmsDownloadManagerListener.aidl b/telephony/java/android/telephony/mbms/IMbmsDownloadManagerListener.aidl
new file mode 100755
index 0000000..6b5c021
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/IMbmsDownloadManagerListener.aidl
@@ -0,0 +1,42 @@
+/*
+** Copyright 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.telephony.mbms.FileServiceInfo;
+
+import java.util.List;
+
+/**
+ * The interface the clients top-level file download listener will satisfy.
+ * @hide
+ */
+interface IMbmsDownloadManagerListener
+{
+ void error(int errorCode, String message);
+
+ /**
+ * Called to indicate published File Services have changed.
+ *
+ * This will only be called after the application has requested
+ * a list of file services and specified a service class list
+ * of interest AND the results of a subsequent getFileServices
+ * call with the same service class list would
+ * return different
+ * results.
+ */
+ void fileServicesUpdated(in List<FileServiceInfo> services);
+}
diff --git a/telephony/java/android/telephony/mbms/IMbmsStreamingManagerListener.aidl b/telephony/java/android/telephony/mbms/IMbmsStreamingManagerListener.aidl
new file mode 100755
index 0000000..80176bf
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/IMbmsStreamingManagerListener.aidl
@@ -0,0 +1,53 @@
+/*
+** Copyright 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.telephony.mbms.StreamingServiceInfo;
+
+import java.util.List;
+
+/**
+ * The interface the clients top-level streaming listener will satisfy.
+ * @hide
+ */
+interface IMbmsStreamingManagerListener
+{
+ void error(int errorCode, String message);
+
+ /**
+ * Called to indicate published Streaming Services have changed.
+ *
+ * This will only be called after the application has requested
+ * a list of streaming services and specified a service class list
+ * of interest AND the results of a subsequent getStreamServices
+ * call with the same service class list would
+ * return different
+ * results.
+ */
+ void streamingServicesUpdated(in List<StreamingServiceInfo> services);
+
+ /**
+ * Called to indicate the active Streaming Services have changed.
+ *
+ * This will be caused whenever a new service starts streaming or whenever
+ * MbmsStreamServiceManager.getActiveStreamingServices is called.
+ *
+ * @param services a list of StreamingServiceInfos. May be empty if
+ * there are no active StreamingServices
+ */
+ void activeStreamingServicesUpdated(in List<StreamingServiceInfo> services);
+}
diff --git a/telephony/java/android/telephony/mbms/IStreamingServiceListener.aidl b/telephony/java/android/telephony/mbms/IStreamingServiceListener.aidl
new file mode 100755
index 0000000..a41aca3
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/IStreamingServiceListener.aidl
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 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;
+
+import android.net.Uri;
+import android.telephony.SignalStrength;
+
+/**
+ * @hide
+ */
+oneway interface IStreamingServiceListener {
+ void error(int errorCode, String message);
+ void stateUpdated(int state);
+ void uriUpdated(in Uri uri);
+ void signalStrengthUpdated(in SignalStrength signalStrength);
+}
diff --git a/telephony/java/android/telephony/mbms/MbmsDownloadManagerListener.java b/telephony/java/android/telephony/mbms/MbmsDownloadManagerListener.java
new file mode 100644
index 0000000..04c2f9a
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/MbmsDownloadManagerListener.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 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;
+
+import java.util.List;
+
+/**
+ * A Parcelable class with Cell-Broadcast service information.
+ * @hide
+ */
+public class MbmsDownloadManagerListener extends IMbmsDownloadManagerListener.Stub {
+
+ public final static int ERROR_CARRIER_NOT_SUPPORTED = 1;
+ public final static int ERROR_UNABLE_TO_INITIALIZE = 2;
+ public final static int ERROR_UNABLE_TO_ALLOCATE_MEMORY = 3;
+
+
+ public void error(int errorCode, String message) {
+ // default implementation empty
+ }
+
+ /**
+ * Called to indicate published File Services have changed.
+ *
+ * This will only be called after the application has requested
+ * a list of file services and specified a service class list
+ * of interest AND the results of a subsequent getFileServices
+ * call with the same service class list would return different
+ * results.
+ *
+ * @param services a List of FileServiceInfos
+ *
+ */
+ public void fileServicesUpdated(List<FileServiceInfo> services) {
+ // default implementation empty
+ }
+}
diff --git a/telephony/java/android/telephony/mbms/MbmsStreamingManagerListener.java b/telephony/java/android/telephony/mbms/MbmsStreamingManagerListener.java
new file mode 100644
index 0000000..c64ad44
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/MbmsStreamingManagerListener.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 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;
+
+import java.util.List;
+
+/**
+ * A Parcelable class with Cell-Broadcast service information.
+ * @hide
+ */
+public class MbmsStreamingManagerListener extends IMbmsStreamingManagerListener.Stub {
+
+ public final static int ERROR_CARRIER_NOT_SUPPORTED = 1;
+ public final static int ERROR_UNABLE_TO_INITIALIZE = 2;
+ public final static int ERROR_UNABLE_TO_ALLOCATE_MEMORY = 3;
+
+
+ public void error(int errorCode, String message) {
+ // default implementation empty
+ }
+
+ /**
+ * Called to indicate published Streaming Services have changed.
+ *
+ * This will only be called after the application has requested
+ * a list of streaming services and specified a service class list
+ * of interest AND the results of a subsequent getStreamServices
+ * call with the same service class list would return different
+ * results.
+ *
+ * @param services a List of StreamingServiceInfos
+ *
+ */
+ public void streamingServicesUpdated(List<StreamingServiceInfo> services) {
+ // default implementation empty
+ }
+
+ /**
+ * Called to indicate the active Streaming Services have changed.
+ *
+ * This will be caused whenever a new service starts streaming or whenever
+ * MbmsStreamServiceManager.getActiveStreamingServices is called.
+ *
+ * @param services a list of StreamingServiceInfos. May be empty if
+ * there are no active StreamingServices
+ */
+ public void activeStreamingServicesUpdated(List<StreamingServiceInfo> services) {
+ // default implementation empty
+ }
+}
diff --git a/telephony/java/android/telephony/mbms/ServiceInfo.aidl b/telephony/java/android/telephony/mbms/ServiceInfo.aidl
new file mode 100755
index 0000000..6661c26
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/ServiceInfo.aidl
@@ -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 ServiceInfo;
diff --git a/telephony/java/android/telephony/mbms/ServiceInfo.java b/telephony/java/android/telephony/mbms/ServiceInfo.java
new file mode 100644
index 0000000..cd2e46c
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/ServiceInfo.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 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;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.text.TextUtils;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A Parcelable class with Cell-Broadcast service information.
+ * @hide
+ */
+public class ServiceInfo implements Parcelable {
+ // arbitrary limit on the number of locale -> name pairs we support
+ final static int MAP_LIMIT = 50;
+ /**
+ * User displayable names listed by language. Unmodifiable.
+ */
+ final Map<Locale, String> names;
+
+ /**
+ * The class name for this service - used to catagorize and filter
+ */
+ final String className;
+
+ /**
+ * The language for this service content
+ */
+ final Locale locale;
+
+ /**
+ * The carrier's identifier for the service.
+ */
+ final String serviceId;
+
+ /**
+ * The start time indicating when this service will be available.
+ */
+ final Date sessionStartTime;
+
+ /**
+ * The end time indicating when this sesion stops being available.
+ */
+ final Date sessionEndTime;
+
+
+ public ServiceInfo(Map<Locale, String> newNames, String newClassName, Locale newLocale,
+ String newServiceId, Date start, Date end) {
+ if (newNames == null || newNames.isEmpty() || TextUtils.isEmpty(newClassName)
+ || newLocale == null || TextUtils.isEmpty(newServiceId)
+ || start == null || end == null) {
+ throw new IllegalArgumentException("Bad ServiceInfo construction");
+ }
+ if (newNames.size() > MAP_LIMIT) {
+ throw new RuntimeException("bad map length" + newNames.size());
+ }
+ names = new HashMap(newNames.size());
+ names.putAll(newNames);
+ className = newClassName;
+ locale = (Locale)newLocale.clone();
+ serviceId = newServiceId;
+ sessionStartTime = (Date)start.clone();
+ sessionEndTime = (Date)end.clone();
+ }
+
+ public static final Parcelable.Creator<FileServiceInfo> CREATOR =
+ new Parcelable.Creator<FileServiceInfo>() {
+ @Override
+ public FileServiceInfo createFromParcel(Parcel source) {
+ return new FileServiceInfo(source);
+ }
+
+ @Override
+ public FileServiceInfo[] newArray(int size) {
+ return new FileServiceInfo[size];
+ }
+ };
+
+ ServiceInfo(Parcel in) {
+ int mapCount = in.readInt();
+ if (mapCount > MAP_LIMIT || mapCount < 0) {
+ throw new RuntimeException("bad map length" + mapCount);
+ }
+ names = new HashMap(mapCount);
+ while (mapCount-- > 0) {
+ Locale locale = (java.util.Locale) in.readSerializable();
+ String name = in.readString();
+ names.put(locale, name);
+ }
+ className = in.readString();
+ locale = (java.util.Locale) in.readSerializable();
+ serviceId = in.readString();
+ sessionStartTime = (java.util.Date) in.readSerializable();
+ sessionEndTime = (java.util.Date) in.readSerializable();
+ }
+
+ public void writeToParcel(Parcel dest, int flags) {
+ Set<Locale> keySet = names.keySet();
+ dest.writeInt(keySet.size());
+ for (Locale l : keySet) {
+ dest.writeSerializable(l);
+ dest.writeString(names.get(l));
+ }
+ dest.writeString(className);
+ dest.writeSerializable(locale);
+ dest.writeString(serviceId);
+ dest.writeSerializable(sessionStartTime);
+ dest.writeSerializable(sessionEndTime);
+ }
+
+ public int describeContents() {
+ return 0;
+ }
+}
diff --git a/telephony/java/android/telephony/mbms/StreamingService.aidl b/telephony/java/android/telephony/mbms/StreamingService.aidl
new file mode 100755
index 0000000..0c286f3
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/StreamingService.aidl
@@ -0,0 +1,19 @@
+/*
+** Copyright 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;
+
+parcelable StreamingService;
diff --git a/telephony/java/android/telephony/mbms/StreamingService.java b/telephony/java/android/telephony/mbms/StreamingService.java
new file mode 100644
index 0000000..f93b1a8
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/StreamingService.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 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;
+
+import android.net.Uri;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.telephony.SignalStrength;
+
+/**
+ * @hide
+ */
+public class StreamingService {
+
+ public final static int STATE_STOPPED = 1;
+ public final static int STATE_STARTED = 2;
+ public final static int STATE_STALLED = 3;
+
+ /**
+ */
+ StreamingService(StreamingServiceInfo streamingServiceInfo,
+ IStreamingServiceListener listener) {
+ }
+
+ /**
+ * Retreive the Uri used to play this stream
+ */
+ public Uri getPlaybackUri() {
+ return null;
+ }
+
+ /**
+ * Retreive the info for this StreamingService.
+ */
+ public StreamingServiceInfo getInfo() {
+ return null;
+ }
+
+ /**
+ * Retreive the current state of this stream.
+ */
+ public int getState() {
+ return STATE_STOPPED;
+ }
+
+ /**
+ * Stop streaming this service. Terminal.
+ */
+ public void stopStreaming() {
+ }
+
+ /**
+ * Switch this stream to a different service. Used for smooth transitions.
+ */
+ public void switchStream(StreamingServiceInfo streamingServiceInfo) {
+ }
+
+ public void dispose() {
+ }
+
+ public static final Parcelable.Creator<StreamingService> CREATOR =
+ new Parcelable.Creator<StreamingService>() {
+ @Override
+ public StreamingService createFromParcel(Parcel in) {
+ return new StreamingService(in);
+ }
+
+ @Override
+ public StreamingService[] newArray(int size) {
+ return new StreamingService[size];
+ }
+ };
+
+ private StreamingService(Parcel in) {
+ }
+
+ public void writeToParcel(Parcel dest, int flags) {
+ }
+
+ public int describeContents() {
+ return 0;
+ }
+}
+
diff --git a/telephony/java/android/telephony/mbms/StreamingServiceInfo.aidl b/telephony/java/android/telephony/mbms/StreamingServiceInfo.aidl
new file mode 100755
index 0000000..b902f27
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/StreamingServiceInfo.aidl
@@ -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 StreamingServiceInfo;
diff --git a/telephony/java/android/telephony/mbms/StreamingServiceInfo.java b/telephony/java/android/telephony/mbms/StreamingServiceInfo.java
new file mode 100644
index 0000000..f559585
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/StreamingServiceInfo.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 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;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.util.Date;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * A Parcelable class Cell-Broadcast media stream information.
+ * This may not have any more info than ServiceInfo, but kept for completeness.
+ * @hide
+ */
+public class StreamingServiceInfo extends ServiceInfo implements Parcelable {
+
+ public StreamingServiceInfo(Map<Locale, String> newNames, String newClassName,
+ Locale newLocale, String newServiceId, Date start, Date end) {
+ super(newNames, newClassName, newLocale, newServiceId, start, end);
+ }
+
+ public static final Parcelable.Creator<StreamingServiceInfo> CREATOR =
+ new Parcelable.Creator<StreamingServiceInfo>() {
+ @Override
+ public StreamingServiceInfo createFromParcel(Parcel source) {
+ return new StreamingServiceInfo(source);
+ }
+
+ @Override
+ public StreamingServiceInfo[] newArray(int size) {
+ return new StreamingServiceInfo[size];
+ }
+ };
+
+ StreamingServiceInfo(Parcel in) {
+ super(in);
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ super.writeToParcel(dest, flags);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+}
diff --git a/telephony/java/android/telephony/mbms/StreamingServiceListener.java b/telephony/java/android/telephony/mbms/StreamingServiceListener.java
new file mode 100644
index 0000000..bc5aebb
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/StreamingServiceListener.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 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;
+
+import android.net.Uri;
+import android.telephony.SignalStrength;
+
+/**
+ * A Callback class for use when the applicaiton is actively streaming content.
+ * @hide
+ */
+public class StreamingServiceListener extends IStreamingServiceListener.Stub {
+
+
+ public void error(int errorCode, String message) {
+ // default implementation empty
+ }
+
+ /**
+ * Called to indicate this stream has changed state.
+ *
+ * See {@link StreamingService#STATE_STOPPED}, {@link StreamingService#STATE_STARTED}
+ * and {@link StreamingService#STATE_STALLED}.
+ */
+ public void stateUpdated(int state) {
+ // default implementation empty
+ }
+
+ /**
+ * Called to indicate published Download Services have changed.
+ *
+ * This may be called when a looping stream hits the end or
+ * when the a new URI should be used to correct for time drift.
+ */
+ public void uriUpdated(Uri uri) {
+ // default implementation empty
+ }
+
+ /**
+ * Signal Strength updated.
+ *
+ * This signal strength is the BROADCAST signal strength which,
+ * depending on technology in play and it's deployment, may be
+ * stronger or weaker than the traditional UNICAST signal
+ * strength.
+ *
+ * A {@link android.telephony.SignalStrength#getLevel} result of 0 means
+ * you don't have coverage for this stream, either due to geographic
+ * restrictions, poor tower coverage or something (yards of concrete?)
+ * interferring with the signal.
+ */
+ public void signalStrengthUpdated(SignalStrength signalStrength) {
+ // default implementation empty
+ }
+}
diff --git a/telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl b/telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl
new file mode 100755
index 0000000..4ec40da
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl
@@ -0,0 +1,73 @@
+/*
+** Copyright 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.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;
+
+/**
+ * The interface the opaque MbmsStreamingService will satisfy.
+ * @hide
+ */
+interface IMbmsDownloadService
+{
+ /**
+ * Initialize download service
+ * Registers this listener, subId with this appName
+ *
+ * No return value. Async errors may be reported, but none expected (not doing anything yet).
+ */
+ void initialize(String appName, int subId, IMbmsDownloadManagerListener listener);
+
+ /**
+ * - Registers serviceClasses of interest with the uid/appName/subId key.
+ * - Starts asynch fetching data on download services of matching classes to be reported
+ * later by callback.
+ *
+ * Note that subsequent calls with the same callback, appName, subId and uid will replace
+ * the service class list.
+ */
+ int getFileServices(String appName, int subId, in List<String> serviceClasses);
+
+ /**
+ * should move the params into a DownloadRequest parcelable
+ */
+ int download(in DownloadRequest downloadRequest, IDownloadListener listener);
+
+ List<DownloadRequest> listPendingDownloads();
+
+ int cancelDownload(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(in DownloadRequest downloadRequest);
+
+ /**
+ * End of life for this MbmsDownloadManager.
+ * Any pending downloads remain in affect and may start up independently in the future.
+ */
+ void dispose(String appName, int subId);
+}
diff --git a/telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl b/telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl
new file mode 100755
index 0000000..cb83969
--- /dev/null
+++ b/telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl
@@ -0,0 +1,88 @@
+/*
+** Copyright 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.telephony.mbms.IMbmsStreamingManagerListener;
+import android.telephony.mbms.IStreamingServiceListener;
+import android.telephony.mbms.StreamingService;
+import android.telephony.mbms.StreamingServiceInfo;
+import android.telephony.SignalStrength;
+
+/**
+ * The interface the opaque MbmsStreamingService will satisfy.
+ * @hide
+ */
+interface IMbmsStreamingService
+{
+ /**
+ * Initialize streaming service
+ * Registers this listener, subId with this appName
+ *
+ */
+ int initialize(IMbmsStreamingManagerListener listener, String appName, int subId);
+
+
+ /**
+ * - Registers serviceClasses of interest with the uid/appName/subId key.
+ * - Starts asynch fetching data on streaming services of matching classes to be reported
+ * later by callback.
+ *
+ * Note that subsequent calls with the same callback, appName, subId and uid will replace
+ * the service class list.
+ */
+ int getStreamingServices(String appName, int subId, in List<String> serviceClasses);
+
+ /**
+ * - Starts streaming the serviceId given.
+ * - if the uid/appName/subId don't match a previously registered callback an error will
+ * be returned
+ * - Streaming status will be sent via the included listener, including an initial
+ * URL-change and State-change pair.
+ */
+ StreamingService startStreaming(String appName, int subId, String serviceId,
+ IStreamingServiceListener listener);
+
+ /**
+ * Asynchronously fetches all Services being streamed by this uid/appName/subId.
+ */
+ int getActiveStreamingServices(String appName, int subId);
+
+
+ /**
+ * Per-stream api. Note each specifies what stream they apply to.
+ */
+
+ Uri getPlaybackUri(String appName, int subId, String serviceId);
+
+ void switchStreams(String appName, int subId, String oldServiceId, String newServiceId);
+
+ int getState(String appName, int subId, String serviceId);
+
+ void stopStreaming(String appName, int subId, String serviceId);
+
+ void disposeStream(String appName, int subId, String serviceId);
+
+
+ /**
+ * End of life for all MbmsStreamingManager's created by this uid/appName/subId.
+ * Ends any streams run under this uid/appname/subId and calls the disposed methods
+ * an callbacks registered for this uid/appName/subId and the disposed methods on any
+ * listeners registered with startStreaming.
+ */
+ void dispose(String appName, int subId);
+}