Merge "remove PROP_QTAGUID_ENABLED"
This commit is contained in:
@@ -17,7 +17,6 @@
|
|||||||
package com.android.server;
|
package com.android.server;
|
||||||
|
|
||||||
import android.os.StrictMode;
|
import android.os.StrictMode;
|
||||||
import android.os.SystemProperties;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
|
|
||||||
@@ -33,13 +32,6 @@ public final class NetworkManagementSocketTagger extends SocketTagger {
|
|||||||
private static final String TAG = "NetworkManagementSocketTagger";
|
private static final String TAG = "NetworkManagementSocketTagger";
|
||||||
private static final boolean LOGD = false;
|
private static final boolean LOGD = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link SystemProperties} key that indicates if {@code qtaguid} bandwidth
|
|
||||||
* controls have been enabled.
|
|
||||||
*/
|
|
||||||
// TODO: remove when always enabled, or once socket tagging silently fails.
|
|
||||||
public static final String PROP_QTAGUID_ENABLED = "net.qtaguid_enabled";
|
|
||||||
|
|
||||||
private static ThreadLocal<SocketTags> threadSocketTags = new ThreadLocal<SocketTags>() {
|
private static ThreadLocal<SocketTags> threadSocketTags = new ThreadLocal<SocketTags>() {
|
||||||
@Override
|
@Override
|
||||||
protected SocketTags initialValue() {
|
protected SocketTags initialValue() {
|
||||||
@@ -88,13 +80,11 @@ public final class NetworkManagementSocketTagger extends SocketTagger {
|
|||||||
private void tagSocketFd(FileDescriptor fd, int tag, int uid) {
|
private void tagSocketFd(FileDescriptor fd, int tag, int uid) {
|
||||||
if (tag == -1 && uid == -1) return;
|
if (tag == -1 && uid == -1) return;
|
||||||
|
|
||||||
if (SystemProperties.getBoolean(PROP_QTAGUID_ENABLED, false)) {
|
final int errno = native_tagSocketFd(fd, tag, uid);
|
||||||
final int errno = native_tagSocketFd(fd, tag, uid);
|
if (errno < 0) {
|
||||||
if (errno < 0) {
|
Log.i(TAG, "tagSocketFd(" + fd.getInt$() + ", "
|
||||||
Log.i(TAG, "tagSocketFd(" + fd.getInt$() + ", "
|
+ tag + ", "
|
||||||
+ tag + ", " +
|
+ uid + ") failed with errno" + errno);
|
||||||
+ uid + ") failed with errno" + errno);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,11 +100,9 @@ public final class NetworkManagementSocketTagger extends SocketTagger {
|
|||||||
final SocketTags options = threadSocketTags.get();
|
final SocketTags options = threadSocketTags.get();
|
||||||
if (options.statsTag == -1 && options.statsUid == -1) return;
|
if (options.statsTag == -1 && options.statsUid == -1) return;
|
||||||
|
|
||||||
if (SystemProperties.getBoolean(PROP_QTAGUID_ENABLED, false)) {
|
final int errno = native_untagSocketFd(fd);
|
||||||
final int errno = native_untagSocketFd(fd);
|
if (errno < 0) {
|
||||||
if (errno < 0) {
|
Log.w(TAG, "untagSocket(" + fd.getInt$() + ") failed with errno " + errno);
|
||||||
Log.w(TAG, "untagSocket(" + fd.getInt$() + ") failed with errno " + errno);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,21 +112,17 @@ public final class NetworkManagementSocketTagger extends SocketTagger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setKernelCounterSet(int uid, int counterSet) {
|
public static void setKernelCounterSet(int uid, int counterSet) {
|
||||||
if (SystemProperties.getBoolean(PROP_QTAGUID_ENABLED, false)) {
|
final int errno = native_setCounterSet(counterSet, uid);
|
||||||
final int errno = native_setCounterSet(counterSet, uid);
|
if (errno < 0) {
|
||||||
if (errno < 0) {
|
Log.w(TAG, "setKernelCountSet(" + uid + ", " + counterSet + ") failed with errno "
|
||||||
Log.w(TAG, "setKernelCountSet(" + uid + ", " + counterSet + ") failed with errno "
|
+ errno);
|
||||||
+ errno);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void resetKernelUidStats(int uid) {
|
public static void resetKernelUidStats(int uid) {
|
||||||
if (SystemProperties.getBoolean(PROP_QTAGUID_ENABLED, false)) {
|
int errno = native_deleteTagData(0, uid);
|
||||||
int errno = native_deleteTagData(0, uid);
|
if (errno < 0) {
|
||||||
if (errno < 0) {
|
Slog.w(TAG, "problem clearing counters for uid " + uid + " : errno " + errno);
|
||||||
Slog.w(TAG, "problem clearing counters for uid " + uid + " : errno " + errno);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,8 +39,6 @@ import static android.net.NetworkStats.STATS_PER_UID;
|
|||||||
import static android.net.NetworkStats.TAG_NONE;
|
import static android.net.NetworkStats.TAG_NONE;
|
||||||
import static android.net.TrafficStats.UID_TETHERING;
|
import static android.net.TrafficStats.UID_TETHERING;
|
||||||
|
|
||||||
import static com.android.server.NetworkManagementSocketTagger.PROP_QTAGUID_ENABLED;
|
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -72,7 +70,6 @@ import android.os.ServiceManager;
|
|||||||
import android.os.ServiceSpecificException;
|
import android.os.ServiceSpecificException;
|
||||||
import android.os.StrictMode;
|
import android.os.StrictMode;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.os.SystemProperties;
|
|
||||||
import android.os.Trace;
|
import android.os.Trace;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -446,9 +443,6 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
|
|||||||
// push any existing quota or UID rules
|
// push any existing quota or UID rules
|
||||||
synchronized (mQuotaLock) {
|
synchronized (mQuotaLock) {
|
||||||
|
|
||||||
// Netd unconditionally enable bandwidth control
|
|
||||||
SystemProperties.set(PROP_QTAGUID_ENABLED, "1");
|
|
||||||
|
|
||||||
mStrictEnabled = true;
|
mStrictEnabled = true;
|
||||||
|
|
||||||
setDataSaverModeEnabled(mDataSaverMode);
|
setDataSaverModeEnabled(mDataSaverMode);
|
||||||
|
|||||||
Reference in New Issue
Block a user