Fix support for CDMA devices in SamsungRIL.

These fixes are ported from jt1134's fascinatemtd patches and CM7.  For
CM9, the fixes are applied to SamsungRIL directly instead of elsewhere in
the telephony framework.  They include:

- Signal strength reporting: pass raw integer values.
- Voice registration: convert base station values from hex to dec.
- Data call setup/deactivate: start/stop pppd_cdma service and pull network
  parameters from pppd ip-up script.
- CDMA subscription: add missing PRL version from system properties.

Changes from CM7:

Note use of "ril.cdma.data_state" property instead of
"ril.cdma.data_ready".  This property has three states:

- Disconnect(ed): ril.cdma.data_state=0: stop pppd_cdma service.
- Connecting:     ril.cdma.data_state=1: (re)start pppd_cdma.
- Connected:      ril.cdma.data_state=2: pppd_cdma has responded.

The disconnect (0) and connecting (1) states are set by SamsungRIL on the
deactivation and setup, respectively, of a data call.  Prior to setting the
connecting (1) state, SamsungRIL sets the "net.cdma.datalinkinterface" for
pppd_runner's use.

After setting to the connecting (1) state, SamsungRIL waits for pppd_cdma
to respond by (itself) setting the connected (2) state.  This should be
done at the end of a /system/etc/ppp/ip-up script, after that script sets
the following interface values, which SamsungRIL uses to complete the data
call state:

- net.cdma.ppp.interface: $IFNAME (typically "ppp0")
- net.$IFNAME.local-ip:   pppd's local IPv4 address
- net.$IFNAME.remote-ip:  pppd's remote IPv4 address
- net.$IFNAME.dns1:       pppd's primary DNS address
- net.$IFNAME.dns2:       pppd's secondary DNS address

Signed-off-by: Jesper Lundgren <koudelkaa@gmail.com>
Add more CDMA SamsungRIL fixes.

Adds a collection of CDMA device fixes to SamsungRIL.  They include:

- Overriding ERROR_UNSPECIFIED fail cause with NORMAL_CLEARING, to prevent
  far-end hangups from displaying the "Call Lost" dialog.

- Adding, and ignoring the RIL_UNSOL_GPS_NOTI request, which is also
  ignored in the TW RIL, to keep the radio log clean of exceptions when the
  GPS is active.

- Workaround for Samsung CDMA "ring of death" bug.  See source comments for
  details on this problem.

Change-Id: Ida4797718ad3463d073a6fc27246cc916526d487

Signed-off-by: Jesper Lundgren <koudelkaa@gmail.com>
SamsungRIL: Fixes for CDMA data reconnection failures due to stale pppd

Occasionally the CDMA data connection fails to reconnect after various
radio events, which is fixed neither by toggling mobile data nor airplane
mode, but only by a reboot.  One known cause of this problem is that the
pppd_cdma service is occasionally left running after the radio event, which
causes all subsequent "setup data call" operations to fail.  These two
fixes address the stale pppd_cdma service issue:

- Move the pppd_cdma service shutdown (set ril.cdma.data_state=0) from the
  "deactivate data call" response to its request.  This avoids the issue
  where the response never comes (radio crash?), and thus, the service is
  never stopped.

- Force pppd_cdma service shutdown on a "setup data call" failure.  This
  allows subsequent setup attempts to succeed in the event that the
  "deactivate" request was never made (unexpected radio poweroff).

Signed-off-by: Jesper Lundgren <koudelkaa@gmail.com>
SamsungRIL: clean up and re-organization

Clean up some messy code in the Samsung RIL.

Change-Id: If8bc9c0e4264de5919be1b6a858896076c879708

Signed-off-by: Jesper Lundgren <koudelkaa@gmail.com>
telephony: SamsungRIL cleanup

== RIL ==
* remove unused "found" boolean in processSolicited
* make requestToString/repsonseToString append the request
  ID on unknown requests.

== Samsung RIL ==
* add CM copyright header to file
* SAMSUNG_UNKNOWN_MAGIC_REQUEST_3 is actually UNSOL_AM
* add DIAL_EMERGENCY to a SamsungRIL::requestToString
* add DIAL_EMERGENCY response to processSolicited
* move emergency dialing into dialEmergencyCall()
* dialEmergencyCall() also ditches UUS info like on stock.
* cleanup and improve readibility of responseCallList()
* move isVideo before isVoicePrivacy, as it is in stock:
    ref "stock" code: http://pastebin.com/WePMyXDi
    ref "stock" order: isMpty then isMT then als then isVoice then isVideo
                       then isVoicePrivacy
    ref cm code: http://pastebin.com/UU105gNr
    ref cm order: isMpty then isMT then als then isVoice then
                  isVoicePrivacy then "videoMagic"
* general cleanup

Change-Id: Ic4ada0a3d6ac1bf580b3930a2599a91e822540ef

Signed-off-by: Jesper Lundgren <koudelkaa@gmail.com>
fixed typo in RIL_UNSOL_CDMA_PRL_CHANGED constant

Change-Id: I190022fc7fdd8b33a8ec14fdc712c1a99222b61f

Signed-off-by: Jesper Lundgren <koudelkaa@gmail.com>
Fix for Signal bars on Samsung devices

Sometimes the CDMA ecio value is sent as a negative integer where we would expect a positive.
This causes SignalStrength.java to mark ecio as -160 (Unknown_Signal_Strength) and making signal bar
s clear out.
This "fix" checks the ecio value and takes it absolute value if it is negative.

Confirmed working on SCH-I500 and SPH-D710

Change-Id: Ic515dd6c92193cd5db75adf5bef93ecd617a5c6a

Signed-off-by: Jesper Lundgren <koudelkaa@gmail.com>
smdk4210: fix setPreferedNetworkType when mobile data is connected

Change-Id: I42997c13a8582a401d4d80cfe98227a1ecb446eb

Signed-off-by: Jesper Lundgren <koudelkaa@gmail.com>