MSIM: Add support for cell info

Add suport for getAllCellInfo in MSIM

Change-Id: I9d61723b4c73f595dafd18275532f80a9a6390ff
CRs-Fixed: 654445
(cherry picked from commit 66ed7478ff831a26cde9b397356d2301997004c7)
IndexOutOfBoundsException observed rarely in ProcessStats

Sometime IndexOutOfBoundsException is observed in ProcessStats
while allocating longs array. This could be due to synchronization.
This fix will return if array index is >= size.

Change-Id: I1df34152c95f2ff61829da07f750e79a6f1efab3
CRs-fixed: 626638
(cherry picked from commit 449d385688240bb86e9624afb6ae66f687dc5184)
Fix a resource race bug in PathCache

When enabled defer rendering, it will do precache for DrawPathOp.
The paint used for creating PathTask in precache just get the address
of mFilteredPaint of OpenGLRenderer. So for the following defer
operation like DrawTextOp has possibility change the mFilteredPaint
by getPaint while another WorkerThread in PathCache is using the paint
which pointed to the same address of mFilteredPaint to generate bitmap.
As a result, it will generate a wrong bitmap for generateTexture in
PathCache. To fix it, do a copy of paint when creating PathTask.

CRs-Fixed: 664244

Change-Id: I5516f5b143458b88d3573d15b7ebb34f688800c7
(cherry picked from commit 0dea56f8e6e3184ed6335b337d9d606829ccf970)
base: App crash when select suggestion's length more than specified.

App crashed by catch IndexOutOfBoundsException which raised
by check span range when select suggested string.The root
cause is that the editor will truncate the suggested string
which length is more than it specified, but it also set span
use the suggestion's original length.

Update the suggestion's real length after editor replace the
original string to suggested.

Change-Id: I2d765701934a9e68be172cb87a104590f3cdeceb
CRs-Fixed: 532211
(cherry picked from commit 735c72b126203da915fc19950e6f695f5648901e)
Applications crash observed while selecting words from suggestion list

While selecting words from suggestion list, applications are crashing as
textview span are going out of index. For textinput where spaces are not
allowed length difference shall be calculated properly to avoid Index
out of bound situations.

Change-Id: I360318cf9241abbb7f58ad1ddf3f3c8d364f17d1
CRs-Fixed: 642057
(cherry picked from commit 7b579eb8650a57234843ffa2d2625df52e6df631)
MMS: Fix Messaging will force close after tap one item in suggestion list

The span end is larger than string's length, it caused IndexOutOfBounds
exception.

Check the span end to avoid the IndexOutOfBounds exception.

CRs-Fixed: 555378

Change-Id: Iaf1cbe8db8704b3112afb6207982750b650fe5c5
(cherry picked from commit 4cb51bed8893f43b6132a7eaabd8954150af8463)
Fixing IndexOutOfBounds Exception in ActivityManager

Bypass the iteration to avoid the exception during
the execution of ensureActivityVisibleLocked() because
startSpecificActivityLocked() within the loop may delete
the elements from History stack.

Change-Id: I195da10a8e9161572bdb653ad3021998d4f2a939
CRs-Fixed: 651963
(cherry picked from commit 762abf6dabe838aa52f302a3278acd1df7d921e0)
base: Add support for FLAG_SUPPORTS_PROTECTED_BUFFERS

For the clients (WFD) which need secure HWC composition,
FLAG_SUPPORTS_PROTECTED_BUFFERS need to be set.
- Define new flag VIRTUAL_DISPLAY_SUPPORTS_PROTECTED_BUFFERS
- In VirtualDisplayAdapter, add support for the flag
FLAG_SUPPORTS_PROTECTED_BUFFERS.

CRs-Fixed: 653794
Change-Id: Ib954943f3e27067b2805188771f951c115833237
(cherry picked from commit c8837a226fa51b3aefa868b9638bd24469c19aa3)
audio: Fixed dead lock in AudioService during volume change

- AudioService goes into dead lock when there is a volume
  change for source stream and the respective aliased stream
  simultaneously from multiple threads
- When setIndex is called for source stream, it also updates
  the index for the aliased streams. Meantime, setAllIndexes
  is called on aliased stream. Initially, it gets index of
  default device of source stream. It requires lock on the
  source stream. This is leading to a dead lock
- Fix is to avoid locking parent while updating child
  streams. Removing lock from method and synchronizing
  parent only when it is updating member variable.

Change-Id: Id38e539e2ec178ea25548312a1dd62d2de3043da
CRs-fixed: 635789
(cherry picked from commit e12f3ea902dd4df8764a55dc2470ed891f2d93cc)
Telephony(MSIM): Fix tcp buffersize issue

On a multi-sim device, getNetworkType function call
in getTcpBufferSizesPropName function of
MobileDataStateTracker will return data radio technology
value on the subscription on which data call is
currently active.

Change-Id: I7c36a408cfa090a2801d03f61f86d6d1a148c7c2
CRs-Fixed: 661835
(cherry picked from commit 1597dc394569d84b30e4a84d34eb72bfcd87cea1)
Added validity check for Pointer Index

Checking if the pointer index is valid before querying for X & Y
coordinates. This is done to avoid IllegalArgumentException.

Change-Id: Ic7f3022d33c313a0bfe8b55c9bc89019b33d23b7
(cherry picked from commit 772ca3d4e4b6904c13df7534aa0d49e3f6a94145)
Frameworks: Fix to avoid crash when the tab is not set.

Tab is not highlighted in Videoapp unlike Music app.
Instead the list is highlighted with mSelectedTab a negative value
when onFocusChange is called.
Add a check for mSelectedTab.

Change-Id: I930657b8a9be4be4d973f876242a15a667ec6f94
CRs-Fixed: 657606
(cherry picked from commit c58e035f4bfb2ccb42e769b1d7427ab84c5edcf3)
audio: Inform audio HAL if it is a voice call initiated by Telephony

setMode() API with IN_CALL mode can be called by any of the Apps.
In HAL, it is required to distinguish if it is a real voice call
or not. Inform to audio HAL if it is a voice call by checking
getPhonestate() updated by telephony.

CRs-Fixed: 662804
Change-Id: I20a661f49f6566bdd1e23d6de18b509e2728ef19
(cherry picked from commit 11ed43242a0fa20f4ef514562514e1bdfb33199e)
Common: Add the api to parse the string to current language

These APIs are used to parse the text to local languange.
For example, if the carrier name in English is got from network or SIM card, we will
use these APIs to parse it to local language and display it to the user.

Change-Id: Id4922c526d77f434b43c5ac013472b6a1cd5069c
(cherry picked from commit 0f33aa41b4d08622f3fc970d164dfb75a1667f95)
Fix the texture ID reuse issue in HWUI.

Issue: When the layer of previous frame is destroyed, it doesn't clear the
texture id in mBoundTextures[mTextureUnit], so in the next frame, if
glGenTexture returns same texture ID of the previous frame,
the new texture is not bound.

CRs-fixed: 671736

Change-Id: Ifc5fd2115fb1863b3c006ab14b0faabeaeb4eab4
(cherry picked from commit d15ab58934819b5d33f3de1c621cc6168707f839)

Conflicts:
	libs/hwui/Caches.cpp
	libs/hwui/Caches.h
	libs/hwui/Layer.cpp
Remove getBoundTexture().

GetBoundTexture checks the bound and active texture,
and we should clear the id from all bound textures
(regardless of whether they're active or not).
Remove the check and getBoundTexture() method,
and just always call caches.unbindTexture(texture.id).

CRs-fixed: 681102

Change-Id: I481386394f382519bb7ea2700c4e808e00474c70
(cherry picked from commit 1ef217effe61ad867f8b2be16e72422f4aad089c)