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

Commit d0e65f5e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Use ConnectivityService's NETWORK_STACK permission for SoftAp operations" into oc-dev

parents 34c226d6 7c7ef6ee
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -398,15 +398,21 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering
    }

    private int setWifiTethering(final boolean enable) {
        int rval = ConnectivityManager.TETHER_ERROR_MASTER_ERROR;
        final long ident = Binder.clearCallingIdentity();
        try {
            synchronized (mPublicSync) {
                mWifiTetherRequested = enable;
            final WifiManager wifiManager = getWifiManager();
            if ((enable && wifiManager.startSoftAp(null /* use existing wifi config */)) ||
                (!enable && wifiManager.stopSoftAp())) {
                return ConnectivityManager.TETHER_ERROR_NO_ERROR;
                final WifiManager mgr = getWifiManager();
                if ((enable && mgr.startSoftAp(null /* use existing wifi config */)) ||
                    (!enable && mgr.stopSoftAp())) {
                    rval = ConnectivityManager.TETHER_ERROR_NO_ERROR;
                }
            return ConnectivityManager.TETHER_ERROR_MASTER_ERROR;
            }
        } finally {
            Binder.restoreCallingIdentity(ident);
        }
        return rval;
    }

    private void setBluetoothTethering(final boolean enable, final ResultReceiver receiver) {