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

Commit 389c46b7 authored by Mark Chien's avatar Mark Chien Committed by android-build-merger
Browse files

Merge "Fix some @hide usage in Tethering(Cont.)"

am: 6a953996

Change-Id: I086c49cc9653162d157176bf44a8ce1651f699cb
parents 95640294 6a953996
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -619,6 +619,7 @@ filegroup {
        "core/java/com/android/internal/util/Preconditions.java",
        "core/java/com/android/internal/util/State.java",
        "core/java/com/android/internal/util/StateMachine.java",
        "core/java/com/android/internal/util/TrafficStatsConstants.java",
        "core/java/android/net/shared/Inet4AddressUtils.java",
    ],
}
+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ rule com.android.internal.util.MessageUtils* com.android.networkstack.tethering.
rule com.android.internal.util.Preconditions* com.android.networkstack.tethering.util.Preconditions@1
rule com.android.internal.util.State* com.android.networkstack.tethering.util.State@1
rule com.android.internal.util.StateMachine* com.android.networkstack.tethering.util.StateMachine@1
rule com.android.internal.util.TrafficStatsConstants* com.android.networkstack.tethering.util.TrafficStatsConstants@1

rule android.net.LocalLog* com.android.networkstack.tethering.LocalLog@1

+1 −1
Original line number Diff line number Diff line
@@ -668,7 +668,7 @@ public class RouterAdvertisementDaemon {
    }

    private final class UnicastResponder extends Thread {
        private final InetSocketAddress mSolicitor = new InetSocketAddress();
        private final InetSocketAddress mSolicitor = new InetSocketAddress(0);
        // The recycled buffer for receiving Router Solicitations from clients.
        // If the RS is larger than IPV6_MIN_MTU the packets are truncated.
        // This is fine since currently only byte 0 is examined anyway.
+8 −11
Original line number Diff line number Diff line
@@ -71,7 +71,6 @@ import android.net.LinkAddress;
import android.net.LinkProperties;
import android.net.Network;
import android.net.NetworkInfo;
import android.net.NetworkUtils;
import android.net.TetherStatesParcel;
import android.net.TetheringConfigurationParcel;
import android.net.ip.IpServer;
@@ -291,13 +290,6 @@ public class Tethering {
        filter.addAction(WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION);
        filter.addAction(UserManager.ACTION_USER_RESTRICTIONS_CHANGED);
        mContext.registerReceiver(mStateReceiver, filter, null, handler);

        filter = new IntentFilter();
        filter.addAction(Intent.ACTION_MEDIA_SHARED);
        filter.addAction(Intent.ACTION_MEDIA_UNSHARED);
        filter.addDataScheme("file");
        mContext.registerReceiver(mStateReceiver, filter, null, handler);

    }

    private class TetheringThreadExecutor implements Executor {
@@ -1384,12 +1376,17 @@ public class Tethering {

        protected void setDnsForwarders(final Network network, final LinkProperties lp) {
            // TODO: Set v4 and/or v6 DNS per available connectivity.
            String[] dnsServers = mConfig.defaultIPv4DNS;
            final Collection<InetAddress> dnses = lp.getDnsServers();
            // TODO: Properly support the absence of DNS servers.
            final String[] dnsServers;
            if (dnses != null && !dnses.isEmpty()) {
                // TODO: remove this invocation of NetworkUtils.makeStrings().
                dnsServers = NetworkUtils.makeStrings(dnses);
                dnsServers = new String[dnses.size()];
                int i = 0;
                for (InetAddress dns : dnses) {
                    dnsServers[i++] = dns.getHostAddress();
                }
            } else {
                dnsServers = mConfig.defaultIPv4DNS;
            }
            final int netId = (network != null) ? network.netId : NETID_UNSET;
            try {
+13 −25
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ import static com.android.internal.R.string.config_mobile_hotspot_provision_app_
import android.content.ContentResolver;
import android.content.Context;
import android.content.res.Resources;
import android.net.ConnectivityManager;
import android.net.TetheringConfigurationParcel;
import android.net.util.SharedLog;
import android.provider.Settings;
@@ -179,8 +178,8 @@ public class TetheringConfiguration {

        pw.print("chooseUpstreamAutomatically: ");
        pw.println(chooseUpstreamAutomatically);
        dumpStringArray(pw, "preferredUpstreamIfaceTypes",
                preferredUpstreamNames(preferredUpstreamIfaceTypes));
        pw.print("legacyPreredUpstreamIfaceTypes: ");
        pw.println(Arrays.toString(toIntArray(preferredUpstreamIfaceTypes)));

        dumpStringArray(pw, "legacyDhcpRanges", legacyDhcpRanges);
        dumpStringArray(pw, "defaultIPv4DNS", defaultIPv4DNS);
@@ -205,7 +204,7 @@ public class TetheringConfiguration {
        sj.add(String.format("isDunRequired:%s", isDunRequired));
        sj.add(String.format("chooseUpstreamAutomatically:%s", chooseUpstreamAutomatically));
        sj.add(String.format("preferredUpstreamIfaceTypes:%s",
                makeString(preferredUpstreamNames(preferredUpstreamIfaceTypes))));
                toIntArray(preferredUpstreamIfaceTypes)));
        sj.add(String.format("provisioningApp:%s", makeString(provisioningApp)));
        sj.add(String.format("provisioningAppNoUi:%s", provisioningAppNoUi));
        sj.add(String.format("enableLegacyDhcpServer:%s", enableLegacyDhcpServer));
@@ -234,21 +233,6 @@ public class TetheringConfiguration {
        return sj.toString();
    }

    private static String[] preferredUpstreamNames(Collection<Integer> upstreamTypes) {
        String[] upstreamNames = null;

        if (upstreamTypes != null) {
            upstreamNames = new String[upstreamTypes.size()];
            int i = 0;
            for (Integer netType : upstreamTypes) {
                upstreamNames[i] = ConnectivityManager.getNetworkTypeName(netType);
                i++;
            }
        }

        return upstreamNames;
    }

    /** Check whether dun is required. */
    public static boolean checkDunRequired(Context ctx) {
        final TelephonyManager tm = (TelephonyManager) ctx.getSystemService(TELEPHONY_SERVICE);
@@ -388,6 +372,15 @@ public class TetheringConfiguration {
        return false;
    }

    private static int[] toIntArray(Collection<Integer> values) {
        final int[] result = new int[values.size()];
        int index = 0;
        for (Integer value : values) {
            result[index++] = value;
        }
        return result;
    }

    /**
     * Convert this TetheringConfiguration to a TetheringConfigurationParcel.
     */
@@ -400,12 +393,7 @@ public class TetheringConfiguration {
        parcel.isDunRequired = isDunRequired;
        parcel.chooseUpstreamAutomatically = chooseUpstreamAutomatically;

        int[] preferredTypes = new int[preferredUpstreamIfaceTypes.size()];
        int index = 0;
        for (Integer type : preferredUpstreamIfaceTypes) {
            preferredTypes[index++] = type;
        }
        parcel.preferredUpstreamIfaceTypes = preferredTypes;
        parcel.preferredUpstreamIfaceTypes = toIntArray(preferredUpstreamIfaceTypes);

        parcel.legacyDhcpRanges = legacyDhcpRanges;
        parcel.defaultIPv4DNS = defaultIPv4DNS;
Loading