Home | History | Annotate | Download | only in telephony
      1 /*
      2  * Copyright (C) 2014 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;
     18 
     19 /**
     20  * Contains disconnect call causes generated by the framework and the RIL.
     21  * @hide
     22  */
     23 public class DisconnectCause {
     24 
     25     /** The disconnect cause is not valid (Not received a disconnect cause) */
     26     public static final int NOT_VALID                      = -1;
     27     /** Has not yet disconnected */
     28     public static final int NOT_DISCONNECTED               = 0;
     29     /** An incoming call that was missed and never answered */
     30     public static final int INCOMING_MISSED                = 1;
     31     /** Normal; Remote hangup*/
     32     public static final int NORMAL                         = 2;
     33     /** Normal; Local hangup */
     34     public static final int LOCAL                          = 3;
     35     /** Outgoing call to busy line */
     36     public static final int BUSY                           = 4;
     37     /** Outgoing call to congested network */
     38     public static final int CONGESTION                     = 5;
     39     /** Not presently used */
     40     public static final int MMI                            = 6;
     41     /** Invalid dial string */
     42     public static final int INVALID_NUMBER                 = 7;
     43     /** Cannot reach the peer */
     44     public static final int NUMBER_UNREACHABLE             = 8;
     45     /** Cannot reach the server */
     46     public static final int SERVER_UNREACHABLE             = 9;
     47     /** Invalid credentials */
     48     public static final int INVALID_CREDENTIALS            = 10;
     49     /** Calling from out of network is not allowed */
     50     public static final int OUT_OF_NETWORK                 = 11;
     51     /** Server error */
     52     public static final int SERVER_ERROR                   = 12;
     53     /** Client timed out */
     54     public static final int TIMED_OUT                      = 13;
     55     /** Client went out of network range */
     56     public static final int LOST_SIGNAL                    = 14;
     57     /** GSM or CDMA ACM limit exceeded */
     58     public static final int LIMIT_EXCEEDED                 = 15;
     59     /** An incoming call that was rejected */
     60     public static final int INCOMING_REJECTED              = 16;
     61     /** Radio is turned off explicitly */
     62     public static final int POWER_OFF                      = 17;
     63     /** Out of service */
     64     public static final int OUT_OF_SERVICE                 = 18;
     65     /** No ICC, ICC locked, or other ICC error */
     66     public static final int ICC_ERROR                      = 19;
     67     /** Call was blocked by call barring */
     68     public static final int CALL_BARRED                    = 20;
     69     /** Call was blocked by fixed dial number */
     70     public static final int FDN_BLOCKED                    = 21;
     71     /** Call was blocked by restricted all voice access */
     72     public static final int CS_RESTRICTED                  = 22;
     73     /** Call was blocked by restricted normal voice access */
     74     public static final int CS_RESTRICTED_NORMAL           = 23;
     75     /** Call was blocked by restricted emergency voice access */
     76     public static final int CS_RESTRICTED_EMERGENCY        = 24;
     77     /** Unassigned number */
     78     public static final int UNOBTAINABLE_NUMBER            = 25;
     79     /** MS is locked until next power cycle */
     80     public static final int CDMA_LOCKED_UNTIL_POWER_CYCLE  = 26;
     81     /** Drop call*/
     82     public static final int CDMA_DROP                      = 27;
     83     /** INTERCEPT order received, MS state idle entered */
     84     public static final int CDMA_INTERCEPT                 = 28;
     85     /** MS has been redirected, call is cancelled */
     86     public static final int CDMA_REORDER                   = 29;
     87     /** Service option rejection */
     88     public static final int CDMA_SO_REJECT                 = 30;
     89     /** Requested service is rejected, retry delay is set */
     90     public static final int CDMA_RETRY_ORDER               = 31;
     91     /** Unable to obtain access to the CDMA system */
     92     public static final int CDMA_ACCESS_FAILURE            = 32;
     93     /** Not a preempted call */
     94     public static final int CDMA_PREEMPTED                 = 33;
     95     /** Not an emergency call */
     96     public static final int CDMA_NOT_EMERGENCY             = 34;
     97     /** Access Blocked by CDMA network */
     98     public static final int CDMA_ACCESS_BLOCKED            = 35;
     99     /** Unknown error or not specified */
    100     public static final int ERROR_UNSPECIFIED              = 36;
    101     /**
    102      * Only emergency numbers are allowed, but we tried to dial
    103      * a non-emergency number.
    104      */
    105     // TODO: This should be the same as NOT_EMERGENCY
    106     public static final int EMERGENCY_ONLY                 = 37;
    107     /**
    108      * The supplied CALL Intent didn't contain a valid phone number.
    109      */
    110     public static final int NO_PHONE_NUMBER_SUPPLIED       = 38;
    111     /**
    112      * Our initial phone number was actually an MMI sequence.
    113      */
    114     public static final int DIALED_MMI                     = 39;
    115     /**
    116      * We tried to call a voicemail: URI but the device has no
    117      * voicemail number configured.
    118      */
    119     public static final int VOICEMAIL_NUMBER_MISSING       = 40;
    120     /**
    121      * This status indicates that InCallScreen should display the
    122      * CDMA-specific "call lost" dialog.  (If an outgoing call fails,
    123      * and the CDMA "auto-retry" feature is enabled, *and* the retried
    124      * call fails too, we display this specific dialog.)
    125      *
    126      * TODO: this is currently unused, since the "call lost" dialog
    127      * needs to be triggered by a *disconnect* event, rather than when
    128      * the InCallScreen first comes to the foreground.  For now we use
    129      * the needToShowCallLostDialog field for this (see below.)
    130      */
    131     public static final int CDMA_CALL_LOST                 = 41;
    132     /**
    133      * This status indicates that the call was placed successfully,
    134      * but additionally, the InCallScreen needs to display the
    135      * "Exiting ECM" dialog.
    136      *
    137      * (Details: "Emergency callback mode" is a CDMA-specific concept
    138      * where the phone disallows data connections over the cell
    139      * network for some period of time after you make an emergency
    140      * call.  If the phone is in ECM and you dial a non-emergency
    141      * number, that automatically *cancels* ECM, but we additionally
    142      * need to warn the user that ECM has been canceled (see bug
    143      * 4207607.))
    144      *
    145      * TODO: Rethink where the best place to put this is. It is not a notification
    146      * of a failure of the connection -- it is an additional message that accompanies
    147      * a successful connection giving the user important information about what happened.
    148      *
    149      * {@hide}
    150      */
    151     public static final int EXITED_ECM                     = 42;
    152 
    153     /**
    154      * The outgoing call failed with an unknown cause.
    155      */
    156     public static final int OUTGOING_FAILURE               = 43;
    157 
    158     /**
    159      * The outgoing call was canceled by the {@link android.telecom.ConnectionService}.
    160      */
    161     public static final int OUTGOING_CANCELED              = 44;
    162 
    163     /**
    164      * The call, which was an IMS call, disconnected because it merged with another call.
    165      */
    166     public static final int IMS_MERGED_SUCCESSFULLY        = 45;
    167 
    168     /**
    169      * Stk Call Control modified DIAL request to USSD request.
    170      * {@hide}
    171      */
    172     public static final int DIAL_MODIFIED_TO_USSD          = 46;
    173     /**
    174      * Stk Call Control modified DIAL request to SS request.
    175      * {@hide}
    176      */
    177     public static final int DIAL_MODIFIED_TO_SS            = 47;
    178     /**
    179      * Stk Call Control modified DIAL request to DIAL with modified data.
    180      * {@hide}
    181      */
    182     public static final int DIAL_MODIFIED_TO_DIAL          = 48;
    183 
    184     /**
    185      * The call was terminated because CDMA phone service and roaming have already been activated.
    186      * {@hide}
    187      */
    188     public static final int CDMA_ALREADY_ACTIVATED         = 49;
    189 
    190     /**
    191      * The call was terminated because it is not possible to place a video call while TTY is
    192      * enabled.
    193      * {@hide}
    194      */
    195     public static final int VIDEO_CALL_NOT_ALLOWED_WHILE_TTY_ENABLED = 50;
    196 
    197     /**
    198      * The call was terminated because it was pulled to another device.
    199      * {@hide}
    200      */
    201     public static final int CALL_PULLED = 51;
    202 
    203     /**
    204      * The call was terminated because it was answered on another device.
    205      * {@hide}
    206      */
    207     public static final int ANSWERED_ELSEWHERE = 52;
    208 
    209     /**
    210      * The call was terminated because the maximum allowable number of calls has been reached.
    211      * {@hide}
    212      */
    213     public static final int MAXIMUM_NUMBER_OF_CALLS_REACHED = 53;
    214 
    215     /**
    216      * The call was terminated because cellular data has been disabled.
    217      * Used when in a video call and the user disables cellular data via the settings.
    218      * {@hide}
    219      */
    220     public static final int DATA_DISABLED = 54;
    221 
    222     /**
    223      * The call was terminated because the data policy has disabled cellular data.
    224      * Used when in a video call and the user has exceeded the device data limit.
    225      * {@hide}
    226      */
    227     public static final int DATA_LIMIT_REACHED = 55;
    228 
    229     /**
    230      * The call being placed was detected as a call forwarding number and was being dialed while
    231      * roaming on a carrier that does not allow this.
    232      */
    233     public static final int DIALED_CALL_FORWARDING_WHILE_ROAMING = 57;
    234 
    235     /**
    236      * The network does not accept the emergency call request because IMEI was used as
    237      * identification and this cability is not supported by the network.
    238      * {@hide}
    239      */
    240     public static final int IMEI_NOT_ACCEPTED = 58;
    241 
    242     /**
    243      * A call over WIFI was disconnected because the WIFI signal was lost or became too degraded to
    244      * continue the call.
    245      */
    246     public static final int WIFI_LOST = 59;
    247 
    248     /**
    249      * The call has failed because of access class barring.
    250      * {@hide}
    251      */
    252     public static final int IMS_ACCESS_BLOCKED = 60;
    253 
    254     /**
    255      * The call has ended (mid-call) because the device's battery is too low.
    256      */
    257     public static final int LOW_BATTERY = 61;
    258 
    259     /**
    260      * A call was not dialed because the device's battery is too low.
    261      */
    262     public static final int DIAL_LOW_BATTERY = 62;
    263 
    264     /**
    265      * Emergency call failed with a temporary fail cause and can be redialed on this slot.
    266      * {@hide}
    267      */
    268     public static final int EMERGENCY_TEMP_FAILURE = 63;
    269 
    270     /**
    271      * Emergency call failed with a permanent fail cause and should not be redialed on this
    272      * slot.
    273      * {@hide}
    274      */
    275     public static final int EMERGENCY_PERM_FAILURE = 64;
    276 
    277     /**
    278      * This cause is used to report a normal event only when no other cause in the normal class
    279      * applies.
    280      * {@hide}
    281      */
    282     public static final int NORMAL_UNSPECIFIED = 65;
    283 
    284     /**
    285      * Stk Call Control modified DIAL request to video DIAL request.
    286      * {@hide}
    287      */
    288     public static final int DIAL_MODIFIED_TO_DIAL_VIDEO = 66;
    289 
    290     /**
    291      * Stk Call Control modified Video DIAL request to SS request.
    292      * {@hide}
    293      */
    294     public static final int DIAL_VIDEO_MODIFIED_TO_SS = 67;
    295 
    296     /**
    297      * Stk Call Control modified Video DIAL request to USSD request.
    298      * {@hide}
    299      */
    300     public static final int DIAL_VIDEO_MODIFIED_TO_USSD = 68;
    301 
    302     /**
    303      * Stk Call Control modified Video DIAL request to DIAL request.
    304      * {@hide}
    305      */
    306     public static final int DIAL_VIDEO_MODIFIED_TO_DIAL = 69;
    307 
    308     /**
    309      * Stk Call Control modified Video DIAL request to Video DIAL request.
    310      * {@hide}
    311      */
    312     public static final int DIAL_VIDEO_MODIFIED_TO_DIAL_VIDEO = 70;
    313 
    314     /**
    315      * The network has reported that an alternative emergency number has been dialed, but the user
    316      * must exit airplane mode to place the call.
    317      */
    318     public static final int IMS_SIP_ALTERNATE_EMERGENCY_CALL = 71;
    319 
    320     //*********************************************************************************************
    321     // When adding a disconnect type:
    322     // 1) Update toString() with the newly added disconnect type.
    323     // 2) Update android.telecom.DisconnectCauseUtil with any mappings to a telecom.DisconnectCause.
    324     //*********************************************************************************************
    325 
    326     /** Private constructor to avoid class instantiation. */
    327     private DisconnectCause() {
    328         // Do nothing.
    329     }
    330 
    331     /** Returns descriptive string for the specified disconnect cause. */
    332     public static String toString(int cause) {
    333         switch (cause) {
    334         case NOT_DISCONNECTED:
    335             return "NOT_DISCONNECTED";
    336         case INCOMING_MISSED:
    337             return "INCOMING_MISSED";
    338         case NORMAL:
    339             return "NORMAL";
    340         case LOCAL:
    341             return "LOCAL";
    342         case BUSY:
    343             return "BUSY";
    344         case CONGESTION:
    345             return "CONGESTION";
    346         case INVALID_NUMBER:
    347             return "INVALID_NUMBER";
    348         case NUMBER_UNREACHABLE:
    349             return "NUMBER_UNREACHABLE";
    350         case SERVER_UNREACHABLE:
    351             return "SERVER_UNREACHABLE";
    352         case INVALID_CREDENTIALS:
    353             return "INVALID_CREDENTIALS";
    354         case OUT_OF_NETWORK:
    355             return "OUT_OF_NETWORK";
    356         case SERVER_ERROR:
    357             return "SERVER_ERROR";
    358         case TIMED_OUT:
    359             return "TIMED_OUT";
    360         case LOST_SIGNAL:
    361             return "LOST_SIGNAL";
    362         case LIMIT_EXCEEDED:
    363             return "LIMIT_EXCEEDED";
    364         case INCOMING_REJECTED:
    365             return "INCOMING_REJECTED";
    366         case POWER_OFF:
    367             return "POWER_OFF";
    368         case OUT_OF_SERVICE:
    369             return "OUT_OF_SERVICE";
    370         case ICC_ERROR:
    371             return "ICC_ERROR";
    372         case CALL_BARRED:
    373             return "CALL_BARRED";
    374         case FDN_BLOCKED:
    375             return "FDN_BLOCKED";
    376         case CS_RESTRICTED:
    377             return "CS_RESTRICTED";
    378         case CS_RESTRICTED_NORMAL:
    379             return "CS_RESTRICTED_NORMAL";
    380         case CS_RESTRICTED_EMERGENCY:
    381             return "CS_RESTRICTED_EMERGENCY";
    382         case UNOBTAINABLE_NUMBER:
    383             return "UNOBTAINABLE_NUMBER";
    384         case CDMA_LOCKED_UNTIL_POWER_CYCLE:
    385             return "CDMA_LOCKED_UNTIL_POWER_CYCLE";
    386         case CDMA_DROP:
    387             return "CDMA_DROP";
    388         case CDMA_INTERCEPT:
    389             return "CDMA_INTERCEPT";
    390         case CDMA_REORDER:
    391             return "CDMA_REORDER";
    392         case CDMA_SO_REJECT:
    393             return "CDMA_SO_REJECT";
    394         case CDMA_RETRY_ORDER:
    395             return "CDMA_RETRY_ORDER";
    396         case CDMA_ACCESS_FAILURE:
    397             return "CDMA_ACCESS_FAILURE";
    398         case CDMA_PREEMPTED:
    399             return "CDMA_PREEMPTED";
    400         case CDMA_NOT_EMERGENCY:
    401             return "CDMA_NOT_EMERGENCY";
    402         case CDMA_ACCESS_BLOCKED:
    403             return "CDMA_ACCESS_BLOCKED";
    404         case EMERGENCY_ONLY:
    405             return "EMERGENCY_ONLY";
    406         case NO_PHONE_NUMBER_SUPPLIED:
    407             return "NO_PHONE_NUMBER_SUPPLIED";
    408         case DIALED_MMI:
    409             return "DIALED_MMI";
    410         case VOICEMAIL_NUMBER_MISSING:
    411             return "VOICEMAIL_NUMBER_MISSING";
    412         case CDMA_CALL_LOST:
    413             return "CDMA_CALL_LOST";
    414         case EXITED_ECM:
    415             return "EXITED_ECM";
    416         case DIAL_MODIFIED_TO_USSD:
    417             return "DIAL_MODIFIED_TO_USSD";
    418         case DIAL_MODIFIED_TO_SS:
    419             return "DIAL_MODIFIED_TO_SS";
    420         case DIAL_MODIFIED_TO_DIAL:
    421             return "DIAL_MODIFIED_TO_DIAL";
    422         case DIAL_MODIFIED_TO_DIAL_VIDEO:
    423             return "DIAL_MODIFIED_TO_DIAL_VIDEO";
    424         case DIAL_VIDEO_MODIFIED_TO_SS:
    425             return "DIAL_VIDEO_MODIFIED_TO_SS";
    426         case DIAL_VIDEO_MODIFIED_TO_USSD:
    427             return "DIAL_VIDEO_MODIFIED_TO_USSD";
    428         case DIAL_VIDEO_MODIFIED_TO_DIAL:
    429             return "DIAL_VIDEO_MODIFIED_TO_DIAL";
    430         case DIAL_VIDEO_MODIFIED_TO_DIAL_VIDEO:
    431             return "DIAL_VIDEO_MODIFIED_TO_DIAL_VIDEO";
    432         case ERROR_UNSPECIFIED:
    433             return "ERROR_UNSPECIFIED";
    434         case OUTGOING_FAILURE:
    435             return "OUTGOING_FAILURE";
    436         case OUTGOING_CANCELED:
    437             return "OUTGOING_CANCELED";
    438         case IMS_MERGED_SUCCESSFULLY:
    439             return "IMS_MERGED_SUCCESSFULLY";
    440         case CDMA_ALREADY_ACTIVATED:
    441             return "CDMA_ALREADY_ACTIVATED";
    442         case VIDEO_CALL_NOT_ALLOWED_WHILE_TTY_ENABLED:
    443             return "VIDEO_CALL_NOT_ALLOWED_WHILE_TTY_ENABLED";
    444         case CALL_PULLED:
    445             return "CALL_PULLED";
    446         case ANSWERED_ELSEWHERE:
    447             return "ANSWERED_ELSEWHERE";
    448         case MAXIMUM_NUMBER_OF_CALLS_REACHED:
    449             return "MAXIMUM_NUMER_OF_CALLS_REACHED";
    450         case DATA_DISABLED:
    451             return "DATA_DISABLED";
    452         case DATA_LIMIT_REACHED:
    453             return "DATA_LIMIT_REACHED";
    454         case DIALED_CALL_FORWARDING_WHILE_ROAMING:
    455             return "DIALED_CALL_FORWARDING_WHILE_ROAMING";
    456         case IMEI_NOT_ACCEPTED:
    457             return "IMEI_NOT_ACCEPTED";
    458         case WIFI_LOST:
    459             return "WIFI_LOST";
    460         case IMS_ACCESS_BLOCKED:
    461             return "IMS_ACCESS_BLOCKED";
    462         case LOW_BATTERY:
    463             return "LOW_BATTERY";
    464         case DIAL_LOW_BATTERY:
    465             return "DIAL_LOW_BATTERY";
    466         case EMERGENCY_TEMP_FAILURE:
    467             return "EMERGENCY_TEMP_FAILURE";
    468         case EMERGENCY_PERM_FAILURE:
    469             return "EMERGENCY_PERM_FAILURE";
    470         case NORMAL_UNSPECIFIED:
    471             return "NORMAL_UNSPECIFIED";
    472         case IMS_SIP_ALTERNATE_EMERGENCY_CALL:
    473             return "IMS_SIP_ALTERNATE_EMERGENCY_CALL";
    474         default:
    475             return "INVALID: " + cause;
    476         }
    477     }
    478 }
    479