Telephony: Reset the data registration state on radio off/unavailable

CRs-fixed: 380373
(cherry picked from commit 6716ad9c64467e01b268108909c2ef64430b6b9f)

Change-Id: I0973a583704ab502d7b7b22125bd314ed42703c9
DateUtils: Avoid Time.format() calls when unnecessary.

While preparing the full time/date formats, formatDateRange() function
unnecessarily creates the Day, Month and Year sub-strings by calling
Time.format() separately 3 times.

Ensuring to call Time.format() only once by specifying the full format type
for Full format text and hence skipping the above 3 individual calls.

CRs-fixed: 376187
(cherry picked from commit 37d2f5d76d53df193929d485ffb81818e2814619)

Change-Id: Ieff68f83c6d3cf1a356e464cfbb7ec92a0d940dc
audioflinger: Fix for Equalizer effect not to turn off

-Equalizer effect is turned off when more than 15 applcations are launched
-Activity manger closing the Equalizer effect when more than 15 application
are launched after music application.
-To resolving this issue removed setEnabled(false) from the AudioFlinger
 disconnect function.

Change-Id: If71a3ccc0be4b8778edcdf30572f026e0bc5f321
CRs-fixed: 376111
frameworks/base: Fix for LPA volume change with headset

- LPA volume is set without checking the output type
- Set LPA volume only when the output is LPA.

CRs-Fixed: 373975
(cherry picked from commit 9ef83a9038a76ef199bae9e5f1ad69da822b8af4)

Change-Id: Id2b6b2002231164b5622c4a71e2214b5b9a82836
libstagefright: LPA: Fix flush issue when seek in A2DP

- When pause is done while LPA clip playback over A2DP,
the output volume is increased for a moment right
before a pause of a playback.
- When Pause is done on AudioSink, flush is also issued.
Flush is not required incase of Pause. Flush is only
needed incase of Seek. Remove it from AudioSink pause.
- Add flush Api in seekTo when AudioSink is in Pause state
and remove flush call from Pause of AudioSink.

CRs-Fixed: 375325
(cherry picked from commit 9824803ac88b603aab8e094bdce9d714a46bd23d)

Change-Id: I206e9fa5f8cc577a2a43f05389f9859d7551f260
libstagefright: Fix for audio fail issue during continuous BT switching

- During playback, when BT is enabled and disabled
  continuously, audio fails after a while.
- A2DPNotificationThreadEntry() clears all the buffers
  in the response and request queues when BT is enabled
  and pushes back the buffers in the request queue.
  In parallel, eventThreadEntry() pushes a buffer back
  to the request queue which makes its size 5 causing
  audio failure.
- In eventThreadEntry(), acquire and release the request and
  response queue mutexes in a proper manner to prevent
  the scenario described above from happening.

Change-Id: I982f8c3281cfc19d44724b8d705453497a1c041b
CRs-Fixed: 365533
(cherry picked from commit da024eb01b8dd29739f2fda8000201a57e6c48de)
libstagefright: Prevent sink from starting in paused state

Whenever BT is connected and playback is in paused state, sink
should not be started. This will result in a wrong state

Change-Id: I5e2d0395d40bb9b63f850fd971c9815590b51b95
(cherry picked from commit 531f15f5bc2b23a64f0a07263480b8e515d1f71c)
libstagefright: Convert mono to stereo for LPA clips

- Sound effects are not supported for mono clips
- Repetative calling of effects_configure and effect_process for
mono clips is resulting in crash in the sound effects library.
- So, Mono clips are now converted to stereo by copying the left
sample to right.
- This is same as what Resampler does in Non-LPA Playback.

CRs-fixed: 371641 376970
Signed-off-by: Satish Babu Patakokila <sbpata@codeaurora.org>
(cherry picked from commit fcc0647fab20ceaf1c07bc10bb243f14c48b114c)

Change-Id: I6afe24183f99ceb2fb1711b98c57b734ecb0a575
	media/libstagefright/LPAPlayerALSA.cpp
telephony: Handle RIL_APPSTATE_ILLEGAL

Map APPSTATE_ILLEGAL to APPSTATE_READY. APPSTATE_ILLEGAL means
card is valid but the subscription is rejected by network.
All ICC operations must be permitted.
Registration will anyway not happen as network would reject
registration request.

Change-Id: If4994371423d83343171be8b2a339ff79ff52c8e
CRs-Fixed: 380882
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 intiate 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.

CRs-Fixed: 371400
(cherry picked from commit 5f6ef98113e1f5fd26720c0c666e30318940e6f9)

Change-Id: I27e4dee95883116c7fd853368662ea104195a5e5
telephony: neighboring cells are now handled properly

GsmServiceStateTracker.java sets the System Property
PROPERTY_DATA_NETWORK_TYPE = "TypeName:RadioTechnology"
for the current network type (ex. EDGE:2 or HSPA:11).

When neighboring cell info is sent to responseCellList() in RIL.java,
the routine compares PROPERTY_DATA_NETWORK_TYPE to just the TypeName
(without the :) and can not find a match.  It defaults to
NETWORK_TYPE_UNKNOWN and does no interpret the location.

This patch splits off the string part of PROPERTY_DATA_NETWORK_TYPE
so a proper match is found and the location is interpreted.

Also HSPA+ (HSPAP) is added as a valid match.

Patch compiled and tested on HP TouchPad 4G.

Change-Id: I223db80d6c4a7791300e299826aa316854738d5c