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
frameworks/base: Update quick launch shortcut icons/resources

Update the existing icons and add "xxhdpi" versions created
from a vector template. This commit cleans also the resource
files a bit up.

Screenshot: http://goo.gl/6CrMYr

Change-Id: I45abee5cf13cd239eb5b4402019afac28d6d5952

Conflicts:

	core/res/res/drawable-mdpi/ic_navigation_ring_blank_activated.png
	core/res/res/drawable-mdpi/ic_navigation_ring_blank_normal.png
	core/res/res/drawable-mdpi/ic_navigation_ring_ime_switcher_activated.png
	core/res/res/drawable-mdpi/ic_navigation_ring_ime_switcher_normal.png
	core/res/res/drawable-mdpi/ic_navigation_ring_screenshot_activated.png
	core/res/res/drawable-mdpi/ic_navigation_ring_screenshot_normal.png
	core/res/res/drawable-mdpi/ic_navigation_ring_silent_activated.png
	core/res/res/drawable-mdpi/ic_navigation_ring_silent_normal.png
	core/res/res/drawable-mdpi/ic_navigation_ring_sound_on_activated.png
	core/res/res/drawable-mdpi/ic_navigation_ring_sound_on_normal.png
	core/res/res/drawable-mdpi/ic_navigation_ring_vibrate_activated.png
	core/res/res/drawable-mdpi/ic_navigation_ring_vibrate_normal.png
	core/res/res/values/dimens.xml
Fix crash in widget pager - DO NOT MERGE

Fixes bug 14299491

Change-Id: I3c94cbd7f7923dc5a429c9929bc432a5dd29d04f
KeyChain: add explicit package for getPrivateKey.

Bug: 9964538
Change-Id: If67c1938e9506d4fa81b241bcbce2193d1b194ef
frameworks/base: Fix binder parcel leak with getMetadata() API

When VideoView calls getMetadata API of MediaPlayer, parcel object
is getting allocated by MediaPlayer and metadata is created over
parcel object. This metadata object is returned to the VideoView
which is being GC without calling recycle on parcel which was
creating leak in binder virtual memory.

CRs-fixed: 669303
Change-Id: I1e265909ee42d4fabd8b2552668b3d84af994294
add framework torch service

Change-Id: I0c7a055b33fdebe697f23d207b20408e06eb74a8
Signed-off-by: Roman Birg <roman@cyngn.com>

Conflicts:

	core/java/android/content/Context.java
Fully fix interaction between torch and camera usage.

For doing this, two things are necessary:
- The torch shutdown needs to be synchronous, so that the torch app has
  a chance to release the camera before the camera app tries to use it.
- The torch service needs to track camera usage, so that it can notify
  the torch app if a camera is busy.

Change-Id: I521091d255ff4c251d97a0e8d65c9d2a80b9dae4
HeadsUp: Only remove heads up if attached to window

Attempting to remove mHeadsUpNoficiationView from the window manager
when it is not currently attached will throw an IllegalArgumentException
so we check if it is attached and if so remove it, otherwise carry on.

Change-Id: Ida916eba496c4183e47288ef24a8a93c46a7eddf

Conflicts:

	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
HeadsUp: Fix dismiss on back key press.

Change-Id: Ia213aeba114d153f5561622a2bea884963f3d8a1
SystemUI: fix double tap to sleep not working with secure lock screen

Double tap to sleep on status bar would only work on secure lockscreens if the
slider brightness control was enabled.

Change-Id: I7c4dc5b2f559aafae819422d747f92ac59631ffd
Signed-off-by: Roman Birg <roman@cyngn.com>

Conflicts:

	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
Revert "hwui: Always enable the scissor while composing layer"

This reverts commit 77705ae235df4c977cf509fcafd8727695498aab.
[ActivityManager] Ensure alive process is not killedByAm.

Symptom: Unable to kill by Am again and will be skipped updating its oom adj.

Root Cause:
A restarted process will reuse original process record.
The flag killedByAm will keep previous state.

Solution:
Reset the flag killedByAm to false when the process is started.

Note: Found another similiar patch If95137d91939cc44882ad2813131bcde0edd0c1b

Change-Id: I59a86648ca8d0aed4c489d92751af120aae5ef90
[ActivityManager] Prevent kill a restarted process again.

Root Cause:
Use removeTask with flag ActivityManager.REMOVE_TASK_KILL_PROCESS will set waitingToKill = "remove task"
to the target process when its setSchedGroup is not BG_NONINTERACTIVE.
Later the target process may be killed when applying oom-adj due to setSchedGroup has changed to BG_NONINTERACTIVE.
If the process is needed to restart, the process record will be resued.
Then the restarted process may be killed again because its waitingToKill is not null.

Solution:
Clean waitingToKill when process is dead.

Change-Id: I5ffb5388127f4221da4c700d3f1c224f7ca6e7b2
[ActivityManager] Avoid keeping restarting home when only home activity exists.

Root Cause:
When there is only home activity existed,
updating home apk will call forceStopPackageLocked to finish the activity.
Then activity history becomes empty, then home will be launched,
but its package is still target to close that results a loop.

Solution:
If home activity has been force-stopped, do not stop the same home activity again.

Change-Id: Icff12028d407873c2e6f50a06bcad231b908ccbd
[ActivityManager] Prevent potential deadlock from system error dialog and InputMethodManager.

Sympton:
When application crash in a special timing and system server's InputMethodManager is binding, deadlock may occur.

Root Cause:
Thread(1): When using InputMethodManager in system server, it will lock mH(handler) of InputMethodManager,
and sometimes it will call to InputMethodManagerService::showCurrentInputLocked and will call bindService at some condition,
then it will also lock ActivityManagerService.
Thread(2): When an application crashed, it will lock ActivityManager when showing crash dialog, inside the dialog,
it will call setEnabled of Button and lock mH of InputMethodManager.setEnable of TextView will lock IMM's handler.
So the deadlock happened as the flow: (2) lock AMS -> (1)lock mH -> (2)wait mH -> (1) wait AMS

Solution:
Reduce nested lock of error dialog: post message to let (2) lock mH after release AMS lock.

Change-Id: Id85c29406236db3b5fca9655fde1fcaf0afd1337
[ActivityManager] Move top task to top in window manager

Symptom:
In certain situations, application starts activity while
it is in background. When an existing background activity
starts a new activity which results to be kept in the same
background task, the new activity won't be resumed.
In that case, the background task (sourceTask) should not be
moved to top in window manager.

Solution:
Move top task of the target stack to top in window manager

Change-Id: Id7a37ea67ce1f80e0c2b5399865c51fd7113deb8
[ActivityManager] Do not finish root activity when reset task

Symptom:
The root activity not always located at index 0 of the task.
For example, the index 1 activity will become the new root
when the original root activity (at index 0) finished.
The new root activity might be finished unexpectedly before
the original root activity actually destroyed.

Solution:
Check frontOfTask to avoid finishing the root activity unexpectedly

Change-Id: I623ab97e9c95c83b3cfe7c9dfc151a291a391ea4
[ActivityManager]: Update home process when home activity resumed

Symptom:
  When switch between two home activities, the home process might not be updated to the correct one. In that case, the home activity might be killed easily.

Root Cause:
  The home process is updated only when a home activity is newly created or being restarted. ActivityManager did not update the home process when simply resume a home activity.

Solution:
  Update home process when home activity resumed

Reproduce Steps:
  1. Install a launcher application, such as Apex Launcher
  2. Press home key to change to Apex Launcher by "Just once" option
  3. Press home key to switch back to original home activity by "Just once" option.
     (The home process is still the Apex Launcher's process because ActivityManager does not update the home process when resuming the original home activity.)

Change-Id: I046279ca7ba851a283ee67ea19202890f7b3f343
base: update link ring-notifications after read user settings

Change-Id: Ib424124dc20e38243e572333e323ba97aacb1111
JIRA: CYAN-3559
Issue: https://jira.cyanogenmod.org/browse/CYAN-3559
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
QS: Make CameraTile respect locale changes for the label.

Change-Id: Id4be230c443263b4185e5b4af6e8df6805a7aac5