Telephony: Samsung STK Support

Squashed Commits of the following:

    Add Samsung STK support (telephony part)

    Support for SMS-based SIM applications.
    Partially rewritten the original patch by Jüri Schultz to be less intrusive.

    Change-Id: I15d2de1781a2823e24941dd792db3d372578aa9f

    Samsung STK: Add USSD support

    Allow USSD-based STK applications to work

    Change-Id: I483f37a44a6c3ed43eefcf979e17b84877d03f93

    Samsung STK: Fix SMS-based STK

    SEND_SMS was falling through to SEND_USSD (which used to do nothing
    until USSD support was added) causing an Exception because cmdParams
    is not an instance of SendUSSDParams.

    Fix by using type-checking instead of checking if Samsung STK is
    enabled (because SendSMSParams and SendUSSDParams will only be
    created if Samsung STK is enabled.)

    Change-Id: I671014e295e9e529aad25a8b6fbd5a2e5788fc44

Change-Id: I67866c9db4d5e5b42d8aa8d465d931f74c67e308
PhoneFactory: fall back to default RIL if custom RIL Class fails

If the ro.telephony.ril_class property is set to an invalid class it will cause
Phone to repeatedly FC and make the device unuseable. This allows it to handle the
exceptions gracefully and fall back on the default RIL.

Change-Id: Ic9c309aff173de5267aa7ef633bfff87243f24fd
Fix enabling data connection

Could not enable the default type APN in below case:
1. Default apn exists, connect wifi
2. Delete default apn
3. Disconnect wifi

enableApnType won't reactivate default apn type when no
default apn exists. Add default apn criterium to avoid this.

Change-Id: Ic8699669e576e5d2140852f359e34ed6c3275633
SamsungCDMAv6RIL: update to latest RIL

Also add two mic state and WB AMR

Change-Id: I0a9fdbbfa7880f964c530b7aa3e46baf2fe9e6c1
Don't assume 3GPP as active app on CDMA with LTE device

IccCardProxy assumes, that on a CDMA+LTE device, the active app
is the SIM/USIM and not the RUIM/CSIM. However, for voice RUIM/CSIM
is the active app on such a device. All services, like FDN,etc. should
be tied to the active voice app.
CRs-Fixed: 428304, 506938

Change-Id: I70894a1aab0a812a50f1cbab986161bb3b708b85
(cherry picked from commit 4d19143c3cf2ea1ee37fa1c05cac984ab14ce603)
(cherry picked from commit c623954a27891a0693bf2208bb095183f1d1b9d9)
(cherry picked from commit e48c977e219b4afba93eb71ac0c4e937f3376710)
(cherry picked from commit 76eab3d4d4b2e6e57048b229b132525c1fd80e3a)
cdma: Restore SVDO after merge.

Allow evdo/ehrpd + voice simutaneously.
Use ro.ril.svdo=true

Change-Id: If7be25edc10f21680adbe3a059370d77a82ef076
(cherry picked from commit a28dfbec287a2e546d1bfcc1f958922daa04822c)
DCTracker: Squashed commits to fix CDMA Data

Use dummy profiles if buildWaitingApns can't find valid APNs

Requires: https://gerrit.omnirom.org/#/c/4195/

Change-Id: I706767200fa4a061a8f2e18796c878e506527102

Fix cdma data calls based on NV

For NV data calls we need to create dummy profiles
When DcTracker switches from lte to cdma we need to bring
down existing data call and establish new one (same goes
for switching cdma->lte)

Bug: 10804691
(cherry picked from commit 4ead798ed4964952c3086b3224d775479d66d240)
(cherry picked from commit f333f0ca7b1c992ab36af83ca74a1131d3ae17b8)
(cherry picked from commit 14e5657432de2eb9ba52ebf28a8967ed62ee4a0b)
(cherry picked from commit ff99b7392eccef8a848d49fdc46a3a5f1afecd56)

Change-Id: I7ad8d0632854ea9875afb76709c1ba894bf048fd

Create cdma dummy profiles

Create cdma dummy profiles if none are found in database

(cherry picked from commit fd636d72606d9f34ffbbe0e8d7aa1e238dbb3f85)
(cherry picked from commit 4c1b138e89e200cb5a2b4e6e640f162bad2d9b36)
(cherry picked from commit 37ad63426059d621d7d6ad5c3ea5901aa937a608)
(cherry picked from commit e085e00824a570942a2f47a9b3474f5a03f37e53)

Change-Id: I2b1fcc349b0734f67c59fc7d1bca96ee7164461b

Change-Id: I7ad8d0632854ea9875afb76709c1ba894bf048fd
fix for Samsung CDMA incoming SMS bug

ported from CM7/9/10/11

Change-Id: I6189dd0c6aeffb0b8b530bab7994a07bb390c32c
Verify apnContext is not null before it gets dereferenced

If this is still null a NPE will be thrown when it is dereferenced later on

Change-Id: I71ec478eb32425ca4242ee1eb366756648935350
DcTracker: verify preferred apn list is not empty before enabling

If a non-null but empty cursor is returned mCanSetPreferApn will be
set to true even though the preferred apn list is empty. Verify the
cursor contains at least one apn before setting mCanSetPreferApn.

Change-Id: I6a66ab334d997d8ced06ea0b596ba3463f4ce85b
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.

Change-Id: I915421a6f5906d80ed5b8dd9c433115ad5df1f14
CRs-Fixed: 285986, 303275, 326204, 326634, 333008, 339297
(cherry picked from commit 5e973bedadf36b08a1e2a82745d912fcfdebb020)
(cherry picked from commit fd4dcb2c518eef3e655136cbd69c94b5a3fffb1b)
(cherry picked from commit c5b8a284415d65bad41915b3e50fed853d5f5110)
Handle DATA_CALL_LIST in DCC and update dataActivity properly

Update mActivity in DCC before notifyDataActivity. Without this change,
the notifyDataActivity was notifying incorrect data activity status
due to race condition between DCT when mActivity was updated and
DCC thread where notifyDataActivity was called.

Change-Id: Iffb7bf369062264dd773338c732bc69318d90b73
Bug: 11596853
(cherry picked from commit f74c31dfe3c9db4cb8e81be014aaac2537c23f51)
DcTracker: respect build property for multiple data connections

Change-Id: I90094708a4ebf050837db3405f76c1875c3f42de
[3/3] Opt/Telephony: Add MobileNetwork Flip Tile

base from:

https://gerrit.paranoidandroid.co/457

with moarr changes to OmniRom

toggle Network Flip Tile

for device support 4G (GSM)
toggle will change into 2G only => 3G only => 2G/3G auto => 2G/3G pref => 4G lte => back to 2G only

for device support 4G (CDMA)
toggle will change into cdma/evdo auto => cdma only => evdo only => 4G lte => back to cdma/evdo auto

for device unsupport 4G (GSM)
toggle will change into 2G only => 3G only => 2G/3G auto => 2G/3G pref => back to 2G only

for device unsupport 4G (CDMA)
toogle will change into cdma/evdo auto => cdma only => evdo only => back to cdma/evdo auto

4G toggle requires that at least one (1) of the following configs
must be present in the device's build.prop in order to use it:
telephony.lteOnCdmaDevice=1
telephony.lteOnGsmDevice=1

Change-Id: I50950399537b19954a4f4fb19d038a07c8759c36
SamsungQualcomRIL: update to include newDialCode

Courtesy of CM

Change-Id: I5410bc2c027ef8af3f93c5f07ca6932242caeb22
Don't display prompt when card inserted/removed

UiccCard displays a prompt to reboot the device when a card is
inserted or removed. Don't display this if the modem supports
hot swapping.

Change-Id: I8627a5fcfabaa86e13de9f392a31fc8f71558b00
SamsungQualcommRIL: fix signal strength reporting

Change-Id: I375ee9f37d8cb27b79c547fbb7c9a738e195e375
SamsungQualcommRIL: make mQANElements adjustable

The new proprietary blobs for i9305 require that mQANElements = 6.
This simply introduces a new property that can be used to adjust
the value of mQANElements if required.

Change-Id: If25fd73fd2700d6d36b2f2e8bd671b56703b0878
GsmSST: Disregard any invalid verbose values for timezones in NITZ requests

And assume anything resulting in "GMT" is invalid, since that's the
default value returned by libcore

Change-Id: Iee8509c76228f9977b5df3f4e69c82ca063efce8
DcTrackerBase: Dont provision APN if default is disconnecting

Change-Id: I4f1d6551dee3dc2f737fda0fefde95d441ef25e1