• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.annotation.IntDef;
20 import android.telephony.MbmsStreamingSession;
21 
22 import java.lang.annotation.Retention;
23 import java.lang.annotation.RetentionPolicy;
24 
25 public class MbmsErrors {
26     /**
27      * Indicates that the middleware has sent an error code that is not defined in the version of
28      * the SDK targeted by your app. This is an illegal value for the middleware to return -- it
29      * should only ever be generated by the framework.
30      */
31     public static final int UNKNOWN = -1;
32 
33     /** Indicates that the operation was successful. */
34     public static final int SUCCESS = 0;
35 
36     // Following errors are generated in the manager and should not be returned from the
37     // middleware
38     /**
39      * Indicates that either no MBMS middleware app is installed on the device or multiple
40      * middleware apps are installed on the device.
41      */
42     public static final int ERROR_NO_UNIQUE_MIDDLEWARE = 1;
43 
44     /**
45      * Indicates that the app attempted to perform an operation on an instance of
46      * {@link android.telephony.MbmsDownloadSession} or
47      * {@link MbmsStreamingSession} without being bound to the middleware.
48      */
49     public static final int ERROR_MIDDLEWARE_NOT_BOUND = 2;
50 
51     /** Indicates that the middleware has died and the requested operation was not completed.*/
52     public static final int ERROR_MIDDLEWARE_LOST = 3;
53 
54     /**
55      * Indicates errors that may be generated during initialization by the
56      * middleware. They are applicable to both streaming and file-download use-cases.
57      */
58     public static class InitializationErrors {
InitializationErrors()59         private InitializationErrors() {}
60         /**
61          * Indicates that the app tried to create more than one instance each of
62          * {@link MbmsStreamingSession} or {@link android.telephony.MbmsDownloadSession}.
63          */
64         public static final int ERROR_DUPLICATE_INITIALIZE = 101;
65         /** Indicates that the app is not authorized to access media via MBMS.*/
66         public static final int ERROR_APP_PERMISSIONS_NOT_GRANTED = 102;
67         /** Indicates that the middleware was unable to initialize for this app. */
68         public static final int ERROR_UNABLE_TO_INITIALIZE = 103;
69     }
70 
71     /**
72      * Indicates the errors that may occur at any point and are applicable to both
73      * streaming and file-download.
74      */
75     public static class GeneralErrors {
GeneralErrors()76         private GeneralErrors() {}
77         /**
78          * Indicates that the app attempted to perform an operation before receiving notification
79          * that the middleware is ready via {@link MbmsStreamingSessionCallback#onMiddlewareReady()}
80          * or {@link MbmsDownloadSessionCallback#onMiddlewareReady()}.
81          */
82         public static final int ERROR_MIDDLEWARE_NOT_YET_READY = 201;
83         /**
84          * Indicates that the middleware ran out of memory and was unable to complete the requested
85          * operation.
86          */
87         public static final int ERROR_OUT_OF_MEMORY = 202;
88         /**
89          * Indicates that the requested operation failed due to the middleware being unavailable due
90          * to a transient condition. The app may retry the operation at a later time.
91          */
92         public static final int ERROR_MIDDLEWARE_TEMPORARILY_UNAVAILABLE = 203;
93         /**
94          * Indicates that the requested operation was not performed due to being in emergency
95          * callback mode.
96          */
97         public static final int ERROR_IN_E911 = 204;
98         /** Indicates that MBMS is not available due to the device being in roaming. */
99         public static final int ERROR_NOT_CONNECTED_TO_HOME_CARRIER_LTE = 205;
100         /** Indicates that MBMS is not available due to a SIM read error. */
101         public static final int ERROR_UNABLE_TO_READ_SIM = 206;
102         /**
103          * Indicates that MBMS is not available due to the inserted SIM being from an unsupported
104          * carrier.
105          */
106         public static final int ERROR_CARRIER_CHANGE_NOT_ALLOWED = 207;
107     }
108 
109     /**
110      * Indicates the errors that are applicable only to the streaming use-case
111      */
112     public static class StreamingErrors {
StreamingErrors()113         private StreamingErrors() {}
114         /** Indicates that the middleware cannot start a stream due to too many ongoing streams */
115         public static final int ERROR_CONCURRENT_SERVICE_LIMIT_REACHED = 301;
116 
117         /** Indicates that the middleware was unable to start the streaming service */
118         public static final int ERROR_UNABLE_TO_START_SERVICE = 302;
119 
120         /**
121          * Indicates that the app called
122          * {@link MbmsStreamingSession#startStreaming(StreamingServiceInfo,
123          * java.util.concurrent.Executor, StreamingServiceCallback)}
124          * more than once for the same {@link StreamingServiceInfo}.
125          */
126         public static final int ERROR_DUPLICATE_START_STREAM = 303;
127     }
128 
129     /**
130      * Indicates the errors that are applicable only to the file-download use-case
131      */
132     public static class DownloadErrors {
DownloadErrors()133         private DownloadErrors() { }
134         /**
135          * Indicates that the app is not allowed to change the temp file root at this time due to
136          * outstanding download requests.
137          */
138         public static final int ERROR_CANNOT_CHANGE_TEMP_FILE_ROOT = 401;
139 
140         /** Indicates that the middleware has no record of the supplied {@link DownloadRequest}. */
141         public static final int ERROR_UNKNOWN_DOWNLOAD_REQUEST = 402;
142 
143         /** Indicates the the middleware has no record of the supplied {@link FileInfo} */
144         public static final int ERROR_UNKNOWN_FILE_INFO = 403;
145 
146         /**
147          * Indicates that the service announcement descriptor passed via
148          * {@link android.telephony.MbmsDownloadSession#addServiceAnnouncement(byte[])}
149          * is malformed.
150          */
151         public static final int ERROR_MALFORMED_SERVICE_ANNOUNCEMENT = 404;
152     }
153 
154     /**
155      * Indicates the errors that are applicable only to the group call use-case.
156      */
157     public static class GroupCallErrors {
GroupCallErrors()158         private GroupCallErrors() { }
159         /** Indicates that the middleware was unable to start the group call. */
160         public static final int ERROR_UNABLE_TO_START_SERVICE = 501;
161 
162         /**
163          * Indicates that the app called
164          * {@link android.telephony.MbmsGroupCallSession#startGroupCall} more than once for the
165          * same {@code tmgi}.
166          */
167         public static final int ERROR_DUPLICATE_START_GROUP_CALL = 502;
168     }
169 
170     /** @hide */
171     @IntDef(value = {
172             SUCCESS,
173             ERROR_NO_UNIQUE_MIDDLEWARE,
174             ERROR_MIDDLEWARE_NOT_BOUND,
175             ERROR_MIDDLEWARE_LOST,
176             InitializationErrors.ERROR_DUPLICATE_INITIALIZE,
177             InitializationErrors.ERROR_APP_PERMISSIONS_NOT_GRANTED,
178             InitializationErrors.ERROR_UNABLE_TO_INITIALIZE,
179             GeneralErrors.ERROR_MIDDLEWARE_NOT_YET_READY,
180             GeneralErrors.ERROR_OUT_OF_MEMORY,
181             GeneralErrors.ERROR_MIDDLEWARE_TEMPORARILY_UNAVAILABLE,
182             GeneralErrors.ERROR_IN_E911,
183             GeneralErrors.ERROR_NOT_CONNECTED_TO_HOME_CARRIER_LTE,
184             GeneralErrors.ERROR_UNABLE_TO_READ_SIM,
185             GeneralErrors.ERROR_CARRIER_CHANGE_NOT_ALLOWED,
186             StreamingErrors.ERROR_CONCURRENT_SERVICE_LIMIT_REACHED,
187             StreamingErrors.ERROR_UNABLE_TO_START_SERVICE,
188             StreamingErrors.ERROR_DUPLICATE_START_STREAM,
189             DownloadErrors.ERROR_CANNOT_CHANGE_TEMP_FILE_ROOT,
190             DownloadErrors.ERROR_UNKNOWN_DOWNLOAD_REQUEST,
191             DownloadErrors.ERROR_UNKNOWN_FILE_INFO,
192             DownloadErrors.ERROR_MALFORMED_SERVICE_ANNOUNCEMENT,
193             GroupCallErrors.ERROR_UNABLE_TO_START_SERVICE,
194             GroupCallErrors.ERROR_DUPLICATE_START_GROUP_CALL,
195     })
196     @Retention(RetentionPolicy.SOURCE)
197     public @interface MbmsError {
198     }
199 
MbmsErrors()200     private MbmsErrors() {}
201 }
202