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

Commit 72c17a72 authored by Erik Kline's avatar Erik Kline Committed by android-build-merger
Browse files

Merge "More concisely export whether we have a "tetherable configuration""

am: 1b2a1b91

Change-Id: I5f9717c9dab6b39f1fbf2186107b2a1f3f2d4f8f
parents 2aec2f7a 1b2a1b91
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -3094,10 +3094,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
                Settings.Global.TETHER_SUPPORTED, defaultVal) != 0)
                && !mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING);
        return tetherEnabledInSettings && mUserManager.isAdminUser() &&
                ((mTethering.getTetherableUsbRegexs().length != 0 ||
                mTethering.getTetherableWifiRegexs().length != 0 ||
                mTethering.getTetherableBluetoothRegexs().length != 0) &&
                mTethering.getUpstreamIfaceTypes().length != 0);
               mTethering.hasTetherableConfiguration();
    }

    @Override
+12 −12
Original line number Diff line number Diff line
@@ -204,7 +204,7 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering
        return (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
    }

    void updateConfiguration() {
    private void updateConfiguration() {
        mConfig = new TetheringConfiguration(mContext);
    }

@@ -816,6 +816,17 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering
        return mConfig;
    }

    public boolean hasTetherableConfiguration() {
        final TetheringConfiguration cfg = mConfig;
        final boolean hasDownstreamConfiguration =
                (cfg.tetherableUsbRegexs.length != 0) ||
                (cfg.tetherableWifiRegexs.length != 0) ||
                (cfg.tetherableBluetoothRegexs.length != 0);
        final boolean hasUpstreamConfiguration = !cfg.preferredUpstreamIfaceTypes.isEmpty();

        return hasDownstreamConfiguration && hasUpstreamConfiguration;
    }

    // TODO - update callers to use getTetheringConfiguration(),
    // which has only final members.
    public String[] getTetherableUsbRegexs() {
@@ -863,17 +874,6 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering
        return ConnectivityManager.TETHER_ERROR_NO_ERROR;
    }

    public int[] getUpstreamIfaceTypes() {
        updateConfiguration();  // TODO - remove?
        final Collection<Integer> upstreams = mConfig.preferredUpstreamIfaceTypes;
        final int[] values = new int[upstreams.size()];
        int i = 0;
        for (Integer u : upstreams) {
            values[i++] = u.intValue();
        }
        return values;
    }

    // TODO review API - maybe return ArrayList<String> here and below?
    public String[] getTetheredIfaces() {
        ArrayList<String> list = new ArrayList<String>();