1 /*
2  * Copyright (C) 2018 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.annotation.IntRange;
21 import android.annotation.Nullable;
22 
23 import java.lang.annotation.Retention;
24 import java.lang.annotation.RetentionPolicy;
25 
26 /**
27  * A callback class for use when the application is in a group call. The middleware
28  * will provide updates on the status of the call via this callback.
29  */
30 public interface GroupCallCallback {
31     /** @hide */
32     @Retention(RetentionPolicy.SOURCE)
33     @IntDef(value = {
34             MbmsErrors.ERROR_NO_UNIQUE_MIDDLEWARE,
35             MbmsErrors.ERROR_MIDDLEWARE_LOST,
36             MbmsErrors.ERROR_MIDDLEWARE_NOT_BOUND,
37             MbmsErrors.GeneralErrors.ERROR_MIDDLEWARE_NOT_YET_READY,
38             MbmsErrors.GeneralErrors.ERROR_OUT_OF_MEMORY,
39             MbmsErrors.GeneralErrors.ERROR_MIDDLEWARE_TEMPORARILY_UNAVAILABLE,
40             MbmsErrors.GeneralErrors.ERROR_IN_E911,
41             MbmsErrors.GeneralErrors.ERROR_NOT_CONNECTED_TO_HOME_CARRIER_LTE,
42             MbmsErrors.GeneralErrors.ERROR_UNABLE_TO_READ_SIM,
43             MbmsErrors.GeneralErrors.ERROR_CARRIER_CHANGE_NOT_ALLOWED}, prefix = { "ERROR_" })
44     @interface GroupCallError{}
45 
46     /**
47      * Indicates broadcast signal strength is not available for this call.
48      *
49      * This may be due to the call no longer being available due to geography
50      * or timing (end of service)
51      */
52     int SIGNAL_STRENGTH_UNAVAILABLE = -1;
53 
54     /**
55      * Called by the middleware when it has detected an error condition in this group call. The
56      * possible error codes are listed in {@link MbmsErrors}.
57      * @param errorCode The error code.
58      * @param message A human-readable message generated by the middleware for debugging purposes.
59      */
onError(@roupCallError int errorCode, @Nullable String message)60     default void onError(@GroupCallError int errorCode, @Nullable String message) {}
61 
62     /**
63      * Called to indicate this call has changed state.
64      *
65      * See {@link GroupCall#STATE_STOPPED}, {@link GroupCall#STATE_STARTED}
66      * and {@link GroupCall#STATE_STALLED}.
67      */
onGroupCallStateChanged(@roupCall.GroupCallState int state, @GroupCall.GroupCallStateChangeReason int reason)68     default void onGroupCallStateChanged(@GroupCall.GroupCallState int state,
69             @GroupCall.GroupCallStateChangeReason int reason) {}
70 
71     /**
72      * Broadcast Signal Strength updated.
73      *
74      * This signal strength is the BROADCAST signal strength which,
75      * depending on technology in play and it's deployment, may be
76      * stronger or weaker than the traditional UNICAST signal
77      * strength.  It a simple int from 0-4 for valid levels or
78      * {@link #SIGNAL_STRENGTH_UNAVAILABLE} if broadcast is not available
79      * for this call due to timing, geography or popularity.
80      */
onBroadcastSignalStrengthUpdated( @ntRangefrom = -1, to = 4) int signalStrength)81     default void onBroadcastSignalStrengthUpdated(
82             @IntRange(from = -1, to = 4) int signalStrength) {}
83 }
84