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

Commit 8594bb8a authored by Michaël Burtin's avatar Michaël Burtin Committed by Steve Kondik
Browse files

Allow customization of SoftAp

Support for device with SoftAp only relying on one interface.
Support for device with SoftAp that does not required manual firmware.

Change-Id: If2db6e8ce675c3214ce645231c7a354f41ea0cc6
parent 68ef972e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -265,6 +265,12 @@
         point on the move. A value of 0 means no periodic scans will be used in the framework. -->
    <integer translatable="false" name="config_wifi_framework_scan_interval">300000</integer>

    <!-- Boolean indicating whether Softap rely only on one interface -->
    <bool name="config_wifi_ap_use_single_interface">false</bool>

    <!-- Boolean indicating whether Softap require reloading AP firware -->
    <bool name="config_wifi_ap_firmware_reload">true</bool>

    <!-- Flag indicating whether the keyguard should be bypassed when
         the slider is open.  This can be set or unset depending how easily
         the slider can be opened (for example, in a pocket or purse). -->
+11 −4
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import static com.android.server.NetworkManagementSocketTagger.PROP_QTAGUID_ENAB

import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.net.INetworkManagementEventObserver;
import android.net.InterfaceConfiguration;
import android.net.LinkAddress;
@@ -968,10 +969,16 @@ public class NetworkManagementService extends INetworkManagementService.Stub
        mContext.enforceCallingOrSelfPermission(
                android.Manifest.permission.CHANGE_WIFI_STATE, "NetworkManagementService");
        try {
            Resources resources = mContext.getResources();
            String mainIface = resources.getBoolean(
                    com.android.internal.R.bool.config_wifi_ap_use_single_interface)
                    ? softapIface : wlanIface;

            if (resources.getBoolean(com.android.internal.R.bool.config_wifi_ap_firmware_reload))
                wifiFirmwareReload(wlanIface, "AP");
            mConnector.doCommand(String.format("softap start " + wlanIface));
            mConnector.doCommand(String.format("softap start " + mainIface));
            if (wifiConfig == null) {
                mConnector.doCommand(String.format("softap set " + wlanIface + " " + softapIface));
                mConnector.doCommand(String.format("softap set " + mainIface + " " + softapIface));
            } else {
                /**
                 * softap set arg1 arg2 arg3 [arg4 arg5 arg6 arg7 arg8]
@@ -984,7 +991,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub
                 * argv7 - Preamble
                 * argv8 - Max SCB
                 */
                 String str = String.format("softap set " + wlanIface + " " + softapIface +
                 String str = String.format("softap set " + mainIface + " " + softapIface +
                                       " %s %s %s", convertQuotedString(wifiConfig.SSID),
                                       getSecurityType(wifiConfig),
                                       convertQuotedString(wifiConfig.preSharedKey));