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

Commit b8166563 authored by Nalla Kartheek's avatar Nalla Kartheek Committed by Linux Build Service Account
Browse files

Wifi: Introduce additional APIs to support STA + SoftAp concurrency

1. Add a configuration  parameter to indicate STA + SoftAp concurrency support
2. Add new APIs createSoftApInterface/deleteSoftApInterface to create/delete
   an interfcae softap0, an additional interface to cater to STA + SoftAp
   concurrency.
The intention here is to create another SoftAP interface while the
station interface is active, in contrary to the current design in
the framework which shall shut down the station components (wpa_supplicant
/ host driver) on a SoftAp start(starts hostapd the host driver).

Change-Id: Ie613f73b2fd98f02ba0611e9545f6ec749fd2087
CRs-Fixed: 1017907
parent e87c0ffe
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -448,4 +448,13 @@ interface INetworkManagementService
    void removeInterfaceFromLocalNetwork(String iface);

    void setAllowOnlyVpnForUids(boolean enable, in UidRange[] uidRanges);
    /**
     * Create SoftAp Interface
     */
    void createSoftApInterface(String wlanIface);

     /**
     * Delete SoftAp Interface
     */
    void deleteSoftApInterface(String wlanIface);
}
+20 −0
Original line number Diff line number Diff line
@@ -1245,6 +1245,26 @@ public class NetworkManagementService extends INetworkManagementService.Stub
        }
    }

    @Override
    public void createSoftApInterface(String wlanIface) {
        mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
        try {
            mConnector.execute("softap", "create", wlanIface);
        } catch (NativeDaemonConnectorException e) {
            throw e.rethrowAsParcelableException();
        }
    }

    @Override
    public void deleteSoftApInterface(String wlanIface) {
        mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
        try {
            mConnector.execute("softap", "remove", wlanIface);
        } catch (NativeDaemonConnectorException e) {
            throw e.rethrowAsParcelableException();
        }
    }

    @Override
    public void startTethering(String[] dhcpRange) {
        mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
+21 −0
Original line number Diff line number Diff line
@@ -257,6 +257,8 @@ public class Tethering extends BaseNetworkObserver {
        if (VDBG) Log.d(TAG, "interfaceStatusChanged " + iface + ", " + up);
        boolean found = false;
        boolean usb = false;
        WifiManager mWifiManager =
           (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
        synchronized (mPublicSync) {
            if (isWifi(iface)) {
                found = true;
@@ -280,6 +282,25 @@ public class Tethering extends BaseNetworkObserver {
                    // ignore usb0 down after enabling RNDIS
                    // we will handle disconnect in interfaceRemoved instead
                    if (VDBG) Log.d(TAG, "ignore interface down for " + iface);
                } else if (isWifi(iface) && (mWifiManager != null) &&
                              mWifiManager.getWifiStaSapConcurrency()) {
                    int wifiApState = 0;
                    wifiApState = mWifiManager.getWifiApState();

                    // Ignore AP interface down after enabling STA connection.
                    // If STA connects to same  band the SAP is enabled, the
                    // driver stops SAP before it proceeds for STA connection
                    // hence ignore interface down. After STA connection,
                    // driver starts SAP on STA channel.

                    if ((wifiApState == WifiManager.WIFI_AP_STATE_DISABLING) ||
                       (wifiApState == WifiManager.WIFI_AP_STATE_DISABLED)) {
                        if (VDBG) Log.d(TAG, "Got interface down for " + iface);
                        sm.sendMessage(TetherInterfaceSM.CMD_INTERFACE_DOWN);
                        mIfaces.remove(iface);
                    } else {
                        if (VDBG) Log.d(TAG, "ignore interface down for " + iface);
                    }
                } else if (sm != null) {
                    sm.sendMessage(TetherInterfaceSM.CMD_INTERFACE_DOWN);
                    mIfaces.remove(iface);
+2 −0
Original line number Diff line number Diff line
@@ -169,5 +169,7 @@ interface IWifiManager
    void factoryReset();

    Network getCurrentNetwork();

    boolean getWifiStaSapConcurrency();
}
+15 −0
Original line number Diff line number Diff line
@@ -2683,6 +2683,21 @@ public class WifiManager {
        }
    }

    /**
     * get concurrency support
     *
     * @return true if concurrency is allowed.
     *
     * @hide no intent to publish
     */
    public boolean getWifiStaSapConcurrency() {
        try {
            return mService.getWifiStaSapConcurrency();
        } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Resets all wifi manager settings back to factory defaults.
     *