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

Commit 1169bc59 authored by Hall Liu's avatar Hall Liu
Browse files

Mock-un-hide the MBMS streaming APIs

In AOSP, this unhid the MBMS streaming APIs and modified the
vendor base classes to no longer pass raw AIDLs to the vendor code.

@hide tags put back in for MR1.

Bug: 30981736
Test: builds
Change-Id: I861e0568e3bf9ee9a937bf6314b1fc839a31f00c
Merged-In: I8dd83d01a7511968ed51a80ad358a48e50c3d1e7
parent 1e211675
Loading
Loading
Loading
Loading
+24 −4
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package android.telephony;

import android.annotation.SdkConstant;
import android.annotation.SystemApi;
import android.content.ComponentName;
import android.content.Context;
import android.content.ServiceConnection;
@@ -41,6 +43,14 @@ import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
 */
public class MbmsStreamingManager {
    private static final String LOG_TAG = "MbmsStreamingManager";

    /**
     * Service action which must be handled by the middleware implementing the MBMS streaming
     * interface.
     * @hide
     */
    @SystemApi
    @SdkConstant(SdkConstant.SdkConstantType.SERVICE_ACTION)
    public static final String MBMS_STREAMING_SERVICE_ACTION =
            "android.telephony.action.EmbmsStreaming";

@@ -203,13 +213,23 @@ public class MbmsStreamingManager {
                            return;
                        } catch (RuntimeException e) {
                            Log.e(LOG_TAG, "Runtime exception during initialization");
                            try {
                                mCallbackToApp.error(
                                    MbmsException.InitializationErrors.ERROR_UNABLE_TO_INITIALIZE,
                                        MbmsException.InitializationErrors
                                                .ERROR_UNABLE_TO_INITIALIZE,
                                        e.toString());
                            } catch (RemoteException e1) {
                                // ignore
                            }
                            return;
                        }
                        if (result != MbmsException.SUCCESS) {
                            mCallbackToApp.error(result, "Error returned during initialization");
                            try {
                                mCallbackToApp.error(
                                        result, "Error returned during initialization");
                            } catch (RemoteException e) {
                                // ignore
                            }
                            return;
                        }
                        mService.set(streamingService);
+4 −0
Original line number Diff line number Diff line
@@ -61,6 +61,10 @@ public class FileInfo implements Parcelable {
        }
    };

    /**
     * @hide
     * TODO: systemapi
     */
    public FileInfo(Uri uri, String mimeType, long size, byte[] md5Hash) {
        this.uri = uri;
        this.mimeType = mimeType;
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import java.util.Map;
public class FileServiceInfo extends ServiceInfo implements Parcelable {
    private final List<FileInfo> files;

    /** @hide TODO: systemapi */
    public FileServiceInfo(Map<Locale, String> newNames, String newClassName,
            List<Locale> newLocales, String newServiceId, Date start, Date end,
            List<FileInfo> newFiles) {
+6 −6
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ public class MbmsException extends Exception {

    /**
     * Indicates that the app attempted to perform an operation on an instance of
     * {@link android.telephony.MbmsDownloadManager} or
     * TODO: link android.telephony.MbmsDownloadManager or
     * {@link android.telephony.MbmsStreamingManager} without being bound to the middleware.
     */
    public static final int ERROR_MIDDLEWARE_NOT_BOUND = 2;
@@ -47,7 +47,7 @@ public class MbmsException extends Exception {
        /**
         * Indicates that the app tried to create more than one instance each of
         * {@link android.telephony.MbmsStreamingManager} or
         * {@link android.telephony.MbmsDownloadManager}.
         * TODO: link android.telephony.MbmsDownloadManager
         */
        public static final int ERROR_DUPLICATE_INITIALIZE = 101;
        /** Indicates that the app is not authorized to access media via MBMS.*/
@@ -64,7 +64,7 @@ public class MbmsException extends Exception {
        /**
         * Indicates that the app attempted to perform an operation before receiving notification
         * that the middleware is ready via {@link MbmsStreamingManagerCallback#middlewareReady()}
         * or {@link MbmsDownloadManagerCallback#middlewareReady()}.
         * or TODO: link MbmsDownloadManagerCallback#middlewareReady
         */
        public static final int ERROR_MIDDLEWARE_NOT_YET_READY = 201;
        /**
@@ -113,6 +113,8 @@ public class MbmsException extends Exception {

    /**
     * Indicates the errors that are applicable only to the file-download use-case
     * TODO: unhide
     * @hide
     */
    public static class DownloadErrors {
        /**
@@ -127,9 +129,7 @@ public class MbmsException extends Exception {

    private final int mErrorCode;

    /** @hide
     * TODO: future systemapi
     */
    /** @hide */
    public MbmsException(int errorCode) {
        super();
        mErrorCode = errorCode;
+16 −10
Original line number Diff line number Diff line
@@ -16,20 +16,25 @@

package android.telephony.mbms;

import android.content.Context;
import android.os.RemoteException;

import java.util.List;

/**
 * A Parcelable class with Cell-Broadcast service information.
 * A callback class that is used to receive information from the middleware on MBMS streaming
 * services. An instance of this object should be passed into
 * {@link android.telephony.MbmsStreamingManager#create(Context, MbmsStreamingManagerCallback)}.
 * @hide
 */
public class MbmsStreamingManagerCallback extends IMbmsStreamingManagerCallback.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) {
    /**
     * Called by the middleware when it has detected an error condition. The possible error codes
     * are listed in {@link MbmsException}.
     * @param errorCode The error code.
     * @param message A human-readable message generated by the middleware for debugging purposes.
     */
    public void error(int errorCode, String message) throws RemoteException {
        // default implementation empty
    }

@@ -45,7 +50,8 @@ public class MbmsStreamingManagerCallback extends IMbmsStreamingManagerCallback.
     * @param services a List of StreamingServiceInfos
     *
     */
    public void streamingServicesUpdated(List<StreamingServiceInfo> services) {
    public void streamingServicesUpdated(List<StreamingServiceInfo> services)
            throws RemoteException {
        // default implementation empty
    }

@@ -58,7 +64,7 @@ public class MbmsStreamingManagerCallback extends IMbmsStreamingManagerCallback.
     * or {@link MbmsException.GeneralErrors#ERROR_MIDDLEWARE_NOT_YET_READY}
     */
    @Override
    public void middlewareReady() {
    public void middlewareReady() throws RemoteException {
        // default implementation empty
    }
}
Loading