欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

Android Wifi小记 (2)

程序员文章站 2022-06-24 19:07:16
Hostapd ACS 开关控制 public HostapdHal(Context context) { mEnableAcs = context.getResources().getBoolean(R.bool.config_wifi_softap_acs_supported); mEnableIeee80211AC = context.getResources().getBoolean(R.bool.config_wifi_sof...

Hostapd ACS 开关控制

    public HostapdHal(Context context) {
        mEnableAcs = context.getResources().getBoolean(R.bool.config_wifi_softap_acs_supported);
        mEnableIeee80211AC =
                context.getResources().getBoolean(R.bool.config_wifi_softap_ieee80211ac_supported);
    }

采用了overlay,覆盖了aosp中设置的值。

// aosp
./frameworks/base/core/res/res/values/config.xml:    <bool translatable="false" name="config_wifi_softap_acs_supported">false</bool>
./frameworks/base/core/res/res/values/symbols.xml:  <java-symbol type="bool" name="config_wifi_softap_acs_supported" />

// overlay
./device/qcom/common/device/overlay/frameworks/base/core/res/res/values/config.xml:   <bool translatable="false" name="config_wifi_softap_acs_supported">true</bool>
./device/qcom/common/automotive/device/overlay/frameworks/base/core/res/res/values/config.xml:   <bool translatable="false" name="config_wifi_softap_acs_supported">true</bool>
./vendor/qcom/proprietary/resource-overlay/common/Frameworks/res/values/config.xml:   <bool translatable="false" name="config_wifi_softap_acs_supported">true</bool>

其中device, automotive 代表手机和车机平台。选择哪个是根据宏定义TARGET_BOARD_AUTO决定的。

//file path: device/qcom/common/base.mk
# enable overlays to use our version of
# source/resources etc.
ifneq ($(strip $(TARGET_BOARD_AUTO)),true)
DEVICE_PACKAGE_OVERLAYS += device/qcom/common/device/overlay
PRODUCT_PACKAGE_OVERLAYS += device/qcom/common/product/overlay
else
DEVICE_PACKAGE_OVERLAYS += device/qcom/common/automotive/device/overlay
PRODUCT_PACKAGE_OVERLAYS += device/qcom/common/automotive/product/overlay
endif
endif

//file path device/qcom/msmnile_gvmq/msmnile_gvmq.mk
TARGET_BOARD_AUTO := true

hotspot 开关流程

两个步骤。

  • 1 hotspot 开关不是直接操作WifiManage的 startSoftAp()打开的。
  • 2 ap 相关的设置是通过WifiManage 更新的。不是随着startSoftAp传进的。
//Setting WifiTetherSettings.java 
    @Override
    public void onTetherConfigUpdated() {
        final WifiConfiguration config = buildNewConfig();
        mPasswordPreferenceController.updateVisibility(config.getAuthType());

        /**
         * if soft AP is stopped, bring up
         * else restart with new config
         * TODO: update config on a running access point when framework support is added
         */
        if (mWifiManager.getWifiApState() == WifiManager.WIFI_AP_STATE_ENABLED) {
            Log.d("TetheringSettings",
                    "Wifi AP config changed while enabled, stop and restart");
            mRestartWifiApAfterConfigChange = true;
            mSwitchBarController.stopTether();
        }
        mWifiManager.setWifiApConfiguration(config);
    }

//system_server WifiServiceImpl.java 需要权限
	private boolean checkNetworkSettingsPermission(int pid, int uid) {
        return mContext.checkPermission(android.Manifest.permission.NETWORK_SETTINGS, pid, uid)
                == PackageManager.PERMISSION_GRANTED;
    }
	


//Setting  WifiTetherSwitchBarController.java
    void stopTether() {
        mSwitchBar.setEnabled(false);
        mConnectivityManager.stopTethering(TETHERING_WIFI);
    }

    void startTether() {
        mSwitchBar.setEnabled(false);
        mConnectivityManager.startTethering(TETHERING_WIFI, true /* showProvisioningUi */,
                mOnStartTetheringCallback, new Handler(Looper.getMainLooper()));
    }


Wifi WireShare 标签

帧类型 过滤器语法
Management frame wlan.fc.type == 0
Control frame wlan.fc.type == 1
Data frame wlan.fc.type == 2
Association request wlan.fc.type_subtype == 0x00
Association response wlan.fc.type_subtype == 0x01
Reassociation request wlan.fc.type_subtype == 0x02
Reassociation response wlan.fc.type_subtype == 0x03
Probe request wlan.fc.type_subtype == 0x04
Probe response wlan.fc.type_subtype == 0x05
Beacon wlan.fc.type_subtype == 0x08
Disassociate wlan.fc.type_subtype == 0x0A
Authentication wlan.fc.type_subtype == 0x0B
Deauthentication wlan.fc.type_subtype == 0x0C
Action frame wlan.fc.type_subtype == 0x0D
Block ACK requests wlan.fc.type_subtype == 0x18
Block ACK wlan.fc.type_subtype == 0x19
Power save poll wlan.fc.type_subtype == 0x1A
Request to send wlan.fc.type_subtype == 0x1B
Clear to send wlan.fc.type_subtype == 0x1C
ACK wlan.fc.type_subtype == 0x1D
Contention free period end wlan.fc.type_subtype == 0x1E
NULL data wlan.fc.type_subtype == 0x24
QoS data wlan.fc.type_subtype == 0x28
Null QoS data wlan.fc.type_subtype == 0x2C

本文地址:https://blog.csdn.net/github_33381613/article/details/108737015

相关标签: wifi