Merge "remove PROP_QTAGUID_ENABLED" am: 999147b4ab

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1888335

Change-Id: I695b9b491873fba378affcc540ae03ddfae5e51a
This commit is contained in:
Treehugger Robot
2021-11-16 04:18:54 +00:00
committed by Automerger Merge Worker
2 changed files with 15 additions and 37 deletions

View File

@@ -17,7 +17,6 @@
package com.android.server;
import android.os.StrictMode;
import android.os.SystemProperties;
import android.util.Log;
import android.util.Slog;
@@ -33,13 +32,6 @@ public final class NetworkManagementSocketTagger extends SocketTagger {
private static final String TAG = "NetworkManagementSocketTagger";
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>() {
@Override
protected SocketTags initialValue() {
@@ -88,13 +80,11 @@ public final class NetworkManagementSocketTagger extends SocketTagger {
private void tagSocketFd(FileDescriptor fd, int tag, int uid) {
if (tag == -1 && uid == -1) return;
if (SystemProperties.getBoolean(PROP_QTAGUID_ENABLED, false)) {
final int errno = native_tagSocketFd(fd, tag, uid);
if (errno < 0) {
Log.i(TAG, "tagSocketFd(" + fd.getInt$() + ", "
+ tag + ", " +
+ uid + ") failed with errno" + errno);
}
final int errno = native_tagSocketFd(fd, tag, uid);
if (errno < 0) {
Log.i(TAG, "tagSocketFd(" + fd.getInt$() + ", "
+ tag + ", "
+ uid + ") failed with errno" + errno);
}
}
@@ -110,11 +100,9 @@ public final class NetworkManagementSocketTagger extends SocketTagger {
final SocketTags options = threadSocketTags.get();
if (options.statsTag == -1 && options.statsUid == -1) return;
if (SystemProperties.getBoolean(PROP_QTAGUID_ENABLED, false)) {
final int errno = native_untagSocketFd(fd);
if (errno < 0) {
Log.w(TAG, "untagSocket(" + fd.getInt$() + ") failed with errno " + errno);
}
final int errno = native_untagSocketFd(fd);
if (errno < 0) {
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) {
if (SystemProperties.getBoolean(PROP_QTAGUID_ENABLED, false)) {
final int errno = native_setCounterSet(counterSet, uid);
if (errno < 0) {
Log.w(TAG, "setKernelCountSet(" + uid + ", " + counterSet + ") failed with errno "
+ errno);
}
final int errno = native_setCounterSet(counterSet, uid);
if (errno < 0) {
Log.w(TAG, "setKernelCountSet(" + uid + ", " + counterSet + ") failed with errno "
+ errno);
}
}
public static void resetKernelUidStats(int uid) {
if (SystemProperties.getBoolean(PROP_QTAGUID_ENABLED, false)) {
int errno = native_deleteTagData(0, uid);
if (errno < 0) {
Slog.w(TAG, "problem clearing counters for uid " + uid + " : errno " + errno);
}
int errno = native_deleteTagData(0, uid);
if (errno < 0) {
Slog.w(TAG, "problem clearing counters for uid " + uid + " : errno " + errno);
}
}

View File

@@ -39,8 +39,6 @@ import static android.net.NetworkStats.STATS_PER_UID;
import static android.net.NetworkStats.TAG_NONE;
import static android.net.TrafficStats.UID_TETHERING;
import static com.android.server.NetworkManagementSocketTagger.PROP_QTAGUID_ENABLED;
import android.annotation.NonNull;
import android.app.ActivityManager;
import android.content.Context;
@@ -72,7 +70,6 @@ import android.os.ServiceManager;
import android.os.ServiceSpecificException;
import android.os.StrictMode;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.Trace;
import android.text.TextUtils;
import android.util.Log;
@@ -446,9 +443,6 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
// push any existing quota or UID rules
synchronized (mQuotaLock) {
// Netd unconditionally enable bandwidth control
SystemProperties.set(PROP_QTAGUID_ENABLED, "1");
mStrictEnabled = true;
setDataSaverModeEnabled(mDataSaverMode);