Revert "Clean up my botched attempt at theme engine merge thanks RC and CM"

This reverts commit 84a7da96ce44195faf3cf353bf3fef82d49455ec.
Revert "Bring in TMobile Theme engine from 4.1.2"

This reverts commit a41d0c2e89596e24ec9c83fe888f3684c54bad44.
Rebase of theme engine support.

Updated 4.2 support for the old T-Mobile theme engine, as usual
needs the provider and switcher apps installed as well.

I'm finally dropping the 400+ commit history on this, since everybody
else keeps picking it up from CM as a single patch anyway... But
for the record, nothing of this would be possible without Josh, Ed,
and the rest of the TMo guys who wrote and maintained it until 2.2:

amit chabra <amit.chabra@t-mobile.com>
Amit Kohli <amit.kohli@t-mobile.com>
Chris Cogar <chriscogar@t-mobile.com>
Dirk Sigurdson <dirk.sigurdson@t-mobile.com>
Ed Carrigan <edward.carrigan@t-mobile.com>
Gaurav Sharma <gaurav.sharma3@t-mobile.com>
Hui Feng <hui.feng@t-mobile.com>
John Ritz <john.ritz1@t-mobile.com>
Josh Guilfoyle <josh.guilfoyle@t-mobile.com>
Mark Roberts <mark.roberts48@t-mobile.com>
Pankaj Kumar <Pankaj.kumar6@t-mobile.com>
Samuel Cheung <samuel.cheung@t-mobile.com>
Sergey Ten <sergey.ten6@t-mobile.com>

Change-Id: I7148d51be48f28a2dc4bdf9ec9018f04b268ffc4

Conflicts:
	media/java/android/media/RingtoneManager.java
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
	policy/src/com/android/internal/policy/impl/GlobalActions.java
	services/java/com/android/server/NotificationManagerService.java
	services/java/com/android/server/wm/WindowManagerService.java

Clean up my botched attempt at theme engine merge thanks RC and CM

Squashed commit of the theme engine support.

Updated 4.2 support for the old T-Mobile theme engine, as usual
needs the provider and switcher apps installed as well.

I'm finally dropping the 400+ commit history on this, since everybody
else keeps picking it up from CM as a single patch anyway... But
for the record, nothing of this would be possible without Josh, Ed,
and the rest of the TMo guys who wrote and maintained it until 2.2:

amit chabra <amit.chabra@t-mobile.com>
Amit Kohli <amit.kohli@t-mobile.com>
Chris Cogar <chriscogar@t-mobile.com>
Dirk Sigurdson <dirk.sigurdson@t-mobile.com>
Ed Carrigan <edward.carrigan@t-mobile.com>
Gaurav Sharma <gaurav.sharma3@t-mobile.com>
Hui Feng <hui.feng@t-mobile.com>
John Ritz <john.ritz1@t-mobile.com>
Josh Guilfoyle <josh.guilfoyle@t-mobile.com>
Mark Roberts <mark.roberts48@t-mobile.com>
Pankaj Kumar <Pankaj.kumar6@t-mobile.com>
Samuel Cheung <samuel.cheung@t-mobile.com>
Sergey Ten <sergey.ten6@t-mobile.com>

Change-Id: I7148d51be48f28a2dc4bdf9ec9018f04b268ffc4

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

GlobalActions: Fix dialog dismissal

The themeability of the global actions dialog introduced by
change I644e2e8d7d4abf07bae639b606197d691f16adac broke the
hook that prevented multiple instances of that dialog, and
multiple instances of it will cause framework crashes due to
mismatches variable references (besides looking weird).

Fix it by restoring the original dismissal condition and forcing
a recreation of the theme context if necessary.

Change-Id: Ic6e06bef18fa9e09c84c774fa273f1b7e3bf9630
Toast: fix force close if called from system service

If a toast is created from a system service, an application context
will not be available, use the service context instead.

Fixes
http://code.google.com/p/android/issues/detail?id=40058
http://code.google.com/p/android/issues/detail?id=40075

Change-Id: Ic643f4557fa04476819cd2c3ee640b735eeae429
Add simple caching to XML compilation

XML compilation stage will perform many (expensive) resource ID
lookups - for the same entries. Adding this simple cache can
dramatically improve performance of this stage (often a bottleneck)

Change-Id: Ib1ab82ba9bf901bc2a3f9027b47d680861d6c315
Signed-off-by: Jorrit Jongma <jorrit@jongma.org>
Add simple caching to XML compilation

XML compilation stage will perform many (expensive) resource ID
lookups - for the same entries. Adding this simple cache can
dramatically improve performance of this stage (often a bottleneck)

Change-Id: I61356b6b3f0d90b7ac549b781e3ac8dd02282559
Updated: fixed for Mac OS X (also tested on Windows, Linux)
ActivityManagerService: stay away from zombie content providers

When the lowmemorykiller kills a content provider in an unfortunate
moment, an innocent client app can become attached to a zombie provider
and be unconditionally killed moments after, when the dead provider is
being removed.
Prevent this race by addition of isAlive function to Process.java that
determines whether a process is still running and is not only a zombie,
add a check of the state of the provider process to getContentProviderImpl.

Change-Id: Id753b8dab103e4b447c4138468938ca9f5cb857d
ProcessStats: Fix another crasher

Prevent occurences of:

java.util.NoSuchElementException
	at java.util.StringTokenizer.nextToken(StringTokenizer.java:208)
	at com.android.internal.os.ProcessStats.getCpuSpeedTimes(ProcessStats.java:574)
	at com.android.internal.os.ProcessStats.getLastCpuSpeedTimes(ProcessStats.java:546)
	at com.android.server.am.ActivityManagerService.updateCpuStatsNow(ActivityManagerService.java:1676)
	at com.android.server.am.ActivityManagerService.batteryNeedsCpuUpdate(ActivityManagerService.java:1728)
	at com.android.internal.os.BatteryStatsImpl$MyHandler.handleMessage(BatteryStatsImpl.java:129)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loop(Looper.java:137)
	at com.android.server.am.ActivityManagerService$AThread.run(ActivityManagerService.java:1431)

Change-Id: I66f30739455dd726b708467f814f53c445f327b2