Remove unnecessary code and APIs.
This stuff has been replaced by setNetworkForUser() in NetdClient.
Change-Id: If525ee259b74314191d1913f7c2a3e828e05c38f
diff --git a/core/java/android/net/IConnectivityManager.aidl b/core/java/android/net/IConnectivityManager.aidl
index b9c6491..f61984a 100644
--- a/core/java/android/net/IConnectivityManager.aidl
+++ b/core/java/android/net/IConnectivityManager.aidl
@@ -42,9 +42,6 @@
/** {@hide} */
interface IConnectivityManager
{
- // Keep this in sync with framework/native/services/connectivitymanager/ConnectivityManager.h
- void markSocketAsUser(in ParcelFileDescriptor socket, int uid);
-
NetworkInfo getActiveNetworkInfo();
NetworkInfo getActiveNetworkInfoForUid(int uid);
NetworkInfo getNetworkInfo(int networkType);
diff --git a/core/java/android/net/NetworkUtils.java b/core/java/android/net/NetworkUtils.java
index af860b0..9b95305 100644
--- a/core/java/android/net/NetworkUtils.java
+++ b/core/java/android/net/NetworkUtils.java
@@ -106,11 +106,6 @@
public native static String getDhcpError();
/**
- * Set the SO_MARK of {@code socketfd} to {@code mark}
- */
- public native static void markSocket(int socketfd, int mark);
-
- /**
* Binds the current process to the network designated by {@code netId}. All sockets created
* in the future (and not explicitly bound via a bound {@link SocketFactory} (see
* {@link Network#getSocketFactory}) will be bound to this network. Note that if this
diff --git a/core/jni/android_net_NetUtils.cpp b/core/jni/android_net_NetUtils.cpp
index 2325bc7..760ed45 100644
--- a/core/jni/android_net_NetUtils.cpp
+++ b/core/jni/android_net_NetUtils.cpp
@@ -246,13 +246,6 @@
return env->NewStringUTF(::dhcp_get_errmsg());
}
-static void android_net_utils_markSocket(JNIEnv *env, jobject thiz, jint socket, jint mark)
-{
- if (setsockopt(socket, SOL_SOCKET, SO_MARK, &mark, sizeof(mark)) < 0) {
- jniThrowException(env, "java/lang/IllegalStateException", "Error marking socket");
- }
-}
-
static jboolean android_net_utils_bindProcessToNetwork(JNIEnv *env, jobject thiz, jint netId)
{
return (jboolean) !setNetworkForProcess(netId);
@@ -296,7 +289,6 @@
{ "stopDhcp", "(Ljava/lang/String;)Z", (void *)android_net_utils_stopDhcp },
{ "releaseDhcpLease", "(Ljava/lang/String;)Z", (void *)android_net_utils_releaseDhcpLease },
{ "getDhcpError", "()Ljava/lang/String;", (void*) android_net_utils_getDhcpError },
- { "markSocket", "(II)V", (void*) android_net_utils_markSocket },
{ "bindProcessToNetwork", "(I)Z", (void*) android_net_utils_bindProcessToNetwork },
{ "getNetworkBoundToProcess", "()I", (void*) android_net_utils_getNetworkBoundToProcess },
{ "bindProcessToNetworkForHostResolution", "(I)Z", (void*) android_net_utils_bindProcessToNetworkForHostResolution },
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index b52aecf..6554ed3 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -2122,16 +2122,6 @@
"ConnectivityService");
}
- private void enforceMarkNetworkSocketPermission() {
- //Media server special case
- if (Binder.getCallingUid() == Process.MEDIA_UID) {
- return;
- }
- mContext.enforceCallingOrSelfPermission(
- android.Manifest.permission.MARK_NETWORK_SOCKET,
- "ConnectivityService");
- }
-
/**
* Handle a {@code DISCONNECTED} event. If this pertains to the non-active
* network, we ignore it. If it is for the active network, we send out a
@@ -4084,23 +4074,6 @@
}
}
- @Override
- public void markSocketAsUser(ParcelFileDescriptor socket, int uid) {
- enforceMarkNetworkSocketPermission();
- final long token = Binder.clearCallingIdentity();
- try {
- int mark = mNetd.getMarkForUid(uid);
- // Clear the mark on the socket if no mark is needed to prevent socket reuse issues
- if (mark == -1) {
- mark = 0;
- }
- NetworkUtils.markSocket(socket.getFd(), mark);
- } catch (RemoteException e) {
- } finally {
- Binder.restoreCallingIdentity(token);
- }
- }
-
/**
* Configure a TUN interface and return its file descriptor. Parameters
* are encoded and opaque to this class. This method is used by VpnBuilder