When system server goes down, crash apps more.

Apps making calls into the system server may end up persisting
internal state or making security decisions based on the perceived
success or failure of a call, or the default values returned.

The reality is that if the system process just died, init will be
along shortly to kill all running apps, so we should have no problem
rethrowing the RemoteException as a RuntimeException.

Bug: 27364859
Change-Id: Ife0bcb079636c88d54c44d17eb580409fd79028b
This commit is contained in:
Jeff Sharkey
2016-03-01 19:27:23 -07:00
parent 89a344fe60
commit f713828f74
2 changed files with 14 additions and 9 deletions

View File

@@ -87,8 +87,8 @@ public class EthernetManager {
public IpConfiguration getConfiguration() {
try {
return mService.getConfiguration();
} catch (NullPointerException | RemoteException e) {
return new IpConfiguration();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
@@ -98,7 +98,8 @@ public class EthernetManager {
public void setConfiguration(IpConfiguration config) {
try {
mService.setConfiguration(config);
} catch (NullPointerException | RemoteException e) {
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
@@ -109,8 +110,8 @@ public class EthernetManager {
public boolean isAvailable() {
try {
return mService.isAvailable();
} catch (NullPointerException | RemoteException e) {
return false;
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
@@ -127,7 +128,8 @@ public class EthernetManager {
if (mListeners.size() == 1) {
try {
mService.addListener(mServiceListener);
} catch (NullPointerException | RemoteException e) {
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
}
@@ -145,7 +147,8 @@ public class EthernetManager {
if (mListeners.isEmpty()) {
try {
mService.removeListener(mServiceListener);
} catch (NullPointerException | RemoteException e) {
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
}

View File

@@ -619,7 +619,9 @@ public final class NsdManager {
public void setEnabled(boolean enabled) {
try {
mService.setEnabled(enabled);
} catch (RemoteException e) { }
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
/**
@@ -632,7 +634,7 @@ public final class NsdManager {
try {
return mService.getMessenger();
} catch (RemoteException e) {
return null;
throw e.rethrowFromSystemServer();
}
}
}