am 1bd7d5e4: am 675814d4: Merge "Maybe fix issue #7596986: Frequent runtime restarts; IAE at..." into jb-mr1.1-dev

* commit '1bd7d5e47ed7e73c244b79c5a92d6af1e3e89266':
  Maybe fix issue #7596986: Frequent runtime restarts; IAE at...
This commit is contained in:
Dianne Hackborn
2012-11-30 10:47:01 -08:00
committed by Android Git Automerger
2 changed files with 19 additions and 3 deletions

View File

@ -531,7 +531,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
synchronized (this) { synchronized (this) {
// synchronize to ensure incrementPendingBroadcastsLocked() // synchronize to ensure incrementPendingBroadcastsLocked()
// is called before decrementPendingBroadcasts() // is called before decrementPendingBroadcasts()
mListener.onLocationChanged(location); mListener.onLocationChanged(new Location(location));
// call this after broadcasting so we do not increment // call this after broadcasting so we do not increment
// if we throw an exeption. // if we throw an exeption.
incrementPendingBroadcastsLocked(); incrementPendingBroadcastsLocked();
@ -1323,10 +1323,10 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
if (allowedResolutionLevel < RESOLUTION_LEVEL_FINE) { if (allowedResolutionLevel < RESOLUTION_LEVEL_FINE) {
Location noGPSLocation = location.getExtraLocation(Location.EXTRA_NO_GPS_LOCATION); Location noGPSLocation = location.getExtraLocation(Location.EXTRA_NO_GPS_LOCATION);
if (noGPSLocation != null) { if (noGPSLocation != null) {
return mLocationFudger.getOrCreate(noGPSLocation); return new Location(mLocationFudger.getOrCreate(noGPSLocation));
} }
} else { } else {
return location; return new Location(location);
} }
} }
return null; return null;

View File

@ -38,6 +38,7 @@ import android.os.RemoteException;
import android.os.SystemClock; import android.os.SystemClock;
import android.os.UserHandle; import android.os.UserHandle;
import android.util.EventLog; import android.util.EventLog;
import android.util.Log;
import android.util.Slog; import android.util.Slog;
/** /**
@ -779,6 +780,21 @@ public class BroadcastQueue {
} catch (RemoteException e) { } catch (RemoteException e) {
Slog.w(TAG, "Exception when sending broadcast to " Slog.w(TAG, "Exception when sending broadcast to "
+ r.curComponent, e); + r.curComponent, e);
} catch (RuntimeException e) {
Log.wtf(TAG, "Failed sending broadcast to "
+ r.curComponent + " with " + r.intent, e);
// If some unexpected exception happened, just skip
// this broadcast. At this point we are not in the call
// from a client, so throwing an exception out from here
// will crash the entire system instead of just whoever
// sent the broadcast.
logBroadcastReceiverDiscardLocked(r);
finishReceiverLocked(r, r.resultCode, r.resultData,
r.resultExtras, r.resultAbort, true);
scheduleBroadcastsLocked();
// We need to reset the state if we failed to start the receiver.
r.state = BroadcastRecord.IDLE;
return;
} }
// If a dead object exception was thrown -- fall through to // If a dead object exception was thrown -- fall through to