From d9b3d55152ca6184caf64667b0d03c08eff02263 Mon Sep 17 00:00:00 2001 From: Lorenzo Colitti Date: Sun, 17 Mar 2013 03:21:35 +0900 Subject: Catch RuntimeException in NMService notifications Currently, NetworkManagementService only catches RemoteExceptions when calling the BaseNetworkObserver notification methods (e.g., interfaceStatusChanged). However, if the observer is in the same process, unchecked exceptions can occur as well. When this happens, finishBroadcast does not get called, and no further notifications can be sent, because any attempt to do so fails with a "beginBroadcast() called while already in a broadcast" exception. Fix this by catching RuntimeException as well. Bug: 8397534 Bug: 8276725 Change-Id: Icd6f32128707244978943c48a9ea3a2b952a2957 --- services/java/com/android/server/NetworkManagementService.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'services/java/com/android/server/NetworkManagementService.java') diff --git a/services/java/com/android/server/NetworkManagementService.java b/services/java/com/android/server/NetworkManagementService.java index 768670575baa..2210a180d6d4 100644 --- a/services/java/com/android/server/NetworkManagementService.java +++ b/services/java/com/android/server/NetworkManagementService.java @@ -233,6 +233,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub try { mObservers.getBroadcastItem(i).interfaceStatusChanged(iface, up); } catch (RemoteException e) { + } catch (RuntimeException e) { } } mObservers.finishBroadcast(); @@ -248,6 +249,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub try { mObservers.getBroadcastItem(i).interfaceLinkStateChanged(iface, up); } catch (RemoteException e) { + } catch (RuntimeException e) { } } mObservers.finishBroadcast(); @@ -262,6 +264,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub try { mObservers.getBroadcastItem(i).interfaceAdded(iface); } catch (RemoteException e) { + } catch (RuntimeException e) { } } mObservers.finishBroadcast(); @@ -281,6 +284,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub try { mObservers.getBroadcastItem(i).interfaceRemoved(iface); } catch (RemoteException e) { + } catch (RuntimeException e) { } } mObservers.finishBroadcast(); @@ -295,6 +299,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub try { mObservers.getBroadcastItem(i).limitReached(limitName, iface); } catch (RemoteException e) { + } catch (RuntimeException e) { } } mObservers.finishBroadcast(); @@ -309,6 +314,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub try { mObservers.getBroadcastItem(i).interfaceClassDataActivityChanged(label, active); } catch (RemoteException e) { + } catch (RuntimeException e) { } } mObservers.finishBroadcast(); -- cgit v1.2.3