frameworks/base: add app launch timeline instrumentation

Displayed Activity is often being used to measure application
launch times. However Displayed Activity only accounts for a
subset of the app launch. This additional instrumentation will
allow for more accurate measurements of applications launch
times.

ActivityManager: Update timeline debug statements
Update the timeline debug messages so that
'ActivityManager' is not used as the tag in log
messages as it interferes with some CTS tests.
CRs-fixed: 628703

This commit combines the changes from KK gerrit 668250 & 543988

Change-Id: I0af42520dc30d89a910e60aebdddf0c4fdd32b3e
AppOps: Check user permission before audio recording.

Add permission check before audio recording.

Change-Id: I55c8397df3169e031bba951cf180fa8c5f4c4ce0
Conflicts:
media/java/android/media/AudioRecord.java
Telephony: Add 7bit Ascii support for long messages

Add config item for 7bit Ascii encoding and decoding
support for long messages

Change-Id: I54080a5c63fd2dc470f38edeffbe58729c22adf9
Add config for the expire age of partial segment messages.

Set the value to 30 days based on default value in code,
then it could be customized via res overlay mechanism.

Change-Id: I46fda3389a34b99b6e8e5bdb07a16a28ba49ca23
Introduce a new config item: config_lte_capable

config_lte_capable is set to true when the device is
LTE capable.

CRs-Fixed: 628506

Conflicts:
core/res/res/values/config.xml
core/res/res/values/symbols.xml
Change-Id: I0032ff41a37509eb0acf25f1ee08de6cbd01511e
Add config to send SMS on 1x

When UE is attached to eHRPD network, IMS is registered and
there is an active 1xRTT voice call, the config determines
whether to send SMS over 1x. Default value is true

CRs-Fixed: 565247

Conflicts:
core/res/res/values/symbols.xml
Change-Id: Ie4e00eb57ef439e9383c616cd1b60108bcfd505f
core: jni: fix memory leak in SoundTrigger JNI

jExtras object created in android_hardware_SoundTrigger
JNISoundTriggerCallback::onRecognitionEvent()
is not deleted causing a memory which depletes JNI
JNI local storage during back-to-back SoundTrigger
detections.
Delete jExtra after storing in return object.

Change-Id: Ib7048917b7538a27d4519504b30252879acc5447
CRs-fixed: 733969
Statusbar: Show wifi status when wifi enabled

Now, Wifi status is only shown on StatusBar when connected to AP.
To satisfy the security requirement, we need show wifi status when
AppOps enabled.

Change-Id: Iae803025e17fd7fb90931f39e8f9841b659ed8ee
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
Media process is crashing with NullPointer exception

Sometime, while creating thumnails list of media files in
compose MMS->attach file,  filepath may be null due to
synchronization issue.
Adding NULL check to avoid NUllPointer exception.

Change-Id: Id6cf5612a959b3ae15b44bc60dbbcbe40c624f09
CRs-Fixed: 636494
Add looper to the thread to fix system_server crash

Toast message internally creates handler and we can't create
handler inside thread that has not called Looper.prepare().
Thus, we added looper to the thread to avoid system_server
carsh.

Change-Id: I09b9c4923c109f0b2707f8346e091efbd24b5089
CRs-Fixed: 669467
AlarmManager: Set RTC_POWEROFF_WAKEUP as hidden alarm type

Hide RTC_POWEROFF_WAKEUP type to avoid any conflict with android
CDD.

Change-Id: I13a01f133a1aab2a68b32e92fc91801ceb7d43c7
Add reboot reason to detect device shutdown

This change will detect silent device shutdown

Change-Id: Ia3c13e372b02dd4d3ec4a99d1c1f7c4787977ac3
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
Manual CDMA and GSM search in global mode.

Always set preferred network mode as Global

Conflicts:
	core/res/res/values/config.xml

Change-Id: I1a1c0f1a1eb08e756d518f9522b011ef8c2b35ea
Sensor: Enable the motion accelerometer for screen orientation change

The screen orientation can be detected by the motion accelerometer
instead of generic accelerometer to save power.

Change-Id: Iaeb3e5958d2ef7cc33080d7091ed8a5462695c67
SystemServer: Do not start Atlas Service on lowram devices.

Provide an on/off switch to control atlas service at start-up. This
service is disabled by default on lowram devices to save memory.
Atlas service is responsible for pre-loading drawables which
can be shareable among the applications. Found that the probability
of using same drawables in different apps concurrently is very less.
However it allocates fixed size of ion buffer based on config.
So by disabling it this memory overhead can be avoided. We are safe
to disable this service as it does not block any functionality.

Change-Id: I14599125c717b61f3ea5cded376fcc1802281756
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
AppOpsService: Add MODE_ASK support to AppOps.

Add support for new mode(MODE_ASK) in AppOpsService to show a permission
dialog box to user to confirm user permission before allowing or ignoring
that operation.
All strict operations (defined in AppOpsManager) are going to be in
MODE_ASK by default.
Operations will be moved to MODE_ALLOWED or MODE_IGNORED according to
user's choice.

Change-Id: I1314125a2b8be558e422e4a9eea0ff066c21bf94
AppOps: Add support for AppOps policy file

Add support to read AppOps policy file.
AppOps policy file can be used to configure Ops default policy.

Change-Id: Idb4e3501ff9f58e491b06e74152342aa9574afbf