文件定位frameworks/base/packages/SettingsLib/src/com/android/settingslib/deviceinfo/AbstractBluetoothAddressPreferenceController.java

 @SuppressLint("HardwareIds")
    @Override
    protected void updateConnectivity() {
        BluetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter();
        if (bluetooth != null && mBtAddress != null) {
            String address = bluetooth.isEnabled() ? bluetooth.getAddress() : null;
            if (!TextUtils.isEmpty(address)) {
                // Convert the address to lowercase for consistency with the wifi MAC address.
               // mBtAddress.setSummary(address.toLowerCase());
               
               //dgua
                  // Convert the address to lowercase for consistency with the wifi MAC address.
                try {
                    
                    Cursor cursorUser33 = mContext2.getContentResolver().query(DGUACONTENT_URI, null, null, null, null);

                    if (cursorUser33 != null) {
                        cursorUser33.moveToLast();
                        int indexa = cursorUser33.getColumnIndex("wifimac");
                        String a = cursorUser33.getString(indexa);
                        mBtAddress.setSummary(a.toLowerCase());
                    } else {
                        mBtAddress.setSummary(address.toLowerCase());
                    }
                } catch (Exception e) {
                    mBtAddress.setSummary(address.toLowerCase());
                }
                //dgua
            } else {
                mBtAddress.setSummary(R.string.status_unavailable);
            }
        }
    }

从Cursor 最后一条读取数据返回结果

Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐