CM11 Themes: Clear wallpaper mixnmatch entry on external change

If a wallpaper is applied from a theme and the wallpaper is changed
from an external source, the theme is still shown to have its
wallpaper applied.  This patch will clear this value out when a
wallpaper change is detected that is not from the ThemeService.

Change-Id: I3d32bb3c0ac96db3f940989bc7ad4eda5e4a71f7
SignalStrength: Hotfix TD-SCDMA take 2

The previous approach worked for 3G, but failed with TD-LTE. Let's
try something different to make them both work, and use the derpy
LTE checks only if a GSM signal is present.

Change-Id: I77e3b5a1e0f99df30c32b102918af418a20077c1
Themes: Fix bad idmaps for system themes

For a system installed theme or a user who cleared his resource-cache,
there were empty idmaps for some packages.

[Details]
During startup PM could reach the theme package first before the target app was scanned in yet. This
would cause aapt to be skipped. Then when the target app is being installed in startup,
PM would try to create idmap pairs but it would fail since the resources from the theme
were not compiled for that target app.

Also cleaned up PM idmap/aapt creation a little bit more

Change-Id: I6a7dbd7c5d51a2d1336e3289c1e03bb3ed5d762e
Avoid calling idmap w/ trailing whitespace [1/2]

installd performs a buffer over-read if trailing ws is sent to it.
No observable effect found yet for idmap, but until installd is
fixed upstream, best to play it safe.

Change-Id: I56c9b4bd956ca6f59935253c6d2c90c4dba0ae94
AppOps: Don't apply OP_ALARM_WAKEUP to system components

System can freely invoke and manage alarms. Preventing it from doing
so interferes with remote components like the backupmanager (backing up alarms)
due to the mismatched uids between the invoking app and the running
service that takes the action.

Change-Id: I079df8d2522642d6d9194781207df7dd67b715b2
audio: Volume can't adjust during HFP call when screen is off.

PhoneWindowManager don't pass the key to the application when screen is
off. In handleVolumeKey(), the STREAM_VOICE_CALL volume was set, so the
STREAM_BLUETOOTH_SCO volume can't be adjusted.
Add a judgement to choose the correct stream to adjust when screen is off.

CRs-Fixed: 649548

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

Change-Id: I1ab06617d59b9bf2eabed9ed8b6892bc20db75b9
Bluetooth: use  virtual sco calls for VOIP

 - use virtualvoicesco connection set-up for VOIP calls
 - cannot simply revert c18c9138cee0f0859bcab636a004ce92ca4a9ab5
and 25fc29b3691a1d2a84164988dc74b2e7d301868e changes because
of aidl modifications involved.

Change-Id: Ib49cb01151a9cea2e94bc7a51ad1f58e877271aa
CRs-Fixed: 598072
audio: no notification sound when adjusting volume bar twice.

Notification sound won't take effect when the previous track hasn't
finished.
Need explicitly stop the previous ongoing track to alow the current one.

Change-Id: Ib344a8b14ecc47a5c8fdd9c11ae48a3541ea9a55
CRs-Fixed: 652236
Bluetooth: Unbind only in case of OFF state

In MESSAGE_SAVE_NAME_AND_ADDRESS,BT manager
calls unbindandfinish without checking BT
adapter state which if not OFF, will lead
to improper cleanup. Unbind will get called
but cleanup will not happen.

Change-Id: Ibfc70c51a95f8b80f331090e322ba3ebb88f6c03
CRs-Fixed: 652260
Bluetooth: Adds check to verify Bluetooth adapter state

This checks whether bluetooth is turned ON or not in BLE
start scan process.BLE scan apis are called from applications
so need to check if BT adapter state is ON to avoid Bluetooth
crash

CRs-fixed: 649274
Change-Id: Ic075e1560bba2cabbfac2e1477932f9ad3144067
BT: HF: Control verbose logging at runtime.

Verbose logging in BluetoothHeadset can be
controlled from adb shell.

Change-Id: If63974402a4fc91065c8007a224388af12f49cf7
CRs-Fixed: 601899
Clear cached locations when location providers disabled Bug: 12118307

(cherry picked from commit b084fef18ee1b5d24d15cff37dc3a053933d361e)

Change-Id: Ief869b9e38858092bfa3f8d6d090a278dee7d86c
ExtMediaPlayer: Increase parcel pool size to 30

Increase MAX_NUM_PARCELS to 30. This is to handle
parcel override issue when textsamples are sent at
a fast pace from mediaplayer.
Usecase: With CEA CC streams, dashplayer sendTextPacket
embedded in each video sample as soon as decoded.
No realtime offset delay sync logic for text samples
as with A/V samples. When samples drained in batch,
can have more than 5 textsamples sent in flurry

Change-Id: I4c4c63b9c9c296dbb387c4da9e70c040b75f92b6
AppOps: fix framework reboot issue when AppOps enabled

When AppOps security feature enabled, there will be a prompt when
someone call the protected operation. If no user click on the
dialog button, it will be always blocked there. This action may
cause watchdog timeout in some service.

Change-Id: I114bfef22502b81887a84b218e1548de29be3f69
Fix descriptor leak after accepting connections

After accepting a connection on a listening socket and
storing the resulting FileDescriptor into a newly created
LocalSocketImpl, the new impl's "descriptor was created
locally and should be closed normally" flag should be set.
Bug: 11805817
(cherry picked from commit 3e7305c6bf6062b5cb1e2ddcec6c6d30b4a8bc0d)

Change-Id: I723d7c5544ee4b6858894c215716cbc32a958df1
Fix socket descriptor leak from Zygote to child app

Due to an API change in LocalSocket, Zygote must now
manually close the FileDescriptor it created when it
registered a LocalServerSocket.  The LocalSocket.close()
routine will no longer do so.
Bug: 12114500
(cherry picked from commit 70ef29b04ee4ef7d7acfec79041dbe800961195e)

Change-Id: Ief23a3c99e007dc4aa6f94dfb47a1b2b6c854dad
Alarm: ignore less than 2 mins upcomming power off alarm

2 minutes is our define for enough boot up time for a power off alarm.
For current design, it can only afford upcoming power off alarm which
is later than 2 minutes. Kernel alarm driver only take care the power
off alarm which is 2 minutes later. And the framework only pass the
first power off alarm to kernel. So we need to find the first 2
minutes later upcomming power off alarm to kernel, otherwise it will
be no power off alarm from kernel's perspective. Fix the bug by
ignoring less than 2 mins upcomming alarm as power off alarm, and
only treat it as a normal alarm.

CRs-Fixed: 624561
Change-Id: I91379ecb2b378441ac2edb36212531ba6f203d8a
AppOps: don't make delay for permission dialog

Permission dialog is unclickable for 1 sec. To remove this delay
for better user experience.

Change-Id: I9dfc90c1fe5b057d4379a8acb05ac21b913b7360
Themes: Map themed icon to app after upgrade

Before this patch, applying an icon theme and then upgrading an app would
cause the app to lose its themed icon.

Change-Id: Ia76a33d0fb731720aa735e9dd9596bc5d2e75d9f
CM11 Themes: load wp from apk if uri is null

When setting a default theme on first start, the provider may
not have processed the theme and the uri for the wp will be null.
If this happens try to load the wallpaper from the themes assets.

Change-Id: I883b9dd796920e66e4729e78d41cd8899916fa42