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

Commit 9005e7f4 authored by Irfan Sheriff's avatar Irfan Sheriff Committed by Android (Google) Code Review
Browse files

Merge "Add setWifiApConfiguration interface" into gingerbread

parents 41debbc6 17b232b5
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -631,6 +631,7 @@ public class WifiService extends IWifiManager.Stub {
    }

    public WifiConfiguration getWifiApConfiguration() {
        enforceAccessPermission();
        final ContentResolver cr = mContext.getContentResolver();
        WifiConfiguration wifiConfig = new WifiConfiguration();
        int authType;
@@ -648,7 +649,8 @@ public class WifiService extends IWifiManager.Stub {
        }
    }

    private void persistApConfiguration(WifiConfiguration wifiConfig) {
    public void setWifiApConfiguration(WifiConfiguration wifiConfig) {
        enforceChangePermission();
        final ContentResolver cr = mContext.getContentResolver();
        boolean isWpa;
        if (wifiConfig == null)
@@ -681,7 +683,7 @@ public class WifiService extends IWifiManager.Stub {
                try {
                    nwService.setAccessPoint(wifiConfig, mWifiStateTracker.getInterfaceName(),
                                             SOFTAP_IFACE);
                    persistApConfiguration(wifiConfig);
                    setWifiApConfiguration(wifiConfig);
                    return true;
                } catch(Exception e) {
                    Slog.e(TAG, "Exception in nwService during AP restart");
@@ -733,7 +735,7 @@ public class WifiService extends IWifiManager.Stub {
                return false;
            }

            persistApConfiguration(wifiConfig);
            setWifiApConfiguration(wifiConfig);

        } else {

+2 −0
Original line number Diff line number Diff line
@@ -83,5 +83,7 @@ interface IWifiManager
    int getWifiApEnabledState();

    WifiConfiguration getWifiApConfiguration();

    void setWifiApConfiguration(in WifiConfiguration wifiConfig);
}
+15 −0
Original line number Diff line number Diff line
@@ -823,6 +823,21 @@ public class WifiManager {
        }
    }

    /**
     * Sets the Wi-Fi AP Configuration.
     * @return {@code true} if the operation succeeded, {@code false} otherwise
     *
     * @hide Dont open yet
     */
    public boolean setWifiApConfiguration(WifiConfiguration wifiConfig) {
        try {
            mService.setWifiApConfiguration(wifiConfig);
            return true;
        } catch (RemoteException e) {
            return false;
        }
    }

    /**
     * Allows an application to keep the Wi-Fi radio awake.
     * Normally the Wi-Fi radio may turn off when the user has not used the device in a while.