Remove the unused ITetheringStatsProvider.
This is safe because : • There are no longer any existing user of this class in AOSP or downstream • Known previous uses by OEMs/vendors have been removed • This class is now superseded by the better and more generic network stats provider, so that remaining uses if any can be retrofitted into this newer, better class Test: TH Bug: 64955351 Merged-In: I88fee389a3c768baf7c29096d2245734d9dd4fe8 Change-Id: I88fee389a3c768baf7c29096d2245734d9dd4fe8
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.net;
|
||||
|
||||
import android.net.NetworkStats;
|
||||
|
||||
/**
|
||||
* Interface for NetworkManagementService to query tethering statistics and set data limits.
|
||||
*
|
||||
* TODO: this does not really need to be an interface since Tethering runs in the same process
|
||||
* as NetworkManagementService. Consider refactoring Tethering to use direct access to
|
||||
* NetworkManagementService instead of using INetworkManagementService, and then deleting this
|
||||
* interface.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
interface ITetheringStatsProvider {
|
||||
// Sets the interface quota for the specified upstream interface. This is defined as the number
|
||||
// of bytes, starting from zero and counting from now, after which data should stop being
|
||||
// forwarded to/from the specified upstream. A value of QUOTA_UNLIMITED means there is no limit.
|
||||
void setInterfaceQuota(String iface, long quotaBytes);
|
||||
|
||||
// Indicates that no data usage limit is set.
|
||||
const int QUOTA_UNLIMITED = -1;
|
||||
}
|
||||
@@ -19,7 +19,6 @@ package android.os;
|
||||
|
||||
import android.net.InterfaceConfiguration;
|
||||
import android.net.INetworkManagementEventObserver;
|
||||
import android.net.ITetheringStatsProvider;
|
||||
import android.net.Network;
|
||||
import android.net.NetworkStats;
|
||||
import android.net.RouteInfo;
|
||||
|
||||
@@ -44,7 +44,6 @@ import android.net.ConnectivityManager;
|
||||
import android.net.INetd;
|
||||
import android.net.INetdUnsolicitedEventListener;
|
||||
import android.net.INetworkManagementEventObserver;
|
||||
import android.net.ITetheringStatsProvider;
|
||||
import android.net.InetAddresses;
|
||||
import android.net.InterfaceConfiguration;
|
||||
import android.net.InterfaceConfigurationParcel;
|
||||
@@ -135,10 +134,6 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
|
||||
private final RemoteCallbackList<INetworkManagementEventObserver> mObservers =
|
||||
new RemoteCallbackList<>();
|
||||
|
||||
@GuardedBy("mTetheringStatsProviders")
|
||||
private final HashMap<ITetheringStatsProvider, String>
|
||||
mTetheringStatsProviders = Maps.newHashMap();
|
||||
|
||||
/**
|
||||
* If both locks need to be held, then they should be obtained in the order:
|
||||
* first {@link #mQuotaLock} and then {@link #mRulesLock}.
|
||||
@@ -217,10 +212,6 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
|
||||
mNetdUnsolicitedEventListener = new NetdUnsolicitedEventListener();
|
||||
|
||||
mDeps.registerLocalService(new LocalService());
|
||||
|
||||
synchronized (mTetheringStatsProviders) {
|
||||
mTetheringStatsProviders.put(new NetdTetheringStatsProvider(), "netd");
|
||||
}
|
||||
}
|
||||
|
||||
static NetworkManagementService create(Context context, Dependencies deps)
|
||||
@@ -909,17 +900,6 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
|
||||
} catch (RemoteException | ServiceSpecificException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
|
||||
synchronized (mTetheringStatsProviders) {
|
||||
for (ITetheringStatsProvider provider : mTetheringStatsProviders.keySet()) {
|
||||
try {
|
||||
provider.setInterfaceQuota(iface, quotaBytes);
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Problem setting tethering data limit on provider " +
|
||||
mTetheringStatsProviders.get(provider) + ": " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -942,17 +922,6 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
|
||||
} catch (RemoteException | ServiceSpecificException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
|
||||
synchronized (mTetheringStatsProviders) {
|
||||
for (ITetheringStatsProvider provider : mTetheringStatsProviders.keySet()) {
|
||||
try {
|
||||
provider.setInterfaceQuota(iface, ITetheringStatsProvider.QUOTA_UNLIMITED);
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Problem removing tethering data limit on provider " +
|
||||
mTetheringStatsProviders.get(provider) + ": " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1148,13 +1117,6 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
|
||||
return true;
|
||||
}
|
||||
|
||||
private class NetdTetheringStatsProvider extends ITetheringStatsProvider.Stub {
|
||||
@Override
|
||||
public void setInterfaceQuota(String iface, long quotaBytes) {
|
||||
// Do nothing. netd is already informed of quota changes in setInterfaceQuota.
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFirewallEnabled(boolean enabled) {
|
||||
enforceSystemUid();
|
||||
|
||||
Reference in New Issue
Block a user