android PCI认证问题记录

公司的POS项目为了远销海外,故申请PCI认证。
本文记录一些认证需求:

1.WLAN去除弱密码连接

弱密码目前只有WEP & OPEN模式,提case给高通,高通回复的是上层在搜索列表中用以下接口过滤列表结果即可。
如果要彻底删除WEP涉及太广并且很复杂,因为WEP是根据频段来区分的,硬件上也需要改造才搜索不到该频段。

/**
     * Helper method to check if the provided |scanResult| corresponds to a WEP network or not.
     * This checks if the provided capabilities string contains WEP encryption type or not.
     */
    public static boolean isScanResultForWepNetwork(ScanResult scanResult) {
        return scanResult.capabilities.contains("WEP");
    }

我的该法是直接在framework层wifi搜索结果实现的地方调用上述接口过滤结果:

/frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiServiceImpl.java
/**
     * Return the results of the most recent access point scan, in the form of
     * a list of {@link ScanResult} objects.
     * @return the list of results
     */
    @Override
    public List<ScanResult> getScanResults(String callingPackage) {
		...
		if (!success) {
            Log.e(TAG, "Failed to post runnable to fetch scan results");
        }
        for (int i = 0; i < scanResults.size(); i++) {
            if (!SystemProperties.getBoolean("ro.wifi_pci.enable", true) 
                    && ScanResultUtil.isScanResultForWepNetwork(scanResults.get(i))) {
                Log.d(TAG, "pci remove wifi info: " + scanResults.get(i).toString());
                scanResults.remove(i);
                i--;
            }
        }
        return scanResults;    
		...
	}

不过想要过滤OPEN即无密码的网络则没有相应的接口,只能反着来,把能用的留着:

for (int i = 0; i < scanResults.size(); i++) {
            if (!SystemProperties.getBoolean("ro.wifi_pci.enable", true) 
                    && isSecureNetwork(scanResults.get(i))) {
                Log.d(TAG, "pci remove wifi info: " + scanResults.get(i).toString());
                scanResults.remove(i);
                i--;
            }
        }

private boolean isSecureNetwork(ScanResult mScanResult) {
        if (ScanResultUtil.isScanResultForPskNetwork(mScanResult) ||
            ScanResultUtil.isScanResultForEapNetwork(mScanResult) ||
            ScanResultUtil.isScanResultForFilsSha256Network(mScanResult) ||
            ScanResultUtil.isScanResultForFilsSha384Network(mScanResult) ||
            ScanResultUtil.isScanResultForDppNetwork(mScanResult) ||
            ScanResultUtil.isScanResultForOweNetwork(mScanResult) ||
            ScanResultUtil.isScanResultForSaeNetwork(mScanResult)) {
            return true;
        }
        return false;
    }

目前只能如此解决。

2.蓝牙去除ble

这部分询问QC得到确切回复

This can be done with NVM Tag changes

Follow the below steps to add the NVM tag 6 with the below mentioned values which will disable BLE functionality


Step. 1

a/hidl_transport/bt/1.0/default/nvm_tags_manager.cpp
+++ b/hidl_transport/bt/1.0/default/nvm_tags_manager.cpp
@@ -104,7 +104,16 @@ int NvmTagsManager::DownloadNvmTags(uint8_t *bdaddr)
/* Tag Value */ 0xFF, 0x03, 0x07, 0x09, 0x09, 0x09, 0x00, 0x00,
0x09, 0x09, 0x04, 0x00
},
- {TAG_END}
+ /* Tag 6 */
+ { /* Opcode */ 0x0b,0xfc,
+ /* Total Len */ 0x0F,
+ /* NVM CMD */ NVM_ACCESS_SET,
+ /* Tag Num */ 0x6,
+ /* Tag Len */ 0x08,
+ /* Tag Value */ 0xFF, 0xFE, 0x8F, 0xFE,
+ 0x98, 0x3F, 0x5B, 0x87
+ },
+ {TAG_END}
};

Step 2. disable all CHECK(ble_supported) in controller.cc

如何测试:

You can just try Connecting ay of BLE device and check if you can get in inquiry and able to connect


also we can confirm the same from snoop logs


Please try Inquiry and connect to any BLE device and collect the snoop logs and share with us, I will confirm


If you are not able to find the BLE devices, then you can think that it is working fine

3.蓝牙关闭justwork模式

justwork简单来说就是不需要pin码就能连接蓝牙,关闭的话需要输入默认的0000或者其他被连接设备默认的pin码

system/bt/stack/btm/btm_sec.cc
        BTM_TRACE_DEBUG("BTM_SP_CFM_REQ_EVT:  num_val: %u",
                        evt_data.cfm_req.num_val);

        +evt_data.cfm_req.just_works = false;

/* process user confirm req in association with the auth_req param */

4.蓝牙profile

关于原理我是一无所知,也不知道功能具体是干什么的,只知道有些配置选项。
附上一张送测反馈的结果图,包含一些profile
在这里插入图片描述

提case给高通,得知一些配置文件路径:
packages/apps/Bluetooth/res/values/config.xml

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009-2012 Broadcom Corporation
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<resources>
    <bool name="profile_supported_a2dp">false</bool>
    <bool name="profile_supported_a2dp_sink">false</bool>
    <bool name="profile_supported_hdp">false</bool>
    <bool name="profile_supported_hs_hfp">false</bool>
    <bool name="profile_supported_hfpclient">false</bool>
    <bool name="profile_supported_hid_host">true</bool>
    <bool name="profile_supported_opp">true</bool>
    <bool name="profile_supported_pan">false</bool>
    <bool name="profile_supported_pbap">false</bool>
    <bool name="profile_supported_gatt">true</bool>
    <bool name="pbap_include_photos_in_vcard">false</bool>
    <bool name="pbap_use_profile_for_owner_vcard">false</bool>
    <bool name="profile_supported_map">false</bool>
    <bool name="profile_supported_avrcp_target">false</bool>
    <bool name="profile_supported_avrcp_controller">false</bool>
    <bool name="profile_supported_sap">false</bool>
    <bool name="profile_supported_pbapclient">false</bool>
    <bool name="profile_supported_mapmce">false</bool>
    <bool name="profile_supported_hid_device">true</bool>
    <bool name="profile_supported_hearing_aid">false</bool>
    <bool name="profile_supported_ba">false</bool>

    <!-- If true, we will require location to be enabled on the device to
         fire Bluetooth LE scan result callbacks in addition to having one
         of the location permissions. -->
    <bool name="strict_location_check">true</bool>

    <!-- Specifies the min/max connection interval parameters for high priority,
         balanced and low power GATT configurations. These values are in
         multiples of 1.25ms. -->
    <integer name="gatt_high_priority_min_interval">9</integer>
    <integer name="gatt_high_priority_max_interval">12</integer>
    <!-- Default specs recommended interval is 30 (24 * 1.25) -> 50 (40 * 1.25)
         ms. -->
    <integer name="gatt_balanced_priority_min_interval">24</integer>
    <integer name="gatt_balanced_priority_max_interval">40</integer>
    <integer name="gatt_low_power_min_interval">80</integer>
    <integer name="gatt_low_power_max_interval">100</integer>

    <!-- Specifies latency parameters for high priority, balanced and low power
         GATT configurations. These values represents the number of packets a
         slave device is allowed to skip. -->
    <integer name="gatt_high_priority_latency">0</integer>
    <integer name="gatt_balanced_priority_latency">0</integer>
    <integer name="gatt_low_power_latency">2</integer>

    <bool name="headset_client_initial_audio_route_allowed">true</bool>

    <!-- @deprecated: use a2dp_absolute_volume_initial_threshold_percent
         instead. -->
    <integer name="a2dp_absolute_volume_initial_threshold">8</integer>

    <!-- AVRCP absolute volume initial value as percent of the maximum value.
         Valid values are in the interval [0, 100].
         Recommended value is 50. -->
    <integer name="a2dp_absolute_volume_initial_threshold_percent">50</integer>

    <!-- For A2DP sink ducking volume feature. -->
    <integer name="a2dp_sink_duck_percent">25</integer>

    <!-- For enabling the hfp client connection service -->
    <bool name="hfp_client_connection_service_enabled">false</bool>

    <!-- Enabling autoconnect over pan -->
    <bool name="config_bluetooth_pan_enable_autoconnect">true</bool>

    <!-- Enabling the phone policy -->
    <bool name="enable_phone_policy">true</bool>

    <!-- Configuring priorities of A2DP source codecs. Larger value means
         higher priority. Value -1 means the codec is disabled.
         Value 0 is reserved and should not be used here. Enabled codecs
         should have priorities in the interval [1, 999999], and each priority
         value should be unique. -->
    <integer name="a2dp_source_codec_priority_sbc">1001</integer>
    <integer name="a2dp_source_codec_priority_aac">2001</integer>
    <integer name="a2dp_source_codec_priority_ldac">3001</integer>
    <integer name="a2dp_source_codec_priority_aptx">4001</integer>
    <integer name="a2dp_source_codec_priority_aptx_hd">5001</integer>
    <integer name="a2dp_source_codec_priority_aptx_adaptive">6001</integer>
    <integer name="a2dp_source_codec_priority_aptx_tws">7001</integer>

    <!-- Package that is responsible for user interaction on pairing request,
         success or cancel.
         Receives:
          - BluetootDevice.ACTION_PAIRING_CANCEL on bond failure
          - BluetoothDevice.ACTION_PAIRING_REUQEST on pin request
          - BluetootDevice.ACTION_BOND_STATE_CHANGED on pairing request and success
          - BluetoothDevice.ACTION_CONNECTION_ACCESS_REQUEST on access requests
          - BluetoothDevice.ACTION_CONNECTION_ACCESS_CANCEL to cancel access requests -->
    <string name="pairing_ui_package">com.android.settings</string>

    <!-- Flag whether or not to keep polling AG with CLCC for call information every 2 seconds -->
    <bool name="hfp_clcc_poll_during_call">true</bool>

     <!-- Reload supported Bluetooth Profiles while BLE is turning ON -->
     <bool name="reload_supported_profiles_when_enabled">true</bool>
    <!-- For AVRCP cover art configuration If there is no update from UI
         these default values would be used to fetch cover art.
         height and width are to be  mentioned in pixels
         maxsize is to be mentioned in bytes -->
    <string name="avrcp_cover_art_default_mimetype">JPEG</string>
    <string name="avrcp_cover_art_default_image_type">image</string>
    <integer name="avrcp_cover_art_default_height">500</integer>
    <integer name="avrcp_cover_art_default_width">500</integer>
    <integer name="avrcp_cover_art_default_maxsize">200000</integer>

</resources>

vendor/qcom/opensource/commonsys/bluetooth/BluetoothExt/res/values/config.xml

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009-2012 Broadcom Corporation
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<resources>
    <bool name="profile_supported_ftp">false</bool>
    <bool name="profile_supported_dun">false</bool>
</resources>

For SAP part, please use the SAP 1.1 instead of 1.2 by changing below part:

package/app/Bluetooth/src/com/android/bluetooth/sap/SapService.java
-private static final int SDP_SAP_VERSION = 0x0102;
+private static final int SDP_SAP_VERSION = 0x0101; 

这里需要注意:
config.xml在很多地方会overlay,认证时sap测试项一直失败。
添加log打印值发现没有变为修改的值,grep工程并测试找到了实际overlay的地方:
device/qcom/common/product/overlay/packages/apps/Bluetooth/res/values/config.xml

总结并整理了android bluetooth profiles feature:

GATT - generic attribute profiles
	profile_supported_gatt - GATT 服务器 / 客户端

PBAP - Phone Book Access Profile(电话号码薄访问规范)
	profile_supported_pbap - PBAP 服务器
	profile_supported_pbapclient - PBAP 客户端

OPP - Object Push Profile(对象推送规范,用于传输文件)
	profile_supported_opp - OPP

FTP - File Transfer Profile
	profile_supported_ftp - FTP 服务器

HFP - Hands-Free Profile(免提规范,用于蓝牙通话)
	profile_supported_hfpclient - 免提 HF
	profile_supported_hs_hfp - 免提 AG

SAP - SIM Access Profile
	profile_supported_sap - SAP 服务器

MAP - Message Access Profile(信息访问规范)
	profile_supported_map - MAP 服务器
	profile_supported_mapmce - MAP 客户端

A2DP - Advanced Audio Distribution Profile(高级音频、立体声规范)
	profile_supported_a2dp - A2DP 发送
    profile_supported_a2dp_sink - A2DP 接收
    
AVRCP - Audio Video Remote Control Profile(音视频远程控制规范,音乐播放、暂停等)
    profile_supported_avrcp_controller - AVRCP 控制器
    profile_supported_avrcp_target - AVRCP 目标设备
    
HID - Human Interface Device Profile(人体接口设备规范)
    profile_supported_hid_host - HID 主机
    profile_supported_hid_device - HID 设备
    
其他配置
    profile_supported_hdp - Health Device Profile(健康设备)
    profile_supported_pan - Personal Area Networking Profile(个人局域网规范,蓝牙网络共享)
    profile_supported_dun - DUN 服务器
    profile_supported_ba - Broadcast Audio
    profile_supported_hearing_aid - hearing aid
  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值