Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 03d91162 authored by Chalard Jean's avatar Chalard Jean Committed by Cherrypicker Worker
Browse files

Remove unused methods from NetworkManagementService.

More methods are unused, but they are marked @UnsupportedAppUsage
and therefore aren't removed by this patch.

Also address warnings :
• member can be final
• deprecated NetworkStack permission check methods
• redundant public modifier

Test: TH
Bug: 64955351
(cherry picked from commit eec9f31d85fc090722015830a9ad87f9f29b035f)
(cherry picked from commit 5956c8058c468d11d37e2dbd0c847da368ac4cd5)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:158469f5201bfe432da324272400631c91bc78fc)
Merged-In: Ib0d4e8c6a063ed57c5a790eab3868ed4fe9cf096
Change-Id: Ib0d4e8c6a063ed57c5a790eab3868ed4fe9cf096
parent cc2a4ccc
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -29,12 +29,6 @@ import android.net.NetworkStats;
 * @hide
 */
interface ITetheringStatsProvider {
    // Returns cumulative statistics for all tethering sessions since boot, on all upstreams.
    // @code {how} is one of the NetworkStats.STATS_PER_* constants. If {@code how} is
    // {@code STATS_PER_IFACE}, the provider should not include any traffic that is already
    // counted by kernel interface counters.
    NetworkStats getTetherStats(int how);

    // 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.
+0 −67
Original line number Diff line number Diff line
@@ -143,14 +143,6 @@ interface INetworkManagementService
    @UnsupportedAppUsage
    void startTethering(in String[] dhcpRanges);

    /**
     * Start tethering services with the specified dhcp server range and
     * DNS proxy config.
     * {@code boolean} is used to control legacy DNS proxy server.
     * {@code String[]} is a set of start end pairs defining the ranges.
     */
    void startTetheringWithConfiguration(boolean usingLegacyDnsProxy, in String[] dhcpRanges);

    /**
     * Stop currently running tethering services
     */
@@ -181,23 +173,6 @@ interface INetworkManagementService
    @UnsupportedAppUsage
    String[] listTetheredInterfaces();

    /**
     * Returns the list of DNS forwarders (in order of priority)
     */
    String[] getDnsForwarders();

    /**
     * Enables unidirectional packet forwarding from {@code fromIface} to
     * {@code toIface}.
     */
    void startInterfaceForwarding(String fromIface, String toIface);

    /**
     * Disables unidirectional packet forwarding from {@code fromIface} to
     * {@code toIface}.
     */
    void stopInterfaceForwarding(String fromIface, String toIface);

    /**
     *  Enables Network Address Translation between two interfaces.
     *  The address and netmask of the external interface is used for
@@ -212,42 +187,10 @@ interface INetworkManagementService
    @UnsupportedAppUsage
    void disableNat(String internalInterface, String externalInterface);

    /**
     * Registers a {@code ITetheringStatsProvider} to provide tethering statistics.
     * All registered providers will be called in order, and their results will be added together.
     * Netd is always registered as a tethering stats provider.
     */
    void registerTetheringStatsProvider(ITetheringStatsProvider provider, String name);

    /**
     * Unregisters a previously-registered {@code ITetheringStatsProvider}.
     */
    void unregisterTetheringStatsProvider(ITetheringStatsProvider provider);

    /**
     * Reports that a tethering provider has reached a data limit.
     *
     * Currently triggers a global alert, which causes NetworkStatsService to poll counters and
     * re-evaluate data usage.
     *
     * This does not take an interface name because:
     * 1. The tethering offload stats provider cannot reliably determine the interface on which the
     *    limit was reached, because the HAL does not provide it.
     * 2. Firing an interface-specific alert instead of a global alert isn't really useful since in
     *    all cases of interest, the system responds to both in the same way - it polls stats, and
     *    then notifies NetworkPolicyManagerService of the fact.
     */
    void tetherLimitReached(ITetheringStatsProvider provider);

    /**
     ** DATA USAGE RELATED
     **/

    /**
     * Return summary of network statistics all tethering interfaces.
     */
    NetworkStats getNetworkStatsTethering(int how);

    /**
     * Set quota for an interface.
     */
@@ -268,11 +211,6 @@ interface INetworkManagementService
     */
    void removeInterfaceAlert(String iface);

    /**
     * Set alert across all interfaces.
     */
    void setGlobalAlert(long alertBytes);

    /**
     * Control network activity of a UID over interfaces with a quota limit.
     */
@@ -291,7 +229,6 @@ interface INetworkManagementService

    void setFirewallEnabled(boolean enabled);
    boolean isFirewallEnabled();
    void setFirewallInterfaceRule(String iface, boolean allow);
    void setFirewallUidRule(int chain, int uid, int rule);
    void setFirewallUidRules(int chain, in int[] uids, in int[] rules);
    void setFirewallChainEnabled(int chain, boolean enable);
@@ -306,10 +243,6 @@ interface INetworkManagementService
     */
    void denyProtect(int uid);

    void addInterfaceToLocalNetwork(String iface, in List<RouteInfo> routes);
    void removeInterfaceFromLocalNetwork(String iface);
    int removeRoutesFromLocalNetwork(in List<RouteInfo> routes);

    @EnforcePermission("OBSERVE_NETWORK_POLICY")
    boolean isNetworkRestricted(int uid);
}
+43 −245

File changed.

Preview size limit exceeded, changes collapsed.