Telephony: Consider EF-SMS for both gsm and cdma

EF-SMS each record length is 176 for GSM and 255 for CDMA.
Consider proper length depending on phone type to avoid crash.
Spec Ref: TS 51.011 10.5.3 for GSM and C.S0023 3.4.27 for CDMA.
CRs-Fixed: 385474

Change-Id: Ia43d0ad0984da9855493e968ad9d046ae0fa7d02
(cherry picked from commit 9056e0750498ac8a8c42290d2dbdebbbb35f2d75)
(cherry picked from commit 13fe891e8e27c03793484b4bbb8d33b5c63739b8)
(cherry picked from commit b425bd894a3d4e1090587302c500755c72dcb547)
Telephony: Set RESULT tag properly when sending TR

While encoding terminal response, result tag is
always encoded with CR flag, although spec is not
clear on when to set CR flag, setting it always leads to
issues with some cards, hence set CR flag based on
CR flag in command details tag received from card.

Change-Id: Ia9a1334c9e1350e2e6cdaa66eb1e0673e5de9d46
CRs-fixed: 481803 356891
(cherry picked from commit 6aac3b2827d62c8a5297247c2af957a99ffd9a97)
(cherry picked from commit 917312567ac958d1740cdbb4454972f5aaab6dc7)
(cherry picked from commit 38c88f94f1a8890809813d6fbf933f1626fcd5c6)
Telephony: Managed Roaming feature re-design.

Add support to broadcast Managed Roaming intent.
When device is in manual network mode, if network rejects the
manual registration request with cause code "Persistent
location update reject", telephony broadcast this intent.

Change-Id: Ideadfb9320b057b332601dde0dc0305a2cb2905d
(cherry picked from commit 747624f61cc3cd5f3d259b6c68020388f2a63a27)
(cherry picked from commit e5454d0f03e8bc02aefb2cbe754b8a3533bcf4f0)
(cherry picked from commit 58efcb9e7241c0092a979d0250cb6676c13d9acd)
Add support CallBarring

Add support for CallBarring in the Phone App
CallBarring now supports the following
-Barr All Outgoing Calls
-Barr Outgoing International Calls
-Barr Outgoing International Calls except to Home Country
-Barr All Incoming Calls
-Barr Incoming Calls when Roaming outside the home country
-All Barring services

Change-Id: I6b69aaa422a06a8a839537ef658f24af32ace52c
CRs-Fixed: 520315
(cherry picked from commit 6180fa0ed7c598b43fe74c3ab85da35c771b9509)
(cherry picked from commit 8241883972952f120cba5cc1afcc13a5c497a61b)
(cherry picked from commit 61bd791952a6e4043dfae5414fee670640f1859c)
Handle ICC IO error

Following changes have been made as part of this:
-> 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.
->IccCardProxy broadcasts card error intent when application index
  received from UIM is invalid(i.e.mUiccAplication is null) during
  initialization of card for fraction of time. As a result of which
  "Invalid Card" is displayed on UI momentarily.

  To fix this, When app index received from UIM is invalid broadcast
  "NOT_READY" intent.

Change-Id: I6489e5be0b64073c70bd12db645a4ac25b34af39
CRs-Fixed: 184479 399597
(cherry picked from commit dbc51a555f68d097a5dad9c54af88af8ba669721)
(cherry picked from commit fd68002b7b88e3132c7383b9eb2275b65d49e6d5)
(cherry picked from commit 6f29acdd155d1d99805d60aa3202b4d50d90d9fe)
Frameworks: Add ADN capabilities for CDMA phone

CDMA can support Abbreviated Dialing Numbers so add
CDMA in TelephonyCapabilities.

Change-Id: Ia33618d42664560f33bfa5b995b89cd030ee20de
(cherry picked from commit b52f52d1c2b3e5cb53a280bfdf4dc8ab807e6642)
(cherry picked from commit b0cb815ba965748b3e9a9057d870f19d4d786948)
(cherry picked from commit fa9d968223657f5a0830a3f1399cd317761d9e2a)
Move ConnectTimeReal to base class Connection.java

Move ConnectTime Real from derived classes GsmConnection
and CdmaConnection to Connection base class.
This gives the flexibility
to access ConnectTimeReal from different derived classes
using base class object.
This is needed to transfer time from ImsConnection
to CS connection for SRVCC.

Change-Id: I4f2a834f9df27514373de22a1c71d3923b66dc14
CRs-Fixed: 412754
(cherry picked from commit a8a1eb130bd51bcedad53f77fc31174f4b2cd3eb)
(cherry picked from commit a568c5244e70dd5f06bd073f48fe881f4c217edc)
(cherry picked from commit 737dda096eeee1fa5bbd30c9e324d1f73fdc68bf)
telephony : Support for voicemail in TP-UDH of SMS

Added support for processing special message indication
for voice mail in TP user data header for SMS
Spec reference: 3GPP TS 23.040 V6.8.1

CPHS method does not use message count.
0xff is used to indicate unknown message count for CPHS
Ref[Adapt requirement CDR-MWI-120, TC: GSM-BTR-1-4700]

Change-Id: I893252d5cacd5c1c8680a8ca6c3a6dba95ef3e1f
(cherry picked from commit ce64a3c4a4cd98931ae888dc3f6c45570bbc78f5)
(cherry picked from commit 3cc432cc2d3f8c44884ddc27b781d1a4e4d68c27)
(cherry picked from commit 9e80253570db3c519a26154a49461ba4a7f27f02)
Telephony: Set digit_mode to 8 bit in case when ton set to 1

C.S0005 requires that digit_mode parameter in mobile originated
cdma sms address needs to be set to 8 bit when type_of_number
parameter is present.
CRs-Fixed: 295542

Change-Id: I3077d9a7b09933732bbff8119308ae3de6259821
(cherry picked from commit 250a99f43642f5f117f860b56ba07deb4c29c250)
(cherry picked from commit b8d7c02eab970caab5f118a8b9e19f2dce5acf78)
(cherry picked from commit 0b1f39924d74a28dc005ae82709e645bf8317568)
Telephony: Ignore data registration when bringing down call

Bring down data call even if we have it while data registration indicates
phone is in unregistered state.
getAnyDataEnabled will return false if phone is not registered hence
user disabling data while phone is unregistered will have no effect
(and data call will remain there indefinitely).

Change-Id: I72cf1fb8b89cad5bb8595233721d1ac315750dbf
CRs-Fixed: 372219
(cherry picked from commit 0bf3869ffd41af11d2f144ac0fec174a582fd023)
(cherry picked from commit 422e033ca7fb169362ddae65448f96ae681787d5)
(cherry picked from commit 8b009c7dadc1cfc213d86f7d6641da36c06ec23a)
Update copyright to The Linux Foundation

Change-Id: I2954254ec766b882179edebdf7d98159495926a8
(cherry picked from commit 8942865fde6508368e93359a99c81eb0b91bb5f0)
(cherry picked from commit 1c77cf5378becfaeb9a8546ffe82d7daddcee509)
(cherry picked from commit 563e27b1eacd02e3d12540153ecae8978f5407a6)