Telephony: Do not display the data icon if data is not connected

When updating the status bar for the bluetooth reverse tether
connected status, even if the mobile data state is in
disconnected state, and it shows the data icon based on the
data network type.
Changes made to check the mobile data connected condition while
updating the data icon.

CRs-Fixed: 356684
cherry picked from commit Iabd6269cc23c1e0ebd5fc140fc14c9ec67883148

Signed-off-by: Chet Kener <Cl3Kener@gmail.com>

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java

Change-Id: Id52bd04340ebafb6206162a5808e0f7d3e8e0d75
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
Telephony: Do not send Radio Power Off on SIM_RESET

Changes made to not to send radio power off during refresh app
reset.

CRs-Fixed: 441924
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>

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

Change-Id: I83b7063a86ce9b380c7aeb0c140a4967d205d93b
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
PhoneWindowManager: Changes for WFD.

- WFD now sends WIFI_DISPLAY_VIDEO intent to set UI orientation.
- PhoneWindowManager to listen for WFD intents.
- Display on WFD should be same as seen on the HDMI, so set the
  orientation to HDMI orientation

Signed-off-by: Chet Kener <Cl3Kener@gmail.com>

Conflicts:
core/java/android/content/Intent.java
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

Change-Id: I446ab768200f9b9f59759e52071bcaca7d6f836c
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
framework: update WFD session orientation based on UIBC rotation

User Input Back Channel (UIBC) support in Wifi Display stack
allows the sink to send control/commands/preferences to the source
e.g. touch, keyboard/mouse entry, or orientation/rotation.

PhoneWindowManager needs to listen for UIBC rotation
intents and update the preferred rotation when WFD is active.

Note: HDMI rotation lock overrides WiFi Display UIBC rotation.

Change-Id: I1869b21c3c03b5b36c5381933b50dfbfeca88db6

Signed-off-by: Chet Kener <Cl3Kener@gmail.com>

Conflicts:
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
Keyguard: Add config to always enable emergency call button

As the original design, emergency call button will be hidden on slide
lock screen. Add config_showEmergencyButton to control emergency call
button on slide lock screen.

CRs-Fixed: 640998
Change-Id: Ica29e1ec9043272e9d507307fb8744e8eef57b2e
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
SystemUI: Enhancement for 4G icons

Add 4G LTE icons with sim IDs.

Change-Id: I1608b18cf6cc1652138162cc51f9c088841892d2
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
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
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
AppOps: Check user permission before audio recording.

Add permission check before audio recording.

Change-Id: I55c8397df3169e031bba951cf180fa8c5f4c4ce0

Signed-off-by: Chet Kener <Cl3Kener@gmail.com>

Conflicts:
media/java/android/media/AudioRecord.java

Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
Telephony: Add 7bit Ascii support for long messages

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

Change-Id: I54080a5c63fd2dc470f38edeffbe58729c22adf9
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
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
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
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
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
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
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
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
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
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
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
Add reboot reason to detect device shutdown

This change will detect silent device shutdown

Change-Id: Ia3c13e372b02dd4d3ec4a99d1c1f7c4787977ac3
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
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
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
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
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
aapt: Support for mxmf file playback

mxmf files couldn't be played.
Added .mxmf file ext to kNoCompressExt array

CRs-Fixed: 465437
Change-Id: I8eb50e09d4a3b0dcf5d60869dc2d69ca924c8dc2
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
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
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
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
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>

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