Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4b3c44be authored by Hall Liu's avatar Hall Liu Committed by Gerrit Code Review
Browse files

Merge "startStreaming for MBMS apis"

parents 0517b719 fb1ee0eb
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -553,7 +553,6 @@ aidl_files := \
        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 \
+34 −34
Original line number Diff line number Diff line
@@ -24,10 +24,10 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.IBinder;
import android.os.RemoteException;
import android.telephony.mbms.IMbmsStreamingManagerCallback;
import android.telephony.mbms.IStreamingServiceCallback;
import android.telephony.mbms.MbmsException;
import android.telephony.mbms.MbmsStreamingManagerCallback;
import android.telephony.mbms.StreamingService;
import android.telephony.mbms.StreamingServiceCallback;
import android.telephony.mbms.StreamingServiceInfo;
import android.telephony.mbms.vendor.IMbmsStreamingService;
import android.util.Log;
@@ -77,14 +77,14 @@ public class MbmsStreamingManager {
    };
    private List<ServiceListener> mServiceListeners = new LinkedList<>();

    private IMbmsStreamingManagerCallback mCallbackToApp;
    private MbmsStreamingManagerCallback mCallbackToApp;
    private final String mAppName;

    private final Context mContext;
    private int mSubscriptionId = INVALID_SUBSCRIPTION_ID;

    /** @hide */
    private MbmsStreamingManager(Context context, IMbmsStreamingManagerCallback listener,
    private MbmsStreamingManager(Context context, MbmsStreamingManagerCallback listener,
                    String streamingAppName, int subscriptionId) {
        mContext = context;
        mAppName = streamingAppName;
@@ -106,7 +106,7 @@ public class MbmsStreamingManager {
     * @param subscriptionId The subscription ID to use.
     */
    public static MbmsStreamingManager create(Context context,
            IMbmsStreamingManagerCallback listener, String streamingAppName, int subscriptionId)
            MbmsStreamingManagerCallback listener, String streamingAppName, int subscriptionId)
            throws MbmsException {
        MbmsStreamingManager manager = new MbmsStreamingManager(context, listener,
                streamingAppName, subscriptionId);
@@ -116,10 +116,10 @@ public class MbmsStreamingManager {

    /**
     * Create a new MbmsStreamingManager using the system default data subscription ID.
     * See {@link #create(Context, IMbmsStreamingManagerCallback, String, int)}.
     * See {@link #create(Context, MbmsStreamingManagerCallback, String, int)}.
     */
    public static MbmsStreamingManager create(Context context,
            IMbmsStreamingManagerCallback listener, String streamingAppName)
            MbmsStreamingManagerCallback listener, String streamingAppName)
            throws MbmsException {
        int subId = SubscriptionManager.getDefaultSubscriptionId();
        MbmsStreamingManager manager = new MbmsStreamingManager(context, listener,
@@ -155,13 +155,12 @@ public class MbmsStreamingManager {
     *
     * This may throw an {@link MbmsException} containing one of the following errors:
     * {@link MbmsException#ERROR_MIDDLEWARE_NOT_BOUND}
     * {@link MbmsException#ERROR_NOT_YET_INITIALIZED}
     * {@link MbmsException#ERROR_UNKNOWN_REMOTE_EXCEPTION}
     * {@link MbmsException#ERROR_CONCURRENT_SERVICE_LIMIT_REACHED}
     *
     * Asynchronous error codes via the {@link IMbmsStreamingManagerCallback#error(int, String)}
     * Asynchronous error codes via the {@link MbmsStreamingManagerCallback#error(int, String)}
     * callback can include any of the errors except:
     * {@link MbmsException#ERROR_UNABLE_TO_START_SERVICE}
     * {@link MbmsException#ERROR_INVALID_SERVICE_ID}
     * {@link MbmsException#ERROR_END_OF_SESSION}
     */
    public void getStreamingServices(List<String> classList) throws MbmsException {
@@ -180,36 +179,37 @@ public class MbmsStreamingManager {

    /**
     * Starts streaming a requested service, reporting status to the indicated listener.
     * Returns an object used to control that stream.
     * Returns an object used to control that stream. The stream may not be ready for consumption
     * immediately upon return from this method -- wait until the streaming state has been
     * reported via {@link android.telephony.mbms.StreamingServiceCallback#streamStateChanged(int)}.
     *
     * May throw an IllegalArgumentException or RemoteException.
     * May throw an {@link MbmsException} containing any of the following error codes:
     * {@link MbmsException#ERROR_MIDDLEWARE_NOT_BOUND}
     * {@link MbmsException#ERROR_UNKNOWN_REMOTE_EXCEPTION}
     * {@link MbmsException#ERROR_CONCURRENT_SERVICE_LIMIT_REACHED}
     *
     * May also throw an {@link IllegalArgumentException} or an {@link IllegalStateException}
     *
     * Asynchronous errors through the listener include any of the errors
     */
    public StreamingService startStreaming(StreamingServiceInfo serviceInfo,
            IStreamingServiceCallback listener) {
        return null;
            StreamingServiceCallback listener) throws MbmsException {
        if (mService == null) {
            throw new MbmsException(MbmsException.ERROR_MIDDLEWARE_NOT_BOUND);
        }

    /**
     * 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.
     *
     * May throw a RemoteException.
     *
     * The return value is a success/error-code with the following possible values:
     * <li>SUCCESS</li>
     * <li>ERROR_MSDC_CONCURRENT_SERVICE_LIMIT_REACHED</li>
     *
     * Asynchronous errors through the listener include any of the errors except
     * <li>ERROR_UNABLED_TO_START_SERVICE</li>
     * <li>ERROR_MSDC_INVALID_SERVICE_ID</li>
     * <li>ERROR_MSDC_END_OF_SESSION</li>
     *
     */
    public int getActiveStreamingServices() {
        return 0;
        try {
            int returnCode = mService.startStreaming(
                    mAppName, mSubscriptionId, serviceInfo.getServiceId(), listener);
            if (returnCode != MbmsException.SUCCESS) {
                throw new MbmsException(returnCode);
            }
        } catch (RemoteException e) {
            throw new MbmsException(MbmsException.ERROR_UNKNOWN_REMOTE_EXCEPTION);
        }

        return new StreamingService(
                mAppName, mSubscriptionId, mService, serviceInfo, listener);
    }

    private void bindAndInitialize() throws MbmsException {
+1 −2
Original line number Diff line number Diff line
@@ -17,14 +17,13 @@
package android.telephony.mbms;

import android.net.Uri;
import android.telephony.mbms.StreamingService;

/**
 * @hide
 */
oneway interface IStreamingServiceCallback {
    void error(int errorCode, String message);
    void streamStateChanged(in StreamingService service, int state);
    void streamStateChanged(int state);
    void uriUpdated(in Uri uri);
    void broadcastSignalStrengthUpdated(int signalStrength);
}
+2 −4
Original line number Diff line number Diff line
@@ -27,16 +27,14 @@ public class MbmsException extends Exception {
    public static final int ERROR_CONCURRENT_SERVICE_LIMIT_REACHED = 6;
    public static final int ERROR_MIDDLEWARE_NOT_BOUND = 7;
    public static final int ERROR_UNABLE_TO_START_SERVICE = 8;
    public static final int ERROR_INVALID_SERVICE_ID = 9;
    public static final int ERROR_STREAM_ALREADY_STARTED = 9;
    public static final int ERROR_END_OF_SESSION = 10;
    public static final int ERROR_NOT_YET_INITIALIZED = 11;
    public static final int ERROR_APP_PERMISSIONS_NOT_GRANTED = 12;

    private final int mErrorCode;

    /** @hide
     * TODO: future systemapi
     * */
     */
    public MbmsException(int errorCode) {
        super();
        mErrorCode = errorCode;
+0 −19
Original line number Diff line number Diff line
/*
** 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;
Loading