Home | History | Annotate | Download | only in phone
      1 /*
      2  * Copyright (C) 2011 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 com.android.phone;
     18 
     19 /**
     20  * App-wide constants and enums for the phone app.
     21  *
     22  * Any constants that need to be shared between two or more classes within
     23  * the com.android.phone package should be defined here.  (Constants that
     24  * are private to only one class can go in that class's .java file.)
     25  */
     26 public class Constants {
     27 
     28     /**
     29      * Complete list of error / diagnostic indications we might possibly
     30      * need to present to the user.
     31      *
     32      * This enum is basically a high-level list of the kinds of failures
     33      * or "exceptional conditions" that can occur when making a phone
     34      * call.  When an error occurs, the CallController stashes away one of
     35      * these codes in the InCallUiState.pendingCallStatusCode flag and
     36      * launches the InCallScreen; the InCallScreen will then display some
     37      * kind of message to the user (usually an error dialog) explaining
     38      * what happened.
     39      *
     40      * The enum values here cover all possible result status / error
     41      * conditions that can happen when attempting to place an outgoing
     42      * call (see CallController.placeCall() and placeCallInternal()), as
     43      * well as some other conditions (like CDMA_CALL_LOST and EXITED_ECM)
     44      * that don't technically result from the placeCall() sequence but
     45      * still need to be communicated to the user.
     46      */
     47     public enum CallStatusCode {
     48         /**
     49          * No error or exceptional condition occurred.
     50          * The InCallScreen does not need to display any kind of alert to the user.
     51          */
     52         SUCCESS,
     53 
     54         /**
     55          * Radio is explictly powered off, presumably because the
     56          * device is in airplane mode.
     57          */
     58         POWER_OFF,
     59 
     60         /**
     61          * Only emergency numbers are allowed, but we tried to dial
     62          * a non-emergency number.
     63          */
     64         EMERGENCY_ONLY,
     65 
     66         /**
     67          * No network connection.
     68          */
     69         OUT_OF_SERVICE,
     70 
     71         /**
     72          * The supplied CALL Intent didn't contain a valid phone number.
     73          */
     74         NO_PHONE_NUMBER_SUPPLIED,
     75 
     76         /**
     77          * Our initial phone number was actually an MMI sequence.
     78          */
     79         DIALED_MMI,
     80 
     81         /**
     82          * We couldn't successfully place the call due to an
     83          * unknown failure in the telephony layer.
     84          */
     85         CALL_FAILED,
     86 
     87         /**
     88          * We tried to call a voicemail: URI but the device has no
     89          * voicemail number configured.
     90          *
     91          * When InCallUiState.pendingCallStatusCode is set to this
     92          * value, the InCallScreen will bring up a UI explaining what
     93          * happened, and allowing the user to go into Settings to fix the
     94          * problem.
     95          */
     96         VOICEMAIL_NUMBER_MISSING,
     97 
     98         /**
     99          * This status indicates that InCallScreen should display the
    100          * CDMA-specific "call lost" dialog.  (If an outgoing call fails,
    101          * and the CDMA "auto-retry" feature is enabled, *and* the retried
    102          * call fails too, we display this specific dialog.)
    103          *
    104          * TODO: this is currently unused, since the "call lost" dialog
    105          * needs to be triggered by a *disconnect* event, rather than when
    106          * the InCallScreen first comes to the foreground.  For now we use
    107          * the needToShowCallLostDialog field for this (see below.)
    108          */
    109         CDMA_CALL_LOST,
    110 
    111         /**
    112          * This status indicates that the call was placed successfully,
    113          * but additionally, the InCallScreen needs to display the
    114          * "Exiting ECM" dialog.
    115          *
    116          * (Details: "Emergency callback mode" is a CDMA-specific concept
    117          * where the phone disallows data connections over the cell
    118          * network for some period of time after you make an emergency
    119          * call.  If the phone is in ECM and you dial a non-emergency
    120          * number, that automatically *cancels* ECM, but we additionally
    121          * need to warn the user that ECM has been canceled (see bug
    122          * 4207607.))
    123          */
    124         EXITED_ECM
    125     }
    126 
    127     //
    128     // TODO: Move all the various EXTRA_* and intent action constants here too.
    129     // (Currently they're all over the place: InCallScreen,
    130     // OutgoingCallBroadcaster, OtaUtils, etc.)
    131     //
    132 
    133 }
    134