Mass squash of telephony commits from CM

Didn't want to push these seperate as there is 40 commits

Mainly looks over phonestatusbar.java just to make sure I didn't derp as it conflicted with
our wifi label stuff.

Telephony: Add new apn.sim.operator_numeric property

Use new property to filter apns. We need this new property
because icc.operator_numeric property is also used in cdma
and ApnSetting UI might display wrong set of apns if the
peroperty value used was set by RuimRecords
CRs-Fixed: 362846

Change-Id: I3831a703a2fdc69df8552af57e0bb981d0c7e46f

Telephony: Add functionality to handle ICC IO error

At present in Android all ICC Card states other than
ICC PRESENT are treated as ICC ABSENT.Adding functionality
to handle ICC IO error card state.
CRs-Fixed: 184479

Change-Id: Id6a8cf8c7bb2ed441bf8db15b84c4e426537fdb1

Telephony: Managed Roaming feature re-design.

Change-Id: I79c7ea2e647617e58526b5b550406214455a58aa

Telephony: Few PIN/PUK fixes

Following changes have been made as part of this:
-> Changes done to display retry counter on wrong entry of
   PIN1,and message to indicate Code accepted/PIN1 blocked
   during PIN1 verification as per certain carrier requirements.
->The current APIs that are used to verify the PIN and PUK only convey
  whether the operation succeeded or failed. As a result on ANY failure
  clients ask the user to re-enter the PIN.
  Add 2 new APIs that report the actual error code in case of failure.
->Display the complete text including attempts remaining to
 unlock PIN on SimUnlockScreen if user entered incorrect PIN.
 On some devices the display text is ellipsized when trying to
 display on a single line.
CRs-Fixed: 184479, 260481, 181402, 181380, 181401, 326286, 441001,
479414, 479417

Change-Id: I73718c9e6a8aa7244097e0dd4593a6226ff0ac08

Telephony: SMS over IMS

Add RIL_REQUEST_IMS_REGISTRATION_STATE, RIL_REQUEST_IMS_SEND_SMS, and
RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED.  Add FORMAT_UNKNOWN to
SmsConstants

Change-Id: Iabaf4cce9f1da94f3f263d09cdd0bc29fbea741d

Conflicts:
	telephony/java/com/android/internal/telephony/ISms.aidl

Telephony: Add tethering definitions

Change-Id: I435a602eb34b16a0c7a9e17a3102e249c98c6bb9

Frameworks: Add TD-SCDMA support

1)TD-SCDMA Signal Strength display changes.
2)Add TD-SCDMA network type support in MobileDataStateTracker class
to identify TD-SCDMA as UMTS variant and use the relevant
kernel data stack tcp buffer sizes defined.

+ Telephony: Display 3g icons for tdscdma

Updated: As per technology order & keeping in view of
future changes, add TDSCDMA case along with UMTS type.

Change-Id: I158821574484bfaf47d1660406e591e2afb3be5e
CRs-Fixed: 403258

telephony: IMS changes for VoLTE and VT

- Add IMS phone type constant
- Add system property persist.radio.calls.on.ims.
  It is set to true if VoLTE/VT calls are supported,
  false otherwise.

Change-Id: I9b2ea0e58bd75598c519ff710a93d7667a9c7993

Telephony: Add enable/disable APIs for Cdma CMAS

Add enable/disable APIs for Cdma broadcast to ISms.aidl

Change-Id: I8fb563d92691d0ce97395ed283165dc9179b586a

Telephony: STK CC feature implementation

Add strings and constants required for stk cc feature.

Change-Id: Ief5786d3010467ec835096eaf1c02f67f2e5e0d1

Conflicts:
	core/res/res/values/strings.xml

Telephony: Initialize GsmCellLocation class members properly

Default values for class members mLac, mCid, mPsc would be 0.
Initialize these variables with -1 as 0 is considered as valid value.
CRs-Fixed: 406479

Change-Id: I08dc4031bb16293e80e5b7f51afcb8dc11747d3b

Telephony(MSIM): Add support for MultiSim

Make changes to add support for MultiSim.

  -Add TelephonyManager and TelePhonyRegistry for MultiSim
  -Add ITelephony and IPhoneSubinfo aidl files for MultiSim
  -Extend ShutdownThread to close all radio's for MultiSim
  -Add Constants and Utils used for MultiSim

Change-Id: I6ee5d2a22e44fe7d0d68a41af0481ddbbbe21c3f

Conflicts:
	services/java/com/android/server/power/ShutdownThread.java

Ims: Fix the NullPointerException in getCountryIso() function

Added Null check for detector.detectCountry(), if this function call
fails, then CountryIso will be picked up based on the Locale.
CRs-Fixed: 490472

Change-Id: Ia94891629cf6170a821f76a718d4b965ae7ab802

Telephony(DSDS): MMS Auto Download.

Add MMS_TRANSACTION property which enables silent or prompt
modes to download MMS on non-DDS sub.

Change-Id: I52fe5c095e0d69c2e0d4a7fd5bfeb77bf3289380

Telephony: Change Default subscription property name.

Change default subscription property name from
persist.default.subscription to persist.radio.default.sub so
that it can be set by radio group access processes.

Change-Id: I0a75eca8c88c54e8f68ebd029abecb17249a546a

Telephony(MSIM): Add StatusBar support for MultiSim.

Add support for Signal Strength icon display for MultiSim.

Add support for NO SIM icon support for multiple SIMs.

Change-Id: I11fb6ed37e7ba40b8db7840feedd109557128758

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
	packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java

Fix for data and roaming icons

- Enable data connected flag based on the data state.

- Do not display data icon in data connected state
if radio type is unknown

- Display data icon independent of voice service state
i.e even if voice network is unavailable

- Show cdma roaming indicators if either voice
or data is roaming.

- Cleanup roaming indicator default values.
Set default CDMA Eri index to roaming off

- Show service if either voice/data is in
service if ro.config.combined_signal is true

- Consider eri only when in service

- Add in service check to isCdmaEri.
roaming related information
in registration state will not be valid
during out of service.
CRs-Fixed: 285986, 303275, 326204, 326634, 333008,
           339297

Change-Id: I915421a6f5906d80ed5b8dd9c433115ad5df1f14

Ims: Fix for Phone App crash and NullPtrException in getCountryIso API

When back to back VOLTE calls are made, sometimes
next MO VOLTE call is failing due to a NullPointerException. The
issue is because of unexpected value in getting the current
country code. Added null check for detector.detectCountry(), if this
function call fails, then CountryIso will be picked up based on the Locale
CRs-Fixed: 478645, 490472

Change-Id: I9f35fe959fc072bf59a6aabc6c17dc4162426721

Telephony: Add TD-SCDMA support

Add  network mode TD-SCDMA to the list
of supported network modes.
CRs-Fixed: 479310

Change-Id: I132ac6a2108ef641ce4e71942a5c057a8df8e76c

Telephony: Add RIL request and event for OMH support

Change-Id: I8f68d6d9e1e188a2c2295a814376dccaaad5ec24

Telephony(MSIM): Set priority when send sms

Add the priority support in 3gpp2 text message

Change-Id: I27e92709a04a89c125424f99c2c61fbf6802c6b1

Telephony(MSIM): MultiSim support for PIN/PUK & Operator Name.

-> Add CarrierText, SimPinView and SimPukView classes for MSIM.
-> Add support to Display Multiple operator name.
-> Add Support for Multiple PIN/PUK Lock screens.
-> Overload few Keyguard methods to take sub info.

Change-Id: I500129a5dc09adcb2cd8eb664d30ae2e8bad2642

Telephony: Added ME Depersonalization support.

Added support for all ME De-Personalizations as per specs
3GPP2 C.S0068-0 and 3GPP TS 22.022.
CRs-fixed: 467276

Change-Id: Iba74e3e5eb4fe96361585f4933897c5c8f17db97

Telephony: Add DETECTED state and PIN/PUK retry count.

1. Add App state DETECTED in the IccCardConstants.State enum.
   Modified logic for allowing PIN cancel based on number of
   cards configured/activated instead of number of cards present.

2. Add method in ITelephonyMSim.aidl to retrieve PIN1RetryCount.
   Display Attempts remaining in PIN/PUK lockscreen UI.

3. Clean up KeyguardUpdateMonitorCallback and MSimCarrierText by
   removing Initialize method from Callback.

Change-Id: I89c9825b35257c1cca5946bf0cbffedb07d0015b
CRs-Fixed: 501887, 504086, 508283, 510400, 513293

Telephony: Remove CDMA cellbroadcast API's

Remove CDMA cellbroadcast API's, handle CDMA cellbroadcast
 management based on phone type in IccSmsInterfaceManager
 to sync with AOSP.

Change-Id: I25b382d232799e964e8812de99c46e2dd372b20f

    CSVT: Introduce Circuit-Switch Video Telephony.

    Introduce CSVT Service which provides necessary API
    for Circuit-Switch Video Telephony.

Change-Id: I1d483212450720d64d05f4e2b02abf8da9f4b37e

Telephony(MultiSim): Add support for emergency calls

Populate ecclist by reading ril.ecclist corresponds to
each subscription.
If dialed number is present in consolidated ecclist then
mark as emergency number.

Change-Id: Ibba48a930e29dac0d80d0c8add2e01214a9bf9c3
CRs-fixed: 445415

Telephony: Add support for NETWORK_TYPE_GSM

Add support for NETWORK_TYPE_GSM in TelephonyManager and
corresponding mapping in ServicState.java so that when
application queries getVoiceNetworkType() and currently
camped rat is GSM, they get network mode as GSM instead
of network mode unknown.

Change-Id: I5e971c625532696776b9555ad8cfd85eba4fc423
CRs-Fixed: 526435

Telephony(MSIM): Define invalid subscription constant

Define a new constant for invalid subscription id.

Change-Id: I7bc433d5f24c70b710cde7ef5ac362b7ee945d2d
CRs-Fixed: 529780

Add onDataRatChanged trigger to DcTracker

It is required to reload apns when data rat switches from
gsm to cdma

Change-Id: Ifdb04d0c8be325a226dbc707a3fa8c8c697089fa
CRs-Fixed: 530277

frameworks/base: Add constants for call_state and vsid

For DSDA, CallManager will call setParameters() to indicate
the call state changes between CS Multimode call,
CS GSM only call and IMS Multimode. Add constants for
call_state and vsid keys. Add pre-defined VSID and call
state constants.

Change-Id: I6add5f13d4a2ad5eacdf0750bbd402128d86f7cd

audio: Manage audio focus for QCHAT

- Cherry-picked from the commit with commit ID:
c14c6156e879ec1c3f83f6a2cc31dac1d22147a2
- FR-fixed: 8965

Change-Id: I51c554b82c6177b7d3e845bdc8970825b5d1198a

frameworks/base: Add support for QCHAT call.

- Add VSID for QCHAT.
- Add a key which can be used with getParameters()
to query all call states.

Change-Id: If7be9467013700b220c9b10c6236a99d56f7a8cc

media: Configure audio encode parameters only for valid audio codec

Added extra check for audio codec in profile

Change-Id: Idc83bcc6d77361bd298bbff3eee1d0132e5498ea
CRs-fixed: 513887

frameworks/base: Add wifi display to fixed volume devices

Wifi display should be treated as device with fixed volume like HDMI.
User should not be able to change the volume on device. Volume
change should be supported only on the end device
CRs-Fixed: 480334

Change-Id: I2e41e9aef01167d1bdca3bca09ed863834dae1d8

frameworks/base: Add support for QCHAT concurrencies.

- Add setParameters() support in Audio Service.
- Handle audio focus for QCHAT to support concurrencies
with telephony calls and music player.

Change-Id: I2c317948c3b1c508f07787d473d40fb9a09f4b91

Frameworks: Do not send Radio Power Off on SIM_RESET

Changes made to not to send radio power off during refresh app
reset.

Change-Id: I83b7063a86ce9b380c7aeb0c140a4967d205d93b
CRs-Fixed: 441924
Conflicts:
	core/res/res/values/symbols.xml

Telephony(MSIM): Add prompt support for SMS

1) Add prompt option in SMS multi sim settings.
2) New iterface API to get SMS prompt is enabled or not.
3) Disply prompt while sending SMS, if user selects
   prompt mode in multi sim settings.
CRs-fixed: 474694

Change-Id: Iea9e8a4ea4f413316604a3d66ece624eab75ee26

Telephony: Add support for tune away and priority sub

Add constants for tune away and priority subscription
CRs-fixed: 464483

Change-Id: I790cfdcd9a1dee946502349084a4d8138d2144ec

Fix compilation after upstream merge

Change-Id: Ifde1ee07d3968b16af7ccc311b0ed615931ea921

Conflicts:

	core/java/android/provider/Settings.java
	core/res/res/values/strings.xml
	media/java/android/media/AudioService.java
	packages/SystemUI/res/layout/signal_cluster_view.xml
	packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
	packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
	packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
	telephony/java/android/telephony/SignalStrength.java
	telephony/java/com/android/internal/telephony/ISms.aidl
	telephony/java/com/android/internal/telephony/RILConstants.java
Correcting NULL pointer when callerApp is not set

Change-Id: Ia6570f428141de32d564dd190bbcf93a5d640fd1
JIRA: CYAN-2458
Issue: https://jira.cyanogenmod.org/browse/CYAN-2458
telephony: disable the use of SMS_EXPECT_MORE by default (1/2)

CodeAurora added the use of the RIL_REQUEST_SEND_SMS_EXPECT_MORE API
which is not supported by every RIL. Disabled it by default to reflect
AOSP behavior and added a flag to enable it.

Conflicts:

	core/res/res/values/config.xml
	core/res/res/values/symbols.xml

PS2: remove extra torch config added by conflicts

Change-Id: I837c161bbca3960e7458ea049f896218d5e60a63

Conflicts:

	core/res/res/values/config.xml
	core/res/res/values/symbols.xml
NetworkController: Hide signal strength icon when no SIM icon is shown

Change-Id: I5c4b43bba1469e14474d20a3627eafa597459e6e
ISms.aidl: Add callingPkg to sendTextWithPriority.

Needed for Voice+ and SecureSMS, due to breakage caused by QCOM merge

Change-Id: I1871bc9e3f644b7b82f7da18f404921c237ec55c
Support GESTURE_SENSOR input device type with GestureService

* The GESTURE_SENSOR input device type is meant to support touch sensors
  which are meant for gesture input only, very similar to a touchpad,
  but without the pointer capability.
* Define separate service to handle gestures from GESTURE_SENSOR device
  type.

Change-Id: I9b273df2a3cc141774d7f7cd81e43a90ea5b230b
Hide InputDevice.SOURCE_GESTURE_SENSOR from API

Change-Id: If009e9595fc593594b0e7764669996de137483a1
telephony-msim: Fix package directory

Change-Id: Ie7240fa841226b1ad23b0928127261d65d144419
SystemUI: fix default navigation bar transparency value

On a fresh flash the navigation bar was completely transparent.
Classic case of integer division, so cast one as a float to
resolve the issue.

Change-Id: I485346e9ac0e38ea68e8e9cf620f9fc455f1cc7a
Signed-off-by: Roman Birg <romanbirg@gmail.com>
Bluetooth: Add Get/Set socket option to the Bluetooth Socket

Introduced Get/Set socket option to the Bluetooth Socket.
For these APIs it will directly call the APIs of Adapter
Service.The corresponding APIs have been implemented in
the Adapter service of native Bluetooth APK.

Change-Id: Ic49b66599fb3c4c500e52295895d708dbc172cc7
Bluetooth: DUN: Add framework changes to support DUN

Bluetooth DUN profile APIs added to the framework APIs.
As DUN server supports only disconnection of DUN profile
level connection this API is implemeted along with other
APIs.

It registers bluetooth state changed callback with the
adapter service,once there is a change in the bluetooth
state,it will bind/unbind the DUN service which is
implemented in BluetoothExt.APK.

DUN service, and other DUN Application layer are mplemented
in BluetoothExt.APK.

Change-Id: I6ce1204ac6138e28ad7486f2855f0f7444ad3886
ringtones: Rename 'Bootes' ringtone

* The 'Title' tag of this ringtone contains an umlaut, not all character
  sets seem to treat this properly, resulting in a corrupt title in the
  ringtone picker.

Change-Id: Iabfebc6326e53982ea9bc7bdea855e9f1ed436d4
MiniThumbFile: Fix image/bitmap retrieval

Change I66005dd69b0a5c8f4353bd7a8225d163a654fd2d changed the insertion
and creation indexing mechanism, but the retrieval method was still
using the old sparse one. Fixit

Fixes android.provider.cts.MediaStore_Images_MediaTest#testInsertImageWithBitmap,
android.provider.cts.MediaStore_Images_MediaTest#testInsertImageWithImagePath,
android.provider.cts.MediaStore_Images_ThumbnailsTest#testQueryExternalMiniThumbnails,
and android.provider.cts.MediaStore_Video_ThumbnailsTest#testGetThumbnail

Change-Id: I41feea79fa304635f3908055fb95a8c85718a97f
Active Display: screenOrientaion = PORTRAIT

* for reals this time

Change-Id: I741e7f1cb1d81d1570af06d613f61e3d0ab4e4f5
Signed-off-by: Brandon McAnsh <brandon.mcansh@gmail.com>
Revert "Active Display: screenOrientaion = PORTRAIT"

This reverts commit 5156362c465710b9b6106859056c5cf5a42f3ab4.
Active Display: screenOrientaion = PORTRAIT

* for reals this time

Change-Id: I741e7f1cb1d81d1570af06d613f61e3d0ab4e4f5
Signed-off-by: Brandon McAnsh <brandon.mcansh@gmail.com>
Revert "Active Display: Force portrait orientation"

* Not the correct implementation

This reverts commit 41d566acfa5daff12d13b6d84814b6105564b4ca.

Change-Id: I4cf26de599c219f3fd7b070c9cc2cd94ba22e4da
Pie: fix PIE_GRAVITY receiver

pie gravity in pie settings will not take effect immediately,this commit can fix it.
StatusBar: Scale date text by 1dp.

looks better on 2 line view.
Revert "Hide InputDevice.SOURCE_GESTURE_SENSOR from API"

This reverts commit c4a492c5a8c4dee9c0cc5e81dc4b431aa90c3074.