Telephony: Add missing network modes for Settings

Change-Id: I459d95210fa0301890b34c3a11f66484bddb9e23
Fix to prevent unnecessary mode changes in LTE network modes.

- Add LTE network modes to valid network mode checks.
- Do not treat LTE_ONLY any differently from other network modes when
world_phone is set to true. Treating it differently causes
inconsistencies between what the user sees and what is stored in
persistent storage.

Change-Id: I56e3423bc425f39659ea648fba8c5474254dbe54
packages/apps/Phone: Dismiss previous dialog before updating network list

* After the network list is updated, the previous
"searching" dialog needs to be dismissed
even if the activity is paused.

* Manual network search query and responses are not synchronous.
This leads to multiple responses being processed consecutively.
A dialog is cleared on receiving the first response
and subsequent responses through exception when attempting to dismiss
the same dialog. Ignore the exception thrown by
dialogs as it is not benign.

Change-Id: Icc092b093af04ddfb15b2e5b30ac123577eab05c
Crs-Fixed: 319580, 326736
Remove  stale DELAYED_CLEANUP_AFTER_DISCONNECT

During phone switch due to RAT change,
any pending DELAYED_CLEANUP_AFTER_DISCONNECT
message in InCallScreen should be dropped.
If they are not dropped they will be accessing destroyed
phone objects even after phone switch.

Change-Id: Iec801f4150fbbcd36aaa3e207eb116c9597ba2c2
CRs-Fixed: 370584
packages/apps/Phone:GSM/CDMA UI Options Fix

- Disable manual network selection in Global modes
For multimode targets,disable manual network selection,
force automatic mode network selection for
Global and Global+LTE modes.
Global Pre-FIT Test Cases: 5.6.4, 5.6.5, 5.6.8

- The disabled options under GsmUmtsOptions
get re-enabled in Settings onResume.
Update the GSM/CDMA options again in onResume.

- Always enable APN menu in settings as modems
support eHRPD by default.

Change-Id: I05fa311d473e1d6620baac3a642f715ddfbaee8e
CRs-Fixed: 301939, 302354, 299244, 300172, 305164
Phone: Shows the list of the status PLMNs

Shows all the list of the PLMNs available but does not
highlight the status (unknown,available,current,forbidden)
PLMNs amongst them.

Shows the list of status (unknown,available,current,forbidden)
PLMNs.

Change-Id: If9986634116d3ebea8bf4a12882ac0b7adb8e420
Phone: Ignore touch during network operators search

When network search is in progress, the progress dialog is
dismissed if user taps the screen. This in-turn cancels
manual search and switches to the previous screen.
This behavior can be avoided if the dialog property is set
to ignore user touch events.
If required BACK key can be used to cancel search and move
to previous screen.

Change-Id: I00da1dfec78498d2f35f6bb5d49e42bb3ad43cc2
CRs-Fixed: 367631
Phone: Handle NullPointerException for Call Waiting functionality.

Display the processing dialog as soon as user enters "Additional
Call Settings" screen.This will avoid the user from clicking
on the checkbox, which is resulting in null pointer exception.

Change-Id: Ia5f22faf60ba3c680587f1376d0245ba400f6d46
CRs-Fixed: 303517
Phone: Fix to answer MT call when USSD session is on progress.

On receiving MMI Complete event for USSD cancel operation, InCallScreen
session was being ended. Changes done to move InCallScreen to
foreground after cancelling an USSD session if the call state is
not IDLE.

Change-Id: Id4c44152b64a6ff3334df31d27ccb64b303055a9
CRs-Fixed: 304191
Phone: Fix for emergency call display issue.

The callerInfo is not updated with connection address in case of
emergency and voice mail numbers.

Change-Id: If7187b5667dd469b96b4d30c25a2638e865d628c
packages/apps/Phone: Set initial focus for SimContacts.

Unable to navigate the contacts stored in SIM card thru keypad due to there is no intial focus.
Add mInitialSelection to zero, which is used to set the initial focus.

Change-Id: I97b7f5f085cdb97470a21171f00bde44a3ac73d3
Display IncallScreen when calling using AT command

Change-Id: Ia5cf3a54eebcc75677c8acdd4a21505ef0c86faf
Revert "Allow only NT_MODE_GSM_ONLY or NT_MODE_WCDMA_PREF"

The issue is that this fix is resetting the network mode in the setting
database to NT_MODE_WCDMA_PREF (0) for all non GSM_ONLY modes. So if user
sets the mode to say Global, the network mode is getting set to WCDMA as
soon as the GsmUmtsOptions Activity is getting created. This causes anyone
who uses the Settings.Secure.PREFERRED_NETWORK_MODE directly to see value
of NT_MODE_WCDMA_PREF instead of the actual network mode that is set by
the user.

This reverts commit 5c7d3167b8372b040d6c0a695f7c0822d80b2c21.
CRs-Fixed: 349523

Change-Id: Idc3aa24789e93c0685d553eb66fd13b36437a699
Add property for RIL to know if phone is in Airplane mode

Set the airplane mode property for RIL to read on boot up to know
if the phone is in airplane mode so that RIL can power down the
ICC card.

Change-Id: Ic817e885bb02faa2a4183d9b16878f7851af5bde
CRs-fixed: 325540
Telephony: Add SAFE_WIFI_CHANNELS protected broadcast

Change-Id: Ic741b61d1035ede21d6549427b34c8a04a937de9
Bluetooth: Merged ICS bug fixes to JB.
Squashed commit of the following:

commit 22478f721a1e0c37609bd561a2edd45cac29a310
Author: Kun Han Kim <kunhank@codeaurora.org>
Date:   Tue Aug 9 15:38:02 2011 -0700

    Bluetooth: Added support for HFP 1.6 Wide Band Speech

     - Fixed SCO connection after audioOff() uses NB.
     - HFP increased timeout for codec negotiation

    Cherry-picked from the following commits
     af77ee80ead8ce9757831cdb85a9a864449233e5
     a36a2945f588fe658c4da69aec69cbf9f5bf6fbe
     41366f9f99d81179a84a3e9faf72792399323c4f

    Change-Id: Ibe4f64e6a6868b26a11fd32e153b0a09a0d6aa11
    CRs-fixed: 305186,313355,324330

    Conflicts:

    	src/com/android/phone/BluetoothHandsfree.java

commit a8d8f5c05da5a616f7b5d2ee3f08238ca092cc1e
Author: Kun Han Kim <kunhank@codeaurora.org>
Date:   Wed Nov 16 11:26:38 2011 -0800

    Bluetooth: Support for HFP 1.6 Individual Indicator Activation

    Change-Id: I0bedd91a5fc2684efe0f64dd1c9022395c5ee500
    CRs-fixed: 317613 320377 324330

    Conflicts:

    	src/com/android/phone/BluetoothHandsfree.java

commit 8a182140a780c8b7dbb37106f00d2c3d82f8cd19
Author: Srinivas Krovvidi <skrovvid@codeaurora.org>
Date:   Thu Apr 5 12:33:03 2012 +0530

    Bluetooth : Supported APIs for reading Voice recognition feature.

    The current change provides API through BluetoothHeadsetService
    for reading Remote device VR support. The Voice dialer APP can read this
    value before routing the audio over SCO when voice recognition started.

    Change-Id: I976a988aff486c54c6b2fe2e7d6d101cebe9ee07

commit 0e87b54017d0976d184617fc35937f4b86fa6b97
Author: Ankit Verma <ankitv@codeaurora.org>
Date:   Wed Nov 23 15:06:26 2011 +0530

    Bluetooth: Merge bluetooth changes

    - Handling call volume control for carkits
    - Fixes for SCO/HFP connection
    - Handling AT commands
    - This change is a merge of below commits:

    commit 90b6ffe0973f3b9dc9e6f3c3ae4343505c24ef06
    Author: Srinivas Krovvidi <skrovvid@codeaurora.org>

        Phone: Handling Bluetooth AT+VTS command to send BurstDtmf for CDMA.

    commit 67a1f7495ca2d524131c7d6ebfe322cf81b7fe2a
    Author: Srinivas Krovvidi <skrovvid@codeaurora.org>

        Phone: Handling VGS& VGM AT commands in Bluetooth for HSP.

    commit 768226c3bbb4f260d9d4c867812ddfd3f6026da8
    Author: Srinivas Krovvidi <skrovvid@codeaurora.org>

        Phone: Bluetooth fix for HFP connection retry on different Rfcomm channel.

    commit 2142fc1c5a27ca19feee57ec9fd6c287ec325e82
    Author: Srinivas Krovvidi <skrovvid@codeaurora.org>

        Phone: BT changes to suspend any A2DP device before SCO connection.

    commit e4db9d762b4cd1f019401ac65a47809579562879
    Author: Srinivas Krovvidi <skrovvid@codeaurora.org>

        Phone: Bluetooth changes for consistant incoming SCO connection

    commit 07a67e8884c205f784d6b485fdf7658daa4ffbc5
    Author: Srinivas Krovvidi <skrovvid@codeaurora.org>

        BT: Handling call volume control for VGS unsupported carkits.

    Change-Id: I25c95a41801774348ae1ea1b57d53ef169d3dd4b

    Conflicts:

    	src/com/android/phone/BluetoothHandsfree.java

commit 928623a721ba01933cff3ae595ffbca19f0341f7
Author: Prabhakaran Mc <prabhakaranmc@codeaurora.org>
Date:   Wed Oct 5 14:04:14 2011 +0530

    Bluetooth: fix to HFP connection failure issue

    As phone application queries the SCN before frameworks get updated in
    case of HFP connection scenarios. Due to this, SCN is returned as -1
    is somecases and hence resulting in HFP connection failures.
    1 sec delay has been added to ensure the Phone application's query
    will be made after the proper SCN updations

    CRs-fixed: 309048

    Change-Id: Idd4082cd9b06b2fdb91db437e1a5645a5c0783ee

commit 0f6a44c3dee3810409149250fa9d5768bf5de3e6
Author: Prabhakaran Mc <prabhakaranmc@codeaurora.org>
Date:   Wed Oct 19 12:42:18 2011 +0530

    Bluetooth: HFP and A2dp concurrent connection issue.

    Found issue with encryption enabled during AVDTP connection
    when setup of HFP SLC connection. The current change
    serializes the SLC connection and AVDTP.

    CRs-Fixed: 318415
    Change-Id: Ie23b5ba457494f4865bc11ec96826080b3c0708b

commit cdb33c3790fe15daeb8c77d13d0d978b1383042c
Author: Srinivas Krovvidi <skrovvid@codeaurora.org>
Date:   Thu Dec 1 10:46:56 2011 +0530

    Phone: Bluetooth changes to validate notifyIncomingConnection.

    Existing code doesn't validate the result for pushing incoming
    connection request message to deviceProfileState queue. If
    the request is not added to queue the consequent connections
    will have issues.

    CRs-Fixed: 318772
    Change-Id: I6cba79b97c35f34999d0a9265ca251cada42010a

    Conflicts:

    	src/com/android/phone/BluetoothHeadsetService.java

commit 1a3f5a2d22e5286e554567301f2a025c8ddc72a4
Author: Kun Han Kim <kunhank@codeaurora.org>
Date:   Thu Jan 5 14:05:30 2012 -0800

    Bluetooth: HFP 1.6 Compliance

    - Remove sending dummy battery level change message
      Battery level change message shall not be used when it is disabled
      by Individual Indicator Activator
    - hci_conn_enter_active_mode() is invoked when l2cap data is being
      sent, so no need to send dummy AT command.

    Change-Id: I818061671a2885c2dea9e0a4961f922dcd8ab8bd
    CRs-fixed: 327425

commit f61b243e8a1b667792d401ec8a4d43fd1b14c4f0
Author: Srinivas Krovvidi <skrovvid@codeaurora.org>
Date:   Wed Dec 28 18:12:45 2011 +0530

    Phone/BT: Handling disconnectHeadset API call in DISCONNECTING state.

    When disconnect profile is issued during disconnect operation
    gracefully return success. Returning failure will disturb
    the state machine for BluetoothDeviceProfileState class.

    CRs-Fixed: 326878

    Change-Id: Ibbfde3674439956da80c1836ec165588ea5da9eb

commit 159988d6e98d5c802a018e1dd4d046b91c085264
Author: Srinivas Krovvidi <skrovvid@codeaurora.org>
Date:   Mon Dec 19 18:07:40 2011 +0530

    Phone/BT: Update HeadsetService state asynchronously to BTService.

    Found deadlock state for incoming connection requests.Synch-
    -ronized methods from BluetoothService calling BluetoothHeadset
    APIs, while BluetoothHeadsetService calling updateState API of
    BluetoothService with is synchronized. This leads to deadlock
    condition.

    Change-Id: I7e761818c550d43871acbc56919671dbea4a5364

    Conflicts:

    	src/com/android/phone/BluetoothHeadsetService.java

commit a4f07cc532c2a5de6ec47d6e054524b8fd095e0b
Author: Srinivas Krovvidi <skrovvid@codeaurora.org>
Date:   Thu Jan 19 14:53:45 2012 +0530

    Phone/Bletooth: Avoid reattempt Rfcomm connection for HFP on user abort.

    When user turns off Bluetooth during HFP connection progress, the
    error returned is Software Abort. In this error case attempting
    connect after 1sec will lead into bad state of RFCOMM. The current
    change handles this error.

    CRs-Fixed: 331926

    Change-Id: I6a124a72e1f01eb402c17ec086b7270b1cb6cef9

commit 8b2b6f80f7ca481c41e931b01473e95a7784a08c
Author: Srinivas Krovvidi <skrovvid@codeaurora.org>
Date:   Thu Jan 12 17:35:37 2012 +0530

    Phone/Bluetooth: Changes to avoid deadlook during UNPAIR operation.

    When headset Connection is in progress if cancelConnectThread is
    issued from frameworks, found a deadlock condition. The current
    change avoids the call of synchronized API in thread run method.

    CRs-Fixed: 330355

    Change-Id: Iade4e59db12d446ea203e507393b44d9a9809edf

commit 92d7934f781ce9976b98957e37c182048d66f0c2
Author: Srinivas Krovvidi <skrovvid@codeaurora.org>
Date:   Wed Feb 22 11:54:34 2012 +0530

    Phone/Bluetooth: Added A2DP PlayStatus listener in BluetoothHandsfree

    From Gingerbread to ICS there is change in A2DP State intent. The listeners
    are supposed to register for Play status change intent, along with Connection
    state change intent to get the playback status. The current change takes
    care of this issue.

    Change-Id: Iee5c1de8a84d67210e5829afbb7d68e25272196c

    Conflicts:

    	src/com/android/phone/BluetoothHandsfree.java

commit e1e52ccab48cb4f50cda5fa80e56639f8f48bcc8
Author: Srinivas Krovvidi <skrovvid@codeaurora.org>
Date:   Wed Feb 22 08:44:41 2012 +0530

    Phone/Bluetooth: Removed redundant synchronization of voiceRecognition APIs.

    These APIs are called from thread synchronized BluetoothHeadsetService APIs.
    As the callers to this function already hold lock on one class, having
    another synchronized call will meet the condition hold and wait, which
    can cause deadlock conditions. The current change avoids this deadlock
    condition.

    CRs-Fixed: 338491

    Change-Id: If28b39b1b30dc2a58719390732066d82fa02e9f6

    Conflicts:

    	src/com/android/phone/BluetoothHandsfree.java

commit 59ad3a0d4ae918ef671734024ac8d6d7f8aa6266
Author: Srinivas Krovvidi <skrovvid@codeaurora.org>
Date:   Mon Mar 19 13:40:19 2012 +0530

    Bluetooth: Handling TURN OFF intent to cancel connect operation.

    During turn off process existing connections will be disconnected. But
    if a connection is in progress then the connection state will not
    be connected. These cases are also to be handled during turn off.
    The current change verifies if the RfcommConnect thread is waiting
    and interrupts the thread during turn off.

    CRs-Fixed: 345065

    Change-Id: Ifaaf1be19b83ece1b2e1fb1129165d6c175633cb

commit 77620938144d720048c89d56c41202a16b59a84c
Author: Rohit Singh <singhr@codeaurora.org>
Date:   Thu Feb 23 19:45:57 2012 +0530

    Bluetooth: RFCOMM Connection initiated twice

    SDP intent for HFP is recieved twice hence two RFCOMM
    connections are initiated to prevent such scenario check
    for RFCOMM  socket connection is necessary.

    Change-Id: I8c451e570a1bf32c0f1dee6156f46ce984fa28a0
    CRs-Fixed: 338797

commit fe63a2e6949c03a20aafb0fff8814b480aa883c2
Author: Srinivas Krovvidi <skrovvid@codeaurora.org>
Date:   Fri Apr 13 12:48:48 2012 +0530

    Bluetooth: Check for existing SCO before starting outgoing connection.

    Found some carkits initiate incoming sco connection soon after
    Call status is updated as active from DUT. In A2DP+ Dial from Headset
    case, to suspend A2DP stream there is a timer in BluetoothHandsfree.
    Only after suspending A2DP stream the outgoing SCO is attempted. Figured
    there is a possibility of attempting outgoing connection though there
    is SCO connection initiated by remote device. In this case there is
    possibility of software abort on the existing SCO connection and
    audio doesnt route on proper channel. The current check fixes the issue.

    CRs-Fixed: 351920

    Change-Id: I37bb5c071ca7d4f716ce4f2aab32bc43712e7a37

commit cae4e429336140d6db734220e9eb8d45f40a67e6
Author: Srinivas Krovvidi <skrovvid@codeaurora.org>
Date:   Tue May 8 17:58:36 2012 +0530

    Bluetooth: Validate return for getServiceState API.

    - NullPointerException occured while HFP reconnect after power cycle.
      This happens when AT+COPS? or AT+CNUM is received
      before Phone is initialized.

    CRs-Fixed: 329627

    Change-Id: I703a9f8f7b9a8cdba7bdf0fd6f1f6e9ac31d858f

Change-Id: I661640538091c96055085b64fcab677758842017
Fix airplane mode issue introuduced by a change picked up from
ICS to JB

Fix the issue introduced by the change 141931.

Change-Id: I5a004d9d2a95587acb57ff4054d4ba03f282ca5d