Merge "Make sure the onended event is dispatched even when the user dismisses the video before it plays to completion." into froyo
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index a556a32..fd84859 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -150,13 +150,13 @@
 
     public static IPackageManager getPackageManager() {
         if (sPackageManager != null) {
-            //Log.v("PackageManager", "returning cur default = " + sPackageManager);
+            //Slog.v("PackageManager", "returning cur default = " + sPackageManager);
             return sPackageManager;
         }
         IBinder b = ServiceManager.getService("package");
-        //Log.v("PackageManager", "default service binder = " + b);
+        //Slog.v("PackageManager", "default service binder = " + b);
         sPackageManager = IPackageManager.Stub.asInterface(b);
-        //Log.v("PackageManager", "default service = " + sPackageManager);
+        //Slog.v("PackageManager", "default service = " + sPackageManager);
         return sPackageManager;
     }
 
@@ -170,7 +170,7 @@
         }
         DisplayMetrics metrics = mDisplayMetrics = new DisplayMetrics();
         mDisplay.getMetrics(metrics);
-        //Log.i("foo", "New metrics: w=" + metrics.widthPixels + " h="
+        //Slog.i("foo", "New metrics: w=" + metrics.widthPixels + " h="
         //        + metrics.heightPixels + " den=" + metrics.density
         //        + " xdpi=" + metrics.xdpi + " ydpi=" + metrics.ydpi);
         return metrics;
@@ -189,14 +189,14 @@
         synchronized (mPackages) {
             // Resources is app scale dependent.
             if (false) {
-                Log.w(TAG, "getTopLevelResources: " + resDir + " / "
+                Slog.w(TAG, "getTopLevelResources: " + resDir + " / "
                         + compInfo.applicationScale);
             }
             WeakReference<Resources> wr = mActiveResources.get(key);
             r = wr != null ? wr.get() : null;
             if (r != null && r.getAssets().isUpToDate()) {
                 if (false) {
-                    Log.w(TAG, "Returning cached resources " + r + " " + resDir
+                    Slog.w(TAG, "Returning cached resources " + r + " " + resDir
                             + ": appScale=" + r.getCompatibilityInfo().applicationScale);
                 }
                 return r;
@@ -204,7 +204,7 @@
         }
 
         //if (r != null) {
-        //    Log.w(TAG, "Throwing away out-of-date resources!!!! "
+        //    Slog.w(TAG, "Throwing away out-of-date resources!!!! "
         //            + r + " " + resDir);
         //}
 
@@ -213,11 +213,11 @@
             return null;
         }
 
-        //Log.i(TAG, "Resource: key=" + key + ", display metrics=" + metrics);
+        //Slog.i(TAG, "Resource: key=" + key + ", display metrics=" + metrics);
         DisplayMetrics metrics = getDisplayMetricsLocked(false);
         r = new Resources(assets, metrics, getConfiguration(), compInfo);
         if (false) {
-            Log.i(TAG, "Created app resources " + resDir + " " + r + ": "
+            Slog.i(TAG, "Created app resources " + resDir + " " + r + ": "
                     + r.getConfiguration() + " appScale="
                     + r.getCompatibilityInfo().applicationScale);
         }
@@ -306,7 +306,7 @@
                     mSystemContext.getResources().updateConfiguration(
                              mainThread.getConfiguration(),
                              mainThread.getDisplayMetricsLocked(false));
-                    //Log.i(TAG, "Created system resources "
+                    //Slog.i(TAG, "Created system resources "
                     //        + mSystemContext.getResources() + ": "
                     //        + mSystemContext.getResources().getConfiguration());
                 }
@@ -465,7 +465,7 @@
                      * create the class loader.
                      */
 
-                    if (localLOGV) Log.v(TAG, "Class path: " + zip);
+                    if (localLOGV) Slog.v(TAG, "Class path: " + zip);
 
                     mClassLoader =
                         ApplicationLoaders.getDefault().getClassLoader(
@@ -692,7 +692,7 @@
                 }
             }
             mUnregisteredReceivers.remove(context);
-            //Log.i(TAG, "Receiver registrations: " + mReceivers);
+            //Slog.i(TAG, "Receiver registrations: " + mReceivers);
             HashMap<ServiceConnection, ServiceDispatcher> smap =
                 mServices.remove(context);
             if (smap != null) {
@@ -714,7 +714,7 @@
                 }
             }
             mUnboundServices.remove(context);
-            //Log.i(TAG, "Service registrations: " + mServices);
+            //Slog.i(TAG, "Service registrations: " + mServices);
         }
 
         public IIntentReceiver getReceiverDispatcher(BroadcastReceiver r,
@@ -810,8 +810,8 @@
                     ReceiverDispatcher rd = mDispatcher.get();
                     if (DEBUG_BROADCAST) {
                         int seq = intent.getIntExtra("seq", -1);
-                        Log.i(TAG, "Receiving broadcast " + intent.getAction() + " seq=" + seq
-                                + " to " + rd);
+                        Slog.i(TAG, "Receiving broadcast " + intent.getAction() + " seq=" + seq
+                                + " to " + (rd != null ? rd.mReceiver : null));
                     }
                     if (rd != null) {
                         rd.performReceive(intent, resultCode, data, extras,
@@ -821,9 +821,8 @@
                         // receiver in this process, but before it could be delivered the
                         // receiver was unregistered.  Acknowledge the broadcast on its
                         // behalf so that the system's broadcast sequence can continue.
-                        if (DEBUG_BROADCAST) {
-                            Log.i(TAG, "Broadcast to unregistered receiver");
-                        }
+                        if (DEBUG_BROADCAST) Slog.i(TAG,
+                                "Finishing broadcast to unregistered receiver");
                         IActivityManager mgr = ActivityManagerNative.getDefault();
                         try {
                             mgr.finishReceiver(this, resultCode, data, extras, false);
@@ -855,16 +854,29 @@
                     BroadcastReceiver receiver = mReceiver;
                     if (DEBUG_BROADCAST) {
                         int seq = mCurIntent.getIntExtra("seq", -1);
-                        Log.i(TAG, "Dispatching broadcast " + mCurIntent.getAction()
+                        Slog.i(TAG, "Dispatching broadcast " + mCurIntent.getAction()
                                 + " seq=" + seq + " to " + mReceiver);
+                        Slog.i(TAG, "  mRegistered=" + mRegistered
+                                + " mCurOrdered=" + mCurOrdered);
                     }
-                    if (receiver == null) {
-                        return;
-                    }
-
+                    
                     IActivityManager mgr = ActivityManagerNative.getDefault();
                     Intent intent = mCurIntent;
                     mCurIntent = null;
+                    
+                    if (receiver == null) {
+                        if (mRegistered && mCurOrdered) {
+                            try {
+                                if (DEBUG_BROADCAST) Slog.i(TAG,
+                                        "Finishing null broadcast to " + mReceiver);
+                                mgr.finishReceiver(mIIntentReceiver,
+                                        mCurCode, mCurData, mCurMap, false);
+                            } catch (RemoteException ex) {
+                            }
+                        }
+                        return;
+                    }
+
                     try {
                         ClassLoader cl =  mReceiver.getClass().getClassLoader();
                         intent.setExtrasClassLoader(cl);
@@ -880,6 +892,8 @@
                     } catch (Exception e) {
                         if (mRegistered && mCurOrdered) {
                             try {
+                                if (DEBUG_BROADCAST) Slog.i(TAG,
+                                        "Finishing failed broadcast to " + mReceiver);
                                 mgr.finishReceiver(mIIntentReceiver,
                                         mCurCode, mCurData, mCurMap, false);
                             } catch (RemoteException ex) {
@@ -894,6 +908,8 @@
                     }
                     if (mRegistered && mCurOrdered) {
                         try {
+                            if (DEBUG_BROADCAST) Slog.i(TAG,
+                                    "Finishing broadcast to " + mReceiver);
                             mgr.finishReceiver(mIIntentReceiver,
                                     receiver.getResultCode(),
                                     receiver.getResultData(),
@@ -961,7 +977,7 @@
                     String data, Bundle extras, boolean ordered, boolean sticky) {
                 if (DEBUG_BROADCAST) {
                     int seq = intent.getIntExtra("seq", -1);
-                    Log.i(TAG, "Enqueueing broadcast " + intent.getAction() + " seq=" + seq
+                    Slog.i(TAG, "Enqueueing broadcast " + intent.getAction() + " seq=" + seq
                             + " to " + mReceiver);
                 }
                 Args args = new Args();
@@ -972,9 +988,11 @@
                 args.mCurOrdered = ordered;
                 args.mCurSticky = sticky;
                 if (!mActivityThread.post(args)) {
-                    if (mRegistered) {
+                    if (mRegistered && ordered) {
                         IActivityManager mgr = ActivityManagerNative.getDefault();
                         try {
+                            if (DEBUG_BROADCAST) Slog.i(TAG,
+                                    "Finishing sync broadcast to " + mReceiver);
                             mgr.finishReceiver(mIIntentReceiver, args.mCurCode,
                                     args.mCurData, args.mCurMap, false);
                         } catch (RemoteException ex) {
@@ -2133,7 +2151,7 @@
                 IActivityManager am = ActivityManagerNative.getDefault();
                 ActivityRecord prev;
                 do {
-                    if (localLOGV) Log.v(
+                    if (localLOGV) Slog.v(
                         TAG, "Reporting idle of " + a +
                         " finished=" +
                         (a.activity != null ? a.activity.mFinished : false));
@@ -2252,7 +2270,7 @@
                 ref = mResourcePackages.get(packageName);
             }
             PackageInfo packageInfo = ref != null ? ref.get() : null;
-            //Log.i(TAG, "getPackageInfo " + packageName + ": " + packageInfo);
+            //Slog.i(TAG, "getPackageInfo " + packageName + ": " + packageInfo);
             if (packageInfo != null && (packageInfo.mResources == null
                     || packageInfo.mResources.getAssets().isUpToDate())) {
                 if (packageInfo.isSecurityViolation()
@@ -2319,7 +2337,7 @@
             PackageInfo packageInfo = ref != null ? ref.get() : null;
             if (packageInfo == null || (packageInfo.mResources != null
                     && !packageInfo.mResources.getAssets().isUpToDate())) {
-                if (localLOGV) Log.v(TAG, (includeCode ? "Loading code package "
+                if (localLOGV) Slog.v(TAG, (includeCode ? "Loading code package "
                         : "Loading resource-only package ") + aInfo.packageName
                         + " (in " + (mBoundApplication != null
                                 ? mBoundApplication.processName : null)
@@ -2402,7 +2420,7 @@
                 context.getResources().updateConfiguration(
                         getConfiguration(), getDisplayMetricsLocked(false));
                 mSystemContext = context;
-                //Log.i(TAG, "Created system resources " + context.getResources()
+                //Slog.i(TAG, "Created system resources " + context.getResources()
                 //        + ": " + context.getResources().getConfiguration());
             }
         }
@@ -2442,10 +2460,10 @@
     void doGcIfNeeded() {
         mGcIdlerScheduled = false;
         final long now = SystemClock.uptimeMillis();
-        //Log.i(TAG, "**** WE MIGHT WANT TO GC: then=" + Binder.getLastGcTime()
+        //Slog.i(TAG, "**** WE MIGHT WANT TO GC: then=" + Binder.getLastGcTime()
         //        + "m now=" + now);
         if ((BinderInternal.getLastGcTime()+MIN_TIME_BETWEEN_GCS) < now) {
-            //Log.i(TAG, "**** WE DO, WE DO WANT TO GC!");
+            //Slog.i(TAG, "**** WE DO, WE DO WANT TO GC!");
             BinderInternal.forceGc("bg");
         }
     }
@@ -2481,7 +2499,7 @@
             } else {
                 name = "(Intent " + intent + ").getComponent() returned null";
             }
-            Log.v(TAG, "Performing launch: action=" + intent.getAction()
+            Slog.v(TAG, "Performing launch: action=" + intent.getAction()
                     + ", comp=" + name
                     + ", token=" + token);
         }
@@ -2495,7 +2513,7 @@
     public final void sendActivityResult(
             IBinder token, String id, int requestCode,
             int resultCode, Intent data) {
-        if (DEBUG_RESULTS) Log.v(TAG, "sendActivityResult: id=" + id
+        if (DEBUG_RESULTS) Slog.v(TAG, "sendActivityResult: id=" + id
                 + " req=" + requestCode + " res=" + resultCode + " data=" + data);
         ArrayList<ResultInfo> list = new ArrayList<ResultInfo>();
         list.add(new ResultInfo(id, requestCode, resultCode, data));
@@ -2514,7 +2532,7 @@
 
     private final void queueOrSendMessage(int what, Object obj, int arg1, int arg2) {
         synchronized (this) {
-            if (localLOGV) Log.v(
+            if (localLOGV) Slog.v(
                 TAG, "SCHEDULE " + what + " " + mH.codeToString(what)
                 + ": " + arg1 + " / " + obj);
             Message msg = Message.obtain();
@@ -2576,8 +2594,8 @@
         try {
             Application app = r.packageInfo.makeApplication(false, mInstrumentation);
 
-            if (localLOGV) Log.v(TAG, "Performing launch of " + r);
-            if (localLOGV) Log.v(
+            if (localLOGV) Slog.v(TAG, "Performing launch of " + r);
+            if (localLOGV) Slog.v(
                     TAG, r + ": app=" + app
                     + ", appName=" + app.getPackageName()
                     + ", pkg=" + r.packageInfo.getPackageName()
@@ -2590,7 +2608,7 @@
                 appContext.setOuterContext(activity);
                 CharSequence title = r.activityInfo.loadLabel(appContext.getPackageManager());
                 Configuration config = new Configuration(mConfiguration);
-                if (DEBUG_CONFIGURATION) Log.v(TAG, "Launching activity "
+                if (DEBUG_CONFIGURATION) Slog.v(TAG, "Launching activity "
                         + r.activityInfo.name + " with config " + config);
                 activity.attach(appContext, this, getInstrumentation(), r.token,
                         r.ident, app, r.intent, r.activityInfo, title, r.parent,
@@ -2659,7 +2677,7 @@
         // we are back active so skip it.
         unscheduleGcIdler();
 
-        if (localLOGV) Log.v(
+        if (localLOGV) Slog.v(
             TAG, "Handling launch of " + r);
         Activity a = performLaunchActivity(r, customIntent);
 
@@ -2765,6 +2783,8 @@
             receiver = (BroadcastReceiver)cl.loadClass(component).newInstance();
         } catch (Exception e) {
             try {
+                if (DEBUG_BROADCAST) Slog.i(TAG,
+                        "Finishing failed broadcast to " + data.intent.getComponent());
                 mgr.finishReceiver(mAppThread.asBinder(), data.resultCode,
                                    data.resultData, data.resultExtras, data.resultAbort);
             } catch (RemoteException ex) {
@@ -2777,7 +2797,7 @@
         try {
             Application app = packageInfo.makeApplication(false, mInstrumentation);
 
-            if (localLOGV) Log.v(
+            if (localLOGV) Slog.v(
                 TAG, "Performing receive of " + data.intent
                 + ": app=" + app
                 + ", appName=" + app.getPackageName()
@@ -2794,6 +2814,8 @@
                     data.intent);
         } catch (Exception e) {
             try {
+                if (DEBUG_BROADCAST) Slog.i(TAG,
+                        "Finishing failed broadcast to " + data.intent.getComponent());
                 mgr.finishReceiver(mAppThread.asBinder(), data.resultCode,
                     data.resultData, data.resultExtras, data.resultAbort);
             } catch (RemoteException ex) {
@@ -2807,11 +2829,15 @@
 
         try {
             if (data.sync) {
+                if (DEBUG_BROADCAST) Slog.i(TAG,
+                        "Finishing ordered broadcast to " + data.intent.getComponent());
                 mgr.finishReceiver(
                     mAppThread.asBinder(), receiver.getResultCode(),
                     receiver.getResultData(), receiver.getResultExtras(false),
                         receiver.getAbortBroadcast());
             } else {
+                if (DEBUG_BROADCAST) Slog.i(TAG,
+                        "Finishing broadcast to " + data.intent.getComponent());
                 mgr.finishReceiver(mAppThread.asBinder(), 0, null, null, false);
             }
         } catch (RemoteException ex) {
@@ -2820,7 +2846,7 @@
 
     // Instantiate a BackupAgent and tell it that it's alive
     private final void handleCreateBackupAgent(CreateBackupAgentData data) {
-        if (DEBUG_BACKUP) Log.v(TAG, "handleCreateBackupAgent: " + data);
+        if (DEBUG_BACKUP) Slog.v(TAG, "handleCreateBackupAgent: " + data);
 
         // no longer idle; we have backup work to do
         unscheduleGcIdler();
@@ -2829,7 +2855,7 @@
         PackageInfo packageInfo = getPackageInfoNoCheck(data.appInfo);
         String packageName = packageInfo.mPackageName;
         if (mBackupAgents.get(packageName) != null) {
-            Log.d(TAG, "BackupAgent " + "  for " + packageName
+            Slog.d(TAG, "BackupAgent " + "  for " + packageName
                     + " already exists");
             return;
         }
@@ -2851,7 +2877,7 @@
                 agent = (BackupAgent) cl.loadClass(data.appInfo.backupAgentName).newInstance();
 
                 // set up the agent's context
-                if (DEBUG_BACKUP) Log.v(TAG, "Initializing BackupAgent "
+                if (DEBUG_BACKUP) Slog.v(TAG, "Initializing BackupAgent "
                         + data.appInfo.backupAgentName);
 
                 ContextImpl context = new ContextImpl();
@@ -2886,7 +2912,7 @@
 
     // Tear down a BackupAgent
     private final void handleDestroyBackupAgent(CreateBackupAgentData data) {
-        if (DEBUG_BACKUP) Log.v(TAG, "handleDestroyBackupAgent: " + data);
+        if (DEBUG_BACKUP) Slog.v(TAG, "handleDestroyBackupAgent: " + data);
 
         PackageInfo packageInfo = getPackageInfoNoCheck(data.appInfo);
         String packageName = packageInfo.mPackageName;
@@ -2924,7 +2950,7 @@
         }
 
         try {
-            if (localLOGV) Log.v(TAG, "Creating service " + data.info.name);
+            if (localLOGV) Slog.v(TAG, "Creating service " + data.info.name);
 
             ContextImpl context = new ContextImpl();
             context.init(packageInfo, null, this);
@@ -3049,7 +3075,7 @@
         Service s = mServices.remove(token);
         if (s != null) {
             try {
-                if (localLOGV) Log.v(TAG, "Destroying service " + s);
+                if (localLOGV) Slog.v(TAG, "Destroying service " + s);
                 s.onDestroy();
                 Context context = s.getBaseContext();
                 if (context instanceof ContextImpl) {
@@ -3070,13 +3096,13 @@
                 }
             }
         }
-        //Log.i(TAG, "Running services: " + mServices);
+        //Slog.i(TAG, "Running services: " + mServices);
     }
 
     public final ActivityRecord performResumeActivity(IBinder token,
             boolean clearHide) {
         ActivityRecord r = mActivities.get(token);
-        if (localLOGV) Log.v(TAG, "Performing resume of " + r
+        if (localLOGV) Slog.v(TAG, "Performing resume of " + r
                 + " finished=" + r.activity.mFinished);
         if (r != null && !r.activity.mFinished) {
             if (clearHide) {
@@ -3122,7 +3148,7 @@
         if (r != null) {
             final Activity a = r.activity;
 
-            if (localLOGV) Log.v(
+            if (localLOGV) Slog.v(
                 TAG, "Resume " + r + " started activity: " +
                 a.mStartedActivity + ", hideForNow: " + r.hideForNow
                 + ", finished: " + a.mFinished);
@@ -3159,7 +3185,7 @@
             // we started another activity, then don't yet make the
             // window visible.
             } else if (!willBeVisible) {
-                if (localLOGV) Log.v(
+                if (localLOGV) Slog.v(
                     TAG, "Launch " + r + " mStartedActivity set");
                 r.hideForNow = true;
             }
@@ -3169,12 +3195,12 @@
             if (!r.activity.mFinished && willBeVisible
                     && r.activity.mDecor != null && !r.hideForNow) {
                 if (r.newConfig != null) {
-                    if (DEBUG_CONFIGURATION) Log.v(TAG, "Resuming activity "
+                    if (DEBUG_CONFIGURATION) Slog.v(TAG, "Resuming activity "
                             + r.activityInfo.name + " with newConfig " + r.newConfig);
                     performConfigurationChanged(r.activity, r.newConfig);
                     r.newConfig = null;
                 }
-                if (localLOGV) Log.v(TAG, "Resuming " + r + " with isForward="
+                if (localLOGV) Slog.v(TAG, "Resuming " + r + " with isForward="
                         + isForward);
                 WindowManager.LayoutParams l = r.window.getAttributes();
                 if ((l.softInputMode
@@ -3198,7 +3224,7 @@
 
             r.nextIdle = mNewActivities;
             mNewActivities = r;
-            if (localLOGV) Log.v(
+            if (localLOGV) Slog.v(
                 TAG, "Scheduling idle handler for " + r);
             Looper.myQueue().addIdleHandler(new Idler());
 
@@ -3256,7 +3282,7 @@
             boolean userLeaving, int configChanges) {
         ActivityRecord r = mActivities.get(token);
         if (r != null) {
-            //Log.v(TAG, "userLeaving=" + userLeaving + " handling pause of " + r);
+            //Slog.v(TAG, "userLeaving=" + userLeaving + " handling pause of " + r);
             if (userLeaving) {
                 performUserLeavingActivity(r);
             }
@@ -3351,7 +3377,7 @@
 
     private final void performStopActivityInner(ActivityRecord r,
             StopInfo info, boolean keepShown) {
-        if (localLOGV) Log.v(TAG, "Performing stop of " + r);
+        if (localLOGV) Slog.v(TAG, "Performing stop of " + r);
         if (r != null) {
             if (!keepShown && r.stopped) {
                 if (r.activity.mFinished) {
@@ -3412,7 +3438,7 @@
                     }
                 }
                 if (r.newConfig != null) {
-                    if (DEBUG_CONFIGURATION) Log.v(TAG, "Updating activity vis "
+                    if (DEBUG_CONFIGURATION) Slog.v(TAG, "Updating activity vis "
                             + r.activityInfo.name + " with new config " + r.newConfig);
                     performConfigurationChanged(r.activity, r.newConfig);
                     r.newConfig = null;
@@ -3434,7 +3460,7 @@
         StopInfo info = new StopInfo();
         performStopActivityInner(r, info, show);
 
-        if (localLOGV) Log.v(
+        if (localLOGV) Slog.v(
             TAG, "Finishing stop of " + r + ": show=" + show
             + " win=" + r.window);
 
@@ -3469,7 +3495,7 @@
             r.stopped = false;
         }
         if (r.activity.mDecor != null) {
-            if (Config.LOGV) Log.v(
+            if (Config.LOGV) Slog.v(
                 TAG, "Handle window " + r + " visibility: " + show);
             updateVisibility(r, show);
         }
@@ -3483,7 +3509,7 @@
                 if (ri.mData != null) {
                     ri.mData.setExtrasClassLoader(r.activity.getClassLoader());
                 }
-                if (DEBUG_RESULTS) Log.v(TAG,
+                if (DEBUG_RESULTS) Slog.v(TAG,
                         "Delivering result to activity " + r + " : " + ri);
                 r.activity.dispatchActivityResult(ri.mResultWho,
                         ri.mRequestCode, ri.mResultCode, ri.mData);
@@ -3500,7 +3526,7 @@
 
     private final void handleSendResult(ResultData res) {
         ActivityRecord r = mActivities.get(res.token);
-        if (DEBUG_RESULTS) Log.v(TAG, "Handling send result to " + r);
+        if (DEBUG_RESULTS) Slog.v(TAG, "Handling send result to " + r);
         if (r != null) {
             final boolean resumed = !r.paused;
             if (!r.activity.mFinished && r.activity.mDecor != null
@@ -3545,7 +3571,7 @@
     private final ActivityRecord performDestroyActivity(IBinder token, boolean finishing,
             int configChanges, boolean getNonConfigInstance) {
         ActivityRecord r = mActivities.get(token);
-        if (localLOGV) Log.v(TAG, "Performing finish of " + r);
+        if (localLOGV) Slog.v(TAG, "Performing finish of " + r);
         if (r != null) {
             r.activity.mConfigChangeFlags |= configChanges;
             if (finishing) {
@@ -3695,7 +3721,7 @@
 
         Configuration changedConfig = null;
 
-        if (DEBUG_CONFIGURATION) Log.v(TAG, "Relaunching activity "
+        if (DEBUG_CONFIGURATION) Slog.v(TAG, "Relaunching activity "
                 + tmp.token + " with configChanges=0x"
                 + Integer.toHexString(configChanges));
         
@@ -3717,7 +3743,7 @@
             }
 
             if (tmp == null) {
-                if (DEBUG_CONFIGURATION) Log.v(TAG, "Abort, activity not relaunching!");
+                if (DEBUG_CONFIGURATION) Slog.v(TAG, "Abort, activity not relaunching!");
                 return;
             }
 
@@ -3741,7 +3767,7 @@
             }
         }
         
-        if (DEBUG_CONFIGURATION) Log.v(TAG, "Relaunching activity "
+        if (DEBUG_CONFIGURATION) Slog.v(TAG, "Relaunching activity "
                 + tmp.token + ": changedConfig=" + changedConfig);
         
         // If there was a pending configuration change, execute it first.
@@ -3750,7 +3776,7 @@
         }
 
         ActivityRecord r = mActivities.get(tmp.token);
-        if (DEBUG_CONFIGURATION) Log.v(TAG, "Handling relaunch of " + r);
+        if (DEBUG_CONFIGURATION) Slog.v(TAG, "Handling relaunch of " + r);
         if (r == null) {
             return;
         }
@@ -3836,7 +3862,7 @@
                         // the activity manager may, before then, decide the
                         // activity needs to be destroyed to handle its new
                         // configuration.
-                        if (DEBUG_CONFIGURATION) Log.v(TAG, "Setting activity "
+                        if (DEBUG_CONFIGURATION) Slog.v(TAG, "Setting activity "
                                 + ar.activityInfo.name + " newConfig=" + newConfig);
                         ar.newConfig = newConfig;
                     }
@@ -3895,7 +3921,7 @@
             }
         }
 
-        if (DEBUG_CONFIGURATION) Log.v(TAG, "Config callback " + cb
+        if (DEBUG_CONFIGURATION) Slog.v(TAG, "Config callback " + cb
                 + ": shouldChangeConfig=" + shouldChangeConfig);
         if (shouldChangeConfig) {
             cb.onConfigurationChanged(config);
@@ -3917,7 +3943,7 @@
             mResConfiguration = new Configuration();
         }
         if (!mResConfiguration.isOtherSeqNewer(config)) {
-            if (DEBUG_CONFIGURATION) Log.v(TAG, "Skipping new config: curSeq="
+            if (DEBUG_CONFIGURATION) Slog.v(TAG, "Skipping new config: curSeq="
                     + mResConfiguration.seq + ", newSeq=" + config.seq);
             return false;
         }
@@ -3932,7 +3958,7 @@
         Resources.updateSystemConfiguration(config, dm);
 
         ContextImpl.ApplicationPackageManager.configurationChanged();
-        //Log.i(TAG, "Configuration changed in " + currentPackageName());
+        //Slog.i(TAG, "Configuration changed in " + currentPackageName());
         
         Iterator<WeakReference<Resources>> it =
             mActiveResources.values().iterator();
@@ -3942,13 +3968,13 @@
             WeakReference<Resources> v = it.next();
             Resources r = v.get();
             if (r != null) {
-                if (DEBUG_CONFIGURATION) Log.v(TAG, "Changing resources "
+                if (DEBUG_CONFIGURATION) Slog.v(TAG, "Changing resources "
                         + r + " config to: " + config);
                 r.updateConfiguration(config, dm);
-                //Log.i(TAG, "Updated app resources " + v.getKey()
+                //Slog.i(TAG, "Updated app resources " + v.getKey()
                 //        + " " + r + ": " + r.getConfiguration());
             } else {
-                //Log.i(TAG, "Removing old resources " + v.getKey());
+                //Slog.i(TAG, "Removing old resources " + v.getKey());
                 it.remove();
             }
         }
@@ -3972,7 +3998,7 @@
                 return;
             }
             
-            if (DEBUG_CONFIGURATION) Log.v(TAG, "Handle configuration changed: "
+            if (DEBUG_CONFIGURATION) Slog.v(TAG, "Handle configuration changed: "
                     + config);
         
             applyConfigurationToResourcesLocked(config);
@@ -4002,7 +4028,7 @@
             return;
         }
 
-        if (DEBUG_CONFIGURATION) Log.v(TAG, "Handle activity config changed: "
+        if (DEBUG_CONFIGURATION) Slog.v(TAG, "Handle activity config changed: "
                 + r.activityInfo.name);
         
         performConfigurationChanged(r.activity, mConfiguration);
@@ -4095,7 +4121,7 @@
             // XXX should have option to change the port.
             Debug.changeDebugPort(8100);
             if (data.debugMode == IApplicationThread.DEBUG_WAIT) {
-                Log.w(TAG, "Application " + data.info.getPackageName()
+                Slog.w(TAG, "Application " + data.info.getPackageName()
                       + " is waiting for the debugger on port 8100...");
 
                 IActivityManager mgr = ActivityManagerNative.getDefault();
@@ -4112,7 +4138,7 @@
                 }
 
             } else {
-                Log.w(TAG, "Application " + data.info.getPackageName()
+                Slog.w(TAG, "Application " + data.info.getPackageName()
                       + " can be debugged on port 8100...");
             }
         }
@@ -4208,7 +4234,7 @@
         if (mBoundApplication.profileFile != null && mBoundApplication.handlingProfiling) {
             Debug.stopMethodTracing();
         }
-        //Log.i(TAG, "am: " + ActivityManagerNative.getDefault()
+        //Slog.i(TAG, "am: " + ActivityManagerNative.getDefault()
         //      + ", app thr: " + mAppThread);
         try {
             am.finishInstrumentation(mAppThread, resultCode, results);
@@ -4275,12 +4301,12 @@
 
         IContentProvider prov = installProvider(context, holder.provider,
                 holder.info, true);
-        //Log.i(TAG, "noReleaseNeeded=" + holder.noReleaseNeeded);
+        //Slog.i(TAG, "noReleaseNeeded=" + holder.noReleaseNeeded);
         if (holder.noReleaseNeeded || holder.provider == null) {
             // We are not going to release the provider if it is an external
             // provider that doesn't care about being released, or if it is
             // a local provider running in this process.
-            //Log.i(TAG, "*** NO RELEASE NEEDED");
+            //Slog.i(TAG, "*** NO RELEASE NEEDED");
             synchronized(mProviderMap) {
                 mProviderRefCountMap.put(prov.asBinder(), new ProviderRefCount(10000));
             }
@@ -4312,7 +4338,7 @@
         synchronized(mProviderMap) {
             ProviderRefCount prc = mProviderRefCountMap.get(jBinder);
             if(prc == null) {
-                if(localLOGV) Log.v(TAG, "releaseProvider::Weird shouldnt be here");
+                if(localLOGV) Slog.v(TAG, "releaseProvider::Weird shouldnt be here");
                 return false;
             } else {
                 prc.count--;
@@ -4344,7 +4370,7 @@
         
         if (name != null) {
             try {
-                if(localLOGV) Log.v(TAG, "removeProvider::Invoking " +
+                if(localLOGV) Slog.v(TAG, "removeProvider::Invoking " +
                         "ActivityManagerNative.removeContentProvider(" + name);
                 ActivityManagerNative.getDefault().removeContentProvider(
                         getApplicationThread(), name);
@@ -4370,10 +4396,10 @@
             if (myBinder == providerBinder) {
                 //find if its published by this process itself
                 if(pr.mLocalProvider != null) {
-                    if(localLOGV) Log.i(TAG, "removeProvider::found local provider returning");
+                    if(localLOGV) Slog.i(TAG, "removeProvider::found local provider returning");
                     return name;
                 }
-                if(localLOGV) Log.v(TAG, "removeProvider::Not local provider Unlinking " +
+                if(localLOGV) Slog.v(TAG, "removeProvider::Not local provider Unlinking " +
                         "death recipient");
                 //content provider is in another process
                 myBinder.unlinkToDeath(pr, 0);
@@ -4392,7 +4418,7 @@
         synchronized(mProviderMap) {
             ProviderRecord pr = mProviderMap.get(name);
             if (pr.mProvider.asBinder() == provider.asBinder()) {
-                Log.i(TAG, "Removing dead content provider: " + name);
+                Slog.i(TAG, "Removing dead content provider: " + name);
                 ProviderRecord removed = mProviderMap.remove(name);
                 if (removed != null) {
                     removed.mProvider.asBinder().unlinkToDeath(removed, 0);
@@ -4404,7 +4430,7 @@
     final void removeDeadProviderLocked(String name, IContentProvider provider) {
         ProviderRecord pr = mProviderMap.get(name);
         if (pr.mProvider.asBinder() == provider.asBinder()) {
-            Log.i(TAG, "Removing dead content provider: " + name);
+            Slog.i(TAG, "Removing dead content provider: " + name);
             ProviderRecord removed = mProviderMap.remove(name);
             if (removed != null) {
                 removed.mProvider.asBinder().unlinkToDeath(removed, 0);
@@ -4417,7 +4443,7 @@
         ContentProvider localProvider = null;
         if (provider == null) {
             if (noisy) {
-                Log.d(TAG, "Loading provider " + info.authority + ": "
+                Slog.d(TAG, "Loading provider " + info.authority + ": "
                         + info.name);
             }
             Context c = null;
@@ -4452,7 +4478,7 @@
                           info.applicationInfo.sourceDir);
                     return null;
                 }
-                if (Config.LOGV) Log.v(
+                if (Config.LOGV) Slog.v(
                     TAG, "Instantiating local provider " + info.name);
                 // XXX Need to create the correct context for this provider.
                 localProvider.attachInfo(c, info);
@@ -4465,7 +4491,7 @@
                 return null;
             }
         } else if (localLOGV) {
-            Log.v(TAG, "Installing external provider " + info.authority + ": "
+            Slog.v(TAG, "Installing external provider " + info.authority + ": "
                     + info.name);
         }
 
@@ -4586,6 +4612,6 @@
         String name = (thread.mInitialApplication != null)
             ? thread.mInitialApplication.getPackageName()
             : "<unknown>";
-        Log.i(TAG, "Main thread of " + name + " is now exiting");
+        Slog.i(TAG, "Main thread of " + name + " is now exiting");
     }
 }
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 9019af6..fd0edaa 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -796,7 +796,7 @@
                     scheduler = mMainThread.getHandler();
                 }
                 rd = new ActivityThread.PackageInfo.ReceiverDispatcher(
-                        receiver, context, scheduler, null, false).getIIntentReceiver();
+                        receiver, context, scheduler, null, true).getIIntentReceiver();
             }
         }
         try {
diff --git a/core/res/res/drawable-hdpi/stat_sys_throttle_warning.png b/core/res/res/drawable-hdpi/stat_sys_throttle_warning.png
deleted file mode 100644
index c42b00c..0000000
--- a/core/res/res/drawable-hdpi/stat_sys_throttle_warning.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_throttled.png b/core/res/res/drawable-hdpi/stat_sys_throttled.png
index e43fbae..33c0521 100644
--- a/core/res/res/drawable-hdpi/stat_sys_throttled.png
+++ b/core/res/res/drawable-hdpi/stat_sys_throttled.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/stat_sys_throttle_warning.png b/core/res/res/drawable-mdpi/stat_sys_throttle_warning.png
deleted file mode 100644
index 3688803..0000000
--- a/core/res/res/drawable-mdpi/stat_sys_throttle_warning.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/stat_sys_throttled.png b/core/res/res/drawable-mdpi/stat_sys_throttled.png
index efb64ad..97ac427 100644
--- a/core/res/res/drawable-mdpi/stat_sys_throttled.png
+++ b/core/res/res/drawable-mdpi/stat_sys_throttled.png
Binary files differ
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index 594e010..a6d8d2c 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -747,6 +747,11 @@
         }
     }
 
+    // Use PV_PLAYER for rtsp for now
+    if (!strncasecmp(url, "rtsp://", 7)) {
+        return PV_PLAYER;
+    }
+
     return getDefaultPlayerType();
 }
 
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index 78f7b33..7babb34 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -179,6 +179,8 @@
     static final int SCAN_NEW_INSTALL = 1<<4;
     static final int SCAN_NO_PATHS = 1<<5;
 
+    static final int REMOVE_CHATTY = 1<<16;
+    
     static final ComponentName DEFAULT_CONTAINER_COMPONENT = new ComponentName(
             "com.android.defcontainer",
             "com.android.defcontainer.DefaultContainerService");
@@ -6068,7 +6070,8 @@
         }
         
         synchronized (mInstallLock) {
-            res = deletePackageLI(packageName, deleteCodeAndResources, flags, info);
+            res = deletePackageLI(packageName, deleteCodeAndResources,
+                    flags | REMOVE_CHATTY, info);
         }
 
         if(res && sendBroadCast) {
@@ -6134,7 +6137,7 @@
         if (outInfo != null) {
             outInfo.removedPackage = packageName;
         }
-        removePackageLI(p, true);
+        removePackageLI(p, (flags&REMOVE_CHATTY) != 0);
         // Retrieve object to delete permissions for shared user later on
         PackageSetting deletedPs;
         synchronized (mPackages) {
@@ -9589,8 +9592,7 @@
                    continue;
                }
                // Parse package
-               int parseFlags = PackageParser.PARSE_CHATTY |
-                       PackageParser.PARSE_ON_SDCARD | mDefParseFlags;
+               int parseFlags = PackageParser.PARSE_ON_SDCARD | mDefParseFlags;
                doGc = true;
                synchronized (mInstallLock) {
                    final PackageParser.Package pkg =  scanPackageLI(new File(codePath),
diff --git a/services/java/com/android/server/ThrottleService.java b/services/java/com/android/server/ThrottleService.java
index 16fd104..9333dd8 100644
--- a/services/java/com/android/server/ThrottleService.java
+++ b/services/java/com/android/server/ThrottleService.java
@@ -425,7 +425,7 @@
                     }
 
                     mNotificationManager.cancel(com.android.internal.R.drawable.
-                            stat_sys_throttle_warning);
+                            stat_sys_throttled);
 
                     postNotification(com.android.internal.R.string.throttled_notification_title,
                             com.android.internal.R.string.throttled_notification_message,
@@ -460,18 +460,18 @@
                         if (mWarningNotificationSent == false) {
                             mWarningNotificationSent = true;
                             mNotificationManager.cancel(com.android.internal.R.drawable.
-                                    stat_sys_throttle_warning);
+                                    stat_sys_throttled);
                             postNotification(com.android.internal.R.string.
                                     throttle_warning_notification_title,
                                     com.android.internal.R.string.
                                     throttle_warning_notification_message,
-                                    com.android.internal.R.drawable.stat_sys_throttle_warning,
+                                    com.android.internal.R.drawable.stat_sys_throttled,
                                     0);
                         }
                     } else {
                         if (mWarningNotificationSent == true) {
                             mNotificationManager.cancel(com.android.internal.R.drawable.
-                                    stat_sys_throttle_warning);
+                                    stat_sys_throttled);
                             mWarningNotificationSent =false;
                         }
                     }
@@ -519,7 +519,6 @@
                 broadcast.putExtra(ThrottleManager.EXTRA_THROTTLE_LEVEL, -1);
                 mContext.sendStickyBroadcast(broadcast);
             }
-            mNotificationManager.cancel(com.android.internal.R.drawable.stat_sys_throttle_warning);
             mNotificationManager.cancel(com.android.internal.R.drawable.stat_sys_throttled);
             mWarningNotificationSent = false;
         }
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index b6f323d..1486a1d 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -9905,7 +9905,7 @@
             }
             if (mOrderedBroadcasts.size() > 0) {
                 pw.println(" ");
-                pw.println("  Active serialized broadcasts:");
+                pw.println("  Active ordered broadcasts:");
             }
             for (int i=mOrderedBroadcasts.size()-1; i>=0; i--) {
                 pw.println("  Serialized Broadcast #" + i + ":");
@@ -12919,7 +12919,7 @@
             try {
                 if (DEBUG_BROADCAST_LIGHT) {
                     int seq = r.intent.getIntExtra("seq", -1);
-                    Slog.i(TAG, "Delivering to " + filter.receiverList.app
+                    Slog.i(TAG, "Delivering to " + filter
                             + " (seq=" + seq + "): " + r);
                 }
                 performReceive(filter.receiverList.app, filter.receiverList.receiver,
@@ -12959,7 +12959,7 @@
 
             if (DEBUG_BROADCAST) Slog.v(TAG, "processNextBroadcast: "
                     + mParallelBroadcasts.size() + " broadcasts, "
-                    + mOrderedBroadcasts.size() + " serialized broadcasts");
+                    + mOrderedBroadcasts.size() + " ordered broadcasts");
 
             updateCpuStats();
             
@@ -12977,7 +12977,7 @@
                 for (int i=0; i<N; i++) {
                     Object target = r.receivers.get(i);
                     if (DEBUG_BROADCAST)  Slog.v(TAG,
-                            "Delivering non-serialized to registered "
+                            "Delivering non-ordered to registered "
                             + target + ": " + r);
                     deliverToRegisteredReceiver(r, (BroadcastFilter)target, false);
                 }
@@ -13115,12 +13115,14 @@
                 // a direct call.
                 BroadcastFilter filter = (BroadcastFilter)nextReceiver;
                 if (DEBUG_BROADCAST)  Slog.v(TAG,
-                        "Delivering serialized to registered "
+                        "Delivering ordered to registered "
                         + filter + ": " + r);
                 deliverToRegisteredReceiver(r, filter, r.ordered);
                 if (r.receiver == null || !r.ordered) {
                     // The receiver has already finished, so schedule to
                     // process the next one.
+                    if (DEBUG_BROADCAST) Slog.v(TAG, "Quick finishing: ordered="
+                            + r.ordered + " receiver=" + r.receiver);
                     r.state = BroadcastRecord.IDLE;
                     scheduleBroadcastsLocked();
                 }
diff --git a/services/java/com/android/server/am/BroadcastRecord.java b/services/java/com/android/server/am/BroadcastRecord.java
index 75c9600..c3f0b3e 100644
--- a/services/java/com/android/server/am/BroadcastRecord.java
+++ b/services/java/com/android/server/am/BroadcastRecord.java
@@ -126,7 +126,9 @@
             pw.println(prefix + "curApp=" + curApp);
             pw.println(prefix + "curComponent="
                     + (curComponent != null ? curComponent.toShortString() : "--"));
-            pw.println(prefix + "curSourceDir=" + curReceiver.applicationInfo.sourceDir);
+            if (curReceiver != null && curReceiver.applicationInfo != null) {
+                pw.println(prefix + "curSourceDir=" + curReceiver.applicationInfo.sourceDir);
+            }
         }
         String stateStr = " (?)";
         switch (state) {