Lines Matching full:phone
17 package com.android.phone;
56 import com.android.internal.telephony.Phone;
69 * Misc utilities for the Phone app.
86 // State of the Phone's audio modes
89 static final int AUDIO_IDLE = 0; /** audio behaviour at phone idle */
103 /** Phone state changed event*/
134 // (a racing condition based on which phone changes firstly)
182 if (cm.getState() != Phone.State.IDLE) {
207 * Register the ConnectionHandler with the phone, to receive connection events
246 Phone phone = ringing.getPhone();
247 boolean phoneIsCdma = (phone.getPhoneType() == Phone.PHONE_TYPE_CDMA);
265 // Set the Phone Call State to SINGLE_ACTIVE
270 // Set the Phone Call State to CONF_CALL
280 // a call waiting is answered from the Phone.
297 // Check is phone in any dock, and turn on speaker accordingly
298 activateSpeakerIfDocked(phone);
317 * based on the current Phone state, as follows:
353 if (phoneType == Phone.PHONE_TYPE_CDMA) {
373 } else if ((phoneType == Phone.PHONE_TYPE_GSM)
374 || (phoneType == Phone.PHONE_TYPE_SIP)) {
380 throw new IllegalStateException("Unexpected phone type: " + phoneType);
396 * @param phone the Phone object.
399 static boolean hangupRingingAndActive(Phone phone) {
402 Call ringingCall = phone.getRingingCall();
403 Call fgCall = phone.getForegroundCall();
483 // while active call and waiting call are from the same phone
484 // i.e. both from GSM phone
501 * For a CDMA phone, advance the call state upon making a new
509 * @param app The phone instance.
514 // This is the first outgoing call. Set the Phone Call State to ACTIVE
518 // This is the second outgoing call. Set the Phone Call State to 3WAY
525 * Dial the number using the phone passed in.
527 * @param phone the Phone object.
534 static int placeCall(Phone phone, String number, Uri contactRef) {
539 Connection cn = PhoneApp.getInstance().mCM.dial(phone, number);
540 if (DBG) log("===> phone.dial() returned: " + cn);
542 int phoneType = phone.getPhoneType();
546 if (phoneType == Phone.PHONE_TYPE_GSM) {
564 if (phoneType == Phone.PHONE_TYPE_CDMA) {
568 // phone.dial() succeeded: we're now in a normal phone call.
573 String content = phone.getContext().getContentResolver().SCHEME_CONTENT;
592 // Check is phone in any dock, and turn on speaker accordingly
593 activateSpeakerIfDocked(phone);
596 Log.w(LOG_TAG, "Exception from phone.dial()", ex);
616 * @param phone the Phone object.
619 * NOT the phone number to connect to. It is used only to build the
626 static int placeCallVia(Context context, Phone phone,
645 connection = phone.dial(gatewayNumber);
657 boolean phoneIsCdma = (phone.getPhoneType() == Phone.PHONE_TYPE_CDMA);
680 // Fallback, lookup contact using the phone number if the
698 static void sendEmptyFlash(Phone phone) {
699 if (phone.getPhoneType() == Phone.PHONE_TYPE_CDMA) {
700 Call fgCall = phone.getForegroundCall();
704 switchHoldingAndActive(phone.getBackgroundCall());
734 Phone phone = PhoneApp.getInstance().mCM.getFgPhone();
737 Connection c = phone.getForegroundCall().getEarliestConnection();
742 int phoneType = phone.getPhoneType();
751 if (phoneType == Phone.PHONE_TYPE_CDMA) {
753 phone.getForegroundCall().getLatestConnection());
754 } else if ((phoneType == Phone.PHONE_TYPE_GSM)
755 || (phoneType == Phone.PHONE_TYPE_SIP)) {
776 if (phoneType == Phone.PHONE_TYPE_CDMA) {
781 // Set the Phone Call State to conference
920 static void displayMMIComplete(final Phone phone, Context context, final MmiCode mmiCode,
991 // indicate to the Phone app that the progress dialog has
1073 phone.sendUssdResponse(inputText.getText().toString());
1101 phone.sendUssdResponse(inputText.getText().toString());
1131 static boolean cancelMmiCode(Phone phone) {
1132 List<? extends MmiCode> pendingMmis = phone.getPendingMmiCodes();
1140 // in the phone UI, because during the MMI operation, an Alert panel
1174 phone number to be called from an intent. Requires a Context
1175 * to access the contacts database, and a Phone to access the voicemail
1178 * <p>If <code>phone</code> is <code>null</code>, the function will return
1181 * <code>null</code> for person/phone URIs.</p>
1190 * a <code>voicemail:</code> URI, but <code>phone</code> does not
1193 * @return the phone number (or SIP address) that would be called by the intent,
1224 * extract a phone number from the specified Connection, and feed that
1229 * phone number from the Connection.
1260 // querying a new CallerInfo using the connection's phone number.
1298 if (phoneType == Phone.PHONE_TYPE_CDMA) {
1300 } else if ((phoneType == Phone.PHONE_TYPE_GSM)
1301 || (phoneType == Phone.PHONE_TYPE_SIP)) {
1304 throw new IllegalStateException("Unexpected phone type: " + phoneType);
1370 // querying a new CallerInfo using the connection's phone number.
1374 log("###### PhoneUtils.startGetCallerInfo: new query for phone number #####");
1377 log("- phone: " + c.getCall().getPhone());
1381 case Phone.PHONE_TYPE_NONE: log(" ==> PHONE_TYPE_NONE"); break;
1382 case Phone.PHONE_TYPE_GSM: log(" ==> PHONE_TYPE_GSM"); break;
1383 case Phone.PHONE_TYPE_CDMA: log(" ==> PHONE_TYPE_CDMA"); break;
1384 case Phone.PHONE_TYPE_SIP: log(" ==> PHONE_TYPE_SIP"); break;
1385 default: log(" ==> Unknown phone type"); break;
1548 newCi.phoneNumber = ci.phoneNumber; // To get formatted phone number
1569 // the phone number being displayed, if applicable.
1618 if (phoneType == Phone.PHONE_TYPE_CDMA) {
1658 // Sanity-check that this is OK given the current state of the phone.
1668 // Inform the phone app that this mute state was NOT done
1785 * Mute / umute the foreground phone, which has the current foreground call
1790 * Wrapper around Phone.setMute() and setMicrophoneMute().
1814 private static void setMuteInternal(Phone phone, boolean muted) {
1816 Context context = phone.getContext();
1821 (AudioManager) phone.getContext().getSystemService(Context.AUDIO_SERVICE);
1825 phone.setMute(muted);
1831 * Get the mute state of foreground phone, which has the current
1835 Phone phone = PhoneApp.getInstance().mCM.getFgPhone();
1837 Context context = phone.getContext();
1842 (AudioManager) phone.getContext().getSystemService(Context.AUDIO_SERVICE);
1845 return phone.getMute();
1854 * Sets the audio mode per current phone state.
1895 /* package */ static boolean handleHeadsetHook(Phone phone, KeyEvent event) {
1898 // If the phone is totally idle, we ignore HEADSETHOOK events
1900 if (phone.getState() == Phone.State.IDLE) {
1904 // Ok, the phone is in use.
1912 final boolean hasRingingCall = !phone.getRingingCall().isIdle();
1913 final boolean hasActiveCall = !phone.getForegroundCall().isIdle();
1914 final boolean hasHoldingCall = !phone.getBackgroundCall().isIdle();
1921 int phoneType = phone.getPhoneType();
1922 if (phoneType == Phone.PHONE_TYPE_CDMA) {
1923 answerCall(phone.getRingingCall());
1924 } else if ((phoneType == Phone.PHONE_TYPE_GSM)
1925 || (phoneType == Phone.PHONE_TYPE_SIP)) {
1928 answerAndEndActive(PhoneApp.getInstance().mCM, phone.getRingingCall());
1931 answerCall(phone.getRingingCall()); // Automatically holds the current active call,
1935 throw new IllegalStateException("Unexpected phone type: " + phoneType);
1945 Connection c = phone.getForegroundCall().getLatestConnection();
1961 // ringing call, the InCallScreen will imminently get a phone
1976 * Look for ANY connections on the phone that qualify as being
1980 * all the phone's call objects.
1982 /* package */ static boolean hasDisconnectedConnections(Phone phone) {
1983 return hasDisconnectedConnections(phone.getForegroundCall()) ||
1984 hasDisconnectedConnections(phone.getBackgroundCall()) ||
1985 hasDisconnectedConnections(phone.getRingingCall());
2012 * state of the Phone.
2016 if (phoneType == Phone.PHONE_TYPE_CDMA) {
2017 // CDMA: "Swap" is enabled only when the phone reaches a *generic*.
2022 } else if ((phoneType == Phone.PHONE_TYPE_GSM)
2023 || (phoneType == Phone.PHONE_TYPE_SIP)) {
2033 throw new IllegalStateException("Unexpected phone type: " + phoneType);
2039 * state of the Phone.
2043 if (phoneType == Phone.PHONE_TYPE_CDMA) {
2062 * state of the Phone.
2065 Phone phone = cm.getActiveFgCall().getPhone();
2067 int phoneType = phone.getPhoneType();
2069 if (phoneType == Phone.PHONE_TYPE_CDMA) {
2076 } else if ((phoneType == Phone.PHONE_TYPE_GSM)
2077 || (phoneType == Phone.PHONE_TYPE_SIP)) {
2094 throw new IllegalStateException("Unexpected phone type: " + phoneType);
2122 * Handles certain "corner cases" for CNAP. When we receive weird phone numbers
2127 * @return the new String that should be used for the phone number
2140 // phone number, so if this happens, change it to "Unknown" in the CallerInfo
2174 // Support for 3rd party phone service providers.
2263 * @param uri A 'tel:' URI with the gateway phone number.
2279 * Check if a phone number can be route through a 3rd party
2280 * gateway. The number must be a global phone number in numerical
2302 * This function is called when phone answers or places a call.
2303 * Check if the phone is in a car dock or desk dock.
2307 private static void activateSpeakerIfDocked(Phone phone) {
2317 turnOnSpeaker(phone.getContext(), true, true);
2324 * Returns whether the phone is in ECM ("Emergency Callback Mode") or not.
2326 /* package */ static boolean isPhoneInEcm(Phone phone) {
2327 if ((phone != null) && TelephonyCapabilities.supportsEcm(phone)) {
2343 * Returns the most appropriate Phone object to handle a call
2348 * @param number the phone number, or SIP address.
2350 public static Phone pickPhoneBasedOnNumber(CallManager cm,
2356 Phone phone = getSipPhoneFromUri(cm, primarySipUri);
2357 if (phone != null) return phone;
2362 public static Phone getSipPhoneFromUri(CallManager cm, String target) {
2363 for (Phone phone : cm.getAllPhones()) {
2364 if (phone.getPhoneType() == Phone.PHONE_TYPE_SIP) {
2365 String sipUri = ((SipPhone) phone).getSipUri();
2368 "found SipPhone! obj = " + phone + ", "
2369 + phone.getClass());
2370 return phone;
2383 // General phone and call state debugging/testing code
2419 Phone phone = cm.getDefaultPhone();
2421 if (phone.getPhoneType() == Phone.PHONE_TYPE_CDMA) {
2437 /* package */ static void dumpCallState(Phone phone) {
2440 Log.d(LOG_TAG, "- Phone: " + phone + ", name = " + phone.getPhoneName()
2441 + ", state = " + phone.getState());
2445 Call call = phone.getForegroundCall();
2455 call = phone.getBackgroundCall();
2465 call = phone.getRingingCall();
2476 final boolean hasRingingCall = !phone.getRingingCall().isIdle();
2477 final boolean hasActiveCall = !phone.getForegroundCall().isIdle();
2478 final boolean hasHoldingCall = !phone.getBackgroundCall().isIdle();
2488 if (phone.getPhoneType() == Phone.PHONE_TYPE_CDMA) {
2539 for (Phone phone : CallManager.getInstance().getAllPhones()) {
2540 if (phone != null) {
2541 Log.d(LOG_TAG, "Phone: " + phone + ", name = " + phone.getPhoneName()
2542 + ", state = " + phone.getState());
2544 call = phone.getForegroundCall();
2550 call = phone.getBackgroundCall();
2555 call = phone.getRingingCall();