Default device volumes not initialised

After fresh rom install default device volumes are not initialised
and therefore muted.

Only after manually changing a device volume it can be used.
IMHO the check for AudioSystem.DEVICE_OUT_DEFAULT here is not correct
since it will not init mIndex and mLastAudibleIndex collections.

Maybe there is a better way to fix this
core and telephony: Additional HSPAP support

Change-Id: I5e921d2308d873678d6ef67a91cff50d383a176b
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
WeatherPanel: Add toast

added collapse after click weather refresh.

Change-Id: I487c63a341fb1f121187ef3224b88afabdffba3d
LocationManagerService: The "value" was used as a Map.remove(key) method parameter.

Change-Id: I83679d41576c609a7f7e0556c36df796666c1f59
SQLiteSession: Use hasNestedException() method instead of direct check

See: https://android-review.googlesource.com/#/c/45433/

Change-Id: I2e025b249cc1c487116fc4abadaf9326b1f98563

Conflicts:
	core/java/android/database/sqlite/SQLiteSession.java
DevicePolicy: Fix lockNow() failing to turn off screen

Pawit Pornkitprasan's patch from ICS.  This issue affects JB as it did ICS.
Original patch: http://review.cyanogenmod.com/#/c/14845/

---
A fix introduced in 93c518e4f8abd98f87cda1712b30a5a86cfa60dd
causes lockNow() to sometimes (most of the time) fail to turn
off the screen. The screen will turn off, but then immediately turn
on showing the lock screen.

This is caused by getWindowManager().lockNow() call which calls the
method to lock the screen, which the PowerManager service also
call in parallel, leading to a race condition.

The fix is to only call getWindowManager().lockNow() if the screen
is not on.
Merge remote-tracking branch 'aokp/jb' into v880-aokp-jb

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
Fix initial telephony crash

Change-Id: I84059021dfd26711a82a0ddd5b918e0e230fe8ad
Add SET_ALARM permission for SystemUI

If one or more third-party alarm clock app is installed, clicking clock should open an app chooser for the alarm clock. However, permission for com.android.alarm.permission.SET_ALARM is required to make this behaviour work properly.

See http://forum.xda-developers.com/showpost.php?p=33155463&postcount=2749 for symptom if this permission is not assigned.

Change-Id: Iaf8cb9aba6e53da021da5373493b1419096e91fa
frameworks/base: Add support for wired headset detection

Change-Id: Ia6f26af85aded9decbce93fc2f381f39ff9ab81b
EventHub: Modify the keyboard layout file name for headset button

The keyboard layout file name was formed based on the name of
tabla sound card on current machine. If it doesn't find such
file, it is going to use Generic keyboard layout where the
key mappings are different, even though the scan code is same.
The sound card name differs across different machine types.
So, generalising the keyboard layout file name will work across
all machine types.

CRs-fixed: 344297
Change-Id: I416b6179f51ac98fe7dfae5268ffb58c243540a4
frameworks/base: Fix for headset switch detect

- Headset Switch detect is not functional
- Headset driver on modem in 8x25 and 7x27A targets
  introduces a delay of 500ms before reporting headset
  events to application processor to avoid the problem
  of spurious interrupts being reported due to hardware
  limitation on these targets. Frameworks code in JB
  treats button release event received after 500ms after
  button press as long press event and generates WEBSEARCH
  event. Due to this all the events in 8x25 and 7x27A
  are interpreted as long press events.
- To avoid this problem increase the timeout to more than
  500ms by introducing headset hook delay property for
  these targets.

CRs-fixed: 387247
(cherry picked from commit 5878d849442af33378805f7b9964102119c2fc93)

Change-Id: I03a77666bb217168f7c362bd775dadfbe09fe638
PhoneWindowManager: Release wakelock after headset detection.

- Device does not go to suspend mode after boots up with headset connected.
- Wakelock is not released properly if headsed is detected during boot up.
- Release wakelock in headset intent handler.

CRs-fixed: 384362

(cherry picked from commit 67ddd3c31c7a58aed89f12f956a4d29d58654ed7)

Change-Id: I09f81f4f0e4b2035b13acbb23f6c1dd7b84652c1
frameworks/base: Fix for UI freeze issue with headset insert/removal

- UI freeze is observed while quick insertion and removal of headset
  for multiple times.
- notifyJackSwitchChanged() acquires mHeadsetLock and waits on
  phoneWindowManager lock to call update() as it is a synchronized
  function. sendIntents() is also "synchronized". This function also
  tries to acquire mHeadsetLock. So there is a dead lock, when the
  notifyJackSwitchChanged() acquires the mHeadsetLock before this
  function does.
- update() is called only from notifyJackSwitched() and need not be a
  synchronized function. Removed synchronization on the update() to
  fix the issue.

CRs-Fixed: 390784
(cherry picked from commit 04e683e79c3633e061c71b2ecff4f4c83624d1e0)

Change-Id: I6d274391b68c0a306128d7009bbb651a9b0554f4
Restore correct volumes when headset is plugged

The correct volume levels for <device>_speaker and
<device>_headset are not restored when a headset device
is plugged in or out
Call to equals() comparing different types

I have found the bug with the FindBugs tool (http://findbugs.sourceforge.net)

Call to String.equals(android.content.ComponentName)
at ActivityManagerService.java [line 8874]
in method dumpActivitesLocked(..)

Change-Id: I99851de024b55b53f1b206f0645b6fe29f865784
UMS support with any volume, not only primary (2/3)

This patch enables UMS support when any volume supports it, even when the
primary storage doesn't.

1. Vold: assign lun_numbers sequentially to the volumes being added to the
   VolumeManager.
2. Fix portions of code which assume that the device has UMS support iff the
   primary storage supports UMS.
   Instead, determine whether the device supports UMS by checking each volume.
3. Display the UMS option in Settings.apk when any volume supports it.

Change-Id: I00a8338abe566f5fa20653733d13503064183c7e
Signed-off-by: Oran Avraham <oranav@gmail.com>
SystemUI: Cog Circle Mod Battery

This is a replacement circle battery mod made specifically for AOKP using the
cog from the logo.

Change-Id: Iac82b909cde77f0f90874f8dfce9e4836a1e42d9
Signed-off-by: Kyle Teague <kwesley1020@gmail.com>
Merge "WeatherPanel: Add toast" into jb