Home | History | Annotate | Download | only in mbms
      1 /*
      2  * Copyright (C) 2017 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License
     15  */
     16 
     17 package android.telephony.mbms;
     18 
     19 import android.telephony.MbmsStreamingSession;
     20 
     21 public class MbmsErrors {
     22     /**
     23      * Indicates that the middleware has sent an error code that is not defined in the version of
     24      * the SDK targeted by your app. This is an illegal value for the middleware to return -- it
     25      * should only ever be generated by the framework.
     26      */
     27     public static final int UNKNOWN = -1;
     28 
     29     /** Indicates that the operation was successful. */
     30     public static final int SUCCESS = 0;
     31 
     32     // Following errors are generated in the manager and should not be returned from the
     33     // middleware
     34     /**
     35      * Indicates that either no MBMS middleware app is installed on the device or multiple
     36      * middleware apps are installed on the device.
     37      */
     38     public static final int ERROR_NO_UNIQUE_MIDDLEWARE = 1;
     39 
     40     /**
     41      * Indicates that the app attempted to perform an operation on an instance of
     42      * {@link android.telephony.MbmsDownloadSession} or
     43      * {@link MbmsStreamingSession} without being bound to the middleware.
     44      */
     45     public static final int ERROR_MIDDLEWARE_NOT_BOUND = 2;
     46 
     47     /** Indicates that the middleware has died and the requested operation was not completed.*/
     48     public static final int ERROR_MIDDLEWARE_LOST = 3;
     49 
     50     /**
     51      * Indicates errors that may be generated during initialization by the
     52      * middleware. They are applicable to both streaming and file-download use-cases.
     53      */
     54     public static class InitializationErrors {
     55         private InitializationErrors() {}
     56         /**
     57          * Indicates that the app tried to create more than one instance each of
     58          * {@link MbmsStreamingSession} or {@link android.telephony.MbmsDownloadSession}.
     59          */
     60         public static final int ERROR_DUPLICATE_INITIALIZE = 101;
     61         /** Indicates that the app is not authorized to access media via MBMS.*/
     62         public static final int ERROR_APP_PERMISSIONS_NOT_GRANTED = 102;
     63         /** Indicates that the middleware was unable to initialize for this app. */
     64         public static final int ERROR_UNABLE_TO_INITIALIZE = 103;
     65     }
     66 
     67     /**
     68      * Indicates the errors that may occur at any point and are applicable to both
     69      * streaming and file-download.
     70      */
     71     public static class GeneralErrors {
     72         private GeneralErrors() {}
     73         /**
     74          * Indicates that the app attempted to perform an operation before receiving notification
     75          * that the middleware is ready via {@link MbmsStreamingSessionCallback#onMiddlewareReady()}
     76          * or {@link MbmsDownloadSessionCallback#onMiddlewareReady()}.
     77          */
     78         public static final int ERROR_MIDDLEWARE_NOT_YET_READY = 201;
     79         /**
     80          * Indicates that the middleware ran out of memory and was unable to complete the requested
     81          * operation.
     82          */
     83         public static final int ERROR_OUT_OF_MEMORY = 202;
     84         /**
     85          * Indicates that the requested operation failed due to the middleware being unavailable due
     86          * to a transient condition. The app may retry the operation at a later time.
     87          */
     88         public static final int ERROR_MIDDLEWARE_TEMPORARILY_UNAVAILABLE = 203;
     89         /**
     90          * Indicates that the requested operation was not performed due to being in emergency
     91          * callback mode.
     92          */
     93         public static final int ERROR_IN_E911 = 204;
     94         /** Indicates that MBMS is not available due to the device being in roaming. */
     95         public static final int ERROR_NOT_CONNECTED_TO_HOME_CARRIER_LTE = 205;
     96         /** Indicates that MBMS is not available due to a SIM read error. */
     97         public static final int ERROR_UNABLE_TO_READ_SIM = 206;
     98         /**
     99          * Indicates that MBMS is not available due to the inserted SIM being from an unsupported
    100          * carrier.
    101          */
    102         public static final int ERROR_CARRIER_CHANGE_NOT_ALLOWED = 207;
    103     }
    104 
    105     /**
    106      * Indicates the errors that are applicable only to the streaming use-case
    107      */
    108     public static class StreamingErrors {
    109         private StreamingErrors() {}
    110         /** Indicates that the middleware cannot start a stream due to too many ongoing streams */
    111         public static final int ERROR_CONCURRENT_SERVICE_LIMIT_REACHED = 301;
    112 
    113         /** Indicates that the middleware was unable to start the streaming service */
    114         public static final int ERROR_UNABLE_TO_START_SERVICE = 302;
    115 
    116         /**
    117          * Indicates that the app called
    118          * {@link MbmsStreamingSession#startStreaming(StreamingServiceInfo,
    119          * java.util.concurrent.Executor, StreamingServiceCallback)}
    120          * more than once for the same {@link StreamingServiceInfo}.
    121          */
    122         public static final int ERROR_DUPLICATE_START_STREAM = 303;
    123     }
    124 
    125     /**
    126      * Indicates the errors that are applicable only to the file-download use-case
    127      */
    128     public static class DownloadErrors {
    129         private DownloadErrors() { }
    130         /**
    131          * Indicates that the app is not allowed to change the temp file root at this time due to
    132          * outstanding download requests.
    133          */
    134         public static final int ERROR_CANNOT_CHANGE_TEMP_FILE_ROOT = 401;
    135 
    136         /** Indicates that the middleware has no record of the supplied {@link DownloadRequest}. */
    137         public static final int ERROR_UNKNOWN_DOWNLOAD_REQUEST = 402;
    138 
    139         /** Indicates the the middleware has no record of the supplied {@link FileInfo} */
    140         public static final int ERROR_UNKNOWN_FILE_INFO = 403;
    141     }
    142 
    143     private MbmsErrors() {}
    144 }
    145