From f0bdc8722dbebca5d775d7bb75884f69c95e9810 Mon Sep 17 00:00:00 2001 From: Soonil Nagarkar Date: Thu, 2 Sep 2021 10:45:04 -0700 Subject: [PATCH] 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 --- .../server/location/provider/LocationProviderManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/location/provider/LocationProviderManager.java b/services/core/java/com/android/server/location/provider/LocationProviderManager.java index 8955c288391f8..62d8c320a13ca 100644 --- a/services/core/java/com/android/server/location/provider/LocationProviderManager.java +++ b/services/core/java/com/android/server/location/provider/LocationProviderManager.java @@ -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();