Merge "change NMS removeNetwork to netd binder variant"

This commit is contained in:
Treehugger Robot
2018-01-15 12:39:09 +00:00
committed by Gerrit Code Review
2 changed files with 10 additions and 4 deletions

View File

@@ -2472,6 +2472,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
private void handleRemoveNetworkRequest(final NetworkRequestInfo nri) {
nri.unlinkDeathRecipient();
mNetworkRequests.remove(nri.request);
synchronized (mUidToNetworkRequestCount) {
int requests = mUidToNetworkRequestCount.get(nri.mUid, 0);
if (requests < 1) {
@@ -2484,6 +2485,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
mUidToNetworkRequestCount.put(nri.mUid, requests - 1);
}
}
mNetworkRequestInfoLogs.log("RELEASE " + nri);
if (nri.request.isRequest()) {
boolean wasKept = false;

View File

@@ -2508,12 +2508,16 @@ public class NetworkManagementService extends INetworkManagementService.Stub
@Override
public void removeNetwork(int netId) {
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
mContext.enforceCallingOrSelfPermission(NETWORK_STACK, TAG);
try {
mConnector.execute("network", "destroy", netId);
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
mNetdService.networkDestroy(netId);
} catch (ServiceSpecificException e) {
Log.w(TAG, "removeNetwork(" + netId + "): ", e);
throw e;
} catch (RemoteException e) {
Log.w(TAG, "removeNetwork(" + netId + "): ", e);
throw e.rethrowAsRuntimeException();
}
}