change NMS removeNetwork to netd binder variant
Also: require NETWORK_STACK instead of CONNECTIVITY_INTERNAL.
Bug: 34953048
Bug: 64133961
Test: as follows
- built
- flashed
- booted
- runtest frameworks-net
Change-Id: I26f07f51a8a2f4a8bb43a276da7c5e66c355c848
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user