diff options
| author | 2023-06-01 17:02:05 +0900 | |
|---|---|---|
| committer | 2023-06-09 09:26:30 +0000 | |
| commit | a025dc923137ebc66bb7629ca5e4c7939ec5b978 (patch) | |
| tree | 57a653936435969ce4c34ef19beff5e9f2454b4c | |
| parent | 03d91162fc3aec6a57781bf3bbf982c16f2c2942 (diff) | |
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
(cherry picked from commit e0ed0d898e926d6cb24153c4aee6a24186a7026b)
(cherry picked from commit cedc5de16ed39d09c9d331cbc9ee475f59637f7c)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:6709e62a06331e743824b3586ef52abe221c775f)
Merged-In: I88fee389a3c768baf7c29096d2245734d9dd4fe8
Change-Id: I88fee389a3c768baf7c29096d2245734d9dd4fe8
3 files changed, 0 insertions, 78 deletions
diff --git a/core/java/android/net/ITetheringStatsProvider.aidl b/core/java/android/net/ITetheringStatsProvider.aidl deleted file mode 100644 index 199afa2ed417..000000000000 --- a/core/java/android/net/ITetheringStatsProvider.aidl +++ /dev/null @@ -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; -} diff --git a/core/java/android/os/INetworkManagementService.aidl b/core/java/android/os/INetworkManagementService.aidl index 7fa99242cc89..ed14652c0f0a 100644 --- a/core/java/android/os/INetworkManagementService.aidl +++ b/core/java/android/os/INetworkManagementService.aidl @@ -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; diff --git a/services/core/java/com/android/server/net/NetworkManagementService.java b/services/core/java/com/android/server/net/NetworkManagementService.java index 5aed791ffaa8..39b8bfd51e3f 100644 --- a/services/core/java/com/android/server/net/NetworkManagementService.java +++ b/services/core/java/com/android/server/net/NetworkManagementService.java @@ -41,7 +41,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}. @@ -218,10 +213,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) @@ -912,17 +903,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); - } - } - } } } @@ -945,17 +925,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); - } - } - } } } @@ -1153,13 +1122,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(); |