frameworks/base/: Fix black wallpaper issue when home pressed.

In the specified usecase, there is a completely new set of
windows that appear on the screen during rotation. And the
existing code in the framework ignores the drawstate of the
hidden windows.

Wait till the drawState is ready for the hidden windows also.

CRs-Fixed: 521758

Change-Id: Ibd96502059c84210ad84ecb03aac5eca28f3c9fe
Fix sluggish to launch an app

The new trace feature/code in 4.0.4, which will dump the app stack
trace every 500ms if an app cant be launched within 500ms, is
holding the global ActivityManagerService lock unnecessarily. It
slows down the apps startup
Port : Audio in bootanimation from BAMF Team
Take device orientation into account when switching UI layout.

PS2:
Use device rotation value to determine correct orientation.

Change-Id: If19d41727fd6a667a79c71f363b564cd2b6e1d49
PA's hybrid engine

Change-Id: If9d2f6e25a3190c8fbaa30fedd748286f7cb8692

Conflicts:
	core/java/android/provider/Settings.java
	core/java/android/view/IWindowManager.aidl
	core/res/res/values/dimens.xml
	packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
	packages/SystemUI/src/com/android/systemui/statusbar/toggles/PieToggle.java
	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
	services/java/com/android/server/am/ActivityStack.java

Conflicts:
	packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
	services/java/com/android/server/wm/WindowManagerService.java
Remove @hide to compile

Change-Id: I29b051fe2dbcf06c548e07aa4c03952b0d225061