Merge tag 'android-4.3_r2.1' into HEAD

Android 4.3 release 2.1

Conflicts:
	Android.mk
	cmds/input/src/com/android/commands/input/Input.java
	cmds/installd/commands.c
	cmds/installd/installd.c
	cmds/installd/installd.h
	cmds/installd/utils.c
	cmds/servicemanager/Android.mk
	cmds/servicemanager/service_manager.c
	core/java/android/app/ActivityManagerNative.java
	core/java/android/app/ContextImpl.java
	core/java/android/app/IActivityManager.java
	core/java/android/app/admin/DevicePolicyManager.java
	core/java/android/content/ContentProvider.java
	core/java/android/content/Context.java
	core/java/android/content/Intent.java
	core/java/android/content/pm/PackageInfo.java
	core/java/android/content/pm/PackageManager.java
	core/java/android/content/pm/PackageUserState.java
	core/java/android/content/res/Resources.java
	core/java/android/os/Trace.java
	core/java/android/provider/Settings.java
	core/java/android/text/format/DateUtils.java
	core/java/android/view/IWindowManager.aidl
	core/java/android/view/inputmethod/InputMethodManager.java
	core/java/android/webkit/BrowserFrame.java
	core/java/android/webkit/WebSettings.java
	core/java/com/android/internal/policy/PolicyManager.java
	core/java/com/android/internal/widget/LockPatternView.java
	core/jni/Android.mk
	core/jni/AndroidRuntime.cpp
	core/jni/android_media_AudioTrack.cpp
	core/res/AndroidManifest.xml
	core/res/res/layout-sw600dp/keyguard_screen_status_land.xml
	core/res/res/layout-sw600dp/keyguard_screen_status_port.xml
	core/res/res/layout/keyguard_screen_tab_unlock.xml
	core/res/res/layout/keyguard_screen_tab_unlock_land.xml
	core/res/res/values-cs/strings.xml
	core/res/res/values-fi/strings.xml
	core/res/res/values-pt-rPT/strings.xml
	core/res/res/values-pt/strings.xml
	core/res/res/values-ro/strings.xml
	core/res/res/values/config.xml
	core/res/res/values/symbols.xml
	data/etc/platform.xml
	data/sounds/NewAudio.mk
	libs/androidfw/AssetManager.cpp
	libs/hwui/OpenGLRenderer.cpp
	media/java/android/media/AudioRecord.java
	media/java/android/media/AudioService.java
	packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
	packages/SystemUI/AndroidManifest.xml
	packages/SystemUI/res/layout-sw600dp/navigation_bar.xml
	packages/SystemUI/res/layout/navigation_bar.xml
	packages/SystemUI/res/layout/status_bar.xml
	packages/SystemUI/res/layout/status_bar_expanded_header.xml
	packages/SystemUI/res/layout/system_bar_notification_area.xml
	packages/SystemUI/res/values-sv/strings.xml
	packages/SystemUI/res/values/dimens.xml
	packages/SystemUI/res/values/donottranslate.xml
	packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
	packages/SystemUI/src/com/android/systemui/SearchPanelView.java
	packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
	packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsContainerView.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsTileView.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/SettingsPanelView.java
	packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
	packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java
	packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
	policy/src/com/android/internal/policy/impl/GlobalActions.java
	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
	policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
	policy/src/com/android/internal/policy/impl/keyguard/KeyguardSelectorView.java
	policy/src/com/android/internal/policy/impl/keyguard/KeyguardTransportControlView.java
	policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java
	policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java
	policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java
	policy/src/com/android/internal/policy/impl/keyguard_obsolete/PatternUnlockScreen.java
	services/java/com/android/server/DevicePolicyManagerService.java
	services/java/com/android/server/DeviceStorageMonitorService.java
	services/java/com/android/server/LocationManagerService.java
	services/java/com/android/server/LockSettingsService.java
	services/java/com/android/server/NotificationManagerService.java
	services/java/com/android/server/SystemServer.java
	services/java/com/android/server/ThrottleService.java
	services/java/com/android/server/VibratorService.java
	services/java/com/android/server/am/ActivityManagerService.java
	services/java/com/android/server/am/ActivityStack.java
	services/java/com/android/server/am/BroadcastQueue.java
	services/java/com/android/server/pm/PackageManagerService.java
	services/java/com/android/server/pm/PackageSettingBase.java
	services/java/com/android/server/pm/SELinuxMMAC.java
	services/java/com/android/server/pm/Settings.java
	services/java/com/android/server/wifi/WifiService.java
	services/java/com/android/server/wm/ScreenRotationAnimation.java
	services/java/com/android/server/wm/WindowManagerService.java
	services/jni/com_android_server_BatteryService.cpp
	telephony/java/android/telephony/SignalStrength.java
	telephony/java/android/telephony/TelephonyManager.java
	telephony/java/com/android/internal/telephony/ITelephony.aidl
	telephony/java/com/android/internal/telephony/RILConstants.java
	wifi/java/android/net/wifi/WifiNative.java
	wifi/java/android/net/wifi/WifiStateMachine.java
	wifi/java/android/net/wifi/p2p/WifiP2pService.java

Change-Id: I5e9e6aaa4df5f1e256db6084a211a2582ac4454a
Revert "core/jni/android/graphics: Cache copy of pre-scaled Bitmaps"

This reverts commit 3083c3c93e12c4548bbe3bee1fecd1a45478657c.
SystemUI: API updates

Change-Id: I5a1cfd8089084af299fe26e8b5b65f7b945777f2
Unbreak merge failures

Change-Id: Ifc0141f1d594e1f5e04ee8532c985e6b3d480fb3
Bluetooth: SAP: Add framework changes to support SAP

This change consists of:
SAP Disconnect from server support related changes

Change-Id: I7215f503244c5ee277e83d60d6960f18559acfb9
AudioService : Fix NPE

Initialize mVolumePanel prior to registering the receiver,
since 4.3 now invokes the layoutDirection call on it.

Change-Id: I8d00f0886b603d52bc55cba5fd3ba1d86f7ea56c
Merge "AudioService : Fix NPE" into cm-10.2
Revert "[webkit] Runtime enablement of WebGL"

 * No longer needed, WebGL is on by default if compiled in.

This reverts commit bcc8f733796f3fcd1c2180336960d747a6995f0c.
Camera: Add support for QC camera features.

Added APIs and keys for all QC features. This
will enable application to get/set paramters.

Change-Id: I58a53c7b9133a3acddc34b268dac086c9562d533
frameworks/base: Watchdog to generate trace of Monkey

We need stacktrace of Monkey process to debug issues wherein
system_server gets stuck doing a binder call with monkey

Change-Id: Ie0be15662c68219fe5e95592c672b86ab0987e37
(cherry picked from commit c509d1147e321118f1c908502b0b9eb5ee2a5926)

Conflicts:
	services/java/com/android/server/Watchdog.java
frameworks/base: move the traces file to avoid data loss

If an ANR comes just after the framework reboot, the traces for
the framework reboot will get over-written with the ANR traces.
So, We are missing the traces for the framework reboot which
makes debugging the framework reboot difficult.

This patch will rename this trace file for the framework reboot
once the ActivityManager collects the traces.

Change-Id: Iee07b13ba02d8aab9cc43567aa5df131cc43c737

Conflicts:
	services/java/com/android/server/Watchdog.java
frameworks/base: creating sperate files for ANRs traces

If an ANR comes just after the framework reboot, the traces for the
framework reboot will get over-written with the ANR traces. So, We
are missing the traces for the framework reboot which makes debugging
the framework reboot difficult.

Even for multiple ANRs in different apps, we will get the traces for
the last ANR.

Most of the time traces show that the call is stuck in some native call
and we do not have any info about the native call stack becuase we do
not collect the tombstones for teh ANR.

This patch will create one trace file for each application in case of ANR
and the filename would be traces_<app_name>.txt and the traces for
framework reboot will be stored in traces.txt

Change-Id: Iec2daee0350b20571d0bda9330a17a68df194f8b
Wifi: Fix for connection failure between third client and GC.

When third device sends a connection request to the group client, the
existing connection is terminating and also the ongoing connection not
successful.Currently as there is  no use case where third device is
connecting to GC,and the existing onnection getting terminated.This
is addressed by ignoring the new connection request from third client
to GC and the existing connection is intact.
CRs-Fixed: 467049

Change-Id: I784c38b9a4ca0c60b188b9697e3b4af4d09053cc
framework/base: Handle ASSOC-REJECT events

Disable current network and enable other saved networks(if any)
once number of ASSOC-REJECTs on an attempt to connect to a corresponding
network exceeds the threshold.
CRs-fixed: 484247

Change-Id: I59ca5b7bcb2cf8d205556feaac5871260a3fd8ec
Pick default interface for upstream.

With multiple upstream interfaces active and connected,
we should choose the default interface for upstream.
CRs-fixed: 461266

Change-Id: Ia3bc32300a1f77f46237994d0e38e9c9886f4bea
To fix fatal exception in system process due to NullPointerException.

Null pointer check added to avoid NullPointerException, that was
leading fatal exception in system process hence framework rebooting.

Change-Id: Ia83a6178bd575954345020ef3a792a3445323808
CRs-fixed: 483763
aapt: Support for mxmf file playback

mxmf files couldn't be played.
Added .mxmf file ext to kNoCompressExt array
CRs-Fixed: 465437

Change-Id: I4473380c0aa13f7c18b59aa48f07a87f7849a74c
libaudioeffect_jni: GREF leak fix for JB

- Excessive JNI global reference in AudioEffects.
- Global references created during native setup
  are not deleted.
- Global references are deleted in setup failure
  and during native release.

(cherry picked from commit a04a2bf4563dc20c52f4d4239e01f80b220077a5)
CRs-fixed: 413633

Change-Id: Ia4340a2128850101b394e00c8e1db9db49f516fd
Reduce total number of background apps for low memory devices

Due to memory constraints, we anyway cannot fit the default number
of BG apps. So instead of killing background apps to
free up memory when launching, start with an already
reduced background set of apps.
Another side-effect is that launch latencies also improve.

Change-Id: I3ae54aa7d53ff1b81252212973646a95d2d82e8a
Note: This is for low memory devices. (~512MB RAM or less)
framework: packageinstaller :fix logical error in size calculation

fix logical error in available size calculation.

Change-Id: Ic6ce312cf1c146030a20187fcb27b24fbe4c321a