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

Commit 4cbacfd0 authored by Suprabh Shukla's avatar Suprabh Shukla
Browse files

Remove unsupported NetworkManagement AIDL methods

These methods will always crash the caller and so do not serve any
purpose.

Flag: EXEMPT refactor

Test: Existing tests unaffected.

Bug: 339532486
Change-Id: I05514790e05e779777ed6f7b1b2f87479012b202
parent d81dd9a4
Loading
Loading
Loading
Loading
+0 −86
Original line number Diff line number Diff line
@@ -109,92 +109,6 @@ interface INetworkManagementService
    @EnforcePermission("SHUTDOWN")
    void shutdown();

    /**
     ** TETHERING RELATED
     **/

    /**
     * Returns true if IP forwarding is enabled
     */
    @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553,
            publicAlternatives = "Use {@code android.net.INetd#ipfwdEnabled}")
    boolean getIpForwardingEnabled();

    /**
     * Enables/Disables IP Forwarding
     */
    @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553,
            publicAlternatives = "Avoid using this directly. Instead, enable tethering with "
            + "{@code android.net.TetheringManager#startTethering}. See also "
            + "{@code INetd#ipfwdEnableForwarding(String)}.")
    void setIpForwardingEnabled(boolean enabled);

    /**
     * Start tethering services with the specified dhcp server range
     * arg is a set of start end pairs defining the ranges.
     */
    @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553,
            publicAlternatives = "{@code android.net.TetheringManager#startTethering}")
    void startTethering(in String[] dhcpRanges);

    /**
     * Stop currently running tethering services
     */
    @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553,
            publicAlternatives = "{@code android.net.TetheringManager#stopTethering(int)}")
    void stopTethering();

    /**
     * Returns true if tethering services are started
     */
    @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553,
            publicAlternatives = "Generally track your own tethering requests. "
            + "See also {@code android.net.INetd#tetherIsEnabled()}")
    boolean isTetheringStarted();

    /**
     * Tethers the specified interface
     */
    @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553,
            publicAlternatives = "Avoid using this directly. Instead, enable tethering with "
            + "{@code android.net.TetheringManager#startTethering}. See also "
            + "{@code com.android.net.module.util.NetdUtils#tetherInterface}.")
    void tetherInterface(String iface);

    /**
     * Untethers the specified interface
     */
    @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553,
            publicAlternatives = "Avoid using this directly. Instead, disable "
            + "tethering with {@code android.net.TetheringManager#stopTethering(int)}. "
            + "See also {@code NetdUtils#untetherInterface}.")
    void untetherInterface(String iface);

    /**
     * Returns a list of currently tethered interfaces
     */
    @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553,
            publicAlternatives = "{@code android.net.TetheringManager#getTetheredIfaces()}")
    String[] listTetheredInterfaces();

    /**
     *  Enables Network Address Translation between two interfaces.
     *  The address and netmask of the external interface is used for
     *  the NAT'ed network.
     */
    @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553,
            publicAlternatives = "Avoid using this directly. Instead, enable tethering with "
            + "{@code android.net.TetheringManager#startTethering}.")
    void enableNat(String internalInterface, String externalInterface);

    /**
     *  Disables Network Address Translation between two interfaces.
     */
    @UnsupportedAppUsage(maxTargetSdk = 34, trackingBug = 170729553,
            publicAlternatives = "Avoid using this directly. Instead, disable tethering with "
            + "{@code android.net.TetheringManager#stopTethering(int)}.")
    void disableNat(String internalInterface, String externalInterface);

    /**
     ** DATA USAGE RELATED
     **/
+0 −60
Original line number Diff line number Diff line
@@ -830,66 +830,6 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
        Slog.i(TAG, "Shutting down");
    }

    @Override
    public boolean getIpForwardingEnabled() throws IllegalStateException{
        PermissionUtils.enforceNetworkStackPermission(mContext);
        throw new UnsupportedOperationException("NMS#getIpForwardingEnabled not supported in V+");
    }

    @Override
    public void setIpForwardingEnabled(boolean enable) {
        PermissionUtils.enforceNetworkStackPermission(mContext);
        throw new UnsupportedOperationException("NMS#setIpForwardingEnabled not supported in V+");
    }

    @Override
    public void startTethering(String[] dhcpRange) {
        PermissionUtils.enforceNetworkStackPermission(mContext);
        throw new UnsupportedOperationException("NMS#startTethering not supported in V+");
    }

    @Override
    public void stopTethering() {
        PermissionUtils.enforceNetworkStackPermission(mContext);
        throw new UnsupportedOperationException("NMS#stopTethering not supported in V+");
    }

    @Override
    public boolean isTetheringStarted() {
        PermissionUtils.enforceNetworkStackPermission(mContext);
        throw new UnsupportedOperationException("NMS#isTetheringStarted not supported in V+");
    }

    @Override
    public void tetherInterface(String iface) {
        PermissionUtils.enforceNetworkStackPermission(mContext);
        throw new UnsupportedOperationException("NMS#tetherInterface not supported in V+");
    }

    @Override
    public void untetherInterface(String iface) {
        PermissionUtils.enforceNetworkStackPermission(mContext);
        throw new UnsupportedOperationException("NMS#untetherInterface not supported in V+");
    }

    @Override
    public String[] listTetheredInterfaces() {
        PermissionUtils.enforceNetworkStackPermission(mContext);
        throw new UnsupportedOperationException("NMS#listTetheredInterfaces not supported in V+");
    }

    @Override
    public void enableNat(String internalInterface, String externalInterface) {
        PermissionUtils.enforceNetworkStackPermission(mContext);
        throw new UnsupportedOperationException("NMS#enableNat not supported in V+");
    }

    @Override
    public void disableNat(String internalInterface, String externalInterface) {
        PermissionUtils.enforceNetworkStackPermission(mContext);
        throw new UnsupportedOperationException("NMS#disableNat not supported in V+");
    }

    @Override
    public void setInterfaceQuota(String iface, long quotaBytes) {
        PermissionUtils.enforceNetworkStackPermission(mContext);