Frameworks: refactor, cleanup, centralize, fixes, features

- refactor a lot code
- remove duplicates and centralize
- a lot fixes and some features like diable navring, color mode for notification shortcuts

etc etc

For further information see Settings patch:

Settings: complete overhaul/optimizing + drag drop sort + easy dev life

Change-Id: Ie90f0ccd51d319ec880333289fea6b20642562ba
squash 4.3 aaaaaaaaaaaaaaaaaaand done

Conflicts:
	Android.mk
	CleanSpec.mk
	api/10.xml
	api/11.xml
	api/12.xml
	api/13.xml
	api/14.txt
	api/15.txt
	api/16.txt
	api/17.txt
	api/8.xml
	api/9.xml
	cmds/content/src/com/android/commands/content/Content.java
	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/ActionBar.java
	core/java/android/app/ActivityManagerNative.java
	core/java/android/app/ContextImpl.java
	core/java/android/app/IActivityManager.java
	core/java/android/app/MediaRouteButton.java
	core/java/android/app/admin/DevicePolicyManager.java
	core/java/android/appwidget/AppWidgetHost.java
	core/java/android/appwidget/AppWidgetManager.java
	core/java/android/content/ContentProvider.java
	core/java/android/content/Context.java
	core/java/android/content/Intent.java
	core/java/android/content/SyncManager.java
	core/java/android/content/SyncStorageEngine.java
	core/java/android/content/pm/PackageInfo.java
	core/java/android/content/pm/PackageUserState.java
	core/java/android/content/res/Resources.java
	core/java/android/hardware/SystemSensorManager.java
	core/java/android/inputmethodservice/IInputMethodWrapper.java
	core/java/android/inputmethodservice/InputMethodService.java
	core/java/android/os/Trace.java
	core/java/android/provider/Settings.java
	core/java/android/server/search/SearchManagerService.java
	core/java/android/view/IWindowManager.aidl
	core/java/android/view/Surface.java
	core/java/android/view/View.java
	core/java/android/view/ViewGroup.java
	core/java/android/view/ViewRootImpl.java
	core/java/android/view/WindowManager.java
	core/java/android/view/WindowOrientationListener.java
	core/java/android/webkit/BrowserFrame.java
	core/java/android/webkit/WebSettings.java
	core/java/android/widget/ListView.java
	core/java/android/widget/RelativeLayout.java
	core/java/android/widget/VideoView.java
	core/java/com/android/internal/app/ActionBarImpl.java
	core/java/com/android/internal/appwidget/IAppWidgetService.aidl
	core/java/com/android/internal/widget/ActionBarView.java
	core/java/com/android/internal/widget/LockPatternView.java
	core/java/com/android/internal/widget/LockSettingsService.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_unlock_portrait.xml
	core/res/res/layout-xlarge/screen_action_bar.xml
	core/res/res/layout-xlarge/screen_action_bar_overlay.xml
	core/res/res/layout/keyguard_screen_sim_pin_portrait.xml
	core/res/res/layout/screen_action_bar.xml
	core/res/res/layout/screen_action_bar_overlay.xml
	core/res/res/values-ar/strings.xml
	core/res/res/values-cs/strings.xml
	core/res/res/values-de/strings.xml
	core/res/res/values-es/strings.xml
	core/res/res/values-et/strings.xml
	core/res/res/values-fr/strings.xml
	core/res/res/values-it/strings.xml
	core/res/res/values-pl/strings.xml
	core/res/res/values-pt-rPT/strings.xml
	core/res/res/values-ru/strings.xml
	core/res/res/values-vi/strings.xml
	core/res/res/values-zh-rCN/strings.xml
	core/res/res/values/config.xml
	core/res/res/values/strings.xml
	core/res/res/values/symbols.xml
	core/tests/coretests/src/android/text/format/DateUtilsTest.java
	data/etc/platform.xml
	data/fonts/fallback_fonts.xml
	data/sounds/AllAudio.mk
	data/sounds/AudioPackage10.mk
	docs/html/guide/practices/jni.jd
	graphics/java/android/graphics/drawable/LayerDrawable.java
	libs/androidfw/AssetManager.cpp
	libs/androidfw/ResourceTypes.cpp
	libs/hwui/FontRenderer.cpp
	libs/hwui/FontRenderer.h
	media/java/android/media/AudioRecord.java
	media/java/android/media/AudioService.java
	media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaRecorderStressTestRunner.java
	media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/CameraStressTest.java
	media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaRecorderStressTest.java
	packages/SettingsProvider/res/values/defaults.xml
	packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
	packages/SystemUI/Android.mk
	packages/SystemUI/AndroidManifest.xml
	packages/SystemUI/res/layout-land/status_bar_recent_panel.xml
	packages/SystemUI/res/layout-land/status_bar_search_panel.xml
	packages/SystemUI/res/layout/status_bar.xml
	packages/SystemUI/res/layout/status_bar_expanded_header.xml
	packages/SystemUI/res/layout/status_bar_recent_panel.xml
	packages/SystemUI/res/layout/system_bar_recent_panel.xml
	packages/SystemUI/res/values-ar/strings.xml
	packages/SystemUI/res/values-cs/strings.xml
	packages/SystemUI/res/values-da/strings.xml
	packages/SystemUI/res/values-de/strings.xml
	packages/SystemUI/res/values-es-rUS/strings.xml
	packages/SystemUI/res/values-es/strings.xml
	packages/SystemUI/res/values-fa/strings.xml
	packages/SystemUI/res/values-fr/strings.xml
	packages/SystemUI/res/values-hu/strings.xml
	packages/SystemUI/res/values-in/strings.xml
	packages/SystemUI/res/values-it/strings.xml
	packages/SystemUI/res/values-lt/strings.xml
	packages/SystemUI/res/values-nl/strings.xml
	packages/SystemUI/res/values-pl/strings.xml
	packages/SystemUI/res/values-ru/strings.xml
	packages/SystemUI/res/values-vi/strings.xml
	packages/SystemUI/res/values-zh-rCN/strings.xml
	packages/SystemUI/res/values-zh-rTW/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/RecentsPanelView.java
	packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
	packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.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/BatteryController.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
	packages/SystemUI/src/com/android/systemui/usb/StorageNotification.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/KeyguardMessageArea.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/KeyguardViewMediator.java
	policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java
	policy/src/com/android/internal/policy/impl/keyguard_obsolete/KeyguardViewMediator.java
	policy/src/com/android/internal/policy/impl/keyguard_obsolete/LockScreen.java
	policy/src/com/android/internal/policy/impl/keyguard_obsolete/PatternUnlockScreen.java
	preloaded-classes
	services/input/InputReader.cpp
	services/java/com/android/server/AppWidgetService.java
	services/java/com/android/server/AttributeCache.java
	services/java/com/android/server/BluetoothManagerService.java
	services/java/com/android/server/DeviceStorageMonitorService.java
	services/java/com/android/server/LocationManagerService.java
	services/java/com/android/server/NotificationManagerService.java
	services/java/com/android/server/ServiceWatcher.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/WifiService.java
	services/java/com/android/server/am/ActivityManagerService.java
	services/java/com/android/server/am/ActivityRecord.java
	services/java/com/android/server/am/ActivityStack.java
	services/java/com/android/server/am/BroadcastQueue.java
	services/java/com/android/server/connectivity/Tethering.java
	services/java/com/android/server/display/LocalDisplayAdapter.java
	services/java/com/android/server/pm/PackageManagerService.java
	services/java/com/android/server/pm/PackageSettingBase.java
	services/java/com/android/server/pm/Settings.java
	services/java/com/android/server/power/DisplayPowerController.java
	services/java/com/android/server/power/ElectronBeam.java
	services/java/com/android/server/power/PowerManagerService.java
	services/java/com/android/server/wm/ScreenRotationAnimation.java
	services/java/com/android/server/wm/WindowManagerService.java
	services/java/com/android/server/wm/WindowStateAnimator.java
	services/tests/servicestests/src/com/android/server/pm/PackageManagerSettingsTests.java
	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
	tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
	tests/MemoryUsage/src/com/android/tests/memoryusage/MemoryUsageTest.java
	tests/RenderScriptTests/ImageProcessing/AndroidManifest.xml
	tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java
	tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingTest.java
	tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingTestRunner.java
	tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/mandelbrot.rs
	tools/aapt/Android.mk
	tools/aapt/Command.cpp
	tools/aapt/ResourceIdCache.cpp
	tools/aapt/ResourceIdCache.h
	voip/java/android/net/rtp/AudioGroup.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: I3070ad6b037290ccb67069bce650c46b64502396
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
frameworks/base: Fix to remove exception in tonegenerator

- Framework reboot happens, if tonegenerator fails to create
  a track in audioflinger.
- The cause for framework reboot is, an exception thrown by
  tonegenerator if fails to init.
- Fix is to remove the exception and delete the tonegenerator
  instance.
CRs-fixed:466491

Change-Id: Ie7b87f787d8a885cc70be9af4ba9d04ecd691cc2
geofence: Low power geofence HW implementation

HW implemntation overwrites the SW implementation

Change-Id: I8762b0b2e3c5001622f9c8aa2a845ee64104faa3
gps: LocationManager CTS proximity test fix

CTS proximity tests needs to use GeoFenceManager
for GeoFences to be able to see mock locations
CRs-Fixed: 452172

Change-Id: Ie7fca5e8078340e8fbbce6f9bb6a4cc62b72866d
frameworks/base: Add changes for Incall Music Delivery

- Add Flag and Stream type required for incall music delivery.
- Add Tone types for ToneGenerator

Change-Id: Ic05cd1af1172dda3c527af826c6e9a48d6ae20d5
NotificationManager : Rebind the notification listeners onChange

Rebind notification listeners when list of listeners change.

Change-Id: I7a14dacdf7a44a3bd71d28748a70d751507230df
Telephony: fix typo

Change-Id: Ic13235744fca561cff4d49ae5c799420c30a3840