Fix framework crash

Catch the correct exception on transport failure (CancelledException for
PendingIntents). This leads to a crash in very rare race conditions (a
location must be in the process of being delivered to the given
PendingIntent at almost the exact moment that it is canceled, such that
the canceled notification reaches the PendingIntent implementation
before it reaches the location service, and the location is delivered
after the notification reaches the PendingIntent implementation but
before it reaches the location service.

Bug: 198558226
Test: presubmits
Change-Id: I20d30b534781c3aee805d80e66048a04e79a530c
This commit is contained in:
Soonil Nagarkar
2021-09-02 10:45:04 -07:00
parent a2276a43e3
commit f0bdc8722d

View File

@@ -1078,7 +1078,7 @@ public class LocationProviderManager extends
}
private void onTransportFailure(Exception e) {
if (e instanceof RemoteException) {
if (e instanceof PendingIntent.CanceledException) {
Log.w(TAG, mName + " provider registration " + getIdentity() + " removed", e);
synchronized (mLock) {
remove();