Telephony: Add null checks in CdmaDataConnection

Change-Id: Ie5038b4b04758129f91e8240f4a0ed69ac368e72
telephony: Add support for new Audio APIs in CallManager

CRs-Fixed: 361103
Change-Id: I25bf14f0b339bdeb69ce8b7b567d156b6ddc901c
Telephony: Fix import sim contacts issue

Get UiccCard from respective Phone.

Change-Id: If864d17c6f52dd2051b0714b28e52d5fb069bf20

Conflicts:
	telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
telephony: Display proper error message when changing PIN1

PIN1 can be changed only after enabling SIM lock. RIL returns
REQUEST_NOT_SUPPORTED error if user tries to change PIN1 without
enabling SIM lock.
Handle the error and display appropriate message when trying to
change PIN1 using MMI code.

Change-Id: I7811365d64486c7092af7b947ef45e98cae988db
CRs-Fixed: 317651
Telephony: Some Stk related bug fixes

1. As per TS 102.223 Annex C, Structure of CAT communications,
the APDU length can be max 255 bytes. This leaves only 239 bytes for user
input string. CMD details TLV + Device IDs TLV + Result TLV + Other
details of TextString TLV not including user input take 16 bytes.

If UCS2 encoding is used, maximum 118 UCS2 chars can be encoded in 238 bytes.
Each UCS2 char takes 2 bytes. Byte Order Mask(BOM), 0xFEFF takes 2 bytes.

If GSM 7 bit default(use 8 bits to represent a 7 bit char) format is used,
maximum 239 chars can be encoded in 239 bytes since each char takes 1 byte.

No issues for GSM 7 bit packed format encoding.

2.CR flag in command details(CD) TLV is always set as true and
sent to Stk app. When CR flag in CD TLV is false in the proactive
command, there is a mismatch of CD TLV data between Stk framework
and Stk app. Terminal Response (TR) is not sent for the proactive
command. Fixed this issue by sending correct CR flag to Stk App.

3.Launch Browser related testcases in 3GPP 31.124 Sec. 27.22.4.26.2
requires that additional information be sent in terminal response.

4.The GCF Testcase GCF-PTCRB SAT/USAT 27.22.4.1.1seq1.2 expects a screen busy
response if the ME is not in idle screen and if the display text message is a
low priority message. Hence sending screen busy response instead of
RESPONSE_TIMEOUT. In present implementation a USER_RESPONSE_TIMEOUT response
is sent for all timeout cases.

5.The Comprehension required bit is always set for result tag. This should
set if comprehension required field is set by the card.

Change-Id: Idb9c4b741d3d69883f7c3fe6252a895b7346ba91
Telephony: Try setup data call when the conditions are met in applyNewState

The data connection failed is not broadcast for the enable APN type
requests when the data is disabled from the settings menu.
Changes to try initiate the data call if the conditions are met whenever
updating the enabled/met flags of the ApnContext to make sure that the
proper data connection state is broadcast.

Change-Id: Ifba76306cfc7e0a808da44339efa01be829de65a
CRs-Fixed: 371400
Telephony: Qos support.

* Added SM changes to accomodate QoS in DataConnection
* APIs in Phone.java for QoS operations
* CommandInterface changes for QoS operations.

Change-Id: Ie6fca1d401ac818ef19a32086d8190c77dee3134
(cherry picked from commit 5909441c354aa13bdc83efdcd9c4acfa28a99f6e)

Conflicts:

	telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java

Conflicts:
	telephony/java/com/android/internal/telephony/BaseCommands.java
	telephony/java/com/android/internal/telephony/CommandsInterface.java
	telephony/java/com/android/internal/telephony/ITelephony.aidl
	telephony/java/com/android/internal/telephony/Phone.java
	telephony/java/com/android/internal/telephony/RIL.java
	telephony/java/com/android/internal/telephony/TelephonyIntents.java
	telephony/tests/telephonytests/src/com/android/internal/telephony/gsm/UsimDataDownloadCommands.java
Telephony: Distinguish GSM vs ETWS bc by message id

Distinguish GSM vs ETWS broadcast format by checking message id field
rather than length of pdu.

Change-Id: I374764a126589cfc201752ac909334d04ff62fa4
CRs-fixed: 318507
Telephony: Add enable/disable APIs for Cdma CMAS

- Add enable/disable APIs for Cdma broadcast to SmsManager.
  Create CdmaBroadcastRangeManager extended from existing IntRangeManager.
- Add synchronized to enable/disable broadcast APIs for Cdma and Gsm.
- Fix decodeCallbackNumber to check for valid param size
- Don't ack CB messages
- Fix lte cb sms
  Ignore 3gpp location information when it is not available.

Change-Id: Ibf0b48362b6e87e715af084ac693e1baae2ad512
Telephony: Handle ICC IO error & display PIN/PUK count

frameworks/base: Handle ICC IO error & display PIN/PUK count.

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.
-> 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.

Change-Id: I6a3d459ab96eb351165e15f7fa47280328396f57
CRs-Fixed: 184479, 260481, 181402, 181380, 181401

Conflicts:
	core/res/res/values/public.xml
Telephony: Enhanced Operator Name String (EONS) algorithm.

The operator name for registered PLMN is displayed in the
following order of preference.

1) Name from EF_OPL/EF_PNN files.

2) Name from NITZ messge.

3) Name from ME database.

4) Name from Network.

This algorithm implements this operator name deriving logic.
3GPP specs referred
1) TS 22.101 A.3 - operator name priority.
2) TS 31.102 - for EF data description.
3) TS 24.008 - for PLMN and LAC coding details.
4) TS 23.122 - for PLMN matching.

Add support to derive EONS for LTE networks based on TAC.

Change-Id: Ib5d8be287347058b738743e7027a6cad8f9b3036
CRs-Fixed: 290029, 308395, 309559, 301854

Conflicts:
	telephony/java/com/android/internal/telephony/TelephonyProperties.java
	telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
Telephony: Fix phone crash

Default code triggers setupDataCall even for cdma detachet event.
In a handoff scenario cdma detach event is sent before the objects
are initialized (profiles being read) and CdmaDCT attempts a call
with null DataProfile object.

Change-Id: I9e5945ce8aebcd203b7f1da6641d306ea16b3772
CRs-Fixed: 328558
Telephony: Correct the CdmaDataProfileTracker getDataProfile API

Use PROFILE_TYPE_CDMA if no suitable PROFILE_TYPE_OMH available

Change-Id: I12d087db6c31517994873a9caa6acc8936d75621
Telephony: Don't start RilReceiver when not needed

Basebandless targets don't need RilReceiver.

Change-Id: I510cc6f0100219af9479738fc4b48c7ab85ea666
CRs-Fixed: 367918
Telephony: notify the link properties changed in CdmaDCT

Change-Id: I0647916750f749ede3fbaf6663c06d3a263d3814
CRs-Fixed: 382871
telephony: add support for FMC .

- provide apis to disable/enable various checks used for data call
  bringup.

Change-Id: I80709b162ca105aa36a7190e8a04937fac7b37a3

Conflicts:
	telephony/java/com/android/internal/telephony/ITelephony.aidl
	telephony/java/com/android/internal/telephony/cdma/CDMALTEPhone.java
	telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
Telephony(DSDS): Add support for DSDS

Add support for DSDS.
Move DSDS functionality to framework_ext jar

Change-Id: I918da344d7d396d153be8fc9f9a41d6834a7dd00

Conflicts:
	Android.mk
	core/java/android/provider/Settings.java
	packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
	telephony/java/com/android/internal/telephony/BaseCommands.java
	telephony/java/com/android/internal/telephony/PhoneBase.java
	telephony/java/com/android/internal/telephony/PhoneProxy.java
	telephony/java/com/android/internal/telephony/RIL.java
	telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
	telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
	telephony/tests/telephonytests/src/com/android/internal/telephony/gsm/UsimDataDownloadCommands.java