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

Commit 34d5259a authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Pick default interface for upstream."

parents fd4110e0 976b34e4
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -190,9 +190,23 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
        int ifaceTypes[] = mContext.getResources().getIntArray(
                com.android.internal.R.array.config_tether_upstream_types);
        Collection<Integer> upstreamIfaceTypes = new ArrayList();
        IBinder b = ServiceManager.getService(Context.CONNECTIVITY_SERVICE);
        IConnectivityManager cm = IConnectivityManager.Stub.asInterface(b);
        try {
            int activeNetType = cm.getActiveNetworkInfo().getType();
            for (int i : ifaceTypes) {
                if(i == activeNetType) {
                    upstreamIfaceTypes.add(new Integer(i));
                }
            }
        } catch (Exception e) {
            Log.d(TAG, "Exception adding default nw to upstreamIfaceTypes: " + e);
        }
        for (int i : ifaceTypes) {
            if(!upstreamIfaceTypes.contains(new Integer(i))) {
                upstreamIfaceTypes.add(new Integer(i));
            }
        }

        synchronized (mPublicSync) {
            mTetherableUsbRegexs = tetherableUsbRegexs;