Discuz! Board

标题: 关于修改系统最大wifi热点连接数 [打印本页]

作者: zangcf    时间: 2016-5-1 06:58
标题: 关于修改系统最大wifi热点连接数
1,如果单单修改最大连接数目,会导致UI出错的。
/media/doraemon/works/android/mtk/6735/b2/alps_ok/frameworks/base/core/java/android/provider/Settings.java
如下位置:
        /**
         * The max client num of hotspot
         * @hide
         * @internal
         */
        public static final String WIFI_HOTSPOT_MAX_CLIENT_NUM = "wifi_hotspot_max_client_num";

        /**
         * Wifi hotspot default client number
         * @hide
         * @internal
         */
        //zcfdebug-- public static final int WIFI_HOTSPOT_DEFAULT_CLIENT_NUM = 5;
                public static final int WIFI_HOTSPOT_DEFAULT_CLIENT_NUM = 50;        //zcfdebug++


为什么呢?
这和spinner初始化有关系
/media/doraemon/works/android/mtk/6735/b2/alps_ok/packages/apps/Settings/src/com/android/settings/wifi/WifiApDialog.java::
        int maxConnValue = System.getInt(mContext.getContentResolver(),System.WIFI_HOTSPOT_MAX_CLIENT_NUM,
                            System.WIFI_HOTSPOT_DEFAULT_CLIENT_NUM);
        //zcfdebug-- mMaxConnSpinner.setSelection(maxConnValue - 1);
                mMaxConnSpinner.setSelection(maxConnValue/10 - 1);//zcfdebug++



作者: zangcf    时间: 2016-5-1 07:01
如果不管显示,实际设置ap连接数量限制在如下文件中修改:
/media/doraemon/works/android/mtk/6735/b2/alps_ok/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java::
    @Override
    public void setAccessPoint(WifiConfiguration wifiConfig, String wlanIface) {
        mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
        try {
            if (wifiConfig == null) {
                mConnector.execute("softap", "set", wlanIface);
            } else {
                /** M: Hotspot Manager @{ */
                int clientNum = Settings.System.getInt(mContext.getContentResolver(), Settings.System.WIFI_HOTSPOT_MAX_CLIENT_NUM,
                    Settings.System.WIFI_HOTSPOT_DEFAULT_CLIENT_NUM);
                if (isBspPackage()) {
                    //zcfdebug-- clientNum = 8;
                                        clientNum = 50;//zcfdebug++
                }
                /** @} */

                ///M: for Hidden SSID
                String hiddenSSid = (wifiConfig.hiddenSSID == true) ? "hidden" : "broadcast";

                mConnector.execute("softap", "set", wlanIface, wifiConfig.SSID,
                                   hiddenSSid, wifiConfig.channel, getSecurityType(wifiConfig),
                                   new SensitiveArg(wifiConfig.preSharedKey),
                                   wifiConfig.channelWidth,
                                   clientNum);
            }
        } catch (NativeDaemonConnectorException e) {
            throw e.rethrowAsParcelableException();
        }
    }

    @Override
    public void startAccessPoint(
            WifiConfiguration wifiConfig, String wlanIface) {
        mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
        try {
            wifiFirmwareReload(wlanIface, "AP");
            if (wifiConfig == null) {
                mConnector.execute("softap", "set", wlanIface);
            } else {
                /** M: Hotspot Manager @{ */
                int clientNum = Settings.System.getInt(mContext.getContentResolver(), Settings.System.WIFI_HOTSPOT_MAX_CLIENT_NUM,
                   Settings.System.WIFI_HOTSPOT_DEFAULT_CLIENT_NUM);
                if (isBspPackage()) {
                    //zcfdebug-- clientNum = 8;
                                        clientNum = 50;        //zcfdebug++
                }
                /** @} */

                ///M: for Hidden SSID
                String hiddenSSid = (wifiConfig.hiddenSSID == true) ? "hidden" : "broadcast";

                mConnector.execute("softap", "set", wlanIface, wifiConfig.SSID,
                                   hiddenSSid, wifiConfig.channel, getSecurityType(wifiConfig),
                                   new SensitiveArg(wifiConfig.preSharedKey),
                                   wifiConfig.channelWidth,
                                   clientNum);
            }
            mConnector.execute("softap", "startap");
        } catch (NativeDaemonConnectorException e) {
            throw e.rethrowAsParcelableException();
        }
    }

这个地方可以直接修改的:





欢迎光临 Discuz! Board (http://47.89.242.157:9000/bbs/discuz/) Powered by Discuz! X3.2